aboutsummaryrefslogtreecommitdiff
path: root/src/indicator-application.c
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2010-08-05 13:23:12 -0500
committerTed Gould <ted@gould.cx>2010-08-05 13:23:12 -0500
commitb17e62540f4ac630d7af7386409779271f3a2a57 (patch)
tree5a7cb1f2f4add6e18dec752007f03edcdb5e5c8d /src/indicator-application.c
parent38074f5f2b53b969b9bdd1759ac6c94cfec68956 (diff)
downloadayatana-indicator-application-b17e62540f4ac630d7af7386409779271f3a2a57.tar.gz
ayatana-indicator-application-b17e62540f4ac630d7af7386409779271f3a2a57.tar.bz2
ayatana-indicator-application-b17e62540f4ac630d7af7386409779271f3a2a57.zip
Reshuffling the signaling and making sure to ref the label.
Diffstat (limited to 'src/indicator-application.c')
-rw-r--r--src/indicator-application.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/src/indicator-application.c b/src/indicator-application.c
index 939537e..2b32a1b 100644
--- a/src/indicator-application.c
+++ b/src/indicator-application.c
@@ -524,6 +524,7 @@ application_added (DBusGProxy * proxy, const gchar * iconname, gint position, co
app->entry.label = NULL;
} else {
app->entry.label = GTK_LABEL(gtk_label_new(label));
+ g_object_ref(G_OBJECT(app->entry.label));
gtk_widget_show(GTK_WIDGET(app->entry.label));
if (app->guide != NULL) {
@@ -603,6 +604,7 @@ application_label_changed (DBusGProxy * proxy, gint position, const gchar * labe
{
IndicatorApplicationPrivate * priv = INDICATOR_APPLICATION_GET_PRIVATE(application);
ApplicationEntry * app = (ApplicationEntry *)g_list_nth_data(priv->applications, position);
+ gboolean signal_reload = FALSE;
if (app == NULL) {
g_warning("Unable to find application at position: %d", position);
@@ -615,10 +617,7 @@ application_label_changed (DBusGProxy * proxy, gint position, const gchar * labe
g_object_unref(G_OBJECT(app->entry.label));
app->entry.label = NULL;
- /* We tell listeners that it got removed and readded so
- that we can get them to remove the old label. */
- g_signal_emit(G_OBJECT(application), INDICATOR_OBJECT_SIGNAL_ENTRY_REMOVED_ID, 0, &(app->entry), TRUE);
- g_signal_emit(G_OBJECT(application), INDICATOR_OBJECT_SIGNAL_ENTRY_ADDED_ID, 0, &(app->entry), TRUE);
+ signal_reload = TRUE;
}
} else {
/* We've got a label, is this just an update or is
@@ -627,12 +626,10 @@ application_label_changed (DBusGProxy * proxy, gint position, const gchar * labe
gtk_label_set_text(app->entry.label, label);
} else {
app->entry.label = GTK_LABEL(gtk_label_new(label));
+ g_object_ref(G_OBJECT(app->entry.label));
gtk_widget_show(GTK_WIDGET(app->entry.label));
- /* We tell listeners that it got removed and readded so
- that we can get them to re-look at the new label. */
- g_signal_emit(G_OBJECT(application), INDICATOR_OBJECT_SIGNAL_ENTRY_REMOVED_ID, 0, &(app->entry), TRUE);
- g_signal_emit(G_OBJECT(application), INDICATOR_OBJECT_SIGNAL_ENTRY_ADDED_ID, 0, &(app->entry), TRUE);
+ signal_reload = TRUE;
}
}
@@ -649,6 +646,13 @@ application_label_changed (DBusGProxy * proxy, gint position, const gchar * labe
/* Protected against not having a label */
guess_label_size(app);
+ if (signal_reload) {
+ /* Telling the listener that this has been removed, and then
+ readded to make it reparse the entry. */
+ g_signal_emit(G_OBJECT(application), INDICATOR_OBJECT_SIGNAL_ENTRY_REMOVED_ID, 0, &(app->entry), TRUE);
+ g_signal_emit(G_OBJECT(application), INDICATOR_OBJECT_SIGNAL_ENTRY_ADDED_ID, 0, &(app->entry), TRUE);
+ }
+
return;
}