changeset 13112:f1ed04b5aa30

[gaim-migrate @ 15474] Make the dinky little icons for status menu items in the system tray reflect what the status actually is. BECAUSE THAT'S THE KIND OF POWER I WEILD. committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Fri, 03 Feb 2006 04:43:06 +0000
parents 328e8cf2fb02
children 7a05525e4197
files plugins/docklet/docklet.c
diffstat 1 files changed, 37 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/docklet/docklet.c	Fri Feb 03 04:26:27 2006 +0000
+++ b/plugins/docklet/docklet.c	Fri Feb 03 04:43:06 2006 +0000
@@ -392,6 +392,31 @@
 }
 
 static GtkWidget *
+new_menu_item_with_gaim_icon(GtkWidget *menu, const char *str, GaimStatusPrimitive primitive, GtkSignalFunc sf, gpointer data, guint accel_key, guint accel_mods, char *mod)
+{
+	GtkWidget *menuitem;
+	GdkPixbuf *pixbuf;
+	GtkWidget *image;
+
+	menuitem = gtk_image_menu_item_new_with_mnemonic(str);
+
+	if (menu)
+		gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
+
+	if (sf)
+		g_signal_connect(G_OBJECT(menuitem), "activate", sf, data);
+
+	pixbuf = gaim_gtk_create_gaim_icon_with_status(primitive, 0.5);
+	image = gtk_image_new_from_pixbuf(pixbuf);
+	g_object_unref(pixbuf);
+	gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(menuitem), image);
+
+	gtk_widget_show_all(menuitem);
+
+	return menuitem;
+}
+
+static GtkWidget *
 docklet_status_submenu()
 {
 	GtkWidget *submenu, *menuitem;
@@ -401,20 +426,20 @@
 	menuitem = gtk_menu_item_new_with_label(_("Change Status"));
 	gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), submenu);
 
-	gaim_new_item_from_stock(submenu, _("Available"),
-		GAIM_STOCK_ICON_AWAY, G_CALLBACK(activate_status_primitive_cb),
+	new_menu_item_with_gaim_icon(submenu, _("Available"),
+		GAIM_STATUS_AVAILABLE, G_CALLBACK(activate_status_primitive_cb),
 		GINT_TO_POINTER(GAIM_STATUS_AVAILABLE), 0, 0, NULL);
 
-	gaim_new_item_from_stock(submenu, _("Away"),
-		GAIM_STOCK_ICON_AWAY, G_CALLBACK(activate_status_primitive_cb),
+	new_menu_item_with_gaim_icon(submenu, _("Away"),
+		GAIM_STATUS_AWAY, G_CALLBACK(activate_status_primitive_cb),
 		GINT_TO_POINTER(GAIM_STATUS_AWAY), 0, 0, NULL);
 
-	gaim_new_item_from_stock(submenu, _("Invisible"),
-		GAIM_STOCK_ICON_AWAY, G_CALLBACK(activate_status_primitive_cb),
+	new_menu_item_with_gaim_icon(submenu, _("Invisible"),
+		GAIM_STATUS_INVISIBLE, G_CALLBACK(activate_status_primitive_cb),
 		GINT_TO_POINTER(GAIM_STATUS_INVISIBLE), 0, 0, NULL);
 
-	gaim_new_item_from_stock(submenu, _("Offline"),
-		GAIM_STOCK_ICON_AWAY, G_CALLBACK(activate_status_primitive_cb),
+	new_menu_item_with_gaim_icon(submenu, _("Offline"),
+		GAIM_STATUS_OFFLINE, G_CALLBACK(activate_status_primitive_cb),
 		GINT_TO_POINTER(GAIM_STATUS_OFFLINE), 0, 0, NULL);
 
 	popular_statuses = gaim_savedstatuses_get_popular(6);
@@ -424,17 +449,17 @@
 	{
 		GaimSavedStatus *saved_status = cur->data;
 		time_t creation_time = gaim_savedstatus_get_creation_time(saved_status);
-		gaim_new_item_from_stock(submenu,
+		new_menu_item_with_gaim_icon(submenu,
 			gaim_savedstatus_get_title(saved_status),
-			GAIM_STOCK_ICON_AWAY, G_CALLBACK(activate_saved_status_cb),
+			gaim_savedstatus_get_type(saved_status), G_CALLBACK(activate_saved_status_cb),
 			GINT_TO_POINTER(creation_time), 0, 0, NULL);
 	}
 	g_list_free(popular_statuses);
 
 	gaim_separator(submenu);
 
-	gaim_new_item_from_stock(submenu, _("New Status..."), GAIM_STOCK_ICON_AWAY, G_CALLBACK(show_custom_status_editor_cb), NULL, 0, 0, NULL);
-	gaim_new_item_from_stock(submenu, _("Saved Status..."), GAIM_STOCK_ICON_AWAY, G_CALLBACK(gaim_gtk_status_window_show), NULL, 0, 0, NULL);
+	new_menu_item_with_gaim_icon(submenu, _("New Status..."), GAIM_STATUS_AVAILABLE, G_CALLBACK(show_custom_status_editor_cb), NULL, 0, 0, NULL);
+	new_menu_item_with_gaim_icon(submenu, _("Saved Status..."), GAIM_STATUS_AVAILABLE, G_CALLBACK(gaim_gtk_status_window_show), NULL, 0, 0, NULL);
 
 	return menuitem;
 }