diff options
-rw-r--r-- | libindicator/indicator-image-helper.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/libindicator/indicator-image-helper.c b/libindicator/indicator-image-helper.c index 2ff97e6..6b11f6f 100644 --- a/libindicator/indicator-image-helper.c +++ b/libindicator/indicator-image-helper.c @@ -30,7 +30,7 @@ static void refresh_image (GtkImage * image) { g_return_if_fail(GTK_IS_IMAGE(image)); - gchar * icon_filename = NULL; + const gchar * icon_filename = NULL; GtkIconInfo * icon_info = NULL; gint icon_size = 22; @@ -47,14 +47,14 @@ refresh_image (GtkImage * image) /* 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]); + icon_filename = 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); + icon_filename = gtk_icon_info_get_filename(icon_info); } g_return_if_fail(icon_filename != NULL); /* An error because we don't have a filename */ @@ -62,8 +62,9 @@ refresh_image (GtkImage * image) GError * error = NULL; GdkPixbuf * pixbuf = gdk_pixbuf_new_from_file(icon_filename, &error); - if (icon_info != NULL) + 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); @@ -142,9 +143,10 @@ indicator_image_helper_update (GtkImage * image, const gchar * name) g_warn_if_fail(icon_names != NULL); g_return_if_fail(icon_names != NULL); + 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); |