# HG changeset patch # User Sean Egan # Date 1189838792 0 # Node ID 507e109387fd49d6abd8e9aab16bf212ebb363b8 # Parent 4fdf9c1212e20d5f8e21dc45d418162ea9b12b20 Move to menu in blist context menu. Used for more easily moving buddies between groups diff -r 4fdf9c1212e2 -r 507e109387fd ChangeLog --- a/ChangeLog Sat Sep 15 03:01:22 2007 +0000 +++ b/ChangeLog Sat Sep 15 06:46:32 2007 +0000 @@ -6,6 +6,7 @@ Pidgin: * When aliasing someone to an alias that already exists in the same group, offer to merge the buddies into the same contact + * 'Move to' submenu in Buddy List context menu Version 2.2.0 (09/13/2007): http://developer.pidgin.im/query?status=closed&milestone=2.2.0 diff -r 4fdf9c1212e2 -r 507e109387fd pidgin/gtkblist.c --- a/pidgin/gtkblist.c Sat Sep 15 03:01:22 2007 +0000 +++ b/pidgin/gtkblist.c Sat Sep 15 06:46:32 2007 +0000 @@ -306,6 +306,13 @@ serv_send_file(b->account->gc, b->name, NULL); } +static void gtk_blist_menu_move_to_cb(GtkWidget *w, PurpleBlistNode *node) +{ + PurpleBlistNode *group = g_object_get_data(w, "groupnode"); + purple_blist_add_contact(node, group, NULL); + +} + static void gtk_blist_menu_autojoin_cb(GtkWidget *w, PurpleChat *chat) { purple_blist_node_set_bool((PurpleBlistNode*)chat, "gtk-autojoin", @@ -1217,6 +1224,34 @@ g_list_free(ll); } + + +static void +pidgin_append_blist_node_move_to_menu(GtkWidget *menu, PurpleBlistNode *node) +{ + GtkWidget *submenu; + GtkWidget *menuitem; + PurpleBlistNode *group; + + menuitem = gtk_menu_item_new_with_label(_("Move to")); + gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); + gtk_widget_show(menuitem); + + submenu = gtk_menu_new(); + gtk_menu_item_set_submenu(menuitem, submenu); + + for (group = purple_blist_get_root(); group; group = group->next) { + if (group->type != PURPLE_BLIST_GROUP_NODE) + continue; + if (group == node->parent) + continue; + menuitem = pidgin_new_item_from_stock(submenu, purple_group_get_name(group), NULL, + G_CALLBACK(gtk_blist_menu_move_to_cb), node, 0, 0, NULL); + g_object_set_data(G_OBJECT(menuitem), "groupnode", group); + } + gtk_widget_show_all(submenu); +} + void pidgin_blist_make_buddy_menu(GtkWidget *menu, PurpleBuddy *buddy, gboolean sub) { PurplePluginProtocolInfo *prpl_info; @@ -1268,6 +1303,9 @@ (PurpleBlistNode *)buddy); pidgin_append_blist_node_extended_menu(menu, (PurpleBlistNode *)buddy); + if (!contact_expanded) + pidgin_append_blist_node_move_to_menu(menu, contact); + if (((PurpleBlistNode*)buddy)->parent && ((PurpleBlistNode*)buddy)->parent->child->next && !sub && !contact_expanded) { pidgin_separator(menu); @@ -1405,7 +1443,6 @@ node, 0, 0, NULL); pidgin_append_blist_node_extended_menu(menu, node); - return menu; }