Ted Gould has proposed merging 
lp:~ted/indicator-application/labels-in-the-indicator into 
lp:indicator-application with lp:~ted/indicator-application/label-in-the-lib as 
a prerequisite.

Requested reviews:
  Indicator Applet Developers (indicator-applet-developers)


Adding label support into the service and indicator.
-- 
https://code.launchpad.net/~ted/indicator-application/labels-in-the-indicator/+merge/31885
Your team ayatana-commits is subscribed to branch lp:indicator-application.
=== modified file 'src/application-service-appstore.c'
--- src/application-service-appstore.c	2010-07-09 21:29:22 +0000
+++ src/application-service-appstore.c	2010-08-05 20:31:04 +0000
@@ -38,17 +38,20 @@
 
 #include "application-service-server.h"
 
-#define NOTIFICATION_ITEM_PROP_ID         "Id"
-#define NOTIFICATION_ITEM_PROP_CATEGORY   "Category"
-#define NOTIFICATION_ITEM_PROP_STATUS     "Status"
-#define NOTIFICATION_ITEM_PROP_ICON_NAME  "IconName"
-#define NOTIFICATION_ITEM_PROP_AICON_NAME "AttentionIconName"
-#define NOTIFICATION_ITEM_PROP_ICON_PATH  "IconThemePath"
-#define NOTIFICATION_ITEM_PROP_MENU       "Menu"
+#define NOTIFICATION_ITEM_PROP_ID             "Id"
+#define NOTIFICATION_ITEM_PROP_CATEGORY       "Category"
+#define NOTIFICATION_ITEM_PROP_STATUS         "Status"
+#define NOTIFICATION_ITEM_PROP_ICON_NAME      "IconName"
+#define NOTIFICATION_ITEM_PROP_AICON_NAME     "AttentionIconName"
+#define NOTIFICATION_ITEM_PROP_ICON_PATH      "IconThemePath"
+#define NOTIFICATION_ITEM_PROP_MENU           "Menu"
+#define NOTIFICATION_ITEM_PROP_LABEL          "Label"
+#define NOTIFICATION_ITEM_PROP_LABEL_GUIDE    "LabelGuide"
 
-#define NOTIFICATION_ITEM_SIG_NEW_ICON    "NewIcon"
-#define NOTIFICATION_ITEM_SIG_NEW_AICON   "NewAttentionIcon"
-#define NOTIFICATION_ITEM_SIG_NEW_STATUS  "NewStatus"
+#define NOTIFICATION_ITEM_SIG_NEW_ICON        "NewIcon"
+#define NOTIFICATION_ITEM_SIG_NEW_AICON       "NewAttentionIcon"
+#define NOTIFICATION_ITEM_SIG_NEW_STATUS      "NewStatus"
+#define NOTIFICATION_ITEM_SIG_NEW_LABEL       "NewLabel"
 
 /* Private Stuff */
 struct _ApplicationServiceAppstorePrivate {
@@ -78,6 +81,8 @@
 	gchar * aicon;
 	gchar * menu;
 	gchar * icon_path;
+	gchar * label;
+	gchar * guide;
 	gboolean currently_free;
 };
 
@@ -89,6 +94,7 @@
 	APPLICATION_ADDED,
 	APPLICATION_REMOVED,
 	APPLICATION_ICON_CHANGED,
+	APPLICATION_LABEL_CHANGED,
 	LAST_SIGNAL
 };
 
@@ -122,8 +128,8 @@
 	                                           G_SIGNAL_RUN_LAST,
 	                                           G_STRUCT_OFFSET (ApplicationServiceAppstoreClass, application_added),
 	                                           NULL, NULL,
