From b63bf8103240f06e05ed99024d4ff24bbc08b725 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 13 Feb 2009 16:12:56 -0600 Subject: Making the image global, and changing it based on how many IMs we have. --- src/indicator-messages.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/indicator-messages.c b/src/indicator-messages.c index 94f1421..20417e6 100644 --- a/src/indicator-messages.c +++ b/src/indicator-messages.c @@ -30,6 +30,7 @@ with this program. If not, see . static IndicateListener * listener; static GList * imList; static GHashTable * serverHash; +static GtkWidget * main_image; typedef struct _imList_t imList_t; struct _imList_t { @@ -154,6 +155,10 @@ subtype_cb (IndicateListener * listener, IndicateListenerServer * server, Indica gtk_menu_shell_prepend(menushell, GTK_WIDGET(menuitem)); } + if (g_list_length(imList) != 0) { + gtk_image_set_from_icon_name(main_image, "indicator-messages-new", GTK_ICON_SIZE_MENU); + } + return; } @@ -211,6 +216,10 @@ indicator_removed (IndicateListener * listener, IndicateListenerServer * server, g_warning("We were asked to remove %s %d but we didn't.", (gchar*)server, (guint)indicator); } + if (g_list_length(imList) == 0) { + gtk_image_set_from_icon_name(main_image, "indicator-messages", GTK_ICON_SIZE_MENU); + } + return; } @@ -225,7 +234,7 @@ get_menu_item (void) GtkWidget * mainmenu = gtk_menu_item_new(); - GtkWidget * image = gtk_image_new_from_icon_name("indicator-messages", GTK_ICON_SIZE_MENU); + main_image = gtk_image_new_from_icon_name("indicator-messages", GTK_ICON_SIZE_MENU); gtk_widget_show(image); gtk_container_add(GTK_CONTAINER(mainmenu), image); -- cgit v1.2.3