comparison console/gntblist.c @ 14847:d478f3853671

[gaim-migrate @ 17616] Fix bug #1582629. The terminal should now always go back to normal state after quitting from gaim-text. committer: Tailor Script <tailor@pidgin.im>
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Sun, 29 Oct 2006 03:43:15 +0000
parents c7651586e27b
children 6d9db29f4c10
comparison
equal deleted inserted replaced
14846:c7651586e27b 14847:d478f3853671
99 static void draw_tooltip(GGBlist *ggblist); 99 static void draw_tooltip(GGBlist *ggblist);
100 static gboolean remove_typing_cb(gpointer null); 100 static gboolean remove_typing_cb(gpointer null);
101 static void remove_peripherals(GGBlist *ggblist); 101 static void remove_peripherals(GGBlist *ggblist);
102 static const char * get_display_name(GaimBlistNode *node); 102 static const char * get_display_name(GaimBlistNode *node);
103 static void savedstatus_changed(GaimSavedStatus *now, GaimSavedStatus *old); 103 static void savedstatus_changed(GaimSavedStatus *now, GaimSavedStatus *old);
104 static void blist_show(GaimBuddyList *list);
104 105
105 /* Sort functions */ 106 /* Sort functions */
106 static int blist_node_compare_text(GaimBlistNode *n1, GaimBlistNode *n2); 107 static int blist_node_compare_text(GaimBlistNode *n1, GaimBlistNode *n2);
107 static int blist_node_compare_status(GaimBlistNode *n1, GaimBlistNode *n2); 108 static int blist_node_compare_status(GaimBlistNode *n1, GaimBlistNode *n2);
108 static int blist_node_compare_log(GaimBlistNode *n1, GaimBlistNode *n2); 109 static int blist_node_compare_log(GaimBlistNode *n1, GaimBlistNode *n2);
226 } 227 }
227 228
228 static void 229 static void
229 new_list(GaimBuddyList *list) 230 new_list(GaimBuddyList *list)
230 { 231 {
232 if (ggblist)
233 return;
234
235 ggblist = g_new0(GGBlist, 1);
236 list->ui_data = ggblist;
231 } 237 }
232 238
233 static void 239 static void
234 add_buddy_cb(void *data, GaimRequestFields *allfields) 240 add_buddy_cb(void *data, GaimRequestFields *allfields)
235 { 241 {
396 402
397 static GaimBlistUiOps blist_ui_ops = 403 static GaimBlistUiOps blist_ui_ops =
398 { 404 {
399 new_list, 405 new_list,
400 new_node, 406 new_node,
401 NULL, 407 blist_show,
402 node_update, 408 node_update,
403 node_remove, 409 node_remove,
404 NULL, 410 NULL,
405 NULL, 411 NULL,
406 .request_add_buddy = gg_request_add_buddy, 412 .request_add_buddy = gg_request_add_buddy,
1468 gaim_prefs_add_int(PREF_ROOT "/position/y", 0); 1474 gaim_prefs_add_int(PREF_ROOT "/position/y", 0);
1469 gaim_prefs_add_bool(PREF_ROOT "/idletime", TRUE); 1475 gaim_prefs_add_bool(PREF_ROOT "/idletime", TRUE);
1470 gaim_prefs_add_bool(PREF_ROOT "/showoffline", FALSE); 1476 gaim_prefs_add_bool(PREF_ROOT "/showoffline", FALSE);
1471 gaim_prefs_add_string(PREF_ROOT "/sort_type", "text"); 1477 gaim_prefs_add_string(PREF_ROOT "/sort_type", "text");
1472 1478
1473 gg_blist_show();
1474
1475 gaim_prefs_connect_callback(gg_blist_get_handle(), 1479 gaim_prefs_connect_callback(gg_blist_get_handle(),
1476 PREF_ROOT "/showoffline", redraw_blist, NULL); 1480 PREF_ROOT "/showoffline", redraw_blist, NULL);
1477 gaim_prefs_connect_callback(gg_blist_get_handle(), 1481 gaim_prefs_connect_callback(gg_blist_get_handle(),
1478 PREF_ROOT "/sort_type", redraw_blist, NULL); 1482 PREF_ROOT "/sort_type", redraw_blist, NULL);
1479 1483
1849 gnt_menu_add_item(GNT_MENU(menu), item); 1853 gnt_menu_add_item(GNT_MENU(menu), item);
1850 } 1854 }
1851 1855
1852 void gg_blist_show() 1856 void gg_blist_show()
1853 { 1857 {
1854 if (ggblist) 1858 blist_show(gaim_get_blist());
1855 return; 1859 }
1856 1860
1857 ggblist = g_new0(GGBlist, 1); 1861 static void
1858 1862 blist_show(GaimBuddyList *list)
1859 gaim_get_blist()->ui_data = ggblist; 1863 {
1864 if (ggblist == NULL)
1865 new_list(list);
1866 else if (ggblist->window)
1867 return;
1860 1868
1861 ggblist->window = gnt_vwindow_new(FALSE); 1869 ggblist->window = gnt_vwindow_new(FALSE);
1862 gnt_widget_set_name(ggblist->window, "buddylist"); 1870 gnt_widget_set_name(ggblist->window, "buddylist");
1863 gnt_box_set_toplevel(GNT_BOX(ggblist->window), TRUE); 1871 gnt_box_set_toplevel(GNT_BOX(ggblist->window), TRUE);
1864 gnt_box_set_title(GNT_BOX(ggblist->window), _("Buddy List")); 1872 gnt_box_set_title(GNT_BOX(ggblist->window), _("Buddy List"));