Mercurial > pidgin.yaz
comparison src/gtkblist.c @ 9285:7a8aa87164ae
[gaim-migrate @ 10088]
Ok I'm done. This started out as shx's patch to make add/remove
buddy/buddies take GaimBuddy and GaimGroup's in various places.
I think his diff was like 2000 lines and mine is like 5000. I
tried to clean up blist.c a bit and make it more uniform. There
are some more g_return_if_fail() checks. Removed some code that
was deprecated--it's probably been long enough. Removed some
#include <multi.h>'s. Make blist.xml saving happen on a timer,
like prefs.xml and accounts.xml.
Sorry if this doesn't merge cleanly with whatever you're doing.
People should really test this a lot.
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Tue, 15 Jun 2004 02:37:27 +0000 |
parents | e8d86fd68552 |
children | af707cc1e229 |
comparison
equal
deleted
inserted
replaced
9284:fe0291162312 | 9285:7a8aa87164ae |
---|---|
530 | 530 |
531 static void gtk_blist_menu_autojoin_cb(GtkWidget *w, GaimChat *chat) | 531 static void gtk_blist_menu_autojoin_cb(GtkWidget *w, GaimChat *chat) |
532 { | 532 { |
533 gaim_blist_node_set_bool((GaimBlistNode*)chat, "gtk-autojoin", | 533 gaim_blist_node_set_bool((GaimBlistNode*)chat, "gtk-autojoin", |
534 gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(w))); | 534 gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(w))); |
535 | |
536 gaim_blist_save(); | |
537 } | 535 } |
538 | 536 |
539 static void gtk_blist_menu_join_cb(GtkWidget *w, GaimChat *chat) | 537 static void gtk_blist_menu_join_cb(GtkWidget *w, GaimChat *chat) |
540 { | 538 { |
541 serv_join_chat(chat->account->gc, chat->components); | 539 serv_join_chat(chat->account->gc, chat->components); |
901 | 899 |
902 node = g_value_get_pointer(&val); | 900 node = g_value_get_pointer(&val); |
903 | 901 |
904 if (GAIM_BLIST_NODE_IS_GROUP(node)) { | 902 if (GAIM_BLIST_NODE_IS_GROUP(node)) { |
905 gaim_blist_node_set_bool(node, "collapsed", FALSE); | 903 gaim_blist_node_set_bool(node, "collapsed", FALSE); |
906 gaim_blist_save(); | |
907 } | 904 } |
908 } | 905 } |
909 | 906 |
910 static void gtk_blist_row_collapsed_cb(GtkTreeView *tv, GtkTreeIter *iter, GtkTreePath *path, gpointer user_data) { | 907 static void gtk_blist_row_collapsed_cb(GtkTreeView *tv, GtkTreeIter *iter, GtkTreePath *path, gpointer user_data) { |
911 GaimBlistNode *node; | 908 GaimBlistNode *node; |
915 | 912 |
916 node = g_value_get_pointer(&val); | 913 node = g_value_get_pointer(&val); |
917 | 914 |
918 if (GAIM_BLIST_NODE_IS_GROUP(node)) { | 915 if (GAIM_BLIST_NODE_IS_GROUP(node)) { |
919 gaim_blist_node_set_bool(node, "collapsed", TRUE); | 916 gaim_blist_node_set_bool(node, "collapsed", TRUE); |
920 gaim_blist_save(); | |
921 } else if(GAIM_BLIST_NODE_IS_CONTACT(node)) { | 917 } else if(GAIM_BLIST_NODE_IS_CONTACT(node)) { |
922 gaim_gtk_blist_collapse_contact_cb(NULL, node); | 918 gaim_gtk_blist_collapse_contact_cb(NULL, node); |
923 } | 919 } |
924 } | 920 } |
925 | 921 |
1887 } | 1883 } |
1888 } | 1884 } |
1889 | 1885 |
1890 gtk_tree_path_free(path); | 1886 gtk_tree_path_free(path); |
1891 gtk_drag_finish(dc, TRUE, (dc->action == GDK_ACTION_MOVE), t); | 1887 gtk_drag_finish(dc, TRUE, (dc->action == GDK_ACTION_MOVE), t); |
1892 | |
1893 gaim_blist_save(); | |
1894 } | 1888 } |
1895 } | 1889 } |
1896 else if (sd->target == gdk_atom_intern("application/x-im-contact", | 1890 else if (sd->target == gdk_atom_intern("application/x-im-contact", |
1897 FALSE) && sd->data) | 1891 FALSE) && sd->data) |
1898 { | 1892 { |
2331 *********************************************************/ | 2325 *********************************************************/ |
2332 static void | 2326 static void |
2333 rename_group_cb(GaimGroup *g, const char *new_name) | 2327 rename_group_cb(GaimGroup *g, const char *new_name) |
2334 { | 2328 { |
2335 gaim_blist_rename_group(g, new_name); | 2329 gaim_blist_rename_group(g, new_name); |
2336 gaim_blist_save(); | 2330 } |
2337 } | 2331 |
2338 | 2332 /* |
2333 * Should disallow empty group names. | |
2334 */ | |
2339 static void | 2335 static void |
2340 show_rename_group(GtkWidget *unused, GaimGroup *g) | 2336 show_rename_group(GtkWidget *unused, GaimGroup *g) |
2341 { | 2337 { |
2342 gaim_request_input(NULL, _("Rename Group"), _("New group name"), | 2338 gaim_request_input(NULL, _("Rename Group"), _("New group name"), |
2343 _("Please enter a new name for the selected group."), | 2339 _("Please enter a new name for the selected group."), |
3862 gaim_blist_add_group(g, NULL); | 3858 gaim_blist_add_group(g, NULL); |
3863 } | 3859 } |
3864 | 3860 |
3865 b = gaim_buddy_new(data->account, who, whoalias); | 3861 b = gaim_buddy_new(data->account, who, whoalias); |
3866 gaim_blist_add_buddy(b, NULL, g, NULL); | 3862 gaim_blist_add_buddy(b, NULL, g, NULL); |
3867 serv_add_buddy(gaim_account_get_connection(data->account), who, g); | 3863 serv_add_buddy(gaim_account_get_connection(data->account), b); |
3868 | 3864 |
3869 /* | 3865 /* |
3866 * XXX | |
3870 * It really seems like it would be better if the call to serv_add_buddy() | 3867 * It really seems like it would be better if the call to serv_add_buddy() |
3871 * and gaim_conversation_update() were done in blist.c, possibly in the | 3868 * and gaim_conversation_update() were done in blist.c, possibly in the |
3872 * gaim_blist_add_buddy() function. Maybe serv_add_buddy() should be | 3869 * gaim_blist_add_buddy() function. Maybe serv_add_buddy() should be |
3873 * renamed to gaim_blist_add_new_buddy() or something, and have it call | 3870 * renamed to gaim_blist_add_new_buddy() or something, and have it call |
3874 * gaim_blist_add_buddy() after it creates it. --Mark | 3871 * gaim_blist_add_buddy() after it creates it. --Mark |
3872 * | |
3873 * No that's not good. blist.c should only deal with adding nodes to the | |
3874 * local list. We need a new, non-gtk file that calls both serv_add_buddy | |
3875 * and gaim_blist_add_buddy(). Or something. --Mark | |
3875 */ | 3876 */ |
3876 | 3877 |
3877 if (c != NULL) { | 3878 if (c != NULL) { |
3878 gaim_buddy_icon_update(gaim_conv_im_get_icon(GAIM_CONV_IM(c))); | 3879 gaim_buddy_icon_update(gaim_conv_im_get_icon(GAIM_CONV_IM(c))); |
3879 gaim_conversation_update(c, GAIM_CONV_UPDATE_ADD); | 3880 gaim_conversation_update(c, GAIM_CONV_UPDATE_ADD); |
3880 } | 3881 } |
3881 | |
3882 gaim_blist_save(); | |
3883 } | 3882 } |
3884 | 3883 |
3885 gtk_widget_destroy(data->window); | 3884 gtk_widget_destroy(data->window); |
3886 } | 3885 } |
3887 | 3886 |
4054 } | 4053 } |
4055 | 4054 |
4056 if (chat != NULL) | 4055 if (chat != NULL) |
4057 { | 4056 { |
4058 gaim_blist_add_chat(chat, group, NULL); | 4057 gaim_blist_add_chat(chat, group, NULL); |
4059 gaim_blist_save(); | |
4060 } | 4058 } |
4061 | 4059 |
4062 gtk_widget_destroy(data->window); | 4060 gtk_widget_destroy(data->window); |
4063 g_list_free(data->entries); | 4061 g_list_free(data->entries); |
4064 | 4062 |
4333 } | 4331 } |
4334 | 4332 |
4335 static void | 4333 static void |
4336 add_group_cb(GaimConnection *gc, const char *group_name) | 4334 add_group_cb(GaimConnection *gc, const char *group_name) |
4337 { | 4335 { |
4338 GaimGroup *g; | 4336 GaimGroup *group; |
4339 | 4337 |
4340 g = gaim_group_new(group_name); | 4338 group = gaim_group_new(group_name); |
4341 gaim_blist_add_group(g, NULL); | 4339 gaim_blist_add_group(group, NULL); |
4342 gaim_blist_save(); | |
4343 } | 4340 } |
4344 | 4341 |
4345 void | 4342 void |
4346 gaim_gtk_blist_request_add_group(void) | 4343 gaim_gtk_blist_request_add_group(void) |
4347 { | 4344 { |