comparison finch/gntblist.c @ 19171:9f7587b86b0d

propagate from branch 'tmpbranch' (head e6743aa2d424749cd40350df703d079ef61fd5ce) to branch 'im.pidgin.soc.2007.finchfeat' (head a87f346863ddc48e5705c2c555c7ed842325a9a3)
author Eric Polino <aluink@pidgin.im>
date Sun, 22 Jul 2007 01:28:19 +0000
parents 7a5025b8698c 980d6e1b2d21
children 069c036d9b72
comparison
equal deleted inserted replaced
19170:315fd66bb08f 19171:9f7587b86b0d
137 static gboolean 137 static gboolean
138 is_group_online(PurpleGroup *group) 138 is_group_online(PurpleGroup *group)
139 { 139 {
140 PurpleBlistNode *node; 140 PurpleBlistNode *node;
141 for (node = ((PurpleBlistNode*)group)->child; node; node = node->next) { 141 for (node = ((PurpleBlistNode*)group)->child; node; node = node->next) {
142 if (PURPLE_BLIST_NODE_IS_CHAT(node)) 142 if (PURPLE_BLIST_NODE_IS_CHAT(node) &&
143 purple_account_is_connected(((PurpleChat *)node)->account))
143 return TRUE; 144 return TRUE;
144 else if (is_contact_online((PurpleContact*)node)) 145 else if (is_contact_online((PurpleContact*)node))
145 return TRUE; 146 return TRUE;
146 } 147 }
147 return FALSE; 148 return FALSE;
676 PurpleBlistNode *node = ggblist->cnode; 677 PurpleBlistNode *node = ggblist->cnode;
677 if (action) { 678 if (action) {
678 void (*callback)(PurpleBlistNode *, gpointer); 679 void (*callback)(PurpleBlistNode *, gpointer);
679 callback = (void (*)(PurpleBlistNode *, gpointer))action->callback; 680 callback = (void (*)(PurpleBlistNode *, gpointer))action->callback;
680 if (callback) 681 if (callback)
681 callback(action->data, node); 682 callback(node, action->data);
682 else 683 else
683 return; 684 return;
684 } 685 }
685 } 686 }
686 687
756 } 757 }
757 } 758 }
758 } 759 }
759 760
760 static void 761 static void
761 chat_components_edit(PurpleChat *chat, PurpleBlistNode *selected) 762 chat_components_edit(PurpleBlistNode *selected, PurpleChat *chat)
762 { 763 {
763 PurpleRequestFields *fields = purple_request_fields_new(); 764 PurpleRequestFields *fields = purple_request_fields_new();
764 PurpleRequestFieldGroup *group = purple_request_field_group_new(NULL); 765 PurpleRequestFieldGroup *group = purple_request_field_group_new(NULL);
765 PurpleRequestField *field; 766 PurpleRequestField *field;
766 GList *parts, *iter; 767 GList *parts, *iter;
817 818
818 add_custom_action(menu, _("Edit Settings"), (PurpleCallback)chat_components_edit, chat); 819 add_custom_action(menu, _("Edit Settings"), (PurpleCallback)chat_components_edit, chat);
819 } 820 }
820 821
821 static void 822 static void
822 finch_add_buddy(PurpleGroup *grp, PurpleBlistNode *selected) 823 finch_add_buddy(PurpleBlistNode *selected, PurpleGroup *grp)
823 { 824 {
824 purple_blist_request_add_buddy(NULL, NULL, grp ? grp->name : NULL, NULL); 825 purple_blist_request_add_buddy(NULL, NULL, grp ? grp->name : NULL, NULL);
825 } 826 }
826 827
827 static void 828 static void
828 finch_add_group(PurpleGroup *grp, PurpleBlistNode *selected) 829 finch_add_group(PurpleBlistNode *selected, PurpleGroup *grp)
829 { 830 {
830 purple_blist_request_add_group(); 831 purple_blist_request_add_group();
831 } 832 }
832 833
833 static void 834 static void
834 finch_add_chat(PurpleGroup *grp, PurpleBlistNode *selected) 835 finch_add_chat(PurpleBlistNode *selected, PurpleGroup *grp)
835 { 836 {
836 purple_blist_request_add_chat(NULL, grp, NULL, NULL); 837 purple_blist_request_add_chat(NULL, grp, NULL, NULL);
837 } 838 }
838 839
839 static void 840 static void
858 serv_get_info(conn, name); 859 serv_get_info(conn, name);
859 return uihandle; 860 return uihandle;
860 } 861 }
861 862
862 static void 863 static void
863 finch_blist_get_buddy_info_cb(PurpleBuddy *buddy, PurpleBlistNode *selected) 864 finch_blist_get_buddy_info_cb(PurpleBlistNode *selected, PurpleBuddy *buddy)
864 { 865 {
865 finch_retrieve_user_info(buddy->account->gc, purple_buddy_get_name(buddy)); 866 finch_retrieve_user_info(buddy->account->gc, purple_buddy_get_name(buddy));
866 } 867 }
867 868
868 static void 869 static void
869 finch_blist_menu_send_file_cb(PurpleBuddy *buddy, PurpleBlistNode *selected) 870 finch_blist_menu_send_file_cb(PurpleBlistNode *selected, PurpleBuddy *buddy)
870 { 871 {
871 serv_send_file(buddy->account->gc, buddy->name, NULL); 872 serv_send_file(buddy->account->gc, buddy->name, NULL);
872 } 873 }
873 874
874 static void 875 static void
875 finch_blist_pounce_node_cb(PurpleBlistNode *node, PurpleBlistNode *selected) 876 finch_blist_pounce_node_cb(PurpleBlistNode *selected, PurpleBlistNode *node)
876 { 877 {
877 PurpleBuddy *b; 878 PurpleBuddy *b;
878 if (PURPLE_BLIST_NODE_IS_CONTACT(node)) 879 if (PURPLE_BLIST_NODE_IS_CONTACT(node))
879 b = purple_contact_get_priority_buddy((PurpleContact *)node); 880 b = purple_contact_get_priority_buddy((PurpleContact *)node);
880 else 881 else
968 else 969 else
969 g_return_if_reached(); 970 g_return_if_reached();
970 } 971 }
971 972
972 static void 973 static void
973 finch_blist_rename_node_cb(PurpleBlistNode *node, PurpleBlistNode *selected) 974 finch_blist_rename_node_cb(PurpleBlistNode *selected, PurpleBlistNode *node)
974 { 975 {
975 const char *name = NULL; 976 const char *name = NULL;
976 char *prompt; 977 char *prompt;
977 const char *text; 978 const char *text;
978 979
1053 remove_group((PurpleGroup*)node); 1054 remove_group((PurpleGroup*)node);
1054 } 1055 }
1055 } 1056 }
1056 1057
1057 static void 1058 static void
1058 finch_blist_remove_node_cb(PurpleBlistNode *node, PurpleBlistNode *selected) 1059 finch_blist_remove_node_cb(PurpleBlistNode *selected, PurpleBlistNode *node)
1059 { 1060 {
1060 PurpleAccount *account = NULL; 1061 PurpleAccount *account = NULL;
1061 char *primary; 1062 char *primary;
1062 const char *name, *sec = NULL; 1063 const char *name, *sec = NULL;
1063 1064
1207 1208
1208 ggblist->cnode = node; 1209 ggblist->cnode = node;
1209 1210
1210 ggblist->context = context = gnt_menu_new(GNT_MENU_POPUP); 1211 ggblist->context = context = gnt_menu_new(GNT_MENU_POPUP);
1211 g_signal_connect(G_OBJECT(context), "destroy", G_CALLBACK(context_menu_destroyed), ggblist); 1212 g_signal_connect(G_OBJECT(context), "destroy", G_CALLBACK(context_menu_destroyed), ggblist);
1213 g_signal_connect(G_OBJECT(context), "hide", G_CALLBACK(gnt_widget_destroy), NULL);
1212 1214
1213 if (!node) { 1215 if (!node) {
1214 create_group_menu(GNT_MENU(context), NULL); 1216 create_group_menu(GNT_MENU(context), NULL);
1215 title = g_strdup(_("Buddy List")); 1217 title = g_strdup(_("Buddy List"));
1216 } else if (PURPLE_BLIST_NODE_IS_CONTACT(node)) { 1218 } else if (PURPLE_BLIST_NODE_IS_CONTACT(node)) {
1217 create_buddy_menu(GNT_MENU(context), 1219 ggblist->cnode = (PurpleBlistNode*)purple_contact_get_priority_buddy((PurpleContact*)node);
1218 purple_contact_get_priority_buddy((PurpleContact*)node)); 1220 create_buddy_menu(GNT_MENU(context), (PurpleBuddy*)ggblist->cnode);
1219 title = g_strdup(purple_contact_get_alias((PurpleContact*)node)); 1221 title = g_strdup(purple_contact_get_alias((PurpleContact*)node));
1220 } else if (PURPLE_BLIST_NODE_IS_BUDDY(node)) { 1222 } else if (PURPLE_BLIST_NODE_IS_BUDDY(node)) {
1221 PurpleBuddy *buddy = (PurpleBuddy *)node; 1223 PurpleBuddy *buddy = (PurpleBuddy *)node;
1222 create_buddy_menu(GNT_MENU(context), buddy); 1224 create_buddy_menu(GNT_MENU(context), buddy);
1223 title = g_strdup(purple_buddy_get_name(buddy)); 1225 title = g_strdup(purple_buddy_get_name(buddy));
1492 /* Escape was pressed */ 1494 /* Escape was pressed */
1493 remove_peripherals(ggblist); 1495 remove_peripherals(ggblist);
1494 } else if (strcmp(text, GNT_KEY_CTRL_O) == 0) { 1496 } else if (strcmp(text, GNT_KEY_CTRL_O) == 0) {
1495 purple_prefs_set_bool(PREF_ROOT "/showoffline", 1497 purple_prefs_set_bool(PREF_ROOT "/showoffline",
1496 !purple_prefs_get_bool(PREF_ROOT "/showoffline")); 1498 !purple_prefs_get_bool(PREF_ROOT "/showoffline"));
1497 } else if (GNT_TREE(ggblist->tree)->search == NULL) { 1499 } else if (!gnt_tree_is_searching(GNT_TREE(ggblist->tree))) {
1498 if (strcmp(text, "t") == 0) { 1500 if (strcmp(text, "t") == 0) {
1499 finch_blist_toggle_tag_buddy(gnt_tree_get_selection_data(GNT_TREE(ggblist->tree))); 1501 finch_blist_toggle_tag_buddy(gnt_tree_get_selection_data(GNT_TREE(ggblist->tree)));
1500 gnt_bindable_perform_action_named(GNT_BINDABLE(ggblist->tree), "move-down"); 1502 gnt_bindable_perform_action_named(GNT_BINDABLE(ggblist->tree), "move-down");
1501 } else if (strcmp(text, "a") == 0) { 1503 } else if (strcmp(text, "a") == 0) {
1502 finch_blist_place_tagged(gnt_tree_get_selection_data(GNT_TREE(ggblist->tree))); 1504 finch_blist_place_tagged(gnt_tree_get_selection_data(GNT_TREE(ggblist->tree)));