-	                                           _application_service_marshal_VOID__STRING_INT_STRING_STRING_STRING,
-	                                           G_TYPE_NONE, 5, G_TYPE_STRING, G_TYPE_INT, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_NONE);
+	                                           _application_service_marshal_VOID__STRING_INT_STRING_STRING_STRING_STRING_STRING,
+	                                           G_TYPE_NONE, 7, G_TYPE_STRING, G_TYPE_INT, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_NONE);
 	signals[APPLICATION_REMOVED] = g_signal_new ("application-removed",
 	                                           G_TYPE_FROM_CLASS(klass),
 	                                           G_SIGNAL_RUN_LAST,
@@ -138,6 +144,19 @@
 	                                           NULL, NULL,
 	                                           _application_service_marshal_VOID__INT_STRING,
 	                                           G_TYPE_NONE, 2, G_TYPE_INT, G_TYPE_STRING, G_TYPE_NONE);
+	signals[APPLICATION_LABEL_CHANGED] = g_signal_new ("application-label-changed",
+	                                           G_TYPE_FROM_CLASS(klass),
+	                                           G_SIGNAL_RUN_LAST,
+	                                           G_STRUCT_OFFSET (ApplicationServiceAppstoreClass, application_label_changed),
+	                                           NULL, NULL,
+	                                           _application_service_marshal_VOID__INT_STRING_STRING,
+	                                           G_TYPE_NONE, 3, G_TYPE_INT, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_NONE);
+
+	dbus_g_object_register_marshaller(_application_service_marshal_VOID__STRING_STRING,
+	                                  G_TYPE_NONE,
+	                                  G_TYPE_STRING,
+	                                  G_TYPE_STRING,
+	                                  G_TYPE_INVALID);
 
 	dbus_g_object_type_install_info(APPLICATION_SERVICE_APPSTORE_TYPE,
 	                                &dbus_glib__application_service_server_object_info);
@@ -253,6 +272,20 @@
 		app->icon_path = g_strdup("");
 	}
 
+	gpointer label_data = g_hash_table_lookup(properties, NOTIFICATION_ITEM_PROP_LABEL);
+	if (label_data != NULL) {
+		app->label = g_value_dup_string((GValue *)label_data);
+	} else {
+		app->label = g_strdup("");
+	}
+
+	gpointer guide_data = g_hash_table_lookup(properties, NOTIFICATION_ITEM_PROP_LABEL_GUIDE);
+	if (guide_data != NULL) {
+		app->guide = g_value_dup_string((GValue *)guide_data);
+	} else {
+		app->guide = g_strdup("");
+	}
+
 	/* TODO: Calling approvers, but we're ignoring the results.  So, eh. */
 	g_list_foreach(priv->approvers, check_with_old_approver, app);
 
@@ -349,6 +382,12 @@
 	if (app->icon_path != NULL) {
 		g_free(app->icon_path);
 	}
+	if (app->label != NULL) {
+		g_free(app->label);
+	}
+	if (app->guide != NULL) {
+		g_free(app->guide);
+	}
 
 	g_free(app);
 	return;
@@ -446,6 +485,8 @@
                                               app->dbus_name,
                                               app->menu,
                                               app->icon_path,
+                                              app->label,
+                                              app->guide,
                                               TRUE);
                         }
 		} else {
@@ -586,6 +627,48 @@
 	return;
 }
 
+/* Called when the Notification Item signals that it
+   has a new label. */
+static void
+new_label (DBusGProxy * proxy, const gchar * label, const gchar * guide, gpointer data)
+{
+	Application * app = (Application *)data;
+	if (!app->validated) return;
+
+	gboolean changed = FALSE;
+
+	if (g_strcmp0(app->label, label) != 0) {
+		changed = TRUE;
+		if (app->label != NULL) {
+			g_free(app->label);
+			app->label = NULL;
+		}
+		app->label = g_strdup(label);
+	}
+
+	if (g_strcmp0(app->guide, guide) != 0) {
+		changed = TRUE;
+		if (app->guide != NULL) {
+			g_free(app->guide);
+			app->guide = NULL;
+		}
+		app->guide = g_strdup(guide);
+	}
+
+	if (changed) {
+		gint position = get_position(app);
+		if (position == -1) return;
+
+		g_signal_emit(app->appstore, signals[APPLICATION_LABEL_CHANGED], 0,
+					  position,
+		              app->label != NULL ? app->label : "", 
+		              app->guide != NULL ? app->guide : "",
+		              TRUE);
+	}
+
+	return;
+}
+
 /* Adding a new NotificationItem object from DBus in to the
    appstore.  First, we need to get the information on it
    though. */
