changeset 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
files console/gntblist.c console/gntgaim.c console/gntui.c console/gntui.h console/libgnt/gntwidget.c console/libgnt/wms/s.c
diffstat 6 files changed, 32 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/console/gntblist.c	Sun Oct 29 01:32:04 2006 +0000
+++ b/console/gntblist.c	Sun Oct 29 03:43:15 2006 +0000
@@ -101,6 +101,7 @@
 static void remove_peripherals(GGBlist *ggblist);
 static const char * get_display_name(GaimBlistNode *node);
 static void savedstatus_changed(GaimSavedStatus *now, GaimSavedStatus *old);
+static void blist_show(GaimBuddyList *list);
 
 /* Sort functions */
 static int blist_node_compare_text(GaimBlistNode *n1, GaimBlistNode *n2);
@@ -228,6 +229,11 @@
 static void
 new_list(GaimBuddyList *list)
 {
+	if (ggblist)
+		return;
+
+	ggblist = g_new0(GGBlist, 1);
+	list->ui_data = ggblist;
 }
 
 static void
@@ -398,7 +404,7 @@
 {
 	new_list,
 	new_node,
-	NULL,
+	blist_show,
 	node_update,
 	node_remove,
 	NULL,
@@ -1470,8 +1476,6 @@
 	gaim_prefs_add_bool(PREF_ROOT "/showoffline", FALSE);
 	gaim_prefs_add_string(PREF_ROOT "/sort_type", "text");
 
-	gg_blist_show();
-
 	gaim_prefs_connect_callback(gg_blist_get_handle(),
 			PREF_ROOT "/showoffline", redraw_blist, NULL);
 	gaim_prefs_connect_callback(gg_blist_get_handle(),
@@ -1851,12 +1855,16 @@
 
 void gg_blist_show()
 {
-	if (ggblist)
-		return;
+	blist_show(gaim_get_blist());
+}
 
-	ggblist = g_new0(GGBlist, 1);
-
-	gaim_get_blist()->ui_data = ggblist;
+static void
+blist_show(GaimBuddyList *list)
+{
+	if (ggblist == NULL)
+		new_list(list);
+	else if (ggblist->window)
+		return;
 
 	ggblist->window = gnt_vwindow_new(FALSE);
 	gnt_widget_set_name(ggblist->window, "buddylist");
--- a/console/gntgaim.c	Sun Oct 29 01:32:04 2006 +0000
+++ b/console/gntgaim.c	Sun Oct 29 03:43:15 2006 +0000
@@ -57,8 +57,8 @@
 {
 	gg_prefs_init,
 	debug_init,
-	NULL, /*gaim_gtk_ui_init,*/
-	NULL, /*gaim_gtk_quit*/
+	gnt_ui_init,
+	gnt_ui_uninit
 };
 
 static GaimCoreUiOps *
@@ -332,8 +332,9 @@
 	if (!init_libgaim(argc, argv))
 		return 0;
 
-	/* Initialize and run the UI */
-	init_gnt_ui();
+	gaim_blist_show();
+	gnt_main();
+
 #ifdef STANDALONE
 	gaim_core_quit();
 #endif
--- a/console/gntui.c	Sun Oct 29 01:32:04 2006 +0000
+++ b/console/gntui.c	Sun Oct 29 03:43:15 2006 +0000
@@ -36,7 +36,7 @@
 
 #include <prefs.h>
 
-void init_gnt_ui()
+void gnt_ui_init()
 {
 #ifdef STANDALONE
 	gnt_init();
@@ -77,9 +77,10 @@
 #ifdef STANDALONE
 
 	gg_plugins_save_loaded();
+}
 
-	gnt_main();
-
+void gnt_ui_uninit()
+{
 	gaim_accounts_set_ui_ops(NULL);
 	gg_accounts_uninit();
 
--- a/console/gntui.h	Sun Oct 29 01:32:04 2006 +0000
+++ b/console/gntui.h	Sun Oct 29 03:43:15 2006 +0000
@@ -24,6 +24,7 @@
 
 #include "gnt.h"
 
-void init_gnt_ui(void);
+void gnt_ui_init(void);
+void gnt_ui_uninit(void);
 
 #endif
--- a/console/libgnt/gntwidget.c	Sun Oct 29 01:32:04 2006 +0000
+++ b/console/libgnt/gntwidget.c	Sun Oct 29 03:43:15 2006 +0000
@@ -581,6 +581,10 @@
 		width--;
 		height--;
 	}
+	if (width <= 0)
+		width = widget->priv.width;
+	if (height <= 0)
+		height = widget->priv.height;
 
 	if (GNT_WIDGET_IS_FLAG_SET(widget, GNT_WIDGET_MAPPED))
 	{
--- a/console/libgnt/wms/s.c	Sun Oct 29 01:32:04 2006 +0000
+++ b/console/libgnt/wms/s.c	Sun Oct 29 03:43:15 2006 +0000
@@ -76,7 +76,7 @@
 		gnt_widget_set_position(win, x, y);
 		mvwin(win->window, y, x);
 
-		gnt_widget_set_size(win, w, h);
+		gnt_widget_set_size(win, -1, h);
 		gnt_widget_draw(win);
 		envelope_buddylist(win);
 	} else if (name && strcmp(name, "conversation-window") == 0) {