From 225167d17161ec59efac14648841b5a36b20f3c1 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 5 Aug 2010 15:04:34 -0500 Subject: Tracking the long name along with the application entry. --- src/indicator-application.c | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/src/indicator-application.c b/src/indicator-application.c index 9abfbe6..a3aabb2 100644 --- a/src/indicator-application.c +++ b/src/indicator-application.c @@ -89,6 +89,7 @@ struct _ApplicationEntry { gchar * dbusobject; gchar * dbusaddress; gchar * guide; + gchar * longname; }; #define INDICATOR_APPLICATION_GET_PRIVATE(o) \ @@ -511,14 +512,13 @@ application_added (DBusGProxy * proxy, const gchar * iconname, gint position, co /* We make a long name using the suffix, and if that icon is available we want to use it. Otherwise we'll just use the name we were given. */ - gchar * longname = NULL; + app->longname = NULL; if (!g_str_has_suffix(iconname, PANEL_ICON_SUFFIX)) { - longname = g_strdup_printf("%s-%s", iconname, PANEL_ICON_SUFFIX); + app->longname = g_strdup_printf("%s-%s", iconname, PANEL_ICON_SUFFIX); } else { - longname = g_strdup(iconname); + app->longname = g_strdup(iconname); } - app->entry.image = indicator_image_helper(longname); - g_free(longname); + app->entry.image = indicator_image_helper(app->longname); if (label == NULL || label[0] == '\0') { app->entry.label = NULL; @@ -583,6 +583,9 @@ application_removed (DBusGProxy * proxy, gint position, IndicatorApplication * a if (app->guide != NULL) { g_free(app->guide); } + if (app->longname != NULL) { + g_free(app->longname); + } if (app->entry.image != NULL) { g_object_unref(G_OBJECT(app->entry.image)); } @@ -693,14 +696,16 @@ application_icon_changed (DBusGProxy * proxy, gint position, const gchar * iconn /* We make a long name using the suffix, and if that icon is available we want to use it. Otherwise we'll just use the name we were given. */ - gchar * longname = NULL; + if (app->longname != NULL) { + g_free(app->longname); + app->longname = NULL; + } if (!g_str_has_suffix(iconname, PANEL_ICON_SUFFIX)) { - longname = g_strdup_printf("%s-%s", iconname, PANEL_ICON_SUFFIX); + app->longname = g_strdup_printf("%s-%s", iconname, PANEL_ICON_SUFFIX); } else { - longname = g_strdup(iconname); + app->longname = g_strdup(iconname); } - indicator_image_helper_update(app->entry.image, longname); - g_free(longname); + indicator_image_helper_update(app->entry.image, app->longname); return; } -- cgit v1.2.3