comparison 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
comparison
equal deleted inserted replaced
10086:6cd2b467e303 10087:9fdbfe832fac
45 GtkWidget *find; 45 GtkWidget *find;
46 46
47 gboolean timestamps; 47 gboolean timestamps;
48 gboolean paused; 48 gboolean paused;
49 49
50 guint timestamps_handle;
51
52 } DebugWindow; 50 } DebugWindow;
53 51
54 static char debug_fg_colors[][8] = { 52 static char debug_fg_colors[][8] = {
55 "#000000", /**< All debug levels. */ 53 "#000000", /**< All debug levels. */
56 "#666666", /**< Misc. */ 54 "#666666", /**< Misc. */
68 }; 66 };
69 67
70 static gint 68 static gint
71 debug_window_destroy(GtkWidget *w, GdkEvent *event, void *unused) 69 debug_window_destroy(GtkWidget *w, GdkEvent *event, void *unused)
72 { 70 {
73 if (debug_win->timestamps_handle != 0) 71 gaim_prefs_disconnect_by_handle(gaim_gtk_debug_get_handle());
74 gaim_prefs_disconnect_callback(debug_win->timestamps_handle);
75 72
76 /* If the "Save Log" dialog is open then close it */ 73 /* If the "Save Log" dialog is open then close it */
77 gaim_request_close_with_handle(debug_win); 74 gaim_request_close_with_handle(debug_win);
78 75
79 g_free(debug_win); 76 g_free(debug_win);
296 win); 293 win);
297 294
298 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), 295 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button),
299 gaim_prefs_get_bool("/gaim/gtk/debug/timestamps")); 296 gaim_prefs_get_bool("/gaim/gtk/debug/timestamps"));
300 297
301 win->timestamps_handle = 298 gaim_prefs_connect_callback(gaim_gtk_debug_get_handle(), "/gaim/gtk/debug/timestamps",
302 gaim_prefs_connect_callback("/gaim/gtk/debug/timestamps", 299 timestamps_pref_cb, button);
303 timestamps_pref_cb, button);
304 } 300 }
305 301
306 /* Now our scrolled window... */ 302 /* Now our scrolled window... */
307 sw = gtk_scrolled_window_new(NULL, NULL); 303 sw = gtk_scrolled_window_new(NULL, NULL);
308 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), 304 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw),
402 gaim_prefs_add_bool("/gaim/gtk/debug/timestamps", FALSE); 398 gaim_prefs_add_bool("/gaim/gtk/debug/timestamps", FALSE);
403 gaim_prefs_add_bool("/gaim/gtk/debug/toolbar", TRUE); 399 gaim_prefs_add_bool("/gaim/gtk/debug/toolbar", TRUE);
404 gaim_prefs_add_int("/gaim/gtk/debug/width", 450); 400 gaim_prefs_add_int("/gaim/gtk/debug/width", 450);
405 gaim_prefs_add_int("/gaim/gtk/debug/height", 250); 401 gaim_prefs_add_int("/gaim/gtk/debug/height", 250);
406 402
407 gaim_prefs_connect_callback("/gaim/gtk/debug/enabled", 403 gaim_prefs_connect_callback(NULL, "/gaim/gtk/debug/enabled",
408 debug_enabled_cb, NULL); 404 debug_enabled_cb, NULL);
409 405
410 #define REGISTER_G_LOG_HANDLER(name) \ 406 #define REGISTER_G_LOG_HANDLER(name) \
411 g_log_set_handler((name), G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL \ 407 g_log_set_handler((name), G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL \
412 | G_LOG_FLAG_RECURSION, \ 408 | G_LOG_FLAG_RECURSION, \
533 GaimDebugUiOps * 529 GaimDebugUiOps *
534 gaim_gtk_debug_get_ui_ops(void) 530 gaim_gtk_debug_get_ui_ops(void)
535 { 531 {
536 return &ops; 532 return &ops;
537 } 533 }
534
535 void *
536 gaim_gtk_debug_get_handle() {
537 static int handle;
538
539 return &handle;
540 }
541