@@ -613,6 +696,8 @@
 	app->aicon = NULL;
 	app->menu = NULL;
 	app->icon_path = NULL;
+	app->label = NULL;
+	app->guide = NULL;
 	app->currently_free = FALSE;
 
 	/* Get the DBus proxy for the NotificationItem interface */
@@ -659,6 +744,11 @@
 	                        NOTIFICATION_ITEM_SIG_NEW_STATUS,
 	                        G_TYPE_STRING,
 	                        G_TYPE_INVALID);
+	dbus_g_proxy_add_signal(app->dbus_proxy,
+	                        NOTIFICATION_ITEM_SIG_NEW_LABEL,
+	                        G_TYPE_STRING,
+	                        G_TYPE_STRING,
+	                        G_TYPE_INVALID);
 
 	dbus_g_proxy_connect_signal(app->dbus_proxy,
 	                            NOTIFICATION_ITEM_SIG_NEW_ICON,
@@ -675,6 +765,11 @@
 	                            G_CALLBACK(new_status),
 	                            app,
 	                            NULL);
+	dbus_g_proxy_connect_signal(app->dbus_proxy,
+	                            NOTIFICATION_ITEM_SIG_NEW_LABEL,
+	                            G_CALLBACK(new_label),
+	                            app,
+	                            NULL);
 
 	/* Get all the propertiees */
 	org_freedesktop_DBus_Properties_get_all_async(app->prop_proxy,
@@ -734,13 +829,14 @@
 	gint position = 0;
 
 	for (listpntr = priv->applications; listpntr != NULL; listpntr = g_list_next(listpntr)) {
+		Application * app = (Application *)listpntr->data;
 		GValueArray * values = g_value_array_new(5);
 
 		GValue value = {0};
 
 		/* Icon name */
 		g_value_init(&value, G_TYPE_STRING);
-		g_value_set_string(&value, ((Application *)listpntr->data)->icon);
+		g_value_set_string(&value, app->icon);
 		g_value_array_append(values, &value);
 		g_value_unset(&value);
 
@@ -752,19 +848,31 @@
 
 		/* DBus Address */
 		g_value_init(&value, G_TYPE_STRING);
-		g_value_set_string(&value, ((Application *)listpntr->data)->dbus_name);
+		g_value_set_string(&value, app->dbus_name);
 		g_value_array_append(values, &value);
 		g_value_unset(&value);
 
 		/* DBus Object */
 		g_value_init(&value, DBUS_TYPE_G_OBJECT_PATH);
-		g_value_set_static_boxed(&value, ((Application *)listpntr->data)->menu);
+		g_value_set_static_boxed(&value, app->menu);
 		g_value_array_append(values, &value);
 		g_value_unset(&value);
 
 		/* Icon path */
 		g_value_init(&value, G_TYPE_STRING);
-		g_value_set_string(&value, ((Application *)listpntr->data)->icon_path);
+		g_value_set_string(&value, app->icon_path);
+		g_value_array_append(values, &value);
+		g_value_unset(&value);
+
+		/* Label */
+		g_value_init(&value, G_TYPE_STRING);
+		g_value_set_string(&value, app->label);
+		g_value_array_append(values, &value);
+		g_value_unset(&value);
+
+		/* Guide */
+		g_value_init(&value, G_TYPE_STRING);
+		g_value_set_string(&value, app->guide);
 		g_value_array_append(values, &value);
 		g_value_unset(&value);
 

=== modified file 'src/application-service-appstore.h'
--- src/application-service-appstore.h	2010-07-09 20:13:48 +0000
+++ src/application-service-appstore.h	2010-08-05 20:31:04 +0000
@@ -46,6 +46,7 @@
 	void (*application_added) (ApplicationServiceAppstore * appstore, gchar *, gint, gchar *, gchar *, gpointer);
 	void (*application_removed) (ApplicationServiceAppstore * appstore, gint, gpointer);
 	void (*application_icon_changed)(ApplicationServiceAppstore * appstore, gint, const gchar *, gpointer);
+	void (*application_label_changed)(ApplicationServiceAppstore * appstore, gint, const gchar *, const gchar *, gpointer);
 };
 
 struct _ApplicationServiceAppstore {

=== modified file 'src/application-service-marshal.list'
--- src/application-service-marshal.list	2010-01-07 23:06:38 +0000
+++ src/application-service-marshal.list	2010-08-05 20:31:04 +0000
@@ -16,5 +16,7 @@
 # 
 # You should have received a copy of the GNU General Public License along 
 # with this program.  If not, see <http://www.gnu.org/licenses/>.
-VOID: STRING, INT, STRING, STRING, STRING
+VOID: STRING, INT, STRING, STRING, STRING, STRING, STRING
+VOID: INT, STRING, STRING
 VOID: INT, STRING
+VOID: STRING, STRING

=== modified file 'src/application-service.xml'
--- src/application-service.xml	2010-01-15 05:25:34 +0000
+++ src/application-service.xml	2010-08-05 20:31:04 +0000
@@ -26,7 +26,7 @@
 
 <!-- Methods -->
 		<method name="GetApplications">
-			<arg type="a(sisos)" name="applications" direction="out" />
+			<arg type="a(sisosss)" name="applications" direction="out" />
 		</method>
 
 <!-- Signals -->
@@ -36,6 +36,8 @@
 			<arg type="s" name="dbusaddress" direction="out" />
 			<arg type="o" name="dbusobject" direction="out" />
 			<arg type="s" name="iconpath" direction="out" />
+			<arg type="s" name="label" direction="out" />
+			<arg type="s" name="labelguide" direction="out" />
 		</signal>
 		<signal name="ApplicationRemoved">
 			<arg type="i" name="position" direction="out" />
@@ -44,6 +46,11 @@
 			<arg type="i" name="position" direction="out" />
 			<arg type="s" name="icon_name" direction="out" />
 		</signal>
+		<signal name="ApplicationLabelChanged">
+			<arg type="i" name="position" direction="out" />
+			<arg type="s" name="label" direction="out" />
+			<arg type="s" name="guide" direction="out" />
+		</signal>
 
 	</interface>
 </node>

=== modified file 'src/indicator-application.c'
--- src/indicator-application.c	2010-03-29 17:41:18 +0000
+++ src/indicator-application.c	2010-08-05 20:31:04 +0000
@@ -88,6 +88,8 @@
 	gboolean old_service;
 	gchar * dbusobject;
 	gchar * dbusaddress;
+	gchar * guide;
+	gchar * longname;
 };
 
 #define INDICATOR_APPLICATION_GET_PRIVATE(o) \
@@ -105,8 +107,9 @@
 static void disconnected_helper (gpointer data, gpointer user_data);
 static gboolean disconnected_kill (gpointer user_data);
 static void disconnected_kill_helper (gpointer data, gpointer user_data);
-static void application_added (DBusGProxy * proxy, const gchar * iconname, gint position, const gchar * dbusaddress, const gchar * dbusobject, const gchar * icon_path, IndicatorApplication * application);
+static void application_added (DBusGProxy * proxy, const gchar * iconname, gint position, const gchar * dbusaddress, const gchar * dbusobject, const gchar * icon_path, const gchar * label, const gchar * guide, IndicatorApplication * application);
 static void application_removed (DBusGProxy * proxy, gint position , IndicatorApplication * application);
+static void application_label_changed (DBusGProxy * proxy, gint position, const gchar * label, const gchar * guide, IndicatorApplication * application);
 static void application_icon_changed (DBusGProxy * proxy, gint position, const gchar * iconname, IndicatorApplication * application);
 static void get_applications (DBusGProxy *proxy, GPtrArray *OUT_applications, GError *error, gpointer userdata);
 static void get_applications_helper (gpointer data, gpointer user_data);
@@ -130,19 +133,27 @@
 	io_class->get_entries = get_entries;
 	io_class->get_location = get_location;
 
-	dbus_g_object_register_marshaller(_application_service_marshal_VOID__STRING_INT_STRING_STRING_STRING,
+	dbus_g_object_register_marshaller(_application_service_marshal_VOID__STRING_INT_STRING_STRING_STRING_STRING_STRING,
 	                                  G_TYPE_NONE,
 	                                  G_TYPE_STRING,
 	                                  G_TYPE_INT,
 	                                  G_TYPE_STRING,
 	                                  G_TYPE_STRING,
 	                                  G_TYPE_STRING,
+	                                  G_TYPE_STRING,
+	                                  G_TYPE_STRING,
 	                                  G_TYPE_INVALID);
 	dbus_g_object_register_marshaller(_application_service_marshal_VOID__INT_STRING,
 	                                  G_TYPE_NONE,
 	                                  G_TYPE_INT,
 	                                  G_TYPE_STRING,
 	                                  G_TYPE_INVALID);
+	dbus_g_object_register_marshaller(_application_service_marshal_VOID__INT_STRING_STRING,
+	                                  G_TYPE_NONE,
+	                                  G_TYPE_INT,
+	                                  G_TYPE_STRING,
+	                                  G_TYPE_STRING,
+	                                  G_TYPE_INVALID);
 
 	return;
 }
@@ -270,6 +281,8 @@
 	                        	G_TYPE_STRING,
 	                        	G_TYPE_STRING,
 	                        	G_TYPE_STRING,
+	                        	G_TYPE_STRING,
+	                        	G_TYPE_STRING,
 	                        	G_TYPE_INVALID);
 		dbus_g_proxy_add_signal(priv->service_proxy,
 	                        	"ApplicationRemoved",
@@ -280,6 +293,12 @@
 	                        	G_TYPE_INT,
 	                        	G_TYPE_STRING,
 	                        	G_TYPE_INVALID);
