diff options
author | Ted Gould <ted@gould.cx> | 2010-03-11 10:35:14 -0600 |
---|---|---|
committer | Ted Gould <ted@gould.cx> | 2010-03-11 10:35:14 -0600 |
commit | e31a7de28b3a030186e49a4b0d88730604196539 (patch) | |
tree | 107abe887757c11fa6128eb3c6e512ba3e585022 | |
parent | b4ca4f6ff3d2176b42cad8ec5e5970452d83edb9 (diff) | |
download | libayatana-indicator-e31a7de28b3a030186e49a4b0d88730604196539.tar.gz libayatana-indicator-e31a7de28b3a030186e49a4b0d88730604196539.tar.bz2 libayatana-indicator-e31a7de28b3a030186e49a4b0d88730604196539.zip |
Check to see if we've seen the image previously before adding signals in.
-rw-r--r-- | libindicator/indicator-image-helper.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/libindicator/indicator-image-helper.c b/libindicator/indicator-image-helper.c index 2703208..ae417c7 100644 --- a/libindicator/indicator-image-helper.c +++ b/libindicator/indicator-image-helper.c @@ -109,6 +109,8 @@ image_destroyed_cb (GtkImage * image, gpointer user_data) return; } +/* Builds an image with the name and fallbacks and all kinds of fun + stuff . */ GtkImage * indicator_image_helper (const gchar * name) { @@ -120,6 +122,7 @@ indicator_image_helper (const gchar * name) return image; } +/* Updates and image with all the fun stuff */ void indicator_image_helper_update (GtkImage * image, const gchar * name) { @@ -131,6 +134,8 @@ indicator_image_helper_update (GtkImage * image, const gchar * name) GIcon * icon_names = g_themed_icon_new_with_default_fallbacks(name); 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); @@ -138,8 +143,10 @@ indicator_image_helper_update (GtkImage * image, const gchar * name) refresh_image(image); /* Connect to all changes */ - g_signal_connect(G_OBJECT(gtk_icon_theme_get_default()), "changed", G_CALLBACK(theme_changed_cb), image); - g_signal_connect(G_OBJECT(image), "destroy", G_CALLBACK(image_destroyed_cb), NULL); + if (!seen_previously) { + g_signal_connect(G_OBJECT(gtk_icon_theme_get_default()), "changed", G_CALLBACK(theme_changed_cb), image); + g_signal_connect(G_OBJECT(image), "destroy", G_CALLBACK(image_destroyed_cb), NULL); + } return; } |