Mercurial > pidgin.yaz
diff console/gntblist.c @ 14024:7109e6397a31
[gaim-migrate @ 16622]
Add commands /accounts, /buddylist, /debugwin and /plugins. It allows
the user to close those windows, and pop them back up when necessary --
provided a conversation window is open -- which I am assuming would be
the case most of the time. Until there's some better way of accessing
these dialogs (eg. menus), this is the only way.
committer: Tailor Script <tailor@pidgin.im>
author | Sadrul Habib Chowdhury <imadil@gmail.com> |
---|---|
date | Thu, 03 Aug 2006 07:16:35 +0000 |
parents | 13e7ba964993 |
children | 27182f83b79b |
line wrap: on
line diff
--- a/console/gntblist.c Wed Aug 02 23:52:45 2006 +0000 +++ b/console/gntblist.c Thu Aug 03 07:16:35 2006 +0000 @@ -66,7 +66,7 @@ { GGBlist *ggblist = list->ui_data; - if (node->ui_data == NULL) + if (ggblist == NULL || node->ui_data == NULL) return; gnt_tree_remove(GNT_TREE(ggblist->tree), node); @@ -85,6 +85,9 @@ static void node_update(GaimBuddyList *list, GaimBlistNode *node) { + if (list->ui_data == NULL) + return; + if (node->ui_data != NULL) { gnt_tree_change_text(GNT_TREE(ggblist->tree), node, @@ -744,6 +747,40 @@ gaim_prefs_set_int(PREF_ROOT "/position/y", y); } +static void +reset_blist_window(GntWidget *window, gpointer null) +{ + GaimBlistNode *node; + gaim_signals_disconnect_by_handle(gg_blist_get_handle()); + gaim_get_blist()->ui_data = NULL; + + node = gaim_blist_get_root(); + while (node) + { + node->ui_data = NULL; + node = gaim_blist_node_next(node, TRUE); + } + + remove_peripherals(ggblist); + g_free(ggblist); + ggblist = NULL; +} + +static void +populate_buddylist() +{ + GaimBlistNode *node; + GaimBuddyList *list; + + list = gaim_get_blist(); + node = gaim_blist_get_root(); + while (node) + { + node_update(list, node); + node = gaim_blist_node_next(node, TRUE); + } +} + void gg_blist_init() { gaim_prefs_add_none(PREF_ROOT); @@ -754,6 +791,16 @@ gaim_prefs_add_int(PREF_ROOT "/position/x", 0); gaim_prefs_add_int(PREF_ROOT "/position/y", 0); + gg_blist_show(); + + return; +} + +void gg_blist_show() +{ + if (ggblist) + return; + ggblist = g_new0(GGBlist, 1); gaim_get_blist()->ui_data = ggblist; @@ -805,11 +852,16 @@ ggblist, 0, G_CONNECT_AFTER | G_CONNECT_SWAPPED); g_signal_connect(G_OBJECT(ggblist->tree), "size_changed", G_CALLBACK(size_changed_cb), NULL); g_signal_connect(G_OBJECT(ggblist->window), "position_set", G_CALLBACK(save_position_cb), NULL); + g_signal_connect(G_OBJECT(ggblist->window), "destroy", G_CALLBACK(reset_blist_window), NULL); + populate_buddylist(); } void gg_blist_uninit() { + if (ggblist == NULL) + return; + gnt_widget_destroy(ggblist->window); g_free(ggblist); ggblist = NULL;