+		dbus_g_proxy_add_signal(priv->service_proxy,
+	                        	"ApplicationLabelChanged",
+	                        	G_TYPE_INT,
+	                        	G_TYPE_STRING,
+	                        	G_TYPE_STRING,
+	                        	G_TYPE_INVALID);
 
 		/* Connect to them */
 		g_debug("Connect to them.");
@@ -298,6 +317,11 @@
 	                            	G_CALLBACK(application_icon_changed),
 	                            	application,
 	                            	NULL /* Disconnection Signal */);
+		dbus_g_proxy_connect_signal(priv->service_proxy,
+	                            	"ApplicationLabelChanged",
+	                            	G_CALLBACK(application_label_changed),
+	                            	application,
+	                            	NULL /* Disconnection Signal */);
 	}
 
 	/* Query it for existing applications */
@@ -409,11 +433,51 @@
 	return -1;
 }
 
+/* Does a quick meausre of how big the string is in
+   pixels with a Pango layout */
+static gint
+measure_string (GtkStyle * style, PangoContext * context, const gchar * string)
+{
+	PangoLayout * layout = pango_layout_new(context);
+	pango_layout_set_text(layout, string, -1);
+	pango_layout_set_font_description(layout, style->font_desc);
+
+	gint width;
+	pango_layout_get_pixel_size(layout, &width, NULL);
+	g_object_unref(layout);
+	return width;
+}
+
+/* Try to get a good guess at what a maximum width of the entire
+   string would be. */
+static void
+guess_label_size (ApplicationEntry * app)
+{
+	/* This is during startup. */
+	if (app->entry.label == NULL) return;
+
+	GtkStyle * style = gtk_widget_get_style(GTK_WIDGET(app->entry.label));
+	PangoContext * context = gtk_widget_get_pango_context(GTK_WIDGET(app->entry.label));
+
+	gint length = measure_string(style, context, gtk_label_get_text(app->entry.label));
+
+	if (app->guide != NULL) {
+		gint guidelen = measure_string(style, context, app->guide);
+		if (guidelen > length) {
+			length = guidelen;
+		}
+	}
+
+	gtk_widget_set_size_request(GTK_WIDGET(app->entry.label), length, -1);
+
+	return;
+}
+
 /* Here we respond to new applications by building up the
    ApplicationEntry and signaling the indicator host that
    we've got a new indicator. */
 static void
