pidgin/gtkstatusbox.c

branch
soc.2013.gobjectification.plugins
changeset 36633
2dcb81a189bd
parent 36626
18fc361b3704
child 36637
9b0109ae118d
equal deleted inserted replaced
36632:1f0650e7b1b5 36633:2dcb81a189bd
492 492
493 switch (param_id) { 493 switch (param_id) {
494 case PROP_ICON_SEL: 494 case PROP_ICON_SEL:
495 if (g_value_get_boolean(value)) { 495 if (g_value_get_boolean(value)) {
496 if (statusbox->account) { 496 if (statusbox->account) {
497 PurpleBuddyIconSpec *icon_spec = NULL;
497 PurpleProtocol *protocol = 498 PurpleProtocol *protocol =
498 purple_protocols_find(purple_account_get_protocol_id(statusbox->account)); 499 purple_protocols_find(purple_account_get_protocol_id(statusbox->account));
499 if (protocol && purple_protocol_get_icon_spec(protocol).format != NULL) 500 if (protocol)
501 icon_spec = purple_protocol_get_icon_spec(protocol);
502 if (icon_spec && icon_spec->format != NULL)
500 setup_icon_box(statusbox); 503 setup_icon_box(statusbox);
501 } else { 504 } else {
502 setup_icon_box(statusbox); 505 setup_icon_box(statusbox);
503 } 506 }
504 } else { 507 } else {
1446 1449
1447 static void 1450 static void
1448 buddy_icon_set_cb(const char *filename, PidginStatusBox *box) 1451 buddy_icon_set_cb(const char *filename, PidginStatusBox *box)
1449 { 1452 {
1450 PurpleStoredImage *img = NULL; 1453 PurpleStoredImage *img = NULL;
1454 PurpleBuddyIconSpec *icon_spec = NULL;
1451 1455
1452 if (box->account) { 1456 if (box->account) {
1453 PurpleProtocol *protocol = 1457 PurpleProtocol *protocol =
1454 purple_protocols_find(purple_account_get_protocol_id(box->account)); 1458 purple_protocols_find(purple_account_get_protocol_id(box->account));
1455 if (protocol && purple_protocol_get_icon_spec(protocol).format) { 1459 if (protocol)
1460 icon_spec = purple_protocol_get_icon_spec(protocol);
1461 if (icon_spec && icon_spec->format) {
1456 gpointer data = NULL; 1462 gpointer data = NULL;
1457 size_t len = 0; 1463 size_t len = 0;
1458 if (filename) 1464 if (filename)
1459 data = pidgin_convert_buddy_icon(protocol, filename, &len); 1465 data = pidgin_convert_buddy_icon(protocol, filename, &len);
1460 img = purple_buddy_icons_set_account_icon(box->account, data, len); 1466 img = purple_buddy_icons_set_account_icon(box->account, data, len);
1473 GList *accounts; 1479 GList *accounts;
1474 for (accounts = purple_accounts_get_all(); accounts != NULL; accounts = accounts->next) { 1480 for (accounts = purple_accounts_get_all(); accounts != NULL; accounts = accounts->next) {
1475 PurpleAccount *account = accounts->data; 1481 PurpleAccount *account = accounts->data;
1476 PurpleProtocol *protocol = 1482 PurpleProtocol *protocol =
1477 purple_protocols_find(purple_account_get_protocol_id(account)); 1483 purple_protocols_find(purple_account_get_protocol_id(account));
1478 if (protocol != NULL && 1484 if (protocol)
1479 purple_account_get_bool(account, "use-global-buddyicon", TRUE) && 1485 icon_spec = purple_protocol_get_icon_spec(protocol);
1480 purple_protocol_get_icon_spec(protocol).format) { 1486 if (icon_spec && icon_spec->format &&
1487 purple_account_get_bool(account, "use-global-buddyicon", TRUE)) {
1481 gpointer data = NULL; 1488 gpointer data = NULL;
1482 size_t len = 0; 1489 size_t len = 0;
1483 if (filename) 1490 if (filename)
1484 data = pidgin_convert_buddy_icon(protocol, filename, &len); 1491 data = pidgin_convert_buddy_icon(protocol, filename, &len);
1485 purple_buddy_icons_set_account_icon(account, data, len); 1492 purple_buddy_icons_set_account_icon(account, data, len);

mercurial