Mercurial > pidgin
comparison gtk/gtkstatusbox.c @ 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 | 40364ce5d6e3 |
children | 97ae8709d6dc |
comparison
equal
deleted
inserted
replaced
15019:70c199c9e558 | 15020:af2debe897c8 |
---|---|
80 static void gtk_gaim_status_box_redisplay_buddy_icon(GtkGaimStatusBox *status_box); | 80 static void gtk_gaim_status_box_redisplay_buddy_icon(GtkGaimStatusBox *status_box); |
81 static void gtk_gaim_status_box_forall (GtkContainer *container, gboolean include_internals, GtkCallback callback, gpointer callback_data); | 81 static void gtk_gaim_status_box_forall (GtkContainer *container, gboolean include_internals, GtkCallback callback, gpointer callback_data); |
82 | 82 |
83 static void do_colorshift (GdkPixbuf *dest, GdkPixbuf *src, int shift); | 83 static void do_colorshift (GdkPixbuf *dest, GdkPixbuf *src, int shift); |
84 static void icon_choose_cb(const char *filename, gpointer data); | 84 static void icon_choose_cb(const char *filename, gpointer data); |
85 static void remove_buddy_icon_cb(GtkWidget *w, GtkGaimStatusBox *box); | |
85 | 86 |
86 static void (*combo_box_size_request)(GtkWidget *widget, GtkRequisition *requisition); | 87 static void (*combo_box_size_request)(GtkWidget *widget, GtkRequisition *requisition); |
87 static void (*combo_box_size_allocate)(GtkWidget *widget, GtkAllocation *allocation); | 88 static void (*combo_box_size_allocate)(GtkWidget *widget, GtkAllocation *allocation); |
88 static void (*combo_box_forall) (GtkContainer *container, gboolean include_internals, GtkCallback callback, gpointer callback_data); | 89 static void (*combo_box_forall) (GtkContainer *container, gboolean include_internals, GtkCallback callback, gpointer callback_data); |
89 | 90 |
226 { | 227 { |
227 if (status_box->account == account) | 228 if (status_box->account == account) |
228 update_to_reflect_account_status(status_box, account, newstatus); | 229 update_to_reflect_account_status(status_box, account, newstatus); |
229 else if (status_box->token_status_account == account) | 230 else if (status_box->token_status_account == account) |
230 status_menu_refresh_iter(status_box); | 231 status_menu_refresh_iter(status_box); |
231 } | |
232 | |
233 static void | |
234 remove_buddy_icon_cb(GtkWidget *w, GtkGaimStatusBox *box) | |
235 { | |
236 /* The pref-connect callback does the actual work */ | |
237 gaim_prefs_set_string("/gaim/gtk/accounts/buddyicon", NULL); | |
238 | |
239 gtk_widget_destroy(box->icon_box_menu); | |
240 box->icon_box_menu = NULL; | |
241 } | 232 } |
242 | 233 |
243 static gboolean | 234 static gboolean |
244 icon_box_press_cb(GtkWidget *widget, GdkEventButton *event, GtkGaimStatusBox *box) | 235 icon_box_press_cb(GtkWidget *widget, GdkEventButton *event, GtkGaimStatusBox *box) |
245 { | 236 { |
1223 gtk_combo_box_popup(GTK_COMBO_BOX(box)); | 1214 gtk_combo_box_popup(GTK_COMBO_BOX(box)); |
1224 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(box->toggle_button), FALSE); | 1215 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(box->toggle_button), FALSE); |
1225 } | 1216 } |
1226 | 1217 |
1227 static void | 1218 static void |
1228 buddy_icon_set_cb(const char *filename, gpointer data) | 1219 buddy_icon_set_cb(const char *filename, GtkGaimStatusBox *box) |
1229 { | 1220 { |
1230 GtkGaimStatusBox *box; | |
1231 | |
1232 box = data; | |
1233 | 1221 |
1234 if (box->account) { | 1222 if (box->account) { |
1235 GaimPlugin *plug = gaim_find_prpl(gaim_account_get_protocol_id(box->account)); | 1223 GaimPlugin *plug = gaim_find_prpl(gaim_account_get_protocol_id(box->account)); |
1236 if (plug) { | 1224 if (plug) { |
1237 GaimPluginProtocolInfo *prplinfo = GAIM_PLUGIN_PROTOCOL_INFO(plug); | 1225 GaimPluginProtocolInfo *prplinfo = GAIM_PLUGIN_PROTOCOL_INFO(plug); |
1266 } | 1254 } |
1267 gtk_gaim_status_box_set_buddy_icon(box, filename); | 1255 gtk_gaim_status_box_set_buddy_icon(box, filename); |
1268 } | 1256 } |
1269 | 1257 |
1270 static void | 1258 static void |
1259 remove_buddy_icon_cb(GtkWidget *w, GtkGaimStatusBox *box) | |
1260 { | |
1261 if (box->account == NULL) | |
1262 /* The pref-connect callback does the actual work */ | |
1263 gaim_prefs_set_string("/gaim/gtk/accounts/buddyicon", NULL); | |
1264 else | |
1265 buddy_icon_set_cb(NULL, box); | |
1266 | |
1267 gtk_widget_destroy(box->icon_box_menu); | |
1268 box->icon_box_menu = NULL; | |
1269 } | |
1270 | |
1271 static void | |
1271 icon_choose_cb(const char *filename, gpointer data) | 1272 icon_choose_cb(const char *filename, gpointer data) |
1272 { | 1273 { |
1273 GtkGaimStatusBox *box = data; | 1274 GtkGaimStatusBox *box = data; |
1274 if (filename) { | 1275 if (filename) { |
1275 if (box->account == NULL) | 1276 if (box->account == NULL) |
1276 /* The pref-connect callback does the actual work */ | 1277 /* The pref-connect callback does the actual work */ |
1277 gaim_prefs_set_string("/gaim/gtk/accounts/buddyicon", filename); | 1278 gaim_prefs_set_string("/gaim/gtk/accounts/buddyicon", filename); |
1278 else | 1279 else |
1279 buddy_icon_set_cb(filename, data); | 1280 buddy_icon_set_cb(filename, box); |
1280 } | 1281 } |
1281 | 1282 |
1282 box->buddy_icon_sel = NULL; | 1283 box->buddy_icon_sel = NULL; |
1283 } | 1284 } |
1284 | 1285 |
1285 static void | 1286 static void |
1286 update_buddyicon_cb(const char *name, GaimPrefType type, | 1287 update_buddyicon_cb(const char *name, GaimPrefType type, |
1287 gconstpointer value, gpointer data) | 1288 gconstpointer value, gpointer data) |
1288 { | 1289 { |
1289 buddy_icon_set_cb(value, data); | 1290 buddy_icon_set_cb(value, (GtkGaimStatusBox*) data); |
1290 } | 1291 } |
1291 | 1292 |
1292 static void | 1293 static void |
1293 gtk_gaim_status_box_init (GtkGaimStatusBox *status_box) | 1294 gtk_gaim_status_box_init (GtkGaimStatusBox *status_box) |
1294 { | 1295 { |