-application_added (DBusGProxy * proxy, const gchar * iconname, gint position, const gchar * dbusaddress, const gchar * dbusobject, const gchar * icon_path, IndicatorApplication * application)
+application_added (DBusGProxy * proxy, const gchar * iconname, gint position, const gchar * dbusaddress, const gchar * dbusobject, const gchar * icon_path, const gchar * label, const gchar * guide, IndicatorApplication * application)
 {
 	g_return_if_fail(IS_INDICATOR_APPLICATION(application));
 	g_debug("Building new application entry: %s  with icon: %s", dbusaddress, iconname);
@@ -443,20 +507,38 @@
 
 	app->dbusaddress = g_strdup(dbusaddress);
 	app->dbusobject = g_strdup(dbusobject);
+	app->guide = NULL;
 
 	/* 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);
-	} else {
-		longname = g_strdup(iconname);
-	}
-	app->entry.image = indicator_image_helper(longname);
-	g_free(longname);
-
-	app->entry.label = NULL;
+		app->longname = g_strdup_printf("%s-%s", iconname, PANEL_ICON_SUFFIX);
+	} else {
+		app->longname = g_strdup(iconname);
+	}
+	app->entry.image = indicator_image_helper(app->longname);
+
+	if (label == NULL || label[0] == '\0') {
+		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) {
+			g_free(app->guide);
+			app->guide = NULL;
+		}
+
+		if (guide != NULL) {
+			app->guide = g_strdup(guide);
+		}
+
+		guess_label_size(app);
+	}
+
 	app->entry.menu = GTK_MENU(dbusmenu_gtkmenu_new((gchar *)dbusaddress, (gchar *)dbusobject));
 
 	/* Keep copies of these for ourself, just in case. */
@@ -467,7 +549,6 @@
 
 	priv->applications = g_list_insert(priv->applications, app, position);
 
-	/* TODO: Need to deal with position here somehow */
 	g_signal_emit(G_OBJECT(application), INDICATOR_OBJECT_SIGNAL_ENTRY_ADDED_ID, 0, &(app->entry), TRUE);
 	return;
 }
