From Jakub Zawadzki via bug 4273:
[obnox/wireshark/wip.git] / gtk / prefs_protocols.c
1 /* prefs_protocols.c
2  * Dialog box for preferences common for all protocols
3  *
4  * $Id$
5  *
6  * Wireshark - Network traffic analyzer
7  * By Gerald Combs <gerald@wireshark.org>
8  * Copyright 1998 Gerald Combs
9  *
10  * This program is free software; you can redistribute it and/or
11  * modify it under the terms of the GNU General Public License
12  * as published by the Free Software Foundation; either version 2
13  * of the License, or (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program; if not, write to the Free Software
22  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
23  */
24
25 #ifdef HAVE_CONFIG_H
26 #include "config.h"
27 #endif
28
29 #include <gtk/gtk.h>
30
31 #include <epan/prefs.h>
32
33 #include "gtk/prefs_protocols.h"
34 #include "gtk/prefs_dlg.h"
35
36 #define PROTOCOLS_SHOW_HIDDEN_KEY   "display_hidden_items"
37 #define PROTOCOLS_TABLE_ROWS 1
38
39 GtkWidget*
40 protocols_prefs_show(void)
41 {
42         GtkWidget   *main_tb, *main_vb;
43         GtkWidget   *display_hidden_cb;
44         GtkTooltips *tooltips = gtk_tooltips_new();
45         int pos = 0;
46
47         /* Main vertical box */
48         main_vb = gtk_vbox_new(FALSE, 7);
49         gtk_container_set_border_width(GTK_CONTAINER(main_vb), 5);
50
51         /* Main table */
52         main_tb = gtk_table_new(PROTOCOLS_TABLE_ROWS, 1, FALSE);
53         gtk_box_pack_start(GTK_BOX(main_vb), main_tb, FALSE, FALSE, 0);
54         gtk_table_set_row_spacings(GTK_TABLE(main_tb), 10);
55         gtk_table_set_col_spacings(GTK_TABLE(main_tb), 15);
56         gtk_widget_show(main_tb);
57         g_object_set_data(G_OBJECT(main_tb), E_TOOLTIPS_KEY, tooltips);
58
59         /* Show hidden protocol items in packet list */
60         display_hidden_cb = create_preference_check_button(main_tb, pos++,
61             "Display hidden protocol items:", 
62             "Display all hidden protocol items in the packet list.",
63             prefs.display_hidden_proto_items);
64         g_object_set_data(G_OBJECT(main_vb), PROTOCOLS_SHOW_HIDDEN_KEY, display_hidden_cb);
65
66         /* Show 'em what we got */
67         gtk_widget_show_all(main_vb);
68
69         return main_vb;
70 }
71
72 void
73 protocols_prefs_fetch(GtkWidget *w _U_)
74 {
75         GtkWidget *display_hidden_cb;
76
77         display_hidden_cb = (GtkWidget *)g_object_get_data(G_OBJECT(w), PROTOCOLS_SHOW_HIDDEN_KEY);
78         prefs.display_hidden_proto_items = (GTK_TOGGLE_BUTTON (display_hidden_cb)->active ? TRUE : FALSE);
79 }
80
81 void
82 protocols_prefs_apply(GtkWidget *w _U_)
83 {
84 }
85
86 void
87 protocols_prefs_destroy(GtkWidget *w _U_)
88 {
89 }
90