Mercurial > pidgin
comparison finch/gntblist.c @ 32771:52fb2e955198
propagate from branch 'im.pidgin.pidgin.2.x.y' (head 6ee8e5cba5c96a1f2171038180b636724b258817)
to branch 'im.pidgin.pidgin' (head 92cc5e21737e6702460525c581295fdd26a2380f)
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Fri, 13 Apr 2012 07:39:04 +0000 |
parents | f5e193735392 |
children |
comparison
equal
deleted
inserted
replaced
32770:1e0ded0cb2ee | 32771:52fb2e955198 |
---|---|
48 #include "gntline.h" | 48 #include "gntline.h" |
49 #include "gntlog.h" | 49 #include "gntlog.h" |
50 #include "gntmenu.h" | 50 #include "gntmenu.h" |
51 #include "gntmenuitem.h" | 51 #include "gntmenuitem.h" |
52 #include "gntmenuitemcheck.h" | 52 #include "gntmenuitemcheck.h" |
53 #include "gntmenuutil.h" | |
53 #include "gntpounce.h" | 54 #include "gntpounce.h" |
54 #include "gntstyle.h" | 55 #include "gntstyle.h" |
55 #include "gnttree.h" | 56 #include "gnttree.h" |
56 #include "gntutils.h" | 57 #include "gntutils.h" |
57 #include "gntwindow.h" | 58 #include "gntwindow.h" |
167 { | 168 { |
168 gboolean offline = purple_prefs_get_bool(PREF_ROOT "/showoffline"); | 169 gboolean offline = purple_prefs_get_bool(PREF_ROOT "/showoffline"); |
169 | 170 |
170 if (PURPLE_BLIST_NODE_IS_BUDDY(node)) { | 171 if (PURPLE_BLIST_NODE_IS_BUDDY(node)) { |
171 PurpleBuddy *buddy = (PurpleBuddy*)node; | 172 PurpleBuddy *buddy = (PurpleBuddy*)node; |
172 FinchBlistNode *fnode = FINCH_GET_DATA(node); | 173 FinchBlistNode *fnode = purple_blist_node_get_ui_data(node); |
173 if (!purple_buddy_get_contact(buddy)) | 174 if (!purple_buddy_get_contact(buddy)) |
174 return FALSE; /* When a new buddy is added and show-offline is set */ | 175 return FALSE; /* When a new buddy is added and show-offline is set */ |
175 if (PURPLE_BUDDY_IS_ONLINE(buddy)) | 176 if (PURPLE_BUDDY_IS_ONLINE(buddy)) |
176 return TRUE; /* The buddy is online */ | 177 return TRUE; /* The buddy is online */ |
177 if (!purple_account_is_connected(purple_buddy_get_account(buddy))) | 178 if (!purple_account_is_connected(purple_buddy_get_account(buddy))) |
327 static GList *managers; | 328 static GList *managers; |
328 | 329 |
329 static FinchBlistNode * | 330 static FinchBlistNode * |
330 create_finch_blist_node(PurpleBlistNode *node, gpointer row) | 331 create_finch_blist_node(PurpleBlistNode *node, gpointer row) |
331 { | 332 { |
332 FinchBlistNode *fnode = FINCH_GET_DATA(node); | 333 FinchBlistNode *fnode = purple_blist_node_get_ui_data(node); |
333 if (!fnode) { | 334 if (!fnode) { |
334 fnode = g_new0(FinchBlistNode, 1); | 335 fnode = g_new0(FinchBlistNode, 1); |
335 fnode->signed_timer = 0; | 336 fnode->signed_timer = 0; |
336 FINCH_SET_DATA(node, fnode); | 337 purple_blist_node_set_ui_data(node, fnode); |
337 } | 338 } |
338 fnode->row = row; | 339 fnode->row = row; |
339 return fnode; | 340 return fnode; |
340 } | 341 } |
341 | 342 |
342 static void | 343 static void |
343 reset_blist_node_ui_data(PurpleBlistNode *node) | 344 reset_blist_node_ui_data(PurpleBlistNode *node) |
344 { | 345 { |
345 FinchBlistNode *fnode = FINCH_GET_DATA(node); | 346 FinchBlistNode *fnode = purple_blist_node_get_ui_data(node); |
346 if (fnode == NULL) | 347 if (fnode == NULL) |
347 return; | 348 return; |
348 if (fnode->signed_timer) | 349 if (fnode->signed_timer) |
349 purple_timeout_remove(fnode->signed_timer); | 350 purple_timeout_remove(fnode->signed_timer); |
350 g_free(fnode); | 351 g_free(fnode); |
351 FINCH_SET_DATA(node, NULL); | 352 purple_blist_node_set_ui_data(node, NULL); |
352 } | 353 } |
353 | 354 |
354 static int | 355 static int |
355 get_display_color(PurpleBlistNode *node) | 356 get_display_color(PurpleBlistNode *node) |
356 { | 357 { |
379 | 380 |
380 static GntTextFormatFlags | 381 static GntTextFormatFlags |
381 get_blist_node_flag(PurpleBlistNode *node) | 382 get_blist_node_flag(PurpleBlistNode *node) |
382 { | 383 { |
383 GntTextFormatFlags flag = 0; | 384 GntTextFormatFlags flag = 0; |
384 FinchBlistNode *fnode = FINCH_GET_DATA(node); | 385 FinchBlistNode *fnode = purple_blist_node_get_ui_data(node); |
385 | 386 |
386 if (ggblist->tagged && g_list_find(ggblist->tagged, node)) | 387 if (ggblist->tagged && g_list_find(ggblist->tagged, node)) |
387 flag |= GNT_TEXT_FLAG_BOLD; | 388 flag |= GNT_TEXT_FLAG_BOLD; |
388 | 389 |
389 if (fnode && fnode->signed_timer) | 390 if (fnode && fnode->signed_timer) |
390 flag |= GNT_TEXT_FLAG_BLINK; | 391 flag |= GNT_TEXT_FLAG_BLINK; |
391 else if (PURPLE_BLIST_NODE_IS_CONTACT(node)) { | 392 else if (PURPLE_BLIST_NODE_IS_CONTACT(node)) { |
392 node = PURPLE_BLIST_NODE(purple_contact_get_priority_buddy(PURPLE_CONTACT(node))); | 393 node = PURPLE_BLIST_NODE(purple_contact_get_priority_buddy(PURPLE_CONTACT(node))); |
393 fnode = FINCH_GET_DATA(node); | 394 fnode = purple_blist_node_get_ui_data(node); |
394 if (fnode && fnode->signed_timer) | 395 if (fnode && fnode->signed_timer) |
395 flag |= GNT_TEXT_FLAG_BLINK; | 396 flag |= GNT_TEXT_FLAG_BLINK; |
396 } else if (PURPLE_BLIST_NODE_IS_GROUP(node)) { | 397 } else if (PURPLE_BLIST_NODE_IS_GROUP(node)) { |
397 /* If the node is collapsed, then check to see if any of the priority buddies of | 398 /* If the node is collapsed, then check to see if any of the priority buddies of |
398 * any of the contacts within this group recently signed on/off, and set the blink | 399 * any of the contacts within this group recently signed on/off, and set the blink |
404 if (!gnt_tree_get_expanded(GNT_TREE(ggblist->tree), node)) { | 405 if (!gnt_tree_get_expanded(GNT_TREE(ggblist->tree), node)) { |
405 for (node = purple_blist_node_get_first_child(node); node; | 406 for (node = purple_blist_node_get_first_child(node); node; |
406 node = purple_blist_node_get_sibling_next(node)) { | 407 node = purple_blist_node_get_sibling_next(node)) { |
407 PurpleBlistNode *pnode; | 408 PurpleBlistNode *pnode; |
408 pnode = purple_contact_get_priority_buddy((PurpleContact*)node); | 409 pnode = purple_contact_get_priority_buddy((PurpleContact*)node); |
409 fnode = FINCH_GET_DATA(node); | 410 fnode = purple_blist_node_get_ui_data(node); |
410 if (fnode && fnode->signed_timer) { | 411 if (fnode && fnode->signed_timer) { |
411 flag |= GNT_TEXT_FLAG_BLINK; | 412 flag |= GNT_TEXT_FLAG_BLINK; |
412 break; | 413 break; |
413 } | 414 } |
414 } | 415 } |
431 is_contact_online(PurpleContact *contact) | 432 is_contact_online(PurpleContact *contact) |
432 { | 433 { |
433 PurpleBlistNode *node; | 434 PurpleBlistNode *node; |
434 for (node = purple_blist_node_get_first_child(((PurpleBlistNode*)contact)); node; | 435 for (node = purple_blist_node_get_first_child(((PurpleBlistNode*)contact)); node; |
435 node = purple_blist_node_get_sibling_next(node)) { | 436 node = purple_blist_node_get_sibling_next(node)) { |
436 FinchBlistNode *fnode = FINCH_GET_DATA(node); | 437 FinchBlistNode *fnode = purple_blist_node_get_ui_data(node); |
437 if (PURPLE_BUDDY_IS_ONLINE((PurpleBuddy*)node) || | 438 if (PURPLE_BUDDY_IS_ONLINE((PurpleBuddy*)node) || |
438 (fnode && fnode->signed_timer)) | 439 (fnode && fnode->signed_timer)) |
439 return TRUE; | 440 return TRUE; |
440 } | 441 } |
441 return FALSE; | 442 return FALSE; |
463 } | 464 } |
464 | 465 |
465 static void | 466 static void |
466 add_node(PurpleBlistNode *node, FinchBlist *ggblist) | 467 add_node(PurpleBlistNode *node, FinchBlist *ggblist) |
467 { | 468 { |
468 if (FINCH_GET_DATA(node)) | 469 if (purple_blist_node_get_ui_data(node)) |
469 return; | 470 return; |
470 | 471 |
471 if (!ggblist->manager->can_add_node(node)) | 472 if (!ggblist->manager->can_add_node(node)) |
472 return; | 473 return; |
473 | 474 |
500 node_remove(PurpleBuddyList *list, PurpleBlistNode *node) | 501 node_remove(PurpleBuddyList *list, PurpleBlistNode *node) |
501 { | 502 { |
502 FinchBlist *ggblist = FINCH_GET_DATA(list); | 503 FinchBlist *ggblist = FINCH_GET_DATA(list); |
503 PurpleBlistNode *parent; | 504 PurpleBlistNode *parent; |
504 | 505 |
505 if (ggblist == NULL || FINCH_GET_DATA(node) == NULL) | 506 if (ggblist == NULL || purple_blist_node_get_ui_data(node) == NULL) |
506 return; | 507 return; |
507 | 508 |
508 if (PURPLE_BLIST_NODE_IS_GROUP(node) && ggblist->new_group) { | 509 if (PURPLE_BLIST_NODE_IS_GROUP(node) && ggblist->new_group) { |
509 ggblist->new_group = g_list_remove(ggblist->new_group, node); | 510 ggblist->new_group = g_list_remove(ggblist->new_group, node); |
510 } | 511 } |
541 return; /* XXX: this is probably the place to auto-join chats */ | 542 return; /* XXX: this is probably the place to auto-join chats */ |
542 | 543 |
543 if (ggblist->window == NULL) | 544 if (ggblist->window == NULL) |
544 return; | 545 return; |
545 | 546 |
546 if (FINCH_GET_DATA(node)!= NULL) { | 547 if (purple_blist_node_get_ui_data(node)!= NULL) { |
547 gnt_tree_change_text(GNT_TREE(ggblist->tree), node, | 548 gnt_tree_change_text(GNT_TREE(ggblist->tree), node, |
548 0, get_display_name(node)); | 549 0, get_display_name(node)); |
549 gnt_tree_sort_row(GNT_TREE(ggblist->tree), node); | 550 gnt_tree_sort_row(GNT_TREE(ggblist->tree), node); |
550 blist_update_row_flags(node); | 551 blist_update_row_flags(node); |
551 if (gnt_tree_get_parent_key(GNT_TREE(ggblist->tree), node) != | 552 if (gnt_tree_get_parent_key(GNT_TREE(ggblist->tree), node) != |
558 add_node((PurpleBlistNode*)buddy, FINCH_GET_DATA(list)); | 559 add_node((PurpleBlistNode*)buddy, FINCH_GET_DATA(list)); |
559 node_update(list, purple_blist_node_get_parent(node)); | 560 node_update(list, purple_blist_node_get_parent(node)); |
560 } else if (PURPLE_BLIST_NODE_IS_CHAT(node)) { | 561 } else if (PURPLE_BLIST_NODE_IS_CHAT(node)) { |
561 add_node(node, FINCH_GET_DATA(list)); | 562 add_node(node, FINCH_GET_DATA(list)); |
562 } else if (PURPLE_BLIST_NODE_IS_CONTACT(node)) { | 563 } else if (PURPLE_BLIST_NODE_IS_CONTACT(node)) { |
563 if (FINCH_GET_DATA(node)== NULL) { | 564 if (purple_blist_node_get_ui_data(node)== NULL) { |
564 /* The core seems to expect the UI to add the buddies. */ | 565 /* The core seems to expect the UI to add the buddies. */ |
565 for (node = purple_blist_node_get_first_child(node); node; node = purple_blist_node_get_sibling_next(node)) | 566 for (node = purple_blist_node_get_first_child(node); node; node = purple_blist_node_get_sibling_next(node)) |
566 add_node(node, FINCH_GET_DATA(list)); | 567 add_node(node, FINCH_GET_DATA(list)); |
567 } | 568 } |
568 } else if (PURPLE_BLIST_NODE_IS_GROUP(node)) { | 569 } else if (PURPLE_BLIST_NODE_IS_GROUP(node)) { |
661 { | 662 { |
662 buddy = purple_buddy_new(account, username, alias); | 663 buddy = purple_buddy_new(account, username, alias); |
663 purple_blist_add_buddy(buddy, NULL, grp, NULL); | 664 purple_blist_add_buddy(buddy, NULL, grp, NULL); |
664 } | 665 } |
665 | 666 |
666 purple_account_add_buddy_with_invite(account, buddy, invite); | 667 purple_account_add_buddy(account, buddy, invite); |
667 } | 668 } |
668 | 669 |
669 static void | 670 static void |
670 finch_request_add_buddy(PurpleAccount *account, const char *username, const char *grp, const char *alias) | 671 finch_request_add_buddy(PurpleAccount *account, const char *username, const char *grp, const char *alias) |
671 { | 672 { |
837 ggblist->new_group_timeout = purple_timeout_add_seconds(SHOW_EMPTY_GROUP_TIMEOUT, | 838 ggblist->new_group_timeout = purple_timeout_add_seconds(SHOW_EMPTY_GROUP_TIMEOUT, |
838 remove_new_empty_group, NULL); | 839 remove_new_empty_group, NULL); |
839 | 840 |
840 /* Select the group */ | 841 /* Select the group */ |
841 if (ggblist->tree) { | 842 if (ggblist->tree) { |
842 FinchBlistNode *fnode = FINCH_GET_DATA((PurpleBlistNode*)grp); | 843 FinchBlistNode *fnode = purple_blist_node_get_ui_data((PurpleBlistNode*)grp); |
843 if (!fnode) | 844 if (!fnode) |
844 add_node((PurpleBlistNode*)grp, ggblist); | 845 add_node((PurpleBlistNode*)grp, ggblist); |
845 gnt_tree_set_selected(GNT_TREE(ggblist->tree), grp); | 846 gnt_tree_set_selected(GNT_TREE(ggblist->tree), grp); |
846 } | 847 } |
847 } | 848 } |
885 static void | 886 static void |
886 add_group(PurpleGroup *group, FinchBlist *ggblist) | 887 add_group(PurpleGroup *group, FinchBlist *ggblist) |
887 { | 888 { |
888 gpointer parent; | 889 gpointer parent; |
889 PurpleBlistNode *node = (PurpleBlistNode *)group; | 890 PurpleBlistNode *node = (PurpleBlistNode *)group; |
890 if (FINCH_GET_DATA(node)) | 891 if (purple_blist_node_get_ui_data(node)) |
891 return; | 892 return; |
892 parent = ggblist->manager->find_parent((PurpleBlistNode*)group); | 893 parent = ggblist->manager->find_parent((PurpleBlistNode*)group); |
893 create_finch_blist_node(node, gnt_tree_add_row_after(GNT_TREE(ggblist->tree), group, | 894 create_finch_blist_node(node, gnt_tree_add_row_after(GNT_TREE(ggblist->tree), group, |
894 gnt_tree_create_row(GNT_TREE(ggblist->tree), get_display_name(node)), | 895 gnt_tree_create_row(GNT_TREE(ggblist->tree), get_display_name(node)), |
895 parent, NULL)); | 896 parent, NULL)); |
958 static void | 959 static void |
959 add_chat(PurpleChat *chat, FinchBlist *ggblist) | 960 add_chat(PurpleChat *chat, FinchBlist *ggblist) |
960 { | 961 { |
961 gpointer parent; | 962 gpointer parent; |
962 PurpleBlistNode *node = (PurpleBlistNode *)chat; | 963 PurpleBlistNode *node = (PurpleBlistNode *)chat; |
963 if (FINCH_GET_DATA(node)) | 964 if (purple_blist_node_get_ui_data(node)) |
964 return; | 965 return; |
965 if (!purple_account_is_connected(purple_chat_get_account(chat))) | 966 if (!purple_account_is_connected(purple_chat_get_account(chat))) |
966 return; | 967 return; |
967 | 968 |
968 parent = ggblist->manager->find_parent((PurpleBlistNode*)chat); | 969 parent = ggblist->manager->find_parent((PurpleBlistNode*)chat); |
977 { | 978 { |
978 gpointer parent; | 979 gpointer parent; |
979 PurpleBlistNode *node = (PurpleBlistNode*)contact; | 980 PurpleBlistNode *node = (PurpleBlistNode*)contact; |
980 const char *name; | 981 const char *name; |
981 | 982 |
982 if (FINCH_GET_DATA(node)) | 983 if (purple_blist_node_get_ui_data(node)) |
983 return; | 984 return; |
984 | 985 |
985 name = get_display_name(node); | 986 name = get_display_name(node); |
986 if (name == NULL) | 987 if (name == NULL) |
987 return; | 988 return; |
1000 { | 1001 { |
1001 gpointer parent; | 1002 gpointer parent; |
1002 PurpleBlistNode *node = (PurpleBlistNode *)buddy; | 1003 PurpleBlistNode *node = (PurpleBlistNode *)buddy; |
1003 PurpleContact *contact; | 1004 PurpleContact *contact; |
1004 | 1005 |
1005 if (FINCH_GET_DATA(node)) | 1006 if (purple_blist_node_get_ui_data(node)) |
1006 return; | 1007 return; |
1007 | 1008 |
1008 contact = purple_buddy_get_contact(buddy); | 1009 contact = purple_buddy_get_contact(buddy); |
1009 parent = ggblist->manager->find_parent((PurpleBlistNode*)buddy); | 1010 parent = ggblist->manager->find_parent((PurpleBlistNode*)buddy); |
1010 | 1011 |
1058 if (!conv) { | 1059 if (!conv) { |
1059 conv = purple_conversation_new(PURPLE_CONV_TYPE_IM, | 1060 conv = purple_conversation_new(PURPLE_CONV_TYPE_IM, |
1060 purple_buddy_get_account(buddy), | 1061 purple_buddy_get_account(buddy), |
1061 purple_buddy_get_name(buddy)); | 1062 purple_buddy_get_name(buddy)); |
1062 } else { | 1063 } else { |
1063 FinchConv *ggconv = FINCH_GET_DATA(conv); | 1064 FinchConv *ggconv = FINCH_CONV(conv); |
1064 gnt_window_present(ggconv->window); | 1065 gnt_window_present(ggconv->window); |
1065 } | 1066 } |
1066 finch_conversation_set_active(conv); | 1067 finch_conversation_set_active(conv); |
1067 } | 1068 } |
1068 else if (PURPLE_BLIST_NODE_IS_CHAT(node)) | 1069 else if (PURPLE_BLIST_NODE_IS_CHAT(node)) |
1069 { | 1070 { |
1070 join_chat((PurpleChat*)node); | 1071 join_chat((PurpleChat*)node); |
1071 } | |
1072 } | |
1073 | |
1074 static void | |
1075 context_menu_callback(GntMenuItem *item, gpointer data) | |
1076 { | |
1077 PurpleMenuAction *action = data; | |
1078 PurpleBlistNode *node = ggblist->cnode; | |
1079 if (action) { | |
1080 void (*callback)(PurpleBlistNode *, gpointer); | |
1081 callback = (void (*)(PurpleBlistNode *, gpointer))action->callback; | |
1082 if (callback) | |
1083 callback(node, action->data); | |
1084 else | |
1085 return; | |
1086 } | |
1087 } | |
1088 | |
1089 static void | |
1090 gnt_append_menu_action(GntMenu *menu, PurpleMenuAction *action, gpointer parent) | |
1091 { | |
1092 GList *list; | |
1093 GntMenuItem *item; | |
1094 | |
1095 if (action == NULL) | |
1096 return; | |
1097 | |
1098 item = gnt_menuitem_new(action->label); | |
1099 if (action->callback) | |
1100 gnt_menuitem_set_callback(GNT_MENU_ITEM(item), context_menu_callback, action); | |
1101 gnt_menu_add_item(menu, GNT_MENU_ITEM(item)); | |
1102 | |
1103 if (action->children) { | |
1104 GntWidget *sub = gnt_menu_new(GNT_MENU_POPUP); | |
1105 gnt_menuitem_set_submenu(item, GNT_MENU(sub)); | |
1106 for (list = action->children; list; list = list->next) | |
1107 gnt_append_menu_action(GNT_MENU(sub), list->data, action); | |
1108 } | 1072 } |
1109 } | 1073 } |
1110 | 1074 |
1111 static void | 1075 static void |
1112 append_proto_menu(GntMenu *menu, PurpleConnection *gc, PurpleBlistNode *node) | 1076 append_proto_menu(GntMenu *menu, PurpleConnection *gc, PurpleBlistNode *node) |
1121 list = g_list_delete_link(list, list)) | 1085 list = g_list_delete_link(list, list)) |
1122 { | 1086 { |
1123 PurpleMenuAction *act = (PurpleMenuAction *) list->data; | 1087 PurpleMenuAction *act = (PurpleMenuAction *) list->data; |
1124 if (!act) | 1088 if (!act) |
1125 continue; | 1089 continue; |
1126 act->data = node; | 1090 purple_menu_action_set_data(act, node); |
1127 gnt_append_menu_action(menu, act, NULL); | 1091 gnt_append_menu_action(menu, act, node); |
1128 g_signal_connect_swapped(G_OBJECT(menu), "destroy", | |
1129 G_CALLBACK(purple_menu_action_free), act); | |
1130 } | 1092 } |
1131 } | 1093 } |
1132 | 1094 |
1133 static void | 1095 static void |
1134 add_custom_action(GntMenu *menu, const char *label, PurpleCallback callback, | 1096 add_custom_action(GntMenu *menu, const char *label, PurpleCallback callback, |
1135 gpointer data) | 1097 gpointer data) |
1136 { | 1098 { |
1137 PurpleMenuAction *action = purple_menu_action_new(label, callback, data, NULL); | 1099 PurpleMenuAction *action = purple_menu_action_new(label, callback, data, NULL); |
1138 gnt_append_menu_action(menu, action, NULL); | 1100 gnt_append_menu_action(menu, action, NULL); |
1139 g_signal_connect_swapped(G_OBJECT(menu), "destroy", | |
1140 G_CALLBACK(purple_menu_action_free), action); | |
1141 } | 1101 } |
1142 | 1102 |
1143 static void | 1103 static void |
1144 chat_components_edit_ok(PurpleChat *chat, PurpleRequestFields *allfields) | 1104 chat_components_edit_ok(PurpleChat *chat, PurpleRequestFields *allfields) |
1145 { | 1105 { |
1214 | 1174 |
1215 static void | 1175 static void |
1216 autojoin_toggled(GntMenuItem *item, gpointer data) | 1176 autojoin_toggled(GntMenuItem *item, gpointer data) |
1217 { | 1177 { |
1218 PurpleMenuAction *action = data; | 1178 PurpleMenuAction *action = data; |
1219 purple_blist_node_set_bool(action->data, "gnt-autojoin", | 1179 purple_blist_node_set_bool(purple_menu_action_get_data(action), "gnt-autojoin", |
1220 gnt_menuitem_check_get_checked(GNT_MENU_ITEM_CHECK(item))); | 1180 gnt_menuitem_check_get_checked(GNT_MENU_ITEM_CHECK(item))); |
1221 } | 1181 } |
1222 | 1182 |
1223 static void | 1183 static void |
1224 create_chat_menu(GntMenu *menu, PurpleChat *chat) | 1184 create_chat_menu(GntMenu *menu, PurpleChat *chat) |
1225 { | 1185 { |
1226 PurpleMenuAction *action = purple_menu_action_new(_("Auto-join"), NULL, chat, NULL); | 1186 PurpleMenuAction *action = purple_menu_action_new(_("Auto-join"), NULL, chat, NULL); |
1227 GntMenuItem *check = gnt_menuitem_check_new(action->label); | 1187 GntMenuItem *check = gnt_menuitem_check_new( |
1188 purple_menu_action_get_label(action)); | |
1228 gnt_menuitem_check_set_checked(GNT_MENU_ITEM_CHECK(check), | 1189 gnt_menuitem_check_set_checked(GNT_MENU_ITEM_CHECK(check), |
1229 purple_blist_node_get_bool((PurpleBlistNode*)chat, "gnt-autojoin")); | 1190 purple_blist_node_get_bool((PurpleBlistNode*)chat, "gnt-autojoin")); |
1230 gnt_menu_add_item(menu, check); | 1191 gnt_menu_add_item(menu, check); |
1231 gnt_menuitem_set_callback(check, autojoin_toggled, action); | 1192 gnt_menuitem_set_callback(check, autojoin_toggled, action); |
1232 g_signal_connect_swapped(G_OBJECT(menu), "destroy", | 1193 g_signal_connect_swapped(G_OBJECT(menu), "destroy", |
1266 | 1227 |
1267 gpointer finch_retrieve_user_info(PurpleConnection *conn, const char *name) | 1228 gpointer finch_retrieve_user_info(PurpleConnection *conn, const char *name) |
1268 { | 1229 { |
1269 PurpleNotifyUserInfo *info = purple_notify_user_info_new(); | 1230 PurpleNotifyUserInfo *info = purple_notify_user_info_new(); |
1270 gpointer uihandle; | 1231 gpointer uihandle; |
1271 purple_notify_user_info_add_pair(info, _("Information"), _("Retrieving...")); | 1232 purple_notify_user_info_add_pair_plaintext(info, _("Information"), _("Retrieving...")); |
1272 uihandle = purple_notify_userinfo(conn, name, info, NULL, NULL); | 1233 uihandle = purple_notify_userinfo(conn, name, info, NULL, NULL); |
1273 purple_notify_user_info_destroy(info); | 1234 purple_notify_user_info_destroy(info); |
1274 | 1235 |
1275 serv_get_info(conn, name); | 1236 serv_get_info(conn, name); |
1276 return uihandle; | 1237 return uihandle; |
1373 GList *iter; | 1334 GList *iter; |
1374 | 1335 |
1375 for (iter = purple_blist_node_get_extended_menu(node); | 1336 for (iter = purple_blist_node_get_extended_menu(node); |
1376 iter; iter = g_list_delete_link(iter, iter)) | 1337 iter; iter = g_list_delete_link(iter, iter)) |
1377 { | 1338 { |
1378 gnt_append_menu_action(menu, iter->data, NULL); | 1339 gnt_append_menu_action(menu, iter->data, node); |
1379 g_signal_connect_swapped(G_OBJECT(menu), "destroy", | |
1380 G_CALLBACK(purple_menu_action_free), iter->data); | |
1381 } | 1340 } |
1382 } | 1341 } |
1383 | 1342 |
1384 /* Xerox'd from gtkdialogs.c:purple_gtkdialogs_remove_contact_cb */ | 1343 /* Xerox'd from gtkdialogs.c:purple_gtkdialogs_remove_contact_cb */ |
1385 static void | 1344 static void |
1555 const char *name, *sec = NULL; | 1514 const char *name, *sec = NULL; |
1556 | 1515 |
1557 if (PURPLE_BLIST_NODE_IS_CONTACT(node)) { | 1516 if (PURPLE_BLIST_NODE_IS_CONTACT(node)) { |
1558 PurpleContact *c = (PurpleContact*)node; | 1517 PurpleContact *c = (PurpleContact*)node; |
1559 name = purple_contact_get_alias(c); | 1518 name = purple_contact_get_alias(c); |
1560 if (c->totalsize > 1) | 1519 if (purple_contact_get_contact_size(c, TRUE) > 1) |
1561 sec = _("Removing this contact will also remove all the buddies in the contact"); | 1520 sec = _("Removing this contact will also remove all the buddies in the contact"); |
1562 } else if (PURPLE_BLIST_NODE_IS_BUDDY(node)) { | 1521 } else if (PURPLE_BLIST_NODE_IS_BUDDY(node)) { |
1563 name = purple_buddy_get_name((PurpleBuddy*)node); | 1522 name = purple_buddy_get_name((PurpleBuddy*)node); |
1564 account = purple_buddy_get_account((PurpleBuddy*)node); | 1523 account = purple_buddy_get_account((PurpleBuddy*)node); |
1565 } else if (PURPLE_BLIST_NODE_IS_CHAT(node)) { | 1524 } else if (PURPLE_BLIST_NODE_IS_CHAT(node)) { |
1781 | 1740 |
1782 account = purple_buddy_get_account(buddy); | 1741 account = purple_buddy_get_account(buddy); |
1783 presence = purple_buddy_get_presence(buddy); | 1742 presence = purple_buddy_get_presence(buddy); |
1784 | 1743 |
1785 if (!full || g_utf8_collate(purple_buddy_get_name(buddy), alias)) { | 1744 if (!full || g_utf8_collate(purple_buddy_get_name(buddy), alias)) { |
1786 char *esc = g_markup_escape_text(alias, -1); | 1745 purple_notify_user_info_add_pair_plaintext(user_info, _("Nickname"), alias); |
1787 purple_notify_user_info_add_pair(user_info, _("Nickname"), esc); | |
1788 g_free(esc); | |
1789 } | 1746 } |
1790 | 1747 |
1791 tmp = g_strdup_printf("%s (%s)", | 1748 tmp = g_strdup_printf("%s (%s)", |
1792 purple_account_get_username(account), | 1749 purple_account_get_username(account), |
1793 purple_account_get_protocol_name(account)); | 1750 purple_account_get_protocol_name(account)); |
1794 purple_notify_user_info_add_pair(user_info, _("Account"), tmp); | 1751 purple_notify_user_info_add_pair_plaintext(user_info, _("Account"), tmp); |
1795 g_free(tmp); | 1752 g_free(tmp); |
1796 | 1753 |
1797 prpl = purple_find_prpl(purple_account_get_protocol_id(account)); | 1754 prpl = purple_find_prpl(purple_account_get_protocol_id(account)); |
1798 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); | 1755 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); |
1799 if (prpl_info && prpl_info->tooltip_text) { | 1756 if (prpl_info && prpl_info->tooltip_text) { |
1804 PurplePresence *pre = purple_buddy_get_presence(buddy); | 1761 PurplePresence *pre = purple_buddy_get_presence(buddy); |
1805 if (purple_presence_is_idle(pre)) { | 1762 if (purple_presence_is_idle(pre)) { |
1806 time_t idle = purple_presence_get_idle_time(pre); | 1763 time_t idle = purple_presence_get_idle_time(pre); |
1807 if (idle > 0) { | 1764 if (idle > 0) { |
1808 char *st = purple_str_seconds_to_string(time(NULL) - idle); | 1765 char *st = purple_str_seconds_to_string(time(NULL) - idle); |
1809 purple_notify_user_info_add_pair(user_info, _("Idle"), st); | 1766 purple_notify_user_info_add_pair_plaintext(user_info, _("Idle"), st); |
1810 g_free(st); | 1767 g_free(st); |
1811 } | 1768 } |
1812 } | 1769 } |
1813 } | 1770 } |
1814 | 1771 |
2541 | 2498 |
2542 static gboolean | 2499 static gboolean |
2543 buddy_recent_signed_on_off(gpointer data) | 2500 buddy_recent_signed_on_off(gpointer data) |
2544 { | 2501 { |
2545 PurpleBlistNode *node = data; | 2502 PurpleBlistNode *node = data; |
2546 FinchBlistNode *fnode = FINCH_GET_DATA(node); | 2503 FinchBlistNode *fnode = purple_blist_node_get_ui_data(node); |
2547 | 2504 |
2548 purple_timeout_remove(fnode->signed_timer); | 2505 purple_timeout_remove(fnode->signed_timer); |
2549 fnode->signed_timer = 0; | 2506 fnode->signed_timer = 0; |
2550 | 2507 |
2551 if (!ggblist->manager->can_add_node(node)) { | 2508 if (!ggblist->manager->can_add_node(node)) { |
2561 | 2518 |
2562 static gboolean | 2519 static gboolean |
2563 buddy_signed_on_off_cb(gpointer data) | 2520 buddy_signed_on_off_cb(gpointer data) |
2564 { | 2521 { |
2565 PurpleBlistNode *node = data; | 2522 PurpleBlistNode *node = data; |
2566 FinchBlistNode *fnode = FINCH_GET_DATA(node); | 2523 FinchBlistNode *fnode = purple_blist_node_get_ui_data(node); |
2567 if (!ggblist || !fnode) | 2524 if (!ggblist || !fnode) |
2568 return FALSE; | 2525 return FALSE; |
2569 | 2526 |
2570 if (fnode->signed_timer) | 2527 if (fnode->signed_timer) |
2571 purple_timeout_remove(fnode->signed_timer); | 2528 purple_timeout_remove(fnode->signed_timer); |