@@ -499,11 +580,16 @@
 	if (app->dbusobject != NULL) {
 		g_free(app->dbusobject);
 	}
+	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));
 	}
 	if (app->entry.label != NULL) {
-		g_warning("Odd, an application indicator with a label?");
 		g_object_unref(G_OBJECT(app->entry.label));
 	}
 	if (app->entry.menu != NULL) {
@@ -514,6 +600,87 @@
 	return;
 }
 
+/* The callback for the signal that the label for an application
+   has changed. */
+static void
+application_label_changed (DBusGProxy * proxy, gint position, const gchar * label, const gchar * guide, IndicatorApplication * application)
+{
+	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);
+		return;
+	}
+	
+	if (label == NULL || label[0] == '\0') {
+		/* No label, let's see if we need to delete the old one */
+		if (app->entry.label != NULL) {
+			g_object_unref(G_OBJECT(app->entry.label));
+			app->entry.label = NULL;
+
+			signal_reload = TRUE;
+		}
+	} else {
+		/* We've got a label, is this just an update or is
+		   it a new thing. */
+		if (app->entry.label != NULL) {
+			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));
+
+			signal_reload = TRUE;
+		}
+	}
+
+	/* Copy the guide if we have one */
+	if (app->guide != NULL) {
+		g_free(app->guide);
+		app->guide = NULL;
+	}
+
+	if (guide != NULL && guide[0] != '\0') {
+		app->guide = g_strdup(guide);
+	}
+
+	/* 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. */
+		if (app->entry.label != NULL) {
+			gtk_widget_hide(GTK_WIDGET(app->entry.label));
+		}
+
+		if (app->entry.image != NULL) {
+			gtk_widget_hide(GTK_WIDGET(app->entry.image));
+		}
+
+		if (app->entry.menu != NULL) {
+			gtk_menu_detach(app->entry.menu);
+		}
+
+		g_signal_emit(G_OBJECT(application), INDICATOR_OBJECT_SIGNAL_ENTRY_REMOVED_ID, 0, &(app->entry), TRUE);
+
+		if (app->entry.label != NULL) {
+			gtk_widget_show(GTK_WIDGET(app->entry.label));
+		}
+
+		if (app->entry.image != NULL) {
+			indicator_image_helper_update(app->entry.image, app->longname);
+			gtk_widget_show(GTK_WIDGET(app->entry.image));
+		}
+
+		g_signal_emit(G_OBJECT(application), INDICATOR_OBJECT_SIGNAL_ENTRY_ADDED_ID, 0, &(app->entry), TRUE);
+	}
+
+	return;
+}
+
 /* The callback for the signal that the icon for an application
    has changed. */
 static void
