Commit eb977167 authored by Felix Riemann's avatar Felix Riemann

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.
parent 6fb64e0a
...@@ -27,7 +27,7 @@ libpostasa_la_LIBADD = $(EOG_LIBS) \ ...@@ -27,7 +27,7 @@ libpostasa_la_LIBADD = $(EOG_LIBS) \
plugin_in_files = postasa.eog-plugin.desktop.in 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) ui_DATA = $(UI_FILES)
uidir = $(plugindir)/postasa uidir = $(plugindir)/postasa
......
...@@ -283,11 +283,25 @@ uploads_add_entry (EogPostasaPlugin *plugin, EogImage *image, GCancellable *canc ...@@ -283,11 +283,25 @@ uploads_add_entry (EogPostasaPlugin *plugin, EogImage *image, GCancellable *canc
particularly what needs unrefing */ particularly what needs unrefing */
uri = eog_image_get_uri_for_display (image); uri = eog_image_get_uri_for_display (image);
thumbnail_pixbuf = eog_image_get_thumbnail (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); scaled_pixbuf = gdk_pixbuf_scale_simple (thumbnail_pixbuf, 32, 32, GDK_INTERP_BILINEAR);
g_object_unref (thumbnail_pixbuf); g_object_unref (thumbnail_pixbuf);
} else { } 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); size = g_strdup_printf ("%luKB", eog_image_get_bytes (image) / 1024);
iter = g_slice_new0 (GtkTreeIter); iter = g_slice_new0 (GtkTreeIter);
......
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