changeset 5704:aa8dbb7e0a4d

[gaim-migrate @ 6125] The timestamps button in the debug toolbar is now set correctly on startup. committer: Tailor Script <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Tue, 03 Jun 2003 10:25:17 +0000
parents cee14870644c
children cd408d69ad2e
files src/gtkdebug.c
diffstat 1 files changed, 17 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/gtkdebug.c	Tue Jun 03 10:15:29 2003 +0000
+++ b/src/gtkdebug.c	Tue Jun 03 10:25:17 2003 +0000
@@ -34,6 +34,8 @@
 	gboolean timestamps;
 	gboolean paused;
 
+	guint timestamps_handle;
+
 } DebugWindow;
 
 static char debug_fg_colors[][8] = {
@@ -50,11 +52,14 @@
 static gint
 debug_window_destroy(GtkWidget *w, GdkEvent *event, void *unused)
 {
+	if (debug_win->timestamps_handle != 0)
+		gaim_prefs_disconnect_callback(debug_win->timestamps_handle);
+
+	gaim_prefs_set_bool("/gaim/gtk/debug/enabled", FALSE);
+
 	g_free(debug_win);
 	debug_win = NULL;
 
-	gaim_prefs_set_bool("/gaim/gtk/debug/enabled", FALSE);
-
 	return FALSE;
 }
 
@@ -89,6 +94,13 @@
 	gaim_prefs_set_bool("/gaim/gtk/debug/timestamps", win->timestamps);
 }
 
+static void
+timestamps_pref_cb(const char *name, GaimPrefType type, gpointer value,
+				   gpointer data)
+{
+	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(data), (gboolean)value);
+}
+
 static DebugWindow *
 debug_window_new(void)
 {
@@ -159,8 +171,9 @@
 											NULL, G_CALLBACK(__timestamps_cb),
 											win);
 
-		gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button),
-				gaim_prefs_get_bool("/gaim/gtk/debug/timestamps"));
+		win->timestamps_handle =
+			gaim_prefs_connect_callback("/gaim/gtk/debug/timestamps",
+										timestamps_pref_cb, button);
 	}
 
 	/* Now our scrolled window... */