comparison src/gtkdebug.c @ 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 b61520e71679
children ec032cb2f9ec
comparison
equal deleted inserted replaced
5703:cee14870644c 5704:aa8dbb7e0a4d
32 GtkWidget *text; 32 GtkWidget *text;
33 33
34 gboolean timestamps; 34 gboolean timestamps;
35 gboolean paused; 35 gboolean paused;
36 36
37 guint timestamps_handle;
38
37 } DebugWindow; 39 } DebugWindow;
38 40
39 static char debug_fg_colors[][8] = { 41 static char debug_fg_colors[][8] = {
40 "#000000", /**< All debug levels. */ 42 "#000000", /**< All debug levels. */
41 "#666666", /**< Blather. */ 43 "#666666", /**< Blather. */
48 static DebugWindow *debug_win = NULL; 50 static DebugWindow *debug_win = NULL;
49 51
50 static gint 52 static gint
51 debug_window_destroy(GtkWidget *w, GdkEvent *event, void *unused) 53 debug_window_destroy(GtkWidget *w, GdkEvent *event, void *unused)
52 { 54 {
55 if (debug_win->timestamps_handle != 0)
56 gaim_prefs_disconnect_callback(debug_win->timestamps_handle);
57
58 gaim_prefs_set_bool("/gaim/gtk/debug/enabled", FALSE);
59
53 g_free(debug_win); 60 g_free(debug_win);
54 debug_win = NULL; 61 debug_win = NULL;
55
56 gaim_prefs_set_bool("/gaim/gtk/debug/enabled", FALSE);
57 62
58 return FALSE; 63 return FALSE;
59 } 64 }
60 65
61 static gboolean 66 static gboolean
85 __timestamps_cb(GtkWidget *w, DebugWindow *win) 90 __timestamps_cb(GtkWidget *w, DebugWindow *win)
86 { 91 {
87 win->timestamps = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w)); 92 win->timestamps = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w));
88 93
89 gaim_prefs_set_bool("/gaim/gtk/debug/timestamps", win->timestamps); 94 gaim_prefs_set_bool("/gaim/gtk/debug/timestamps", win->timestamps);
95 }
96
97 static void
98 timestamps_pref_cb(const char *name, GaimPrefType type, gpointer value,
99 gpointer data)
100 {
101 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(data), (gboolean)value);
90 } 102 }
91 103
92 static DebugWindow * 104 static DebugWindow *
93 debug_window_new(void) 105 debug_window_new(void)
94 { 106 {
157 GTK_TOOLBAR_CHILD_TOGGLEBUTTON, 169 GTK_TOOLBAR_CHILD_TOGGLEBUTTON,
158 NULL, _("Timestamps"), NULL, NULL, 170 NULL, _("Timestamps"), NULL, NULL,
159 NULL, G_CALLBACK(__timestamps_cb), 171 NULL, G_CALLBACK(__timestamps_cb),
160 win); 172 win);
161 173
162 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), 174 win->timestamps_handle =
163 gaim_prefs_get_bool("/gaim/gtk/debug/timestamps")); 175 gaim_prefs_connect_callback("/gaim/gtk/debug/timestamps",
176 timestamps_pref_cb, button);
164 } 177 }
165 178
166 /* Now our scrolled window... */ 179 /* Now our scrolled window... */
167 sw = gtk_scrolled_window_new(NULL, NULL); 180 sw = gtk_scrolled_window_new(NULL, NULL);
168 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), 181 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw),