Mercurial > pidgin
diff gtk/gtkstatusbox.c @ 14636:2c09131fffa5
[gaim-migrate @ 17382]
Update the statusbox when a plugin changes the global buddyicon.
Make sure the iconboxes show up correctly if a plugin toggles them on/off.
committer: Tailor Script <tailor@pidgin.im>
author | Sadrul Habib Chowdhury <imadil@gmail.com> |
---|---|
date | Wed, 27 Sep 2006 02:29:03 +0000 |
parents | 26e7d03d40c5 |
children | f0646e3c1c05 |
line wrap: on
line diff
--- a/gtk/gtkstatusbox.c Wed Sep 27 02:07:06 2006 +0000 +++ b/gtk/gtkstatusbox.c Wed Sep 27 02:29:03 2006 +0000 @@ -298,6 +298,8 @@ if (status_box->icon_box != NULL) return; + status_box->icon = gtk_image_new(); + status_box->icon_box = gtk_event_box_new(); if (status_box->account && !gaim_account_get_ui_bool(status_box->account, GAIM_GTK_UI, "use-global-buddyicon", TRUE)) { @@ -309,8 +311,6 @@ { gtk_gaim_status_box_set_buddy_icon(status_box, gaim_prefs_get_string("/gaim/gtk/accounts/buddyicon")); } - status_box->icon = gtk_image_new(); - status_box->icon_box = gtk_event_box_new(); status_box->hand_cursor = gdk_cursor_new (GDK_HAND2); status_box->arrow_cursor = gdk_cursor_new (GDK_LEFT_PTR); @@ -352,6 +352,7 @@ g_free(statusbox->buddy_icon_path); + statusbox->icon = NULL; statusbox->icon_box = NULL; statusbox->buddy_icon_path = NULL; statusbox->buddy_icon = NULL; @@ -1087,7 +1088,7 @@ } static void -icon_choose_cb(const char *filename, gpointer data) +buddy_icon_set_cb(const char *filename, gpointer data) { GtkGaimStatusBox *box; @@ -1125,14 +1126,30 @@ } } gtk_gaim_status_box_set_buddy_icon(box, filename); - if (box->account == NULL) - gaim_prefs_set_string("/gaim/gtk/accounts/buddyicon", filename); } box->buddy_icon_sel = NULL; } static void +icon_choose_cb(const char *filename, gpointer data) +{ + GtkGaimStatusBox *box = data; + if (box->account == NULL) + /* The pref-connect callback does the actual work */ + gaim_prefs_set_string("/gaim/gtk/accounts/buddyicon", filename); + else + buddy_icon_set_cb(filename, data); +} + +static void +update_buddyicon_cb(const char *name, GaimPrefType type, + gconstpointer value, gpointer data) +{ + buddy_icon_set_cb(value, data); +} + +static void gtk_gaim_status_box_init (GtkGaimStatusBox *status_box) { GtkCellRenderer *text_rend; @@ -1234,6 +1251,8 @@ buddy_list_details_pref_changed_cb, status_box); gaim_prefs_connect_callback(status_box, "/gaim/gtk/conversations/spellcheck", spellcheck_prefs_cb, status_box); + gaim_prefs_connect_callback(status_box, "/gaim/gtk/accounts/buddyicon", + update_buddyicon_cb, status_box); } static void