2 * Dialog box for GUI preferences
4 * $Id: gui_prefs.c,v 1.1 1999/12/16 06:20:15 gram Exp $
6 * Ethereal - Network traffic analyzer
7 * By Gerald Combs <gerald@zing.org>
8 * Copyright 1998 Gerald Combs
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License
13 * as published by the Free Software Foundation; either version 2
14 * of the License, or (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
36 #include "gui_prefs.h"
37 #include "gtkglobals.h"
39 #ifndef __PREFS_DLG_H__
40 #include "prefs_dlg.h"
43 static void scrollbar_menu_item_cb(GtkWidget *w, gpointer data);
45 static gboolean temp_gui_scrollbar_on_right;
50 GtkWidget *main_vb, *hbox, *label;
51 GtkWidget *menu_item_left, *menu_item_right,
52 *scrollbar_menu, *scrollbar_option_menu;
54 temp_gui_scrollbar_on_right = prefs.gui_scrollbar_on_right;
56 /* Main vertical box */
57 main_vb = gtk_vbox_new(FALSE, 5);
58 gtk_container_border_width(GTK_CONTAINER(main_vb), 5);
60 /* Scrollbar placment hbox */
61 hbox = gtk_hbox_new(FALSE, 5);
62 gtk_box_pack_start( GTK_BOX(main_vb), hbox, FALSE, FALSE, 5);
64 label = gtk_label_new("Vertical Scrollbar Placement:");
65 gtk_container_add( GTK_CONTAINER(hbox), label );
67 /* Create a simple menu containing the LEFT/RIGHT choices for
68 * the scrollbar placement option */
69 scrollbar_menu = gtk_menu_new();
70 menu_item_left = gtk_menu_item_new_with_label("Left");
71 menu_item_right = gtk_menu_item_new_with_label("Right");
72 gtk_menu_append( GTK_MENU(scrollbar_menu), menu_item_left );
73 gtk_menu_append( GTK_MENU(scrollbar_menu), menu_item_right );
75 gtk_signal_connect( GTK_OBJECT(menu_item_left), "activate",
76 scrollbar_menu_item_cb, GINT_TO_POINTER(FALSE) );
77 gtk_signal_connect( GTK_OBJECT(menu_item_right), "activate",
78 scrollbar_menu_item_cb, GINT_TO_POINTER(TRUE) );
80 /* Create the option menu from the option */
81 scrollbar_option_menu = gtk_option_menu_new();
82 gtk_option_menu_set_menu( GTK_OPTION_MENU(scrollbar_option_menu),
84 gtk_option_menu_set_history( GTK_OPTION_MENU(scrollbar_option_menu),
85 temp_gui_scrollbar_on_right);
86 gtk_container_add( GTK_CONTAINER(hbox), scrollbar_option_menu );
89 /* Show 'em what we got */
90 gtk_widget_show_all(main_vb);
97 scrollbar_menu_item_cb(GtkWidget *w, gpointer data)
99 gboolean value = GPOINTER_TO_INT(data);
101 temp_gui_scrollbar_on_right = value;
102 set_scrollbar_placement(value);
106 gui_prefs_ok(GtkWidget *w)
108 prefs.gui_scrollbar_on_right = temp_gui_scrollbar_on_right;
113 gui_prefs_save(GtkWidget *w)
119 gui_prefs_cancel(GtkWidget *w)
121 /* Reset scrollbar placement value back to what the
122 * current preferences says it should be */
123 temp_gui_scrollbar_on_right = prefs.gui_scrollbar_on_right;
124 set_scrollbar_placement(prefs.gui_scrollbar_on_right);
130 gui_prefs_delete(GtkWidget *w)