changeset 14861:dd2ef00759a7

[gaim-migrate @ 17630] Remember the size of the debug window, and remember the correct size of the conversation windows after resizing. committer: Tailor Script <tailor@pidgin.im>
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Mon, 30 Oct 2006 21:48:42 +0000
parents 50f5099daab1
children d6a98c79ef84
files console/gntconv.c console/gntdebug.c
diffstat 2 files changed, 26 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/console/gntconv.c	Mon Oct 30 05:27:31 2006 +0000
+++ b/console/gntconv.c	Mon Oct 30 21:48:42 2006 +0000
@@ -157,10 +157,12 @@
 }
 
 static void
-size_changed_cb(GntWidget *w, int width, int height)
+size_changed_cb(GntWidget *widget, int width, int height)
 {
-	gaim_prefs_set_int(PREF_ROOT "/size/width", width);
-	gaim_prefs_set_int(PREF_ROOT "/size/height", height);
+	int w, h;
+	gnt_widget_get_size(widget, &w, &h);
+	gaim_prefs_set_int(PREF_ROOT "/size/width", w);
+	gaim_prefs_set_int(PREF_ROOT "/size/height", h);
 }
 
 static void
--- a/console/gntdebug.c	Mon Oct 30 05:27:31 2006 +0000
+++ b/console/gntdebug.c	Mon Oct 30 21:48:42 2006 +0000
@@ -36,6 +36,8 @@
 #include <stdio.h>
 #include <string.h>
 
+#define PREF_ROOT "/gaim/gnt/debug"
+
 static struct
 {
 	GntWidget *window;
@@ -191,6 +193,15 @@
 	g_free(new_domain);
 }
 
+static void
+size_changed_cb(GntWidget *widget, int oldw, int oldh)
+{
+	int w, h;
+	gnt_widget_get_size(widget, &w, &h);
+	gaim_prefs_set_int(PREF_ROOT "/size/width", w);
+	gaim_prefs_set_int(PREF_ROOT "/size/height", h);
+}
+
 void gg_debug_window_show()
 {
 	debug.paused = FALSE;
@@ -206,6 +217,10 @@
 
 		debug.tview = gnt_text_view_new();
 		gnt_box_add_widget(GNT_BOX(debug.window), debug.tview);
+		gnt_widget_set_size(debug.tview,
+				gaim_prefs_get_int(PREF_ROOT "/size/width"),
+				gaim_prefs_get_int(PREF_ROOT "/size/height"));
+		g_signal_connect(G_OBJECT(debug.tview), "size_changed", G_CALLBACK(size_changed_cb), NULL);
 
 		gnt_box_add_widget(GNT_BOX(debug.window), gnt_line_new(FALSE));
 
@@ -268,6 +283,12 @@
 	REGISTER_G_LOG_HANDLER("GThread");
 
 	g_set_print_handler(print_stderr);   /* Redirect the debug messages to stderr */
+
+	gaim_prefs_add_none(PREF_ROOT);
+	gaim_prefs_add_none(PREF_ROOT "/size");
+	gaim_prefs_add_int(PREF_ROOT "/size/width", 60);
+	gaim_prefs_add_int(PREF_ROOT "/size/height", 15);
+
 	if (gaim_debug_is_enabled())
 		g_timeout_add(0, start_with_debugwin, NULL);
 }