changeset 17148:9a649a04fd74

When the /pidgin/debug/enabled pref is toggled, wait until the next iteration through the event loop before drawing or hiding the window. This fixes the bug where we lost the width and height prefs for the debug window because of the following sequence of event 1. Init gtkdebug window, set default width and height 2. Read in pref for /pidgin/debug/enabled and show debug window using default width and height 3. Read in pref for /pidgin/debug/width and height, but it's too late! The window has already been drawn using the default width and height! This is a pretty minor thing, but it was bugging me. I don't like having to always make the debug window bigger when I start Pidgin. The downside of this change is that we won't see as much debug output in the window when starting Pidgin.
author Mark Doliner <mark@kingant.net>
date Tue, 22 May 2007 07:08:57 +0000
parents 7175af86ec01
children 5033139b3ead
files pidgin/gtkdebug.c
diffstat 1 files changed, 18 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/pidgin/gtkdebug.c	Sun May 20 06:30:16 2007 +0000
+++ b/pidgin/gtkdebug.c	Tue May 22 07:08:57 2007 +0000
@@ -77,6 +77,7 @@
 };
 
 static DebugWindow *debug_win = NULL;
+static guint debug_enabled_timer = 0;
 
 #ifdef HAVE_REGEX_H
 static void regex_filter_all(DebugWindow *win);
@@ -864,14 +865,24 @@
 	return win;
 }
 
+static gboolean
+debug_enabled_timeout_cb(gpointer data)
+{
+	debug_enabled_timer = 0;
+
+	if (data)
+		pidgin_debug_window_show();
+	else
+		pidgin_debug_window_hide();
+
+	return FALSE;
+}
+
 static void
 debug_enabled_cb(const char *name, PurplePrefType type,
 				 gconstpointer value, gpointer data)
 {
-	if (value)
-		pidgin_debug_window_show();
-	else
-		pidgin_debug_window_hide();
+	debug_enabled_timer = g_timeout_add(0, debug_enabled_timeout_cb, GINT_TO_POINTER(GPOINTER_TO_INT(value)));
 }
 
 static void
@@ -984,6 +995,9 @@
 pidgin_debug_uninit(void)
 {
 	purple_debug_set_ui_ops(NULL);
+
+	if (debug_enabled_timer != 0)
+		g_source_remove(debug_enabled_timer);
 }
 
 void