comparison 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
comparison
equal deleted inserted replaced
14635:ba12c5e9d7e7 14636:2c09131fffa5
296 setup_icon_box(GtkGaimStatusBox *status_box) 296 setup_icon_box(GtkGaimStatusBox *status_box)
297 { 297 {
298 if (status_box->icon_box != NULL) 298 if (status_box->icon_box != NULL)
299 return; 299 return;
300 300
301 status_box->icon = gtk_image_new();
302 status_box->icon_box = gtk_event_box_new();
301 if (status_box->account && 303 if (status_box->account &&
302 !gaim_account_get_ui_bool(status_box->account, GAIM_GTK_UI, "use-global-buddyicon", TRUE)) 304 !gaim_account_get_ui_bool(status_box->account, GAIM_GTK_UI, "use-global-buddyicon", TRUE))
303 { 305 {
304 char *string = gaim_buddy_icons_get_full_path(gaim_account_get_buddy_icon(status_box->account)); 306 char *string = gaim_buddy_icons_get_full_path(gaim_account_get_buddy_icon(status_box->account));
305 gtk_gaim_status_box_set_buddy_icon(status_box, string); 307 gtk_gaim_status_box_set_buddy_icon(status_box, string);
307 } 309 }
308 else 310 else
309 { 311 {
310 gtk_gaim_status_box_set_buddy_icon(status_box, gaim_prefs_get_string("/gaim/gtk/accounts/buddyicon")); 312 gtk_gaim_status_box_set_buddy_icon(status_box, gaim_prefs_get_string("/gaim/gtk/accounts/buddyicon"));
311 } 313 }
312 status_box->icon = gtk_image_new();
313 status_box->icon_box = gtk_event_box_new();
314 314
315 status_box->hand_cursor = gdk_cursor_new (GDK_HAND2); 315 status_box->hand_cursor = gdk_cursor_new (GDK_HAND2);
316 status_box->arrow_cursor = gdk_cursor_new (GDK_LEFT_PTR); 316 status_box->arrow_cursor = gdk_cursor_new (GDK_LEFT_PTR);
317 317
318 /* Set up DND */ 318 /* Set up DND */
350 if (statusbox->buddy_icon_sel) 350 if (statusbox->buddy_icon_sel)
351 gtk_widget_destroy(statusbox->buddy_icon_sel); 351 gtk_widget_destroy(statusbox->buddy_icon_sel);
352 352
353 g_free(statusbox->buddy_icon_path); 353 g_free(statusbox->buddy_icon_path);
354 354
355 statusbox->icon = NULL;
355 statusbox->icon_box = NULL; 356 statusbox->icon_box = NULL;
356 statusbox->buddy_icon_path = NULL; 357 statusbox->buddy_icon_path = NULL;
357 statusbox->buddy_icon = NULL; 358 statusbox->buddy_icon = NULL;
358 statusbox->buddy_icon_hover = NULL; 359 statusbox->buddy_icon_hover = NULL;
359 statusbox->hand_cursor = NULL; 360 statusbox->hand_cursor = NULL;
1085 gtk_combo_box_popup(GTK_COMBO_BOX(box)); 1086 gtk_combo_box_popup(GTK_COMBO_BOX(box));
1086 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(box->toggle_button), FALSE); 1087 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(box->toggle_button), FALSE);
1087 } 1088 }
1088 1089
1089 static void 1090 static void
1090 icon_choose_cb(const char *filename, gpointer data) 1091 buddy_icon_set_cb(const char *filename, gpointer data)
1091 { 1092 {
1092 GtkGaimStatusBox *box; 1093 GtkGaimStatusBox *box;
1093 1094
1094 box = data; 1095 box = data;
1095 1096
1123 } 1124 }
1124 } 1125 }
1125 } 1126 }
1126 } 1127 }
1127 gtk_gaim_status_box_set_buddy_icon(box, filename); 1128 gtk_gaim_status_box_set_buddy_icon(box, filename);
1128 if (box->account == NULL)
1129 gaim_prefs_set_string("/gaim/gtk/accounts/buddyicon", filename);
1130 } 1129 }
1131 1130
1132 box->buddy_icon_sel = NULL; 1131 box->buddy_icon_sel = NULL;
1132 }
1133
1134 static void
1135 icon_choose_cb(const char *filename, gpointer data)
1136 {
1137 GtkGaimStatusBox *box = data;
1138 if (box->account == NULL)
1139 /* The pref-connect callback does the actual work */
1140 gaim_prefs_set_string("/gaim/gtk/accounts/buddyicon", filename);
1141 else
1142 buddy_icon_set_cb(filename, data);
1143 }
1144
1145 static void
1146 update_buddyicon_cb(const char *name, GaimPrefType type,
1147 gconstpointer value, gpointer data)
1148 {
1149 buddy_icon_set_cb(value, data);
1133 } 1150 }
1134 1151
1135 static void 1152 static void
1136 gtk_gaim_status_box_init (GtkGaimStatusBox *status_box) 1153 gtk_gaim_status_box_init (GtkGaimStatusBox *status_box)
1137 { 1154 {
1232 status_box); 1249 status_box);
1233 gaim_prefs_connect_callback(status_box, "/gaim/gtk/blist/show_buddy_icons", 1250 gaim_prefs_connect_callback(status_box, "/gaim/gtk/blist/show_buddy_icons",
1234 buddy_list_details_pref_changed_cb, status_box); 1251 buddy_list_details_pref_changed_cb, status_box);
1235 gaim_prefs_connect_callback(status_box, "/gaim/gtk/conversations/spellcheck", 1252 gaim_prefs_connect_callback(status_box, "/gaim/gtk/conversations/spellcheck",
1236 spellcheck_prefs_cb, status_box); 1253 spellcheck_prefs_cb, status_box);
1254 gaim_prefs_connect_callback(status_box, "/gaim/gtk/accounts/buddyicon",
1255 update_buddyicon_cb, status_box);
1237 } 1256 }
1238 1257
1239 static void 1258 static void
1240 gtk_gaim_status_box_size_request(GtkWidget *widget, 1259 gtk_gaim_status_box_size_request(GtkWidget *widget,
1241 GtkRequisition *requisition) 1260 GtkRequisition *requisition)