@@ -530,9 +697,16 @@
 	/* 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 = g_strdup_printf("%s-%s", iconname, PANEL_ICON_SUFFIX);
-	indicator_image_helper_update(app->entry.image, longname);
-	g_free(longname);
+	if (app->longname != NULL) {
+		g_free(app->longname);
+		app->longname = NULL;
+	}
+	if (!g_str_has_suffix(iconname, PANEL_ICON_SUFFIX)) {
+		app->longname = g_strdup_printf("%s-%s", iconname, PANEL_ICON_SUFFIX);
+	} else {
+		app->longname = g_strdup(iconname);
+	}
+	indicator_image_helper_update(app->entry.image, app->longname);
 
 	return;
 }
@@ -558,15 +732,17 @@
 {
 	GValueArray * array = (GValueArray *)data;
 
-	g_return_if_fail(array->n_values == 5);
+	g_return_if_fail(array->n_values == 7);
 
 	const gchar * icon_name = g_value_get_string(g_value_array_get_nth(array, 0));
 	gint position = g_value_get_int(g_value_array_get_nth(array, 1));
 	const gchar * dbus_address = g_value_get_string(g_value_array_get_nth(array, 2));
 	const gchar * dbus_object = g_value_get_boxed(g_value_array_get_nth(array, 3));
 	const gchar * icon_path = g_value_get_string(g_value_array_get_nth(array, 4));
+	const gchar * label = g_value_get_string(g_value_array_get_nth(array, 5));
+	const gchar * guide = g_value_get_string(g_value_array_get_nth(array, 6));
 
-	return application_added(NULL, icon_name, position, dbus_address, dbus_object, icon_path, user_data);
+	return application_added(NULL, icon_name, position, dbus_address, dbus_object, icon_path, label, guide, user_data);
 }
 
 /* Refs a theme directory, and it may add it to the search

_______________________________________________
Mailing list: https://launchpad.net/~ayatana-commits
Post to     : ayatana-commits@lists.launchpad.net
Unsubscribe : https://launchpad.net/~ayatana-commits
More help   : https://help.launchpad.net/ListHelp

Reply via email to