diff src/gtkdebug.c @ 10087:9fdbfe832fac

[gaim-migrate @ 11098] gaim_prefs_connect_callback() now takes a handle that can be used to disconnect the callbacks later on. The callback id's remain, so people can still use those if they want, although I'm not sure if there's any need for them any more. I also switched the order for initializing the prefs subsystem and statically compiled protocol plugins so that prpl prefs can work for statically compiled prpls. committer: Tailor Script <tailor@pidgin.im>
author Stu Tomlinson <stu@nosnilmot.com>
date Tue, 12 Oct 2004 00:49:19 +0000
parents 4a15962c344a
children 53410b84336f
line wrap: on
line diff
--- a/src/gtkdebug.c	Sun Oct 10 16:47:56 2004 +0000
+++ b/src/gtkdebug.c	Tue Oct 12 00:49:19 2004 +0000
@@ -47,8 +47,6 @@
 	gboolean timestamps;
 	gboolean paused;
 
-	guint timestamps_handle;
-
 } DebugWindow;
 
 static char debug_fg_colors[][8] = {
@@ -70,8 +68,7 @@
 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_disconnect_by_handle(gaim_gtk_debug_get_handle());
 
 	/* If the "Save Log" dialog is open then close it */
 	gaim_request_close_with_handle(debug_win);
@@ -298,9 +295,8 @@
 		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);
+		gaim_prefs_connect_callback(gaim_gtk_debug_get_handle(), "/gaim/gtk/debug/timestamps",
+									timestamps_pref_cb, button);
 	}
 
 	/* Now our scrolled window... */
@@ -404,7 +400,7 @@
 	gaim_prefs_add_int("/gaim/gtk/debug/width",  450);
 	gaim_prefs_add_int("/gaim/gtk/debug/height", 250);
 
-	gaim_prefs_connect_callback("/gaim/gtk/debug/enabled",
+	gaim_prefs_connect_callback(NULL, "/gaim/gtk/debug/enabled",
 								debug_enabled_cb, NULL);
 
 #define REGISTER_G_LOG_HANDLER(name) \
@@ -535,3 +531,11 @@
 {
 	return &ops;
 }
+
+void *
+gaim_gtk_debug_get_handle() {
+	static int handle;
+
+	return &handle;
+}
+