changeset 15020:af2debe897c8

[gaim-migrate @ 17802] Fix clearing buddy icon for per-account statusboxes. committer: Tailor Script <tailor@pidgin.im>
author Daniel Atallah <daniel.atallah@gmail.com>
date Tue, 21 Nov 2006 15:15:20 +0000
parents 70c199c9e558
children ab2847049049
files gtk/gtkstatusbox.c
diffstat 1 files changed, 17 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/gtk/gtkstatusbox.c	Tue Nov 21 05:34:42 2006 +0000
+++ b/gtk/gtkstatusbox.c	Tue Nov 21 15:15:20 2006 +0000
@@ -82,6 +82,7 @@
 
 static void do_colorshift (GdkPixbuf *dest, GdkPixbuf *src, int shift);
 static void icon_choose_cb(const char *filename, gpointer data);
+static void remove_buddy_icon_cb(GtkWidget *w, GtkGaimStatusBox *box);
 
 static void (*combo_box_size_request)(GtkWidget *widget, GtkRequisition *requisition);
 static void (*combo_box_size_allocate)(GtkWidget *widget, GtkAllocation *allocation);
@@ -230,16 +231,6 @@
 		status_menu_refresh_iter(status_box);
 }
 
-static void
-remove_buddy_icon_cb(GtkWidget *w, GtkGaimStatusBox *box)
-{
-	/* The pref-connect callback does the actual work */
-	gaim_prefs_set_string("/gaim/gtk/accounts/buddyicon", NULL);
-
-	gtk_widget_destroy(box->icon_box_menu);
-	box->icon_box_menu = NULL;
-}
-
 static gboolean
 icon_box_press_cb(GtkWidget *widget, GdkEventButton *event, GtkGaimStatusBox *box)
 {
@@ -1225,11 +1216,8 @@
 }
 
 static void
-buddy_icon_set_cb(const char *filename, gpointer data)
+buddy_icon_set_cb(const char *filename, GtkGaimStatusBox *box)
 {
-	GtkGaimStatusBox *box;
-
-	box = data;
 
 	if (box->account) {
 		GaimPlugin *plug = gaim_find_prpl(gaim_account_get_protocol_id(box->account));
@@ -1268,6 +1256,19 @@
 }
 
 static void
+remove_buddy_icon_cb(GtkWidget *w, GtkGaimStatusBox *box)
+{
+	if (box->account == NULL)
+		/* The pref-connect callback does the actual work */
+		gaim_prefs_set_string("/gaim/gtk/accounts/buddyicon", NULL);
+	else
+		buddy_icon_set_cb(NULL, box);
+
+	gtk_widget_destroy(box->icon_box_menu);
+	box->icon_box_menu = NULL;
+}
+
+static void
 icon_choose_cb(const char *filename, gpointer data)
 {
 	GtkGaimStatusBox *box = data;
@@ -1276,7 +1277,7 @@
 			/* The pref-connect callback does the actual work */
 			gaim_prefs_set_string("/gaim/gtk/accounts/buddyicon", filename);
 		else
-			buddy_icon_set_cb(filename, data);
+			buddy_icon_set_cb(filename, box);
 	}
 
 	box->buddy_icon_sel = NULL;
@@ -1286,7 +1287,7 @@
 update_buddyicon_cb(const char *name, GaimPrefType type,
 				    gconstpointer value, gpointer data)
 {
-	buddy_icon_set_cb(value, data);
+	buddy_icon_set_cb(value, (GtkGaimStatusBox*) data);
 }
 
 static void