changeset 5160:91ea5ef2278b

[gaim-migrate @ 5524] 1) Added neat little protocol icons next to the set away message menu when you have more than one account signed on. I basically just copied Nathan's code, so it should be ok. 2) Changed the horizontal rules in the away message menu so they show up for me. This is how horizontal rules are done in other menus, I'm not sure why the away message menu was different. 3) Moved 2 gtkish functions from util.c to gtkutils.c. Earlier I used one of these functions, and then earlier, but not as early, I realized that gtkutils.c existed, so I put 2 and 2 together and realized you were probably flying somewhere. Well then, let's put another shrimp on the barbi'! committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Fri, 18 Apr 2003 02:28:06 +0000
parents 6b845e0cea87
children 777f56b95a92
files src/away.c src/gtkutils.c src/util.c
diffstat 3 files changed, 81 insertions(+), 81 deletions(-) [+]
line wrap: on
line diff
--- a/src/away.c	Fri Apr 18 02:09:32 2003 +0000
+++ b/src/away.c	Fri Apr 18 02:28:06 2003 +0000
@@ -342,7 +342,8 @@
 	GtkWidget *remmenu;
 	GtkWidget *submenu, *submenu2;
 	GtkWidget *remitem;
-	GtkWidget *sep;
+	GtkWidget *image;
+	GdkPixbuf *pixbuf, *scale;
 	GList *l;
 	GSList *awy = away_messages;
 	struct away_message *a;
@@ -401,13 +402,7 @@
 		gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), remmenu);
 		gtk_widget_show(remmenu);
 
-		sep = gtk_hseparator_new();
-		menuitem = gtk_menu_item_new();
-		gtk_menu_shell_append(GTK_MENU_SHELL(awaymenu), menuitem);
-		gtk_container_add(GTK_CONTAINER(menuitem), sep);
-		gtk_widget_set_sensitive(menuitem, FALSE);
-		gtk_widget_show(menuitem);
-		gtk_widget_show(sep);
+		gaim_separator(awaymenu);
 
 		while (con) {
 			gc = con->data;
@@ -494,9 +489,21 @@
 					continue;
 				}
 
+				pixbuf = create_prpl_icon(gc->account);
+				if (pixbuf) {
+					scale = gdk_pixbuf_scale_simple(pixbuf, 16, 16, GDK_INTERP_BILINEAR);
+					image = gtk_image_new_from_pixbuf(scale);
+					g_object_unref(G_OBJECT(pixbuf));
+					g_object_unref(G_OBJECT(scale));
+				} else {
+					image = gtk_image_new();
+				}
+				gtk_widget_show(image);
+
 				g_snprintf(buf, sizeof(buf), "%s (%s)",
 					   gc->username, gc->prpl->name);
-				menuitem = gtk_menu_item_new_with_label(buf);
+				menuitem = gtk_image_menu_item_new_with_label(buf);
+				gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(menuitem), image);
 				gtk_menu_shell_append(GTK_MENU_SHELL(awaymenu), menuitem);
 				gtk_widget_show(menuitem);
 
@@ -514,13 +521,7 @@
 					g_signal_connect(GTK_OBJECT(menuitem), "activate",
 							   G_CALLBACK(set_gc_away), gc);
 
-					sep = gtk_hseparator_new();
-					menuitem = gtk_menu_item_new();
-					gtk_menu_shell_append(GTK_MENU_SHELL(submenu), menuitem);
-					gtk_container_add(GTK_CONTAINER(menuitem), sep);
-					gtk_widget_set_sensitive(menuitem, FALSE);
-					gtk_widget_show(menuitem);
-					gtk_widget_show(sep);
+					gaim_separator(submenu);
 
 					awy = away_messages;
 
--- a/src/gtkutils.c	Fri Apr 18 02:09:32 2003 +0000
+++ b/src/gtkutils.c	Fri Apr 18 02:28:06 2003 +0000
@@ -401,3 +401,67 @@
 	gtk_widget_show(menuitem);
 	gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
 }
