Commit f69c6a7f authored by Cosimo Cecchi's avatar Cosimo Cecchi

ui-utilities: use libgd to frame images

This fixes problems with framed thumbnail size under some circumstances,
since by passing a lager than expected icon to list view, we would be
causing another scale of the thumbnail.
parent 121da3fa
......@@ -291,6 +291,7 @@ AC_ARG_ENABLE(update-mimedb,
AM_CONDITIONAL(ENABLE_UPDATE_MIMEDB, test x$enable_update_mimedb = xyes)
LIBGD_INIT([
gtk-hacks
notification
static
_view-common
......
......@@ -5,6 +5,7 @@ noinst_LTLIBRARIES=libnautilus-private.la
AM_CPPFLAGS = \
-I$(top_srcdir) \
-I$(top_builddir) \
-I$(top_srcdir)/libgd \
$(BASE_CFLAGS) \
$(COMMON_CFLAGS) \
$(NAUTILUS_CFLAGS) \
......@@ -31,6 +32,7 @@ libnautilus_private_la_LIBADD = \
$(TRACKER_LIBS) \
$(top_builddir)/eel/libeel-2.la \
$(top_builddir)/libnautilus-extension/libnautilus-extension.la \
$(top_builddir)/libgd/libgd.la \
$(BASE_LIBS) \
$(COMMON_LIBS) \
$(NAUTILUS_LIBS) \
......
......@@ -29,6 +29,7 @@
#include <gio/gio.h>
#include <gtk/gtk.h>
#include <libgd/gd.h>
#include <string.h>
static GMenuModel *
......@@ -253,18 +254,6 @@ nautilus_escape_action_name (const char *action_name,
return g_string_free (s, FALSE);
}
static GdkPixbuf *
nautilus_get_thumbnail_frame (void)
{
static GdkPixbuf *thumbnail_frame = NULL;
if (thumbnail_frame == NULL) {
thumbnail_frame = gdk_pixbuf_new_from_resource ("/org/gnome/nautilus/icons/thumbnail_frame.png", NULL);
}
return thumbnail_frame;
}
#define NAUTILUS_THUMBNAIL_FRAME_LEFT 3
#define NAUTILUS_THUMBNAIL_FRAME_TOP 3
#define NAUTILUS_THUMBNAIL_FRAME_RIGHT 3
......@@ -273,22 +262,17 @@ nautilus_get_thumbnail_frame (void)
void
nautilus_ui_frame_image (GdkPixbuf **pixbuf)
{
GdkPixbuf *pixbuf_with_frame, *frame;
int left_offset, top_offset, right_offset, bottom_offset;
frame = nautilus_get_thumbnail_frame ();
if (frame == NULL) {
return;
}
GtkBorder border;
GdkPixbuf *pixbuf_with_frame;
left_offset = NAUTILUS_THUMBNAIL_FRAME_LEFT;
top_offset = NAUTILUS_THUMBNAIL_FRAME_TOP;
right_offset = NAUTILUS_THUMBNAIL_FRAME_RIGHT;
bottom_offset = NAUTILUS_THUMBNAIL_FRAME_BOTTOM;
border.left = NAUTILUS_THUMBNAIL_FRAME_LEFT;
border.top = NAUTILUS_THUMBNAIL_FRAME_TOP;
border.right = NAUTILUS_THUMBNAIL_FRAME_RIGHT;
border.bottom = NAUTILUS_THUMBNAIL_FRAME_BOTTOM;
pixbuf_with_frame = eel_embed_image_in_frame
(*pixbuf, frame,
left_offset, top_offset, right_offset, bottom_offset);
pixbuf_with_frame = gd_embed_image_in_frame (*pixbuf,
"resource:///org/gnome/nautilus/icons/thumbnail_frame.png",
&border, &border);
g_object_unref (*pixbuf);
*pixbuf = pixbuf_with_frame;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment