[eog-plugins] Use default pixmap icon from icon theme for unloaded thumbnails



commit eb977167acfac45c3fdd6e3a7c13227f1c953a8f
Author: Felix Riemann <friemann gnome org>
Date:   Wed Feb 10 19:27:02 2010 +0100

    Use default pixmap icon from icon theme for unloaded thumbnails
    
    If an image's thumbnail isn't loaded use the default icon from the icon
    theme. This is a workaround for eog's thumbnailing behaviour.

 plugins/postasa/Makefile.am          |    2 +-
 plugins/postasa/eog-postasa-plugin.c |   18 ++++++++++++++++--
 2 files changed, 17 insertions(+), 3 deletions(-)
---
diff --git a/plugins/postasa/Makefile.am b/plugins/postasa/Makefile.am
index 657a75a..cdc3e57 100644
--- a/plugins/postasa/Makefile.am
+++ b/plugins/postasa/Makefile.am
@@ -27,7 +27,7 @@ libpostasa_la_LIBADD = $(EOG_LIBS)			\
 
 plugin_in_files = postasa.eog-plugin.desktop.in
 
-UI_FILES = postasa-config.xml postasa-uploads.xml default.png
+UI_FILES = postasa-config.xml postasa-uploads.xml
 ui_DATA = $(UI_FILES)
 uidir = $(plugindir)/postasa
 
diff --git a/plugins/postasa/eog-postasa-plugin.c b/plugins/postasa/eog-postasa-plugin.c
index f7b646e..c20e2d2 100644
--- a/plugins/postasa/eog-postasa-plugin.c
+++ b/plugins/postasa/eog-postasa-plugin.c
@@ -283,11 +283,25 @@ uploads_add_entry (EogPostasaPlugin *plugin, EogImage *image, GCancellable *canc
 	   particularly what needs unrefing */
 	uri = eog_image_get_uri_for_display (image);
 	thumbnail_pixbuf = eog_image_get_thumbnail (image);
-	if (GDK_IS_PIXBUF (thumbnail_pixbuf)) {
+	if (thumbnail_pixbuf && GDK_IS_PIXBUF (thumbnail_pixbuf)) {
 		scaled_pixbuf = gdk_pixbuf_scale_simple (thumbnail_pixbuf, 32, 32, GDK_INTERP_BILINEAR);
 		g_object_unref (thumbnail_pixbuf);
 	} else {
-		scaled_pixbuf = gdk_pixbuf_new_from_file (DEFAULT_THUMBNAIL, &error);
+		/* This is currently a workaround due to limitations in eog's
+		 * eog's thumbnailing mechanism */
+		GError *error = NULL;
+		GtkIconTheme *icon_theme;
+
+		icon_theme = gtk_icon_theme_get_default ();
+
+		scaled_pixbuf = gtk_icon_theme_load_icon (icon_theme,
+							  "image-x-generic",
+							  32, 0, &error);
+
+		if (!scaled_pixbuf) {
+			g_warning ("Couldn't load icon: %s", error->message);
+			g_error_free (error);
+		}
 	}
 	size = g_strdup_printf ("%luKB", eog_image_get_bytes (image) / 1024);
 	iter = g_slice_new0 (GtkTreeIter);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]