2007-08-18 [colin] 2.10.0cvs130
[claws.git] / src / prefs_logging.c
1 /*
2  * Claws Mail -- a GTK+ based, lightweight, and fast e-mail client
3  * Copyright (C) 1999-2007 Tristan Chabredier <wwp@claws-mail.org> and 
4  * the Claws Mail team
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program. If not, see <http://www.gnu.org/licenses/>.
18  * 
19  */
20
21 #ifdef HAVE_CONFIG_H
22 #  include "config.h"
23 #endif
24
25 #include "defs.h"
26
27 #include <stdio.h>
28 #include <stdlib.h>
29
30 #include <glib.h>
31 #include <glib/gi18n.h>
32 #include <gtk/gtk.h>
33
34 #include "prefs_common.h"
35 #include "prefs_gtk.h"
36
37 #include "gtk/gtkutils.h"
38 #include "gtk/prefswindow.h"
39 #include "gtk/menu.h"
40
41 #include "manage_window.h"
42
43 #include "log.h"
44 #include "combobox.h"
45
46 typedef struct _LoggingPage
47 {
48         PrefsPage page;
49
50         GtkWidget *window;
51
52         GtkWidget *checkbtn_clip_network_log;
53         GtkWidget *spinbtn_network_log_length;
54         GtkWidget *checkbtn_log_standard;
55         GtkWidget *checkbtn_log_warning;
56         GtkWidget *checkbtn_log_error;
57         GtkWidget *checkbtn_log_status;
58         GtkWidget *checkbtn_clip_filtering_log;
59         GtkWidget *spinbtn_filtering_log_length;
60         GtkWidget *checkbtn_filtering_log;
61         GtkWidget *checkbtn_filtering_log_inc;
62         GtkWidget *checkbtn_filtering_log_manual;
63         GtkWidget *checkbtn_filtering_log_folder_proc;
64         GtkWidget *checkbtn_filtering_log_pre_proc;
65         GtkWidget *checkbtn_filtering_log_post_proc;
66         GtkWidget *optmenu_filtering_log_level;
67 } LoggingPage;
68
69 static void prefs_logging_create_widget(PrefsPage *_page, GtkWindow *window, 
70                                   gpointer data)
71 {
72         LoggingPage *prefs_logging = (LoggingPage *) _page;
73         
74         GtkWidget *vbox1;
75
76         GtkWidget *frame_logging;
77         GtkWidget *vbox_network_log;
78         GtkWidget *hbox_clip_network_log;
79         GtkWidget *checkbtn_clip_network_log;
80         GtkWidget *spinbtn_network_log_length;
81         GtkObject *spinbtn_network_log_length_adj;
82         GtkTooltips *network_log_length_tooltip;
83         GtkWidget *vbox1_filtering_log;
84         GtkWidget *hbox_clip_filtering_log;
85         GtkWidget *checkbtn_clip_filtering_log;
86         GtkWidget *spinbtn_filtering_log_length;
87         GtkObject *spinbtn_filtering_log_length_adj;
88         GtkTooltips *filtering_log_length_tooltip;
89         GtkWidget *hbox_filtering_log;
90         GtkWidget *checkbtn_filtering_log;
91         GtkWidget *frame_filtering_log;
92         GtkWidget *vbox2_filtering_log;
93         GtkWidget *hbox_filtering_log_inc;
94         GtkWidget *checkbtn_filtering_log_inc;
95         GtkWidget *hbox_filtering_log_manual;
96         GtkWidget *checkbtn_filtering_log_manual;
97         GtkWidget *hbox_filtering_log_folder_proc;
98         GtkWidget *checkbtn_filtering_log_folder_proc;
99         GtkWidget *hbox_filtering_log_pre_proc;
100         GtkWidget *checkbtn_filtering_log_pre_proc;
101         GtkWidget *hbox_filtering_log_post_proc;
102         GtkWidget *checkbtn_filtering_log_post_proc;
103         GtkTooltips *filtering_log_tooltip;
104         GtkWidget *hbox_filtering_log_level;
105         GtkWidget *label_filtering_log_level;
106         GtkWidget *optmenu_filtering_log_level;
107         GtkListStore *menu;
108         GtkTreeIter iter;
109         GtkTooltips *filtering_log_level_tooltip;
110         GtkWidget *frame_disc_log;
111         GtkWidget *vbox_disc_log;
112         GtkWidget *label;
113         GtkWidget *hbox;
114         GtkWidget *checkbtn_log_standard;
115         GtkWidget *hbox_log_standard;
116         GtkWidget *checkbtn_log_warning;
117         GtkWidget *hbox_log_warning;
118         GtkWidget *checkbtn_log_error;
119         GtkWidget *hbox_log_error;
120         GtkWidget *checkbtn_log_status;
121         GtkWidget *hbox_log_status;
122
123         vbox1 = gtk_vbox_new (FALSE, VSPACING);
124         gtk_widget_show (vbox1);
125         gtk_container_set_border_width (GTK_CONTAINER (vbox1), VBOX_BORDER);
126
127         /* Protocol log */
128         vbox_network_log = gtkut_get_options_frame(vbox1, &frame_logging, _("Network log"));
129
130         hbox_clip_network_log = gtk_hbox_new (FALSE, 8);
131         gtk_container_add (GTK_CONTAINER (vbox_network_log), hbox_clip_network_log);
132         gtk_widget_show (hbox_clip_network_log);
133
134         PACK_CHECK_BUTTON (hbox_clip_network_log, checkbtn_clip_network_log,
135                            _("Restrict the log window to"));
136         
137         network_log_length_tooltip = gtk_tooltips_new();
138
139         spinbtn_network_log_length_adj = gtk_adjustment_new (500, 0, G_MAXINT, 1, 10, 10);
140         spinbtn_network_log_length = gtk_spin_button_new
141                 (GTK_ADJUSTMENT (spinbtn_network_log_length_adj), 1, 0);
142         gtk_widget_show (spinbtn_network_log_length);
143         gtk_box_pack_start (GTK_BOX (hbox_clip_network_log), spinbtn_network_log_length,
144                             FALSE, FALSE, 0);
145         gtk_widget_set_size_request (GTK_WIDGET (spinbtn_network_log_length), 64, -1);
146         gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbtn_network_log_length), TRUE);
147
148         gtk_tooltips_set_tip(GTK_TOOLTIPS(network_log_length_tooltip), spinbtn_network_log_length,
149                              _("0 to stop logging in the log window"),
150                              NULL);
151
152         label = gtk_label_new(_("lines"));
153         gtk_widget_show (label);
154         gtk_box_pack_start(GTK_BOX(hbox_clip_network_log), label, FALSE, FALSE, 0);
155
156         SET_TOGGLE_SENSITIVITY(checkbtn_clip_network_log, spinbtn_network_log_length);
157         SET_TOGGLE_SENSITIVITY(checkbtn_clip_network_log, label);
158
159         /* Filtering/processing debug log */
160         vbox1_filtering_log = gtkut_get_options_frame(vbox1,
161                                 &frame_logging, _("Filtering/processing log"));
162
163         PACK_CHECK_BUTTON (vbox1_filtering_log, checkbtn_filtering_log,
164                            _("Enable logging of filtering/processing rules"));
165         hbox_filtering_log = gtk_hbox_new (FALSE, 8);
166         gtk_container_add (GTK_CONTAINER (vbox1_filtering_log), hbox_filtering_log);
167         gtk_widget_show (hbox_filtering_log);
168
169         filtering_log_tooltip = gtk_tooltips_new();
170         gtk_tooltips_set_tip(GTK_TOOLTIPS(filtering_log_tooltip),
171                              checkbtn_filtering_log,
172                              _("If checked, turns on logging of filtering and processing rules.\n"
173                                 "The log is accessible from 'Tools/Filtering log'.\n"
174                                 "Caution: enabling this option will slow down the filtering/processing, "
175                                 "this might be critical when applying many rules upon thousands of "
176                                 "messages."),
177                                 NULL);
178
179         vbox2_filtering_log = gtkut_get_options_frame(vbox1_filtering_log, &frame_filtering_log,
180                                                         _("Log filtering/processing when..."));
181
182         PACK_CHECK_BUTTON (vbox2_filtering_log, checkbtn_filtering_log_inc,
183                            _("filtering at incorporation"));
184         hbox_filtering_log_inc = gtk_hbox_new (FALSE, 8);
185         gtk_container_add (GTK_CONTAINER (vbox2_filtering_log), hbox_filtering_log_inc);
186         gtk_widget_show (hbox_filtering_log_inc);
187
188         PACK_CHECK_BUTTON (vbox2_filtering_log, checkbtn_filtering_log_manual,
189                            _("manually filtering"));
190         hbox_filtering_log_manual = gtk_hbox_new (FALSE, 8);
191         gtk_container_add (GTK_CONTAINER (vbox2_filtering_log), hbox_filtering_log_manual);
192         gtk_widget_show (hbox_filtering_log_manual);
193
194         PACK_CHECK_BUTTON (vbox2_filtering_log, checkbtn_filtering_log_folder_proc,
195                            _("processing folders"));
196         hbox_filtering_log_folder_proc = gtk_hbox_new (FALSE, 8);
197         gtk_container_add (GTK_CONTAINER (vbox2_filtering_log), hbox_filtering_log_folder_proc);
198         gtk_widget_show (hbox_filtering_log_folder_proc);
199
200         PACK_CHECK_BUTTON (vbox2_filtering_log, checkbtn_filtering_log_pre_proc,
201                            _("pre-processing folders"));
202         hbox_filtering_log_pre_proc = gtk_hbox_new (FALSE, 8);
203         gtk_container_add (GTK_CONTAINER (vbox2_filtering_log), hbox_filtering_log_pre_proc);
204         gtk_widget_show (hbox_filtering_log_pre_proc);
205
206         PACK_CHECK_BUTTON (vbox2_filtering_log, checkbtn_filtering_log_post_proc,
207                            _("post-processing folders"));
208         hbox_filtering_log_post_proc = gtk_hbox_new (FALSE, 8);
209         gtk_container_add (GTK_CONTAINER (vbox2_filtering_log), hbox_filtering_log_post_proc);
210         gtk_widget_show (hbox_filtering_log_post_proc);
211
212         SET_TOGGLE_SENSITIVITY(checkbtn_filtering_log, frame_filtering_log);
213
214         hbox_filtering_log_level = gtk_hbox_new (FALSE, 8);
215         gtk_widget_show (hbox_filtering_log_level);
216         gtk_box_pack_start(GTK_BOX (vbox1_filtering_log), hbox_filtering_log_level, FALSE, FALSE, 0);
217
218         label_filtering_log_level = gtk_label_new (_("Log level"));
219         gtk_widget_show (label_filtering_log_level);
220         gtk_box_pack_start(GTK_BOX(hbox_filtering_log_level), label_filtering_log_level, FALSE, FALSE, 0);
221
222         optmenu_filtering_log_level = gtkut_sc_combobox_create(NULL, FALSE);
223         gtk_widget_show (optmenu_filtering_log_level);
224         
225         menu = GTK_LIST_STORE(gtk_combo_box_get_model(
226                                 GTK_COMBO_BOX(optmenu_filtering_log_level)));
227         COMBOBOX_ADD (menu, _("Low"), 0);
228         COMBOBOX_ADD (menu, _("Medium"), 1);
229         COMBOBOX_ADD (menu, _("High"), 2);
230
231         gtk_box_pack_start(GTK_BOX(hbox_filtering_log_level), optmenu_filtering_log_level, FALSE, FALSE, 0);
232
233         filtering_log_level_tooltip = gtk_tooltips_new();
234         gtk_tooltips_set_tip(GTK_TOOLTIPS(filtering_log_level_tooltip),
235                              optmenu_filtering_log_level,
236                              _("Select the level of detail of the logging.\n"
237                                 "Choose Low to see when rules are applied, which "
238                                 "conditions match or don't match and what actions are "
239                                 "performed.\n"
240                                 "Choose Medium to see more details about the message "
241                                 "that is being processed, and why rules are skipped.\n"
242                                 "Choose High to explicitly show the reason why all "
243                                 "rules are processed or skipped, and why all conditions "
244                                 "are matched or not matched.\n"
245                                 "Caution: the higher the level, the greater the "
246                                 "impact on performance."),
247                              NULL);
248
249         hbox_clip_filtering_log = gtk_hbox_new (FALSE, 8);
250         gtk_container_add (GTK_CONTAINER (vbox1_filtering_log), hbox_clip_filtering_log);
251         gtk_widget_show (hbox_clip_filtering_log);
252         PACK_CHECK_BUTTON (hbox_clip_filtering_log, checkbtn_clip_filtering_log,
253                            _("Restrict the log window to"));
254         
255         filtering_log_length_tooltip = gtk_tooltips_new();
256
257         spinbtn_filtering_log_length_adj = gtk_adjustment_new (500, 0, G_MAXINT, 1, 10, 10);
258         spinbtn_filtering_log_length = gtk_spin_button_new
259                 (GTK_ADJUSTMENT (spinbtn_filtering_log_length_adj), 1, 0);
260         gtk_widget_show (spinbtn_filtering_log_length);
261         gtk_box_pack_start (GTK_BOX (hbox_clip_filtering_log), spinbtn_filtering_log_length,
262                             FALSE, FALSE, 0);
263         gtk_widget_set_size_request (GTK_WIDGET (spinbtn_filtering_log_length), 64, -1);
264         gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbtn_filtering_log_length), TRUE);
265
266         gtk_tooltips_set_tip(GTK_TOOLTIPS(filtering_log_length_tooltip), spinbtn_filtering_log_length,
267                              _("0 to stop logging in the log window"),
268                              NULL);
269
270         label = gtk_label_new(_("lines"));
271         gtk_widget_show (label);
272         gtk_box_pack_start(GTK_BOX(hbox_clip_filtering_log), label, FALSE, FALSE, 0);
273
274         SET_TOGGLE_SENSITIVITY(checkbtn_clip_filtering_log, spinbtn_filtering_log_length);
275         SET_TOGGLE_SENSITIVITY(checkbtn_clip_filtering_log, label);
276         SET_TOGGLE_SENSITIVITY(checkbtn_filtering_log, hbox_clip_filtering_log);
277         SET_TOGGLE_SENSITIVITY(checkbtn_filtering_log, optmenu_filtering_log_level);
278         SET_TOGGLE_SENSITIVITY(checkbtn_filtering_log, checkbtn_clip_filtering_log);
279         SET_TOGGLE_SENSITIVITY(checkbtn_filtering_log, label_filtering_log_level);
280
281         /* disk log */
282         vbox_disc_log = gtkut_get_options_frame(vbox1, &frame_disc_log, _("Disc log"));
283
284         label = gtk_label_new(_("Write the following information to disc..."));
285         gtk_widget_show(label);
286         hbox = gtk_hbox_new (FALSE, 8);
287         gtk_container_add (GTK_CONTAINER (vbox_disc_log), hbox);
288         gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
289         gtk_widget_show (hbox);
290
291         PACK_CHECK_BUTTON (vbox_disc_log, checkbtn_log_standard,
292                            _("Network protocol messages"));
293         hbox_log_standard = gtk_hbox_new (FALSE, 8);
294         gtk_container_add (GTK_CONTAINER (vbox_disc_log), hbox_log_standard);
295         gtk_widget_show (hbox_log_standard);
296
297         PACK_CHECK_BUTTON (vbox_disc_log, checkbtn_log_warning,
298                            _("Warning messages"));
299         hbox_log_warning = gtk_hbox_new (FALSE, 8);
300         gtk_container_add (GTK_CONTAINER (vbox_disc_log), hbox_log_warning);
301         gtk_widget_show (hbox_log_warning);
302
303         PACK_CHECK_BUTTON (vbox_disc_log, checkbtn_log_error,
304                            _("Error messages"));
305         hbox_log_error = gtk_hbox_new (FALSE, 8);
306         gtk_container_add (GTK_CONTAINER (vbox_disc_log), hbox_log_error);
307         gtk_widget_show (hbox_log_error);
308
309         PACK_CHECK_BUTTON (vbox_disc_log, checkbtn_log_status,
310                            _("Status messages for filtering/processing log"));
311         hbox_log_status = gtk_hbox_new (FALSE, 8);
312         gtk_container_add (GTK_CONTAINER (vbox_disc_log), hbox_log_status);
313         gtk_widget_show (hbox_log_status);
314
315         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_clip_network_log), 
316                 prefs_common.cliplog);
317         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_clip_filtering_log), 
318                 prefs_common.filtering_debug_cliplog);
319         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_log_standard), 
320                 prefs_common.enable_log_standard);
321         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_log_warning), 
322                 prefs_common.enable_log_warning);
323         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_log_error), 
324                 prefs_common.enable_log_error);
325         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_log_status), 
326                 prefs_common.enable_log_status);
327         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_filtering_log), 
328                 prefs_common.enable_filtering_debug);
329         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_filtering_log_inc), 
330                 prefs_common.enable_filtering_debug_inc);
331         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_filtering_log_manual), 
332                 prefs_common.enable_filtering_debug_manual);
333         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_filtering_log_folder_proc), 
334                 prefs_common.enable_filtering_debug_folder_proc);
335         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_filtering_log_pre_proc), 
336                 prefs_common.enable_filtering_debug_pre_proc);
337         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_filtering_log_post_proc), 
338                 prefs_common.enable_filtering_debug_post_proc);
339
340         gtk_spin_button_set_value(GTK_SPIN_BUTTON(spinbtn_network_log_length),
341                 prefs_common.loglength);
342         gtk_spin_button_set_value(GTK_SPIN_BUTTON(spinbtn_filtering_log_length),
343                 prefs_common.filtering_debug_loglength);
344
345         combobox_select_by_data(GTK_COMBO_BOX(optmenu_filtering_log_level),
346                         prefs_common.filtering_debug_level);
347
348         prefs_logging->checkbtn_clip_network_log = checkbtn_clip_network_log;
349         prefs_logging->spinbtn_network_log_length = spinbtn_network_log_length;
350         prefs_logging->checkbtn_log_standard = checkbtn_log_standard;
351         prefs_logging->checkbtn_log_warning = checkbtn_log_warning;
352         prefs_logging->checkbtn_log_error = checkbtn_log_error;
353         prefs_logging->checkbtn_log_status = checkbtn_log_status;
354         prefs_logging->checkbtn_clip_filtering_log = checkbtn_clip_filtering_log;
355         prefs_logging->spinbtn_filtering_log_length = spinbtn_filtering_log_length;
356         prefs_logging->checkbtn_filtering_log = checkbtn_filtering_log;
357         prefs_logging->checkbtn_filtering_log_inc = checkbtn_filtering_log_inc;
358         prefs_logging->checkbtn_filtering_log_manual = checkbtn_filtering_log_manual;
359         prefs_logging->checkbtn_filtering_log_folder_proc = checkbtn_filtering_log_folder_proc;
360         prefs_logging->checkbtn_filtering_log_pre_proc = checkbtn_filtering_log_pre_proc;
361         prefs_logging->checkbtn_filtering_log_post_proc = checkbtn_filtering_log_post_proc;
362         prefs_logging->optmenu_filtering_log_level = optmenu_filtering_log_level;
363
364         prefs_logging->page.widget = vbox1;
365 }
366
367 static void prefs_logging_save(PrefsPage *_page)
368 {
369         LoggingPage *page = (LoggingPage *) _page;
370         MainWindow *mainwindow;
371         gboolean filtering_debug_enabled;
372
373         prefs_common.filtering_debug_level =
374                 combobox_get_active_data(GTK_COMBO_BOX(page->optmenu_filtering_log_level));
375
376         prefs_common.cliplog = gtk_toggle_button_get_active(
377                 GTK_TOGGLE_BUTTON(page->checkbtn_clip_network_log));
378         prefs_common.loglength = gtk_spin_button_get_value_as_int(
379                 GTK_SPIN_BUTTON(page->spinbtn_network_log_length));
380         prefs_common.enable_log_standard = gtk_toggle_button_get_active(
381                 GTK_TOGGLE_BUTTON(page->checkbtn_log_standard));
382         prefs_common.enable_log_warning = gtk_toggle_button_get_active(
383                 GTK_TOGGLE_BUTTON(page->checkbtn_log_warning));
384         prefs_common.enable_log_error = gtk_toggle_button_get_active(
385                 GTK_TOGGLE_BUTTON(page->checkbtn_log_error));
386         prefs_common.enable_log_status = gtk_toggle_button_get_active(
387                 GTK_TOGGLE_BUTTON(page->checkbtn_log_status));
388         prefs_common.filtering_debug_cliplog = gtk_toggle_button_get_active(
389                 GTK_TOGGLE_BUTTON(page->checkbtn_clip_filtering_log));
390         prefs_common.filtering_debug_loglength = gtk_spin_button_get_value_as_int(
391                 GTK_SPIN_BUTTON(page->spinbtn_filtering_log_length));
392         filtering_debug_enabled = prefs_common.enable_filtering_debug;
393         prefs_common.enable_filtering_debug = gtk_toggle_button_get_active(
394                 GTK_TOGGLE_BUTTON(page->checkbtn_filtering_log));
395         if (filtering_debug_enabled != prefs_common.enable_filtering_debug) {
396                 if (prefs_common.enable_filtering_debug)
397                         log_message(LOG_DEBUG_FILTERING, _("filtering log enabled\n"));
398                 else
399                         log_message(LOG_DEBUG_FILTERING, _("filtering log disabled\n"));
400         }
401         prefs_common.enable_filtering_debug_inc = gtk_toggle_button_get_active(
402                 GTK_TOGGLE_BUTTON(page->checkbtn_filtering_log_inc));
403         prefs_common.enable_filtering_debug_manual = gtk_toggle_button_get_active(
404                 GTK_TOGGLE_BUTTON(page->checkbtn_filtering_log_manual));
405         prefs_common.enable_filtering_debug_folder_proc = gtk_toggle_button_get_active(
406                 GTK_TOGGLE_BUTTON(page->checkbtn_filtering_log_folder_proc));
407         prefs_common.enable_filtering_debug_pre_proc = gtk_toggle_button_get_active(
408                 GTK_TOGGLE_BUTTON(page->checkbtn_filtering_log_pre_proc));
409         prefs_common.enable_filtering_debug_post_proc = gtk_toggle_button_get_active(
410                 GTK_TOGGLE_BUTTON(page->checkbtn_filtering_log_post_proc));
411
412         mainwindow = mainwindow_get_mainwindow();
413         log_window_set_clipping(mainwindow->logwin, prefs_common.cliplog,
414                                 prefs_common.loglength);
415         log_window_set_clipping(mainwindow->filtering_debugwin, prefs_common.filtering_debug_cliplog,
416                                 prefs_common.filtering_debug_loglength);
417 }
418
419 static void prefs_logging_destroy_widget(PrefsPage *_page)
420 {
421 }
422
423 LoggingPage *prefs_logging;
424
425 void prefs_logging_init(void)
426 {
427         LoggingPage *page;
428         static gchar *path[3];
429
430         path[0] = _("Other");
431         path[1] = _("Logging");
432         path[2] = NULL;
433
434         page = g_new0(LoggingPage, 1);
435         page->page.path = path;
436         page->page.create_widget = prefs_logging_create_widget;
437         page->page.destroy_widget = prefs_logging_destroy_widget;
438         page->page.save_page = prefs_logging_save;
439         page->page.weight = 5.0;
440         prefs_gtk_register_page((PrefsPage *) page);
441         prefs_logging = page;
442 }
443
444 void prefs_logging_done(void)
445 {
446         prefs_gtk_unregister_page((PrefsPage *) prefs_logging);
447         g_free(prefs_logging);
448 }