1999-12-16 06:20:18 +00:00
|
|
|
/* gui_prefs.c
|
|
|
|
* Dialog box for GUI preferences
|
|
|
|
*
|
2004-07-18 00:24:25 +00:00
|
|
|
* $Id$
|
1999-12-16 06:20:18 +00:00
|
|
|
*
|
2006-05-21 05:12:17 +00:00
|
|
|
* Wireshark - Network traffic analyzer
|
|
|
|
* By Gerald Combs <gerald@wireshark.org>
|
1999-12-16 06:20:18 +00:00
|
|
|
* Copyright 1998 Gerald Combs
|
2002-08-28 21:04:11 +00:00
|
|
|
*
|
1999-12-16 06:20:18 +00:00
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
2002-08-28 21:04:11 +00:00
|
|
|
*
|
1999-12-16 06:20:18 +00:00
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
2002-08-28 21:04:11 +00:00
|
|
|
*
|
1999-12-16 06:20:18 +00:00
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "config.h"
|
|
|
|
#endif
|
2008-04-13 01:54:20 +00:00
|
|
|
#include <string.h>
|
1999-12-16 06:20:18 +00:00
|
|
|
|
2000-10-20 04:26:40 +00:00
|
|
|
#include <gtk/gtk.h>
|
1999-12-16 06:20:18 +00:00
|
|
|
|
2004-09-27 22:55:15 +00:00
|
|
|
#include <epan/prefs.h>
|
2008-04-13 01:54:20 +00:00
|
|
|
|
|
|
|
#include "../globals.h"
|
|
|
|
#include "../simple_dialog.h"
|
|
|
|
|
2008-04-13 13:10:32 +00:00
|
|
|
#include "gtk/prefs_gui.h"
|
2008-04-13 01:54:20 +00:00
|
|
|
#include "gtk/gtkglobals.h"
|
|
|
|
#include "gtk/help_dlg.h"
|
|
|
|
#include "gtk/supported_protos_dlg.h"
|
|
|
|
#include "gtk/prefs_dlg.h"
|
|
|
|
#include "gtk/gui_utils.h"
|
|
|
|
#include "gtk/dlg_utils.h"
|
|
|
|
#include "gtk/main.h"
|
|
|
|
#include "gtk/main_packet_list.h"
|
|
|
|
#include "gtk/main_proto_draw.h"
|
|
|
|
#include "gtk/main_toolbar.h"
|
|
|
|
#include "gtk/font_utils.h"
|
|
|
|
#include "gtk/recent.h"
|
|
|
|
#include "gtk/webbrowser.h"
|
2004-06-29 17:10:53 +00:00
|
|
|
|
1999-12-16 06:20:18 +00:00
|
|
|
|
2000-11-18 21:41:40 +00:00
|
|
|
static gint fetch_enum_value(gpointer control, const enum_val_t *enumvals);
|
2003-10-14 23:20:17 +00:00
|
|
|
static gint fileopen_dir_changed_cb(GtkWidget *myentry _U_, GdkEvent *event, gpointer parent_w);
|
2004-08-31 09:22:57 +00:00
|
|
|
static gint fileopen_preview_changed_cb(GtkWidget *myentry _U_, GdkEvent *event, gpointer parent_w);
|
2003-10-14 23:20:17 +00:00
|
|
|
static void fileopen_selected_cb(GtkWidget *mybutton_rb _U_, gpointer parent_w);
|
2003-12-29 00:48:56 +00:00
|
|
|
static gint recent_files_count_changed_cb(GtkWidget *recent_files_entry _U_,
|
|
|
|
GdkEvent *event _U_, gpointer parent_w);
|
2008-08-08 19:41:35 +00:00
|
|
|
static gint recent_df_entries_changed_cb(GtkWidget *recent_df_entry _U_,
|
|
|
|
GdkEvent *event _U_, gpointer parent_w);
|
2000-08-21 22:30:04 +00:00
|
|
|
#define PLIST_SEL_BROWSE_KEY "plist_sel_browse"
|
|
|
|
#define PTREE_SEL_BROWSE_KEY "ptree_sel_browse"
|
2001-12-31 04:41:50 +00:00
|
|
|
#define GEOMETRY_POSITION_KEY "geometry_position"
|
|
|
|
#define GEOMETRY_SIZE_KEY "geometry_size"
|
2004-02-01 20:28:11 +00:00
|
|
|
#define GEOMETRY_MAXIMIZED_KEY "geometry_maximized"
|
2000-08-21 22:30:04 +00:00
|
|
|
|
2008-10-26 23:07:37 +00:00
|
|
|
#define MACOSX_STYLE_KEY "macosx_style"
|
|
|
|
|
2004-05-13 15:28:02 +00:00
|
|
|
#define GUI_CONSOLE_OPEN_KEY "console_open"
|
2003-10-14 23:20:17 +00:00
|
|
|
#define GUI_FILEOPEN_KEY "fileopen_behavior"
|
2004-08-31 09:22:57 +00:00
|
|
|
#define GUI_FILEOPEN_PREVIEW_KEY "fileopen_preview_timeout"
|
2003-12-29 00:48:56 +00:00
|
|
|
#define GUI_RECENT_FILES_COUNT_KEY "recent_files_count"
|
2008-08-08 19:41:35 +00:00
|
|
|
#define GUI_RECENT_DF_ENTRIES_KEY "recent_display_filter_entries"
|
2003-10-14 23:20:17 +00:00
|
|
|
#define GUI_FILEOPEN_DIR_KEY "fileopen_directory"
|
2004-06-20 15:57:11 +00:00
|
|
|
#define GUI_ASK_UNSAVED_KEY "ask_unsaved"
|
2004-06-29 17:10:53 +00:00
|
|
|
#define GUI_WEBBROWSER_KEY "webbrowser"
|
2004-08-15 19:26:25 +00:00
|
|
|
#define GUI_FIND_WRAP_KEY "find_wrap"
|
2006-10-03 19:53:10 +00:00
|
|
|
#define GUI_USE_PREF_SAVE_KEY "use_pref_save"
|
2008-10-14 18:18:21 +00:00
|
|
|
#define GUI_SHOW_VERSION_KEY "show_version"
|
2003-10-16 21:19:12 +00:00
|
|
|
|
2007-04-14 15:57:03 +00:00
|
|
|
static const enum_val_t scrollbar_placement_vals[] _U_ = {
|
2004-05-24 02:25:21 +00:00
|
|
|
{ "FALSE", "Left", FALSE },
|
|
|
|
{ "TRUE", "Right", TRUE },
|
|
|
|
{ NULL, NULL, 0 }
|
2000-08-21 22:30:04 +00:00
|
|
|
};
|
|
|
|
|
2000-11-18 21:41:40 +00:00
|
|
|
static const enum_val_t selection_mode_vals[] = {
|
2004-05-24 02:25:21 +00:00
|
|
|
{ "FALSE", "Selects", FALSE },
|
|
|
|
{ "TRUE", "Browses", TRUE },
|
|
|
|
{ NULL, NULL, 0 }
|
2000-08-21 22:30:04 +00:00
|
|
|
};
|
|
|
|
|
2007-04-14 15:57:03 +00:00
|
|
|
static const enum_val_t altern_colors_vals[] _U_ = {
|
2004-05-24 02:25:21 +00:00
|
|
|
{ "FALSE", "No", FALSE },
|
|
|
|
{ "TRUE", "Yes", TRUE },
|
|
|
|
{ NULL, NULL, 0 }
|
2002-11-03 17:38:45 +00:00
|
|
|
};
|
1999-12-16 06:20:18 +00:00
|
|
|
|
2007-04-14 15:57:03 +00:00
|
|
|
static const enum_val_t filter_toolbar_placement_vals[] _U_ = {
|
2004-05-24 02:25:21 +00:00
|
|
|
{ "FALSE", "Below the main toolbar", FALSE },
|
|
|
|
{ "TRUE", "Insert into statusbar", TRUE },
|
|
|
|
{ NULL, NULL, 0 }
|
2004-04-06 19:02:18 +00:00
|
|
|
};
|
|
|
|
|
2007-04-14 15:57:03 +00:00
|
|
|
static const enum_val_t highlight_style_vals[] _U_ = {
|
2004-05-24 02:25:21 +00:00
|
|
|
{ "FALSE", "Bold", FALSE },
|
|
|
|
{ "TRUE", "Inverse", TRUE },
|
|
|
|
{ NULL, NULL, 0 }
|
2000-09-08 09:50:08 +00:00
|
|
|
};
|
|
|
|
|
2004-08-15 19:26:25 +00:00
|
|
|
|
2007-04-14 15:57:03 +00:00
|
|
|
static const enum_val_t toolbar_style_vals[] _U_ = {
|
2004-05-24 02:25:21 +00:00
|
|
|
{ "ICONS", "Icons only", TB_STYLE_ICONS },
|
|
|
|
{ "TEXT", "Text only", TB_STYLE_TEXT },
|
|
|
|
{ "BOTH", "Icons & Text", TB_STYLE_BOTH },
|
|
|
|
{ NULL, NULL, 0 }
|
2003-10-16 21:19:12 +00:00
|
|
|
};
|
|
|
|
|
2004-05-13 15:28:02 +00:00
|
|
|
#ifdef _WIN32
|
|
|
|
static const enum_val_t gui_console_open_vals[] = {
|
2004-05-24 02:25:21 +00:00
|
|
|
{ "NEVER", "Never", console_open_never },
|
|
|
|
{ "AUTOMATIC", "Automatic (advanced user)", console_open_auto },
|
|
|
|
{ "ALWAYS", "Always (debugging)", console_open_always },
|
|
|
|
{ NULL, NULL, 0 }
|
2004-05-13 15:28:02 +00:00
|
|
|
};
|
|
|
|
#endif
|
|
|
|
|
2003-10-14 23:20:17 +00:00
|
|
|
static const enum_val_t gui_fileopen_vals[] = {
|
2004-05-24 02:25:21 +00:00
|
|
|
{ "LAST_OPENED", "Remember last directory", FO_STYLE_LAST_OPENED },
|
|
|
|
{ "SPECIFIED", "Always start in:", FO_STYLE_SPECIFIED },
|
|
|
|
{ NULL, NULL, 0 }
|
2003-10-14 23:20:17 +00:00
|
|
|
};
|
|
|
|
|
2000-08-23 16:15:13 +00:00
|
|
|
/* Set to FALSE initially; set to TRUE if the user ever hits "OK" on
|
|
|
|
the "Font..." dialog, so that we know that they (probably) changed
|
|
|
|
the font, and therefore that the "apply" function needs to take care
|
|
|
|
of that */
|
|
|
|
static gboolean font_changed;
|
|
|
|
|
2000-09-09 10:35:53 +00:00
|
|
|
/* Font name from the font dialog box; if "font_changed" is TRUE, this
|
|
|
|
has been set to the name of the font the user selected. */
|
|
|
|
static gchar *new_font_name;
|
|
|
|
|
2004-01-17 00:26:22 +00:00
|
|
|
static GtkWidget *font_browse_w;
|
|
|
|
|
2003-12-29 00:48:56 +00:00
|
|
|
/* Used to contain the string from the Recent Files Count Max pref item */
|
|
|
|
static char recent_files_count_max_str[128] = "";
|
|
|
|
|
2008-08-08 19:41:35 +00:00
|
|
|
/* Used to contain the string from the Recent Display Filter Max Entries pref item */
|
|
|
|
static char recent_df_entries_max_str[128] = "";
|
|
|
|
|
2004-08-31 09:22:57 +00:00
|
|
|
/* Used to contain the string from the Open File preview timeout pref item */
|
|
|
|
static char open_file_preview_str[128] = "";
|
|
|
|
|
2006-03-02 14:44:50 +00:00
|
|
|
#define GUI_TABLE_ROWS 4
|
2003-10-14 23:20:17 +00:00
|
|
|
|
1999-12-16 06:20:18 +00:00
|
|
|
GtkWidget*
|
|
|
|
gui_prefs_show(void)
|
|
|
|
{
|
2006-03-02 14:44:50 +00:00
|
|
|
GtkWidget *main_tb, *main_vb;
|
|
|
|
GtkWidget *plist_browse_om;
|
|
|
|
GtkWidget *ptree_browse_om;
|
2004-05-13 15:28:02 +00:00
|
|
|
#ifdef _WIN32
|
|
|
|
GtkWidget *console_open_om;
|
|
|
|
#endif
|
2004-08-31 09:22:57 +00:00
|
|
|
GtkWidget *fileopen_rb, *fileopen_dir_te, *fileopen_preview_te;
|
2008-08-08 19:41:35 +00:00
|
|
|
GtkWidget *recent_files_count_max_te, *recent_df_entries_max_te, *ask_unsaved_cb, *find_wrap_cb;
|
2006-10-03 19:53:10 +00:00
|
|
|
GtkWidget *use_pref_save_cb;
|
2008-10-14 18:18:21 +00:00
|
|
|
GtkWidget *show_version_cb;
|
2006-03-02 14:44:50 +00:00
|
|
|
GtkWidget *webbrowser_te;
|
2008-08-09 16:14:34 +00:00
|
|
|
GtkWidget *save_position_cb, *save_size_cb, *save_maximized_cb;
|
2008-10-27 00:18:43 +00:00
|
|
|
#ifdef HAVE_IGE_MAC_INTEGRATION
|
2008-10-26 23:07:37 +00:00
|
|
|
GtkWidget *macosx_style_cb;
|
2008-10-27 00:18:43 +00:00
|
|
|
#endif
|
2006-03-02 14:44:50 +00:00
|
|
|
|
|
|
|
GtkTooltips *tooltips = gtk_tooltips_new();
|
|
|
|
|
2004-01-17 03:09:24 +00:00
|
|
|
int pos = 0;
|
2003-12-29 00:48:56 +00:00
|
|
|
char current_val_str[128];
|
1999-12-16 06:20:18 +00:00
|
|
|
|
2004-01-15 01:13:51 +00:00
|
|
|
/* The font haven't been changed yet. */
|
2000-08-23 16:15:13 +00:00
|
|
|
font_changed = FALSE;
|
2000-08-23 07:38:56 +00:00
|
|
|
|
2007-06-04 20:15:10 +00:00
|
|
|
/* The columns haven't been changed yet */
|
|
|
|
cfile.cinfo.columns_changed = FALSE;
|
|
|
|
|
1999-12-16 06:20:18 +00:00
|
|
|
/* Main vertical box */
|
2000-09-08 09:50:08 +00:00
|
|
|
main_vb = gtk_vbox_new(FALSE, 7);
|
2008-06-29 15:51:43 +00:00
|
|
|
gtk_container_set_border_width( GTK_CONTAINER(main_vb), 5 );
|
1999-12-16 06:20:18 +00:00
|
|
|
|
2006-03-02 14:44:50 +00:00
|
|
|
/* Main table */
|
|
|
|
main_tb = gtk_table_new(GUI_TABLE_ROWS, 2, FALSE);
|
|
|
|
gtk_box_pack_start(GTK_BOX(main_vb), main_tb, FALSE, FALSE, 0);
|
|
|
|
gtk_table_set_row_spacings(GTK_TABLE(main_tb), 10);
|
|
|
|
gtk_table_set_col_spacings(GTK_TABLE(main_tb), 15);
|
1999-12-30 23:02:56 +00:00
|
|
|
|
Changed the protocol tree widget from a GtkTree to a GtkCTree. The two reasons
I did this:
First, Havoc Pennington, in "GTK+/Gnome Application Development", in
Appendix seciton A.3.88, recommends using GtkCTree instead of GtkTree
because GtkCtree is faster, and GtkTree has limitation on its total row
height: since it must fit inside a GdkWindow, it is limited to 32,768
pixels of height. GtkTree is more flexible with regards to the types of
widgets that can be placed in the tree, but since we deal only with text,
that doesn't matter, at least for now.
Secondly, a GtkTree doesn't allow arrow-key navigation (at least as far
as I could tell). It always bothered me that the up and down arrow keys
worked in the packet list and in the hex dump, but no in the protocol tree.
GtkCTree does allow arrow-key navigation. In fact, GtkCTree is a subclass
of GtkCList (the packet list widget), so they behave a lot alike.
I went ahead and fixed the selection bar which has been bothering Richard
for a long time now. :) In the GUI preferences dialogue, you can now set
both the packet list selection bar and the protocol tree selection bar
to either "browse" or "select" mode. "browse" mode is what you're used to:
the arrow keys move an outline of the selection bar, but do not change
the selection. "select" mode does change the selection when the arrow keys
are pressed. The default behavior is set to "select", which seems more
natural for a first-time user.
svn path=/trunk/; revision=1393
1999-12-29 20:10:12 +00:00
|
|
|
/* Packet list selection browseable */
|
2002-11-03 17:38:45 +00:00
|
|
|
plist_browse_om = create_preference_option_menu(main_tb, pos++,
|
2003-07-18 20:55:11 +00:00
|
|
|
"Packet list selection mode:", NULL, selection_mode_vals,
|
2000-08-21 22:30:04 +00:00
|
|
|
prefs.gui_plist_sel_browse);
|
2006-03-02 14:44:50 +00:00
|
|
|
gtk_tooltips_set_tip(tooltips, plist_browse_om, "Choose to browse "
|
|
|
|
"or select a packet for detailed dissection.", NULL);
|
2008-04-11 16:04:54 +00:00
|
|
|
g_object_set_data(G_OBJECT(main_vb), PLIST_SEL_BROWSE_KEY, plist_browse_om);
|
1999-12-30 23:02:56 +00:00
|
|
|
|
Changed the protocol tree widget from a GtkTree to a GtkCTree. The two reasons
I did this:
First, Havoc Pennington, in "GTK+/Gnome Application Development", in
Appendix seciton A.3.88, recommends using GtkCTree instead of GtkTree
because GtkCtree is faster, and GtkTree has limitation on its total row
height: since it must fit inside a GdkWindow, it is limited to 32,768
pixels of height. GtkTree is more flexible with regards to the types of
widgets that can be placed in the tree, but since we deal only with text,
that doesn't matter, at least for now.
Secondly, a GtkTree doesn't allow arrow-key navigation (at least as far
as I could tell). It always bothered me that the up and down arrow keys
worked in the packet list and in the hex dump, but no in the protocol tree.
GtkCTree does allow arrow-key navigation. In fact, GtkCTree is a subclass
of GtkCList (the packet list widget), so they behave a lot alike.
I went ahead and fixed the selection bar which has been bothering Richard
for a long time now. :) In the GUI preferences dialogue, you can now set
both the packet list selection bar and the protocol tree selection bar
to either "browse" or "select" mode. "browse" mode is what you're used to:
the arrow keys move an outline of the selection bar, but do not change
the selection. "select" mode does change the selection when the arrow keys
are pressed. The default behavior is set to "select", which seems more
natural for a first-time user.
svn path=/trunk/; revision=1393
1999-12-29 20:10:12 +00:00
|
|
|
/* Proto tree selection browseable */
|
2002-11-03 17:38:45 +00:00
|
|
|
ptree_browse_om = create_preference_option_menu(main_tb, pos++,
|
2003-07-18 20:55:11 +00:00
|
|
|
"Protocol tree selection mode:", NULL, selection_mode_vals,
|
2000-08-21 22:30:04 +00:00
|
|
|
prefs.gui_ptree_sel_browse);
|
2006-03-02 14:44:50 +00:00
|
|
|
gtk_tooltips_set_tip(tooltips, ptree_browse_om, "Choose to browse "
|
|
|
|
"or select.", NULL);
|
2008-04-11 16:04:54 +00:00
|
|
|
g_object_set_data(G_OBJECT(main_vb), PTREE_SEL_BROWSE_KEY, ptree_browse_om);
|
1999-12-30 23:02:56 +00:00
|
|
|
|
2001-12-31 04:41:50 +00:00
|
|
|
/* Geometry prefs */
|
2002-11-03 17:38:45 +00:00
|
|
|
save_position_cb = create_preference_check_button(main_tb, pos++,
|
2004-01-17 03:09:24 +00:00
|
|
|
"Save window position:", NULL, prefs.gui_geometry_save_position);
|
2006-03-02 14:44:50 +00:00
|
|
|
gtk_tooltips_set_tip(tooltips, save_position_cb, "Whether to save the "
|
|
|
|
"position of the main window.", NULL);
|
2008-04-11 16:04:54 +00:00
|
|
|
g_object_set_data(G_OBJECT(main_vb), GEOMETRY_POSITION_KEY, save_position_cb);
|
2002-08-28 21:04:11 +00:00
|
|
|
|
2002-11-03 17:38:45 +00:00
|
|
|
save_size_cb = create_preference_check_button(main_tb, pos++,
|
|
|
|
"Save window size:", NULL, prefs.gui_geometry_save_size);
|
2006-03-02 14:44:50 +00:00
|
|
|
gtk_tooltips_set_tip(tooltips, save_size_cb, "Whether to save the "
|
|
|
|
"size of the main window.", NULL);
|
2008-04-11 16:04:54 +00:00
|
|
|
g_object_set_data(G_OBJECT(main_vb), GEOMETRY_SIZE_KEY, save_size_cb);
|
2002-01-13 20:35:12 +00:00
|
|
|
|
2004-02-01 20:28:11 +00:00
|
|
|
save_maximized_cb = create_preference_check_button(main_tb, pos++,
|
|
|
|
"Save maximized state:", NULL, prefs.gui_geometry_save_maximized);
|
2006-03-02 14:44:50 +00:00
|
|
|
gtk_tooltips_set_tip(tooltips, save_maximized_cb, "Whether to save the "
|
2008-12-20 01:39:16 +00:00
|
|
|
"maximized state of the main window.", NULL);
|
2008-04-11 16:04:54 +00:00
|
|
|
g_object_set_data(G_OBJECT(main_vb), GEOMETRY_MAXIMIZED_KEY, save_maximized_cb);
|
2004-02-01 20:28:11 +00:00
|
|
|
|
2008-10-26 23:07:37 +00:00
|
|
|
#ifdef HAVE_IGE_MAC_INTEGRATION
|
|
|
|
macosx_style_cb = create_preference_check_button(main_tb, pos++,
|
|
|
|
"MacOS X style", NULL, prefs.gui_macosx_style);
|
|
|
|
gtk_tooltips_set_tip(tooltips, macosx_style_cb, "Whether to create a "
|
|
|
|
"MacOS X look and feel. Checking this box will move the menu bar to "
|
|
|
|
"the top of the screen instead of the top of the Wireshark window. "
|
|
|
|
"Requires a restart of Wireshark to take effect.", NULL);
|
|
|
|
g_object_set_data(G_OBJECT(main_vb), MACOSX_STYLE_KEY, macosx_style_cb);
|
|
|
|
#endif
|
|
|
|
|
2004-05-13 15:28:02 +00:00
|
|
|
#ifdef _WIN32
|
|
|
|
/* How the console window should be opened */
|
2006-03-02 14:44:50 +00:00
|
|
|
console_open_om = create_preference_option_menu(main_tb, pos++,
|
|
|
|
"Open a console window", NULL, gui_console_open_vals,
|
|
|
|
prefs.gui_console_open);
|
2006-05-06 12:57:54 +00:00
|
|
|
gtk_tooltips_set_tip(tooltips, console_open_om, "Whether to open a console window "
|
|
|
|
"(Automatic will open a console if messages appear).", NULL);
|
2008-04-11 16:04:54 +00:00
|
|
|
g_object_set_data(G_OBJECT(main_vb), GUI_CONSOLE_OPEN_KEY, console_open_om);
|
2004-05-13 15:28:02 +00:00
|
|
|
#endif
|
|
|
|
|
2003-11-11 05:09:03 +00:00
|
|
|
/* Allow user to select where they want the File Open dialog to open to
|
|
|
|
* by default */
|
|
|
|
fileopen_rb = create_preference_radio_buttons(main_tb, pos++,
|
2006-05-06 12:57:54 +00:00
|
|
|
"\"File Open\" dialog behavior:",
|
|
|
|
"Which directory the \"File Open\" dialog should start with.", gui_fileopen_vals,
|
2003-11-11 05:09:03 +00:00
|
|
|
prefs.gui_fileopen_style);
|
2003-12-29 00:48:56 +00:00
|
|
|
|
2003-11-11 05:09:03 +00:00
|
|
|
/* Directory to default File Open dialog to */
|
2004-02-24 18:39:13 +00:00
|
|
|
fileopen_dir_te = create_preference_entry(main_tb, pos++,
|
|
|
|
"Directory:", NULL, prefs.gui_fileopen_dir);
|
2006-05-06 12:57:54 +00:00
|
|
|
gtk_tooltips_set_tip(tooltips, fileopen_dir_te,
|
|
|
|
"The \"File Open\" dialog defaults always to this directory.", NULL);
|
2008-04-11 16:04:54 +00:00
|
|
|
g_object_set_data(G_OBJECT(main_vb), GUI_FILEOPEN_KEY, fileopen_rb);
|
|
|
|
g_object_set_data(G_OBJECT(main_vb), GUI_FILEOPEN_DIR_KEY, fileopen_dir_te);
|
2008-04-11 23:16:06 +00:00
|
|
|
g_signal_connect(fileopen_rb, "clicked", G_CALLBACK(fileopen_selected_cb), main_vb);
|
|
|
|
g_signal_connect(fileopen_dir_te, "focus-out-event",
|
2008-04-11 22:10:36 +00:00
|
|
|
G_CALLBACK(fileopen_dir_changed_cb), main_vb);
|
2003-11-11 05:09:03 +00:00
|
|
|
|
2004-08-31 09:22:57 +00:00
|
|
|
/* File Open dialog preview timeout */
|
|
|
|
fileopen_preview_te = create_preference_entry(main_tb, pos++,
|
|
|
|
"\"File Open\" preview timeout:", "Timeout, until preview gives up scanning the capture file content.", open_file_preview_str);
|
2009-03-19 17:49:11 +00:00
|
|
|
g_snprintf(current_val_str, sizeof(current_val_str), "%d", prefs.gui_fileopen_preview);
|
2004-08-31 09:22:57 +00:00
|
|
|
gtk_entry_set_text(GTK_ENTRY(fileopen_preview_te), current_val_str);
|
2006-05-06 12:57:54 +00:00
|
|
|
gtk_tooltips_set_tip(tooltips, fileopen_preview_te,
|
|
|
|
"Reading preview data in the \"File Open\" dialog will be stopped after given seconds.", NULL);
|
2008-04-11 16:04:54 +00:00
|
|
|
g_object_set_data(G_OBJECT(main_vb), GUI_FILEOPEN_PREVIEW_KEY, fileopen_preview_te);
|
2008-04-11 23:16:06 +00:00
|
|
|
g_signal_connect(fileopen_preview_te, "focus_out_event", G_CALLBACK(fileopen_preview_changed_cb), main_vb);
|
2004-08-31 09:22:57 +00:00
|
|
|
|
2008-08-08 19:41:35 +00:00
|
|
|
/* Number of recent entries in the display filter list ... */
|
|
|
|
recent_df_entries_max_te = create_preference_entry(main_tb, pos++,
|
|
|
|
"Filter display max. list entries:", "Maximum number of recent entries in filter display list", recent_df_entries_max_str);
|
2009-03-19 17:49:11 +00:00
|
|
|
g_snprintf(current_val_str, sizeof(current_val_str), "%d", prefs.gui_recent_df_entries_max);
|
2008-08-08 19:41:35 +00:00
|
|
|
gtk_entry_set_text(GTK_ENTRY(recent_df_entries_max_te), current_val_str);
|
|
|
|
g_object_set_data(G_OBJECT(main_vb), GUI_RECENT_DF_ENTRIES_KEY, recent_df_entries_max_te);
|
|
|
|
g_signal_connect(recent_df_entries_max_te, "focus_out_event", G_CALLBACK(recent_df_entries_changed_cb), main_vb);
|
|
|
|
|
2004-01-01 13:16:40 +00:00
|
|
|
/* Number of entries in the recent_files list ... */
|
|
|
|
recent_files_count_max_te = create_preference_entry(main_tb, pos++,
|
2004-02-24 18:39:13 +00:00
|
|
|
"\"Open Recent\" max. list entries:", "Maximum number of recent files", recent_files_count_max_str);
|
2009-03-19 17:49:11 +00:00
|
|
|
g_snprintf(current_val_str, sizeof(current_val_str), "%d", prefs.gui_recent_files_count_max);
|
2004-01-01 13:16:40 +00:00
|
|
|
gtk_entry_set_text(GTK_ENTRY(recent_files_count_max_te), current_val_str);
|
2006-05-06 12:57:54 +00:00
|
|
|
gtk_tooltips_set_tip(tooltips, recent_files_count_max_te,
|
|
|
|
"Maximum number of entries in the \"File/Open Recent\" list.", NULL);
|
2008-04-11 16:04:54 +00:00
|
|
|
g_object_set_data(G_OBJECT(main_vb), GUI_RECENT_FILES_COUNT_KEY, recent_files_count_max_te);
|
2008-04-11 23:16:06 +00:00
|
|
|
g_signal_connect(recent_files_count_max_te, "focus_out_event", G_CALLBACK(recent_files_count_changed_cb), main_vb);
|
2004-01-01 13:16:40 +00:00
|
|
|
|
2006-03-02 14:44:50 +00:00
|
|
|
fileopen_selected_cb(NULL, main_vb);
|
2000-08-22 14:04:52 +00:00
|
|
|
|
2006-03-02 14:44:50 +00:00
|
|
|
/* ask for unsaved capture files? */
|
2004-06-20 15:57:11 +00:00
|
|
|
ask_unsaved_cb = create_preference_check_button(main_tb, pos++,
|
|
|
|
"Ask for unsaved capture files:", NULL, prefs.gui_ask_unsaved);
|
2006-03-02 14:44:50 +00:00
|
|
|
gtk_tooltips_set_tip(tooltips, ask_unsaved_cb, "Whether a dialog should "
|
|
|
|
"pop up in case of an unsaved capture file.", NULL);
|
2008-04-11 16:04:54 +00:00
|
|
|
g_object_set_data(G_OBJECT(main_vb), GUI_ASK_UNSAVED_KEY, ask_unsaved_cb);
|
2004-06-20 15:57:11 +00:00
|
|
|
|
2006-03-02 14:44:50 +00:00
|
|
|
/* do we want to wrap when searching for data? */
|
2004-08-15 19:26:25 +00:00
|
|
|
find_wrap_cb = create_preference_check_button(main_tb, pos++,
|
|
|
|
"Wrap to end/beginning of file during a find:", NULL, prefs.gui_find_wrap);
|
2006-03-02 14:44:50 +00:00
|
|
|
gtk_tooltips_set_tip(tooltips, find_wrap_cb, "Whether a search should "
|
|
|
|
"wrap in a capture file.", NULL);
|
2008-04-11 16:04:54 +00:00
|
|
|
g_object_set_data(G_OBJECT(main_vb), GUI_FIND_WRAP_KEY, find_wrap_cb);
|
2004-08-15 19:26:25 +00:00
|
|
|
|
2006-10-03 19:53:10 +00:00
|
|
|
/* show an explicit Save button for settings dialogs (preferences and alike)? */
|
|
|
|
use_pref_save_cb = create_preference_check_button(main_tb, pos++,
|
|
|
|
"Settings dialogs show a save button:", NULL, prefs.gui_use_pref_save);
|
|
|
|
gtk_tooltips_set_tip(tooltips, use_pref_save_cb,
|
|
|
|
"Whether the various settings dialogs (e.g. Preferences) should "
|
|
|
|
"use an explicit save button - for advanced users.", NULL);
|
2008-04-11 16:04:54 +00:00
|
|
|
g_object_set_data(G_OBJECT(main_vb), GUI_USE_PREF_SAVE_KEY, use_pref_save_cb);
|
2006-10-03 19:53:10 +00:00
|
|
|
|
2008-10-14 18:18:21 +00:00
|
|
|
/* Show version in welcome screen */
|
|
|
|
show_version_cb = create_preference_check_button(main_tb, pos++,
|
|
|
|
"Welcome screen shows version:", NULL, prefs.gui_version_in_start_page );
|
|
|
|
gtk_tooltips_set_tip(tooltips, show_version_cb,
|
|
|
|
"Whether version should be shown in the start page or not", NULL);
|
|
|
|
g_object_set_data(G_OBJECT(main_vb), GUI_SHOW_VERSION_KEY, show_version_cb);
|
|
|
|
|
2004-06-29 17:10:53 +00:00
|
|
|
/* Webbrowser */
|
2006-03-02 14:44:50 +00:00
|
|
|
if (browser_needs_pref()) {
|
2004-06-29 17:10:53 +00:00
|
|
|
webbrowser_te = create_preference_entry(main_tb, pos++,
|
|
|
|
"Web browser command:", NULL, prefs.gui_webbrowser);
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(webbrowser_te), prefs.gui_webbrowser);
|
2006-03-02 14:44:50 +00:00
|
|
|
gtk_tooltips_set_tip(tooltips, webbrowser_te, "Command line to "
|
|
|
|
"desired browser.", NULL);
|
2008-04-11 16:04:54 +00:00
|
|
|
g_object_set_data(G_OBJECT(main_vb), GUI_WEBBROWSER_KEY, webbrowser_te);
|
2006-03-02 14:44:50 +00:00
|
|
|
}
|
2004-06-20 15:57:11 +00:00
|
|
|
|
1999-12-16 06:20:18 +00:00
|
|
|
/* Show 'em what we got */
|
|
|
|
gtk_widget_show_all(main_vb);
|
|
|
|
|
|
|
|
return(main_vb);
|
|
|
|
}
|
|
|
|
|
2004-01-17 00:26:22 +00:00
|
|
|
|
|
|
|
/* Create a font widget for browsing. */
|
|
|
|
GtkWidget *
|
|
|
|
gui_font_prefs_show(void)
|
Instead of having the normal-weight and bold fonts set separately,
generate the name of the boldface font from the Roman font; if the two
fonts don't have the same widths, the display will look weird when a
field is selected, and it's a bit of a pain for the user to have to
select *two* fonts.
On UNIX/X, default to
"-*-fixed-medium-r-semicondensed-*-*-120-*-*-*-*-*-" rather than to
"-*-lucidatypewriter-medium-r-normal-*-*-120-*-*-*-*-iso8859-1" - some
Linux distributions appear to lack the Lucida typewriter font.
Add a "gui.font_name" preference to the preferences file, specifying the
normal-weight font to use. Have it settable from the "GUI" tab in the
Preferences dialog box - the "Font..." button, when clicked, pops up a
font selection dialog box.
If we either can't open the selected font or the boldfaced version of
the font, default to "6x13" and "6x13bold" as fallbacks - the former
will probably be "fixed", and the latter would be "fixedbold" if X
actually created such an alias, but it doesn't so we use "6x13bold"
instead.
svn path=/trunk/; revision=2304
2000-08-20 07:53:45 +00:00
|
|
|
{
|
2004-05-27 16:50:16 +00:00
|
|
|
/* Create the font selection widget. */
|
2004-01-17 00:26:22 +00:00
|
|
|
font_browse_w = (GtkWidget *) gtk_font_selection_new();
|
2004-01-17 03:09:24 +00:00
|
|
|
gtk_widget_show(font_browse_w);
|
Instead of having the normal-weight and bold fonts set separately,
generate the name of the boldface font from the Roman font; if the two
fonts don't have the same widths, the display will look weird when a
field is selected, and it's a bit of a pain for the user to have to
select *two* fonts.
On UNIX/X, default to
"-*-fixed-medium-r-semicondensed-*-*-120-*-*-*-*-*-" rather than to
"-*-lucidatypewriter-medium-r-normal-*-*-120-*-*-*-*-iso8859-1" - some
Linux distributions appear to lack the Lucida typewriter font.
Add a "gui.font_name" preference to the preferences file, specifying the
normal-weight font to use. Have it settable from the "GUI" tab in the
Preferences dialog box - the "Font..." button, when clicked, pops up a
font selection dialog box.
If we either can't open the selected font or the boldfaced version of
the font, default to "6x13" and "6x13bold" as fallbacks - the former
will probably be "fixed", and the latter would be "fixedbold" if X
actually created such an alias, but it doesn't so we use "6x13bold"
instead.
svn path=/trunk/; revision=2304
2000-08-20 07:53:45 +00:00
|
|
|
|
2004-01-17 03:09:24 +00:00
|
|
|
return font_browse_w;
|
Instead of having the normal-weight and bold fonts set separately,
generate the name of the boldface font from the Roman font; if the two
fonts don't have the same widths, the display will look weird when a
field is selected, and it's a bit of a pain for the user to have to
select *two* fonts.
On UNIX/X, default to
"-*-fixed-medium-r-semicondensed-*-*-120-*-*-*-*-*-" rather than to
"-*-lucidatypewriter-medium-r-normal-*-*-120-*-*-*-*-iso8859-1" - some
Linux distributions appear to lack the Lucida typewriter font.
Add a "gui.font_name" preference to the preferences file, specifying the
normal-weight font to use. Have it settable from the "GUI" tab in the
Preferences dialog box - the "Font..." button, when clicked, pops up a
font selection dialog box.
If we either can't open the selected font or the boldfaced version of
the font, default to "6x13" and "6x13bold" as fallbacks - the former
will probably be "fixed", and the latter would be "fixedbold" if X
actually created such an alias, but it doesn't so we use "6x13bold"
instead.
svn path=/trunk/; revision=2304
2000-08-20 07:53:45 +00:00
|
|
|
}
|
|
|
|
|
2004-01-17 00:26:22 +00:00
|
|
|
|
2004-01-17 03:09:24 +00:00
|
|
|
static gboolean
|
2004-01-17 00:26:22 +00:00
|
|
|
font_fetch(void)
|
Instead of having the normal-weight and bold fonts set separately,
generate the name of the boldface font from the Roman font; if the two
fonts don't have the same widths, the display will look weird when a
field is selected, and it's a bit of a pain for the user to have to
select *two* fonts.
On UNIX/X, default to
"-*-fixed-medium-r-semicondensed-*-*-120-*-*-*-*-*-" rather than to
"-*-lucidatypewriter-medium-r-normal-*-*-120-*-*-*-*-iso8859-1" - some
Linux distributions appear to lack the Lucida typewriter font.
Add a "gui.font_name" preference to the preferences file, specifying the
normal-weight font to use. Have it settable from the "GUI" tab in the
Preferences dialog box - the "Font..." button, when clicked, pops up a
font selection dialog box.
If we either can't open the selected font or the boldfaced version of
the font, default to "6x13" and "6x13bold" as fallbacks - the former
will probably be "fixed", and the latter would be "fixedbold" if X
actually created such an alias, but it doesn't so we use "6x13bold"
instead.
svn path=/trunk/; revision=2304
2000-08-20 07:53:45 +00:00
|
|
|
{
|
2002-11-03 17:38:45 +00:00
|
|
|
gchar *font_name;
|
2000-09-09 10:35:53 +00:00
|
|
|
|
2004-01-17 00:26:22 +00:00
|
|
|
font_name = g_strdup(gtk_font_selection_get_font_name(
|
|
|
|
GTK_FONT_SELECTION(font_browse_w)));
|
2000-10-09 06:28:49 +00:00
|
|
|
if (font_name == NULL) {
|
2000-10-09 06:38:36 +00:00
|
|
|
/* No font was selected; let the user know, but don't
|
|
|
|
tear down the font selection dialog, so they can
|
|
|
|
try again. */
|
2004-02-12 22:24:28 +00:00
|
|
|
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
|
2000-10-09 06:28:49 +00:00
|
|
|
"You have not selected a font.");
|
2004-01-17 03:09:24 +00:00
|
|
|
return FALSE;
|
2000-10-09 06:28:49 +00:00
|
|
|
}
|
Instead of having the normal-weight and bold fonts set separately,
generate the name of the boldface font from the Roman font; if the two
fonts don't have the same widths, the display will look weird when a
field is selected, and it's a bit of a pain for the user to have to
select *two* fonts.
On UNIX/X, default to
"-*-fixed-medium-r-semicondensed-*-*-120-*-*-*-*-*-" rather than to
"-*-lucidatypewriter-medium-r-normal-*-*-120-*-*-*-*-iso8859-1" - some
Linux distributions appear to lack the Lucida typewriter font.
Add a "gui.font_name" preference to the preferences file, specifying the
normal-weight font to use. Have it settable from the "GUI" tab in the
Preferences dialog box - the "Font..." button, when clicked, pops up a
font selection dialog box.
If we either can't open the selected font or the boldfaced version of
the font, default to "6x13" and "6x13bold" as fallbacks - the former
will probably be "fixed", and the latter would be "fixedbold" if X
actually created such an alias, but it doesn't so we use "6x13bold"
instead.
svn path=/trunk/; revision=2304
2000-08-20 07:53:45 +00:00
|
|
|
|
2004-07-14 08:04:39 +00:00
|
|
|
if (!user_font_test(font_name)) {
|
|
|
|
/* The font isn't usable; "user_font_test()" has already
|
|
|
|
told the user why. Don't tear down the font selection
|
|
|
|
dialog. */
|
|
|
|
g_free(font_name);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
new_font_name = font_name;
|
2004-01-17 03:09:24 +00:00
|
|
|
return TRUE;
|
Instead of having the normal-weight and bold fonts set separately,
generate the name of the boldface font from the Roman font; if the two
fonts don't have the same widths, the display will look weird when a
field is selected, and it's a bit of a pain for the user to have to
select *two* fonts.
On UNIX/X, default to
"-*-fixed-medium-r-semicondensed-*-*-120-*-*-*-*-*-" rather than to
"-*-lucidatypewriter-medium-r-normal-*-*-120-*-*-*-*-iso8859-1" - some
Linux distributions appear to lack the Lucida typewriter font.
Add a "gui.font_name" preference to the preferences file, specifying the
normal-weight font to use. Have it settable from the "GUI" tab in the
Preferences dialog box - the "Font..." button, when clicked, pops up a
font selection dialog box.
If we either can't open the selected font or the boldfaced version of
the font, default to "6x13" and "6x13bold" as fallbacks - the former
will probably be "fixed", and the latter would be "fixedbold" if X
actually created such an alias, but it doesn't so we use "6x13bold"
instead.
svn path=/trunk/; revision=2304
2000-08-20 07:53:45 +00:00
|
|
|
}
|
|
|
|
|
1999-12-30 23:02:56 +00:00
|
|
|
|
2000-08-21 22:30:04 +00:00
|
|
|
static gint
|
2000-11-18 21:41:40 +00:00
|
|
|
fetch_enum_value(gpointer control, const enum_val_t *enumvals)
|
2000-08-21 22:30:04 +00:00
|
|
|
{
|
2002-01-13 20:35:12 +00:00
|
|
|
return fetch_preference_option_menu_val(GTK_WIDGET(control), enumvals);
|
2000-08-21 22:30:04 +00:00
|
|
|
}
|
|
|
|
|
1999-12-16 06:20:18 +00:00
|
|
|
void
|
Instead of each set of built-in preferences having "ok", "save",
"cancel", and "delete" methods, give them:
"fetch" - fetch from the notebook tab any values not already
stored in "prefs", and store them there, but doesn't apply them;
"apply" - apply the settings in "prefs";
"destroy" - clean up any windows created from the tab.
As we no longer have "cancel" methods, we don't have per-preference code
to revert preference values; instead, we have the common preference
dialog box code make a copy of all the current preferences, and, when
the "Cancel" button is clicked, free the current preferences and copy
the saved preferences to it, and apply the preferences.
Add an "Apply" button to the preference dialog box, which applies the
current preferences without closing the dialog box.
Treat a request to delete the preferences dialog box as equivalent to
clicking "Cancel".
Have a "remember_ptree_widget()" routine to remember all protocol tree
widgets, and use the list of those widgets when we set GUI preferences
for the protocol tree widgets, rather than setting the main protocol
tree widget and then using the list of packet windows. Move that code
out of "main.c" to "proto_draw.c", as it's not used by anything in
"main.c", but is used by stuff in "proto_draw.c".
Make the font one of the preferences we can set on the fly for protocol
tree widgets. Also make it something we can set on the fly for the
packet list widget.
svn path=/trunk/; revision=2316
2000-08-21 08:09:17 +00:00
|
|
|
gui_prefs_fetch(GtkWidget *w)
|
1999-12-16 06:20:18 +00:00
|
|
|
{
|
2000-08-21 22:30:04 +00:00
|
|
|
prefs.gui_plist_sel_browse = fetch_enum_value(
|
2008-04-11 16:04:54 +00:00
|
|
|
g_object_get_data(G_OBJECT(w), PLIST_SEL_BROWSE_KEY), selection_mode_vals);
|
2000-08-21 22:30:04 +00:00
|
|
|
prefs.gui_ptree_sel_browse = fetch_enum_value(
|
2008-04-11 16:04:54 +00:00
|
|
|
g_object_get_data(G_OBJECT(w), PTREE_SEL_BROWSE_KEY), selection_mode_vals);
|
2002-08-28 21:04:11 +00:00
|
|
|
prefs.gui_geometry_save_position =
|
2008-04-11 16:04:54 +00:00
|
|
|
gtk_toggle_button_get_active(g_object_get_data(G_OBJECT(w), GEOMETRY_POSITION_KEY));
|
2002-08-28 21:04:11 +00:00
|
|
|
prefs.gui_geometry_save_size =
|
2008-04-11 16:04:54 +00:00
|
|
|
gtk_toggle_button_get_active(g_object_get_data(G_OBJECT(w), GEOMETRY_SIZE_KEY));
|
2004-02-01 20:28:11 +00:00
|
|
|
prefs.gui_geometry_save_maximized =
|
2008-04-11 16:04:54 +00:00
|
|
|
gtk_toggle_button_get_active(g_object_get_data(G_OBJECT(w), GEOMETRY_MAXIMIZED_KEY));
|
2008-08-09 16:14:34 +00:00
|
|
|
|
2008-10-26 23:07:37 +00:00
|
|
|
#ifdef HAVE_IGE_MAC_INTEGRATION
|
|
|
|
prefs.gui_macosx_style =
|
|
|
|
gtk_toggle_button_get_active(g_object_get_data(G_OBJECT(w), MACOSX_STYLE_KEY));
|
|
|
|
#endif
|
|
|
|
|
2004-05-13 15:28:02 +00:00
|
|
|
#ifdef _WIN32
|
|
|
|
prefs.gui_console_open = fetch_enum_value(
|
2008-04-11 16:04:54 +00:00
|
|
|
g_object_get_data(G_OBJECT(w), GUI_CONSOLE_OPEN_KEY), gui_console_open_vals);
|
2004-05-13 15:28:02 +00:00
|
|
|
#endif
|
2004-01-17 03:09:24 +00:00
|
|
|
prefs.gui_fileopen_style = fetch_preference_radio_buttons_val(
|
2008-04-11 16:04:54 +00:00
|
|
|
g_object_get_data(G_OBJECT(w), GUI_FILEOPEN_KEY), gui_fileopen_vals);
|
2006-03-02 14:44:50 +00:00
|
|
|
|
2009-03-13 22:06:48 +00:00
|
|
|
g_free(prefs.gui_fileopen_dir);
|
2004-01-17 03:09:24 +00:00
|
|
|
prefs.gui_fileopen_dir = g_strdup(gtk_entry_get_text(
|
2008-04-11 16:04:54 +00:00
|
|
|
GTK_ENTRY(g_object_get_data(G_OBJECT(w), GUI_FILEOPEN_DIR_KEY))));
|
2004-01-17 03:09:24 +00:00
|
|
|
|
2009-04-08 19:47:09 +00:00
|
|
|
prefs.gui_ask_unsaved =
|
|
|
|
gtk_toggle_button_get_active(g_object_get_data(G_OBJECT(w), GUI_ASK_UNSAVED_KEY));
|
2004-06-20 15:57:11 +00:00
|
|
|
|
2009-04-08 19:47:09 +00:00
|
|
|
prefs.gui_find_wrap =
|
|
|
|
gtk_toggle_button_get_active(g_object_get_data(G_OBJECT(w), GUI_FIND_WRAP_KEY));
|
2006-03-02 14:44:50 +00:00
|
|
|
|
2009-04-08 19:47:09 +00:00
|
|
|
prefs.gui_use_pref_save =
|
|
|
|
gtk_toggle_button_get_active(g_object_get_data(G_OBJECT(w), GUI_USE_PREF_SAVE_KEY));
|
2006-10-03 19:53:10 +00:00
|
|
|
|
2008-10-14 18:18:21 +00:00
|
|
|
prefs.gui_version_in_start_page =
|
2009-04-08 19:47:09 +00:00
|
|
|
gtk_toggle_button_get_active(g_object_get_data(G_OBJECT(w), GUI_SHOW_VERSION_KEY));
|
2008-10-14 18:18:21 +00:00
|
|
|
|
2009-04-08 19:47:09 +00:00
|
|
|
if (browser_needs_pref()) {
|
2004-06-29 17:10:53 +00:00
|
|
|
g_free(prefs.gui_webbrowser);
|
2009-04-08 19:47:09 +00:00
|
|
|
prefs.gui_webbrowser = g_strdup(gtk_entry_get_text(
|
|
|
|
GTK_ENTRY(g_object_get_data(G_OBJECT(w), GUI_WEBBROWSER_KEY))));
|
|
|
|
}
|
2004-01-17 03:09:24 +00:00
|
|
|
/*
|
|
|
|
* XXX - we need to have a way to fetch the preferences into
|
|
|
|
* local storage and only set the permanent preferences if there
|
|
|
|
* weren't any errors in those fetches, as there are several
|
|
|
|
* places where there *can* be a bad preference value.
|
|
|
|
*/
|
|
|
|
if (font_fetch()) {
|
2008-04-08 04:47:32 +00:00
|
|
|
if (strcmp(new_font_name, prefs.gui_font_name) != 0) {
|
2004-01-17 03:09:24 +00:00
|
|
|
font_changed = TRUE;
|
2009-03-13 22:06:48 +00:00
|
|
|
g_free(prefs.gui_font_name);
|
2008-04-08 04:47:32 +00:00
|
|
|
prefs.gui_font_name = g_strdup(new_font_name);
|
2004-01-17 03:09:24 +00:00
|
|
|
}
|
2000-09-09 10:35:53 +00:00
|
|
|
}
|
1999-12-16 06:20:18 +00:00
|
|
|
}
|
|
|
|
|
2004-01-20 18:47:25 +00:00
|
|
|
|
|
|
|
|
1999-12-16 06:20:18 +00:00
|
|
|
void
|
2007-11-21 18:56:05 +00:00
|
|
|
gui_prefs_apply(GtkWidget *w _U_ , gboolean redissect)
|
1999-12-16 06:20:18 +00:00
|
|
|
{
|
2000-08-23 16:15:13 +00:00
|
|
|
|
2004-05-13 15:28:02 +00:00
|
|
|
#ifdef _WIN32
|
2009-04-08 19:47:09 +00:00
|
|
|
/* user immediately wants to see a console */
|
|
|
|
if (prefs.gui_console_open == console_open_always) {
|
|
|
|
create_console();
|
|
|
|
}
|
2004-05-13 15:28:02 +00:00
|
|
|
#endif
|
|
|
|
|
2004-01-23 20:13:23 +00:00
|
|
|
if (font_changed) {
|
|
|
|
/* This redraws the hex dump windows. */
|
2008-08-09 16:14:34 +00:00
|
|
|
switch (user_font_apply()) {
|
2004-01-24 01:02:54 +00:00
|
|
|
|
|
|
|
case FA_SUCCESS:
|
|
|
|
break;
|
|
|
|
|
|
|
|
case FA_FONT_NOT_RESIZEABLE:
|
2004-06-17 16:35:26 +00:00
|
|
|
/* "user_font_apply()" popped up an alert box. */
|
2004-01-24 01:02:54 +00:00
|
|
|
/* turn off zooming - font can't be resized */
|
|
|
|
recent.gui_zoom_level = 0;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case FA_FONT_NOT_AVAILABLE:
|
|
|
|
/* We assume this means that the specified size
|
|
|
|
isn't available. */
|
2004-01-31 03:22:42 +00:00
|
|
|
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
|
2004-04-29 16:35:15 +00:00
|
|
|
"That font isn't available at the specified zoom level;\n"
|
2004-01-24 01:02:54 +00:00
|
|
|
"turning zooming off.");
|
|
|
|
recent.gui_zoom_level = 0;
|
|
|
|
break;
|
|
|
|
}
|
2007-11-21 18:56:05 +00:00
|
|
|
} else if (!redissect) {
|
2004-01-23 20:13:23 +00:00
|
|
|
/* Redraw the hex dump windows, in case the
|
2007-11-21 18:56:05 +00:00
|
|
|
highlight style changed, only if we aren't redissecting the whole file.
|
2004-01-23 20:13:23 +00:00
|
|
|
XXX - do it only if the highlight style *did* change. */
|
|
|
|
redraw_hex_dump_all();
|
Instead of each set of built-in preferences having "ok", "save",
"cancel", and "delete" methods, give them:
"fetch" - fetch from the notebook tab any values not already
stored in "prefs", and store them there, but doesn't apply them;
"apply" - apply the settings in "prefs";
"destroy" - clean up any windows created from the tab.
As we no longer have "cancel" methods, we don't have per-preference code
to revert preference values; instead, we have the common preference
dialog box code make a copy of all the current preferences, and, when
the "Cancel" button is clicked, free the current preferences and copy
the saved preferences to it, and apply the preferences.
Add an "Apply" button to the preference dialog box, which applies the
current preferences without closing the dialog box.
Treat a request to delete the preferences dialog box as equivalent to
clicking "Cancel".
Have a "remember_ptree_widget()" routine to remember all protocol tree
widgets, and use the list of those widgets when we set GUI preferences
for the protocol tree widgets, rather than setting the main protocol
tree widget and then using the list of packet windows. Move that code
out of "main.c" to "proto_draw.c", as it's not used by anything in
"main.c", but is used by stuff in "proto_draw.c".
Make the font one of the preferences we can set on the fly for protocol
tree widgets. Also make it something we can set on the fly for the
packet list widget.
svn path=/trunk/; revision=2316
2000-08-21 08:09:17 +00:00
|
|
|
}
|
Changed the protocol tree widget from a GtkTree to a GtkCTree. The two reasons
I did this:
First, Havoc Pennington, in "GTK+/Gnome Application Development", in
Appendix seciton A.3.88, recommends using GtkCTree instead of GtkTree
because GtkCtree is faster, and GtkTree has limitation on its total row
height: since it must fit inside a GdkWindow, it is limited to 32,768
pixels of height. GtkTree is more flexible with regards to the types of
widgets that can be placed in the tree, but since we deal only with text,
that doesn't matter, at least for now.
Secondly, a GtkTree doesn't allow arrow-key navigation (at least as far
as I could tell). It always bothered me that the up and down arrow keys
worked in the packet list and in the hex dump, but no in the protocol tree.
GtkCTree does allow arrow-key navigation. In fact, GtkCTree is a subclass
of GtkCList (the packet list widget), so they behave a lot alike.
I went ahead and fixed the selection bar which has been bothering Richard
for a long time now. :) In the GUI preferences dialogue, you can now set
both the packet list selection bar and the protocol tree selection bar
to either "browse" or "select" mode. "browse" mode is what you're used to:
the arrow keys move an outline of the selection bar, but do not change
the selection. "select" mode does change the selection when the arrow keys
are pressed. The default behavior is set to "select", which seems more
natural for a first-time user.
svn path=/trunk/; revision=1393
1999-12-29 20:10:12 +00:00
|
|
|
|
2003-11-19 00:10:25 +00:00
|
|
|
/* Redraw the help window(s). */
|
|
|
|
supported_redraw();
|
2000-09-08 10:59:21 +00:00
|
|
|
help_redraw();
|
|
|
|
|
2003-10-16 21:19:12 +00:00
|
|
|
/* XXX: redraw the toolbar only, if style changed */
|
|
|
|
toolbar_redraw_all();
|
2007-06-04 20:15:10 +00:00
|
|
|
|
2002-01-11 07:40:32 +00:00
|
|
|
set_scrollbar_placement_all();
|
2007-06-04 20:15:10 +00:00
|
|
|
packet_list_set_sel_browse(prefs.gui_plist_sel_browse, FALSE);
|
2000-02-29 06:24:41 +00:00
|
|
|
set_ptree_sel_browse_all(prefs.gui_ptree_sel_browse);
|
2002-11-03 17:38:45 +00:00
|
|
|
set_tree_styles_all();
|
2006-03-02 14:44:50 +00:00
|
|
|
main_widgets_rearrange();
|
1999-12-16 06:20:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2004-01-17 03:09:24 +00:00
|
|
|
gui_prefs_destroy(GtkWidget *w _U_)
|
1999-12-16 06:20:18 +00:00
|
|
|
{
|
2000-09-09 10:35:53 +00:00
|
|
|
/* Free up any saved font name. */
|
2001-04-17 18:49:55 +00:00
|
|
|
if (new_font_name != NULL) {
|
2000-09-09 10:35:53 +00:00
|
|
|
g_free(new_font_name);
|
2001-04-17 18:49:55 +00:00
|
|
|
new_font_name = NULL;
|
|
|
|
}
|
2000-08-22 14:04:52 +00:00
|
|
|
}
|
|
|
|
|
2008-08-08 19:41:35 +00:00
|
|
|
static gint
|
|
|
|
recent_df_entries_changed_cb(GtkWidget *recent_df_entry _U_,
|
|
|
|
GdkEvent *event _U_, gpointer parent_w)
|
|
|
|
{
|
2009-04-08 19:47:09 +00:00
|
|
|
GtkWidget *recent_df_entries_count_te;
|
|
|
|
guint newval;
|
2008-08-08 19:41:35 +00:00
|
|
|
|
2009-04-08 19:47:09 +00:00
|
|
|
recent_df_entries_count_te = (GtkWidget *)g_object_get_data(G_OBJECT(parent_w), GUI_RECENT_DF_ENTRIES_KEY);
|
2008-08-08 19:41:35 +00:00
|
|
|
|
2009-04-08 19:47:09 +00:00
|
|
|
/*
|
|
|
|
* Now, just convert the string to a number and store it in the prefs
|
|
|
|
* filed ...
|
|
|
|
*/
|
2008-08-08 19:41:35 +00:00
|
|
|
|
2009-04-08 19:47:09 +00:00
|
|
|
newval = strtol(gtk_entry_get_text (GTK_ENTRY(recent_df_entries_count_te)), NULL, 10);
|
2008-08-08 19:41:35 +00:00
|
|
|
|
2009-04-08 19:47:09 +00:00
|
|
|
if (newval > 0) {
|
|
|
|
prefs.gui_recent_df_entries_max = newval;
|
|
|
|
}
|
2008-08-08 19:41:35 +00:00
|
|
|
|
2009-04-08 19:47:09 +00:00
|
|
|
/* We really should pop up a nasty dialog box if newval <= 0 */
|
2008-08-08 19:41:35 +00:00
|
|
|
|
2009-04-08 19:47:09 +00:00
|
|
|
return FALSE;
|
2008-08-08 19:41:35 +00:00
|
|
|
}
|
2000-08-22 14:04:52 +00:00
|
|
|
|
2003-12-29 00:48:56 +00:00
|
|
|
static gint
|
|
|
|
recent_files_count_changed_cb(GtkWidget *recent_files_entry _U_,
|
|
|
|
GdkEvent *event _U_, gpointer parent_w)
|
|
|
|
{
|
2009-04-08 19:47:09 +00:00
|
|
|
GtkWidget *recent_files_count_te;
|
|
|
|
guint newval;
|
2003-12-29 00:48:56 +00:00
|
|
|
|
2009-04-08 19:47:09 +00:00
|
|
|
recent_files_count_te = (GtkWidget *)g_object_get_data(G_OBJECT(parent_w), GUI_RECENT_FILES_COUNT_KEY);
|
2003-12-29 00:48:56 +00:00
|
|
|
|
2009-04-08 19:47:09 +00:00
|
|
|
/*
|
|
|
|
* Now, just convert the string to a number and store it in the prefs
|
|
|
|
* filed ...
|
|
|
|
*/
|
2003-12-29 00:48:56 +00:00
|
|
|
|
2009-04-08 19:47:09 +00:00
|
|
|
newval = strtol(gtk_entry_get_text (GTK_ENTRY(recent_files_count_te)), NULL, 10);
|
2003-12-29 00:48:56 +00:00
|
|
|
|
2009-04-08 19:47:09 +00:00
|
|
|
if (newval > 0) {
|
|
|
|
prefs.gui_recent_files_count_max = newval;
|
|
|
|
}
|
2003-12-29 00:48:56 +00:00
|
|
|
|
2009-04-08 19:47:09 +00:00
|
|
|
/* We really should pop up a nasty dialog box if newval <= 0 */
|
2003-12-29 00:48:56 +00:00
|
|
|
|
2009-04-08 19:47:09 +00:00
|
|
|
return FALSE;
|
2003-12-29 00:48:56 +00:00
|
|
|
}
|
|
|
|
|
2004-08-31 09:22:57 +00:00
|
|
|
static gint
|
|
|
|
fileopen_preview_changed_cb(GtkWidget *recent_files_entry _U_,
|
|
|
|
GdkEvent *event _U_, gpointer parent_w)
|
|
|
|
{
|
2009-04-08 19:47:09 +00:00
|
|
|
GtkWidget *fileopen_preview_te;
|
|
|
|
guint newval;
|
2004-08-31 09:22:57 +00:00
|
|
|
|
2009-04-08 19:47:09 +00:00
|
|
|
fileopen_preview_te = (GtkWidget *)g_object_get_data(G_OBJECT(parent_w), GUI_FILEOPEN_PREVIEW_KEY);
|
2004-08-31 09:22:57 +00:00
|
|
|
|
2009-04-08 19:47:09 +00:00
|
|
|
/*
|
|
|
|
* Now, just convert the string to a number and store it in the prefs
|
|
|
|
* filed ...
|
|
|
|
*/
|
2004-08-31 09:22:57 +00:00
|
|
|
|
2009-04-08 19:47:09 +00:00
|
|
|
newval = strtol(gtk_entry_get_text (GTK_ENTRY(fileopen_preview_te)), NULL, 10);
|
2004-08-31 09:22:57 +00:00
|
|
|
|
2009-04-08 19:47:09 +00:00
|
|
|
if (newval > 0) {
|
|
|
|
prefs.gui_fileopen_preview = newval;
|
|
|
|
}
|
2004-08-31 09:22:57 +00:00
|
|
|
|
2009-04-08 19:47:09 +00:00
|
|
|
/* We really should pop up a nasty dialog box if newval <= 0 */
|
2004-08-31 09:22:57 +00:00
|
|
|
|
2009-04-08 19:47:09 +00:00
|
|
|
return FALSE;
|
2004-08-31 09:22:57 +00:00
|
|
|
}
|
|
|
|
|
2003-10-14 23:20:17 +00:00
|
|
|
static gint
|
|
|
|
fileopen_dir_changed_cb(GtkWidget *fileopen_entry _U_, GdkEvent *event _U_, gpointer parent_w)
|
|
|
|
{
|
2009-04-08 19:47:09 +00:00
|
|
|
GtkWidget *fileopen_dir_te;
|
|
|
|
char *lastchar;
|
|
|
|
gint fileopen_dir_te_length;
|
2003-10-14 23:20:17 +00:00
|
|
|
|
2009-04-08 19:47:09 +00:00
|
|
|
fileopen_dir_te = (GtkWidget *)g_object_get_data(G_OBJECT(parent_w), GUI_FILEOPEN_DIR_KEY);
|
2009-04-16 00:45:26 +00:00
|
|
|
fileopen_dir_te_length = (gint) strlen(gtk_entry_get_text (GTK_ENTRY(fileopen_entry)));
|
2009-04-08 19:47:09 +00:00
|
|
|
if (fileopen_dir_te_length == 0)
|
|
|
|
return FALSE;
|
|
|
|
lastchar = gtk_editable_get_chars(GTK_EDITABLE(fileopen_entry), fileopen_dir_te_length-1, -1);
|
|
|
|
if (strcmp(lastchar, G_DIR_SEPARATOR_S) != 0)
|
|
|
|
gtk_entry_append_text(GTK_ENTRY(fileopen_entry), G_DIR_SEPARATOR_S);
|
|
|
|
return FALSE;
|
2003-10-14 23:20:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
fileopen_selected_cb(GtkWidget *mybutton_rb _U_, gpointer parent_w)
|
|
|
|
{
|
2009-04-08 19:47:09 +00:00
|
|
|
GtkWidget *fileopen_rb, *fileopen_dir_te;
|
2003-10-14 23:20:17 +00:00
|
|
|
|
2009-04-08 19:47:09 +00:00
|
|
|
fileopen_rb = (GtkWidget *)g_object_get_data(G_OBJECT(parent_w), GUI_FILEOPEN_KEY);
|
|
|
|
fileopen_dir_te = (GtkWidget *)g_object_get_data(G_OBJECT(parent_w), GUI_FILEOPEN_DIR_KEY);
|
2003-10-14 23:20:17 +00:00
|
|
|
|
2009-04-08 19:47:09 +00:00
|
|
|
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(fileopen_rb)))
|
|
|
|
{
|
|
|
|
gtk_widget_set_sensitive(GTK_WIDGET(fileopen_dir_te), TRUE);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
gtk_widget_set_sensitive(GTK_WIDGET(fileopen_dir_te), FALSE);
|
|
|
|
}
|
|
|
|
return;
|
2003-10-14 23:20:17 +00:00
|
|
|
}
|
2004-12-02 11:30:24 +00:00
|
|
|
|