changeset 3111:319a66fc131f

[gaim-migrate @ 3125] Now you can tell of which protocol you're editing buddies on. Thanks Christian Hammond. committer: Tailor Script <tailor@pidgin.im>
author Sean Egan <seanegan@gmail.com>
date Fri, 29 Mar 2002 13:28:55 +0000
parents 13e5dc68efbc
children 4c7f497070ba
files src/buddy.c src/gaim.h src/multi.c
diffstat 3 files changed, 44 insertions(+), 23 deletions(-) [+]
line wrap: on
line diff
--- a/src/buddy.c	Fri Mar 29 04:13:57 2002 +0000
+++ b/src/buddy.c	Fri Mar 29 13:28:55 2002 +0000
@@ -1161,7 +1161,36 @@
 	update_num_groups();
 }
 
-
+void
+create_prpl_icon(GtkWidget *widget, struct gaim_connection *gc,
+				 GdkPixmap **pixmap, GdkBitmap **mask)
+{
+    /* This whole thing is a hack--but it looks nice.
+     * Probably should have a prpl->icon(struct gaim_connection *) to
+     * do this. */
+	GtkStyle *style;
+	char **xpm = NULL; 
+
+	if (widget == NULL || gc == NULL || pixmap == NULL || mask == NULL)
+		return;
+	
+	style = gtk_widget_get_style( widget );
+	
+	if (gc->prpl->list_icon)
+		if (gc->prpl->protocol ==  PROTO_OSCAR) { 
+			if (isdigit(*gc->username)) {
+				xpm = gc->prpl->list_icon(0);
+			} else {
+				xpm = gc->prpl->list_icon(0x10);
+			}
+		} else { 
+			xpm = gc->prpl->list_icon (0);
+		}
+	if (xpm == NULL)
+		xpm = (char **)no_icon_xpm;
+	
+	*pixmap = gdk_pixmap_create_from_xpm_d(widget->window, mask, &style->bg[GTK_STATE_NORMAL], xpm);
+}
 
 void build_edit_tree()
 {
@@ -1185,10 +1214,18 @@
 		z = (struct gaim_connection *)con->data;
 
 		if (g_slist_length(connections) > 1) {
+			GdkPixmap *pixmap;
+			GdkBitmap *mask;
+
 			text[0] = z->username;
 
+			create_prpl_icon(blist, z, &pixmap, &mask);
+
 			c = gtk_ctree_insert_node(GTK_CTREE(edittree), NULL,
-						  NULL, text, 5, NULL, NULL, NULL, NULL, 0, 1);
+						  NULL, text, 3, pixmap, mask, pixmap, mask, 0, 1);
+
+			gdk_pixmap_unref (pixmap);
+			gdk_bitmap_unref (mask);
 
 			gtk_ctree_node_set_row_data(GTK_CTREE(edittree), c, z);
 		} else
@@ -1197,6 +1234,7 @@
 		grp = z->groups;
 
 		while (grp) {
+			
 			g = (struct group *)grp->data;
 
 			text[0] = g->name;
--- a/src/gaim.h	Fri Mar 29 04:13:57 2002 +0000
+++ b/src/gaim.h	Fri Mar 29 13:28:55 2002 +0000
@@ -326,6 +326,8 @@
 extern void do_quit();
 extern void signoff(struct gaim_connection *);
 extern void do_pounce(struct gaim_connection *, char *, int);
+void create_prpl_icon(GtkWidget *widget, struct gaim_connection *gc,
+					  GdkPixmap **pixmap, GdkBitmap **mask);
 
 /* Functions in buddy_chat.c */
 extern void show_new_buddy_chat(struct conversation *);
--- a/src/multi.c	Fri Mar 29 04:13:57 2002 +0000
+++ b/src/multi.c	Fri Mar 29 13:28:55 2002 +0000
@@ -1074,27 +1074,8 @@
 	GdkPixmap *gdkpixmap;
 	GdkBitmap *mask;
 	GtkWidget *pixmap;
-	GtkStyle *style;
-	char **xpm = NULL; 
-	
-	style = gtk_widget_get_style( widget );
-	
-	if (gc->prpl->list_icon)
-		if (gc->prpl->protocol ==  PROTO_OSCAR) { 
-			/* This is such a bad hack to get the right icon
-			 * for OSCAR.  But it's pretty */
-			if (isdigit(*gc->username)) {
-				xpm = gc->prpl->list_icon(0);
-			} else {
-				xpm = gc->prpl->list_icon(0x10);
-			}
-		} else { 
-			xpm = gc->prpl->list_icon (0);
-		}
-	if (xpm == NULL)
-		xpm = (char **)no_icon_xpm;
-	
-	gdkpixmap = gdk_pixmap_create_from_xpm_d(widget->window, &mask, &style->bg[GTK_STATE_NORMAL], xpm);
+
+	create_prpl_icon (widget, gc, &gdkpixmap, &mask);
 			
 	pixmap = gtk_pixmap_new (gdkpixmap, mask);
 	gdk_pixmap_unref (gdkpixmap);