From bec9f56f7d1eae4f1cdcecf572babfec58e72d32 Mon Sep 17 00:00:00 2001 From: Karl Date: Mon, 9 Aug 2010 10:41:11 +0100 Subject: Added absolute filename fixes --- libindicator/indicator-image-helper.c | 34 ++++++++++++++++++++++------------ 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/libindicator/indicator-image-helper.c b/libindicator/indicator-image-helper.c index 2492227..2ff97e6 100644 --- a/libindicator/indicator-image-helper.c +++ b/libindicator/indicator-image-helper.c @@ -30,6 +30,9 @@ static void refresh_image (GtkImage * image) { g_return_if_fail(GTK_IS_IMAGE(image)); + gchar * icon_filename = NULL; + GtkIconInfo * icon_info = NULL; + gint icon_size = 22; GIcon * icon_names = (GIcon *)g_object_get_data(G_OBJECT(image), INDICATOR_NAMES_DATA); g_return_if_fail(icon_names != NULL); @@ -38,23 +41,29 @@ refresh_image (GtkImage * image) GtkIconTheme * default_theme = gtk_icon_theme_get_default(); g_return_if_fail(default_theme != NULL); - gint icon_size = 22; - /* Look through the themes for that icon */ - GtkIconInfo * icon_info = gtk_icon_theme_lookup_by_gicon(default_theme, icon_names, icon_size, 0); + icon_info = gtk_icon_theme_lookup_by_gicon(default_theme, icon_names, icon_size, 0); if (icon_info == NULL) { - g_warning("Unable to find icon in theme."); - return; + /* Try using the second item in the names, which should be the original filename supplied */ + const gchar * const * names = g_themed_icon_get_names(G_THEMED_ICON( icon_names )); + if (names) { + icon_filename = g_strdup(names[1]); + } else { + g_warning("Unable to find icon\n"); + return; + } + } else { + /* Grab the filename */ + icon_filename = (gchar *)gtk_icon_info_get_filename(icon_info); } - - /* Grab the filename */ - const gchar * icon_filename = gtk_icon_info_get_filename(icon_info); - g_return_if_fail(icon_filename != NULL); /* An error because we shouldn't get info without a filename */ + g_return_if_fail(icon_filename != NULL); /* An error because we don't have a filename */ /* Build a pixbuf */ GError * error = NULL; GdkPixbuf * pixbuf = gdk_pixbuf_new_from_file(icon_filename, &error); - gtk_icon_info_free(icon_info); + + if (icon_info != NULL) + gtk_icon_info_free(icon_info); if (pixbuf == NULL) { g_error("Unable to load icon from file '%s' because: %s", icon_filename, error == NULL ? "I don't know" : error->message); @@ -126,15 +135,16 @@ indicator_image_helper_update (GtkImage * image, const gchar * name) g_return_if_fail(name != NULL); g_return_if_fail(name[0] != '\0'); g_return_if_fail(image != NULL); + gboolean seen_previously = FALSE; /* Build us a GIcon */ GIcon * icon_names = g_themed_icon_new_with_default_fallbacks(name); + g_warn_if_fail(icon_names != NULL); g_return_if_fail(icon_names != NULL); - gboolean seen_previously = (g_object_get_data(G_OBJECT(image), INDICATOR_NAMES_DATA) != NULL); - /* Attach our names to the image */ g_object_set_data_full(G_OBJECT(image), INDICATOR_NAMES_DATA, icon_names, g_object_unref); + seen_previously = (g_object_get_data(G_OBJECT(image), INDICATOR_NAMES_DATA) != NULL); /* Put the pixbuf in */ refresh_image(image); -- cgit v1.2.3 From 53265a332a1d59a2f0867207fcd81926bf40ff6c Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 12 Aug 2010 14:40:42 -0500 Subject: 0.3.11 --- configure.ac | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 7f17df0..23350c6 100644 --- a/configure.ac +++ b/configure.ac @@ -1,10 +1,10 @@ -AC_INIT(libindicator, 0.3.10, ted@canonical.com) +AC_INIT(libindicator, 0.3.11, ted@canonical.com) AC_PREREQ(2.53) AM_CONFIG_HEADER(config.h) -AM_INIT_AUTOMAKE(libindicator, 0.3.10) +AM_INIT_AUTOMAKE(libindicator, 0.3.11) AM_MAINTAINER_MODE m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES]) -- cgit v1.2.3