+
+GtkWidget *gaim_new_item_from_stock(GtkWidget *menu, const char *str, const char *icon, GtkSignalFunc sf, gpointer data, guint accel_key, guint accel_mods, char *mod)
+{
+	GtkWidget *menuitem;
+	/*
+	GtkWidget *hbox;
+	GtkWidget *label;
+	*/
+	GtkWidget *image;
+
+	if (icon == NULL)
+		menuitem = gtk_menu_item_new_with_mnemonic(str);
+	else
+		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(GTK_OBJECT(menuitem), "activate", sf, data);
+
+	if (icon != NULL) {
+		image = gtk_image_new_from_stock(icon, GTK_ICON_SIZE_MENU);
+		gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(menuitem), image);
+	}
+/* FIXME: this isn't right
+	if (mod) {
+		label = gtk_label_new(mod);
+		gtk_box_pack_end(GTK_BOX(hbox), label, FALSE, FALSE, 2);
+		gtk_widget_show(label);
+	}
+*/
+/*
+	if (accel_key) {
+		gtk_widget_add_accelerator(menuitem, "activate", accel, accel_key,
+					   accel_mods, GTK_ACCEL_LOCKED);
+	}
+*/
+
+	gtk_widget_show_all(menuitem);
+
+	return menuitem;
+}
+
+GtkWidget *gaim_new_item(GtkWidget *menu, const char *str)
+{
+	GtkWidget *menuitem;
+	GtkWidget *label;
+
+	menuitem = gtk_menu_item_new();
+	if (menu)
+		gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
+	gtk_widget_show(menuitem);
+
+	label = gtk_label_new(str);
+	gtk_label_set_pattern(GTK_LABEL(label), "_");
+	gtk_container_add(GTK_CONTAINER(menuitem), label);
+	gtk_widget_show(label);
+/* FIXME: Go back and fix this 
+	gtk_widget_add_accelerator(menuitem, "activate", accel, str[0],
+				   GDK_MOD1_MASK, GTK_ACCEL_LOCKED);
+*/
+	return menuitem;
+}
--- a/src/util.c	Fri Apr 18 02:09:32 2003 +0000
+++ b/src/util.c	Fri Apr 18 02:28:06 2003 +0000
@@ -45,7 +45,6 @@
 #include <math.h>
 #include "gaim.h"
 #include "prpl.h"
-#include "gtklist.h"
 
 #ifndef _WIN32
 #include <sys/socket.h>
@@ -1111,70 +1110,6 @@
 	return NULL;
 }
 
-GtkWidget *gaim_new_item_from_stock(GtkWidget *menu, const char *str, const char *icon, GtkSignalFunc sf, gpointer data, guint accel_key, guint accel_mods, char *mod)
-{
-	GtkWidget *menuitem;
-	/*
-	GtkWidget *hbox;
-	GtkWidget *label;
-	*/
-	GtkWidget *image;
-
-	if (icon == NULL)
-		menuitem = gtk_menu_item_new_with_mnemonic(str);
-	else
-		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(GTK_OBJECT(menuitem), "activate", sf, data);
-
-	if (icon != NULL) {
-		image = gtk_image_new_from_stock(icon, GTK_ICON_SIZE_MENU);
-		gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(menuitem), image);
-	}
-/* FIXME: this isn't right
-	if (mod) {
-		label = gtk_label_new(mod);
-		gtk_box_pack_end(GTK_BOX(hbox), label, FALSE, FALSE, 2);
-		gtk_widget_show(label);
-	}
-*/
-/*
-	if (accel_key) {
-		gtk_widget_add_accelerator(menuitem, "activate", accel, accel_key,
-					   accel_mods, GTK_ACCEL_LOCKED);
-	}
-*/
-
-	gtk_widget_show_all(menuitem);
-
-	return menuitem;
-}
-
-GtkWidget *gaim_new_item(GtkWidget *menu, const char *str)
-{
-	GtkWidget *menuitem;
-	GtkWidget *label;
-
-	menuitem = gtk_menu_item_new();
-	if (menu)
-		gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
-	gtk_widget_show(menuitem);
-
-	label = gtk_label_new(str);
-	gtk_label_set_pattern(GTK_LABEL(label), "_");
-	gtk_container_add(GTK_CONTAINER(menuitem), label);
-	gtk_widget_show(label);
-/* FIXME: Go back and fix this 
-	gtk_widget_add_accelerator(menuitem, "activate", accel, str[0],
-				   GDK_MOD1_MASK, GTK_ACCEL_LOCKED);
-*/
-	return menuitem;
-}
-
 char *gaim_try_conv_to_utf8(const char *str)
 {
 	int converted;