summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCosimo Cecchi <cosimoc@gnome.org>2015-05-24 19:20:53 -0700
committerCosimo Cecchi <cosimoc@gnome.org>2015-05-24 19:36:00 -0700
commitf69c6a7f7834c0b37734fdef469a8e24ecd60f85 (patch)
treeaa55269cac512d5f3a49a65c0dfce899ecbde344
parent121da3fa7db80b4202556d223d3efd4e63480d7d (diff)
downloadnautilus-f69c6a7f7834c0b37734fdef469a8e24ecd60f85.tar.gz
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.
-rw-r--r--configure.ac1
-rw-r--r--libnautilus-private/Makefile.am2
-rw-r--r--libnautilus-private/nautilus-ui-utilities.c36
3 files changed, 13 insertions, 26 deletions
diff --git a/configure.ac b/configure.ac
index c69bc2d09..de9ce77cc 100644
--- a/configure.ac
+++ b/configure.ac
@@ -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
diff --git a/libnautilus-private/Makefile.am b/libnautilus-private/Makefile.am
index 911187772..c0753e541 100644
--- a/libnautilus-private/Makefile.am
+++ b/libnautilus-private/Makefile.am
@@ -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) \
diff --git a/libnautilus-private/nautilus-ui-utilities.c b/libnautilus-private/nautilus-ui-utilities.c
index 54eb65dab..cade47668 100644
--- a/libnautilus-private/nautilus-ui-utilities.c
+++ b/libnautilus-private/nautilus-ui-utilities.c
@@ -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;