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
|
2012-06-28 22:56:06 +00:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
1999-12-16 06:20:18 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "config.h"
|
2013-12-03 22:16:49 +00:00
|
|
|
|
|
|
|
#include <stdlib.h>
|
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
|
|
|
|
2013-04-01 00:21:44 +00:00
|
|
|
#include "cfile.h"
|
|
|
|
|
2012-01-18 19:38:34 +00:00
|
|
|
#include "ui/recent.h"
|
2008-04-13 01:54:20 +00:00
|
|
|
|
2012-01-15 21:59:11 +00:00
|
|
|
#include "ui/gtk/prefs_gui.h"
|
|
|
|
#include "ui/gtk/gtkglobals.h"
|
|
|
|
#include "ui/gtk/help_dlg.h"
|
|
|
|
#include "ui/gtk/supported_protos_dlg.h"
|
|
|
|
#include "ui/gtk/prefs_dlg.h"
|
2012-06-03 18:35:34 +00:00
|
|
|
#include "ui/gtk/main_titlebar.h"
|
2012-01-15 21:59:11 +00:00
|
|
|
#include "ui/gtk/gui_utils.h"
|
|
|
|
#include "ui/gtk/dlg_utils.h"
|
|
|
|
#include "ui/gtk/main.h"
|
2012-09-04 01:57:36 +00:00
|
|
|
#include "ui/gtk/packet_list.h"
|
2012-06-16 20:52:04 +00:00
|
|
|
#include "ui/gtk/packet_panes.h"
|
2012-01-15 21:59:11 +00:00
|
|
|
#include "ui/gtk/main_toolbar.h"
|
|
|
|
#include "ui/gtk/font_utils.h"
|
|
|
|
#include "ui/gtk/webbrowser.h"
|
|
|
|
#include "ui/gtk/main_welcome.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);
|
2011-05-19 19:22:49 +00:00
|
|
|
static gboolean fileopen_dir_changed_cb(GtkWidget *myentry, GdkEvent *event _U_, gpointer parent_w _U_);
|
2010-07-30 12:41:56 +00:00
|
|
|
static gboolean 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);
|
2010-08-30 16:10:01 +00:00
|
|
|
static gboolean recent_files_count_changed_cb(GtkWidget *recent_files_entry _U_,
|
2010-07-30 12:41:56 +00:00
|
|
|
GdkEvent *event _U_, gpointer parent_w);
|
|
|
|
static gboolean recent_df_entries_changed_cb(GtkWidget *recent_df_entry _U_,
|
|
|
|
GdkEvent *event _U_, gpointer parent_w);
|
2011-08-16 10:57:52 +00:00
|
|
|
static gint scroll_percent_changed_cb(GtkWidget *recent_df_entry _U_,
|
|
|
|
GdkEvent *event _U_, gpointer parent_w);
|
2001-12-31 04:41:50 +00:00
|
|
|
#define GEOMETRY_POSITION_KEY "geometry_position"
|
2010-07-30 12:41:56 +00:00
|
|
|
#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
|
|
|
|
2013-04-07 17:59:44 +00:00
|
|
|
#if defined(HAVE_IGE_MAC_INTEGRATION) || defined(HAVE_GTKOSXAPPLICATION)
|
2010-07-30 12:41:56 +00:00
|
|
|
#define MACOSX_STYLE_KEY "macosx_style"
|
2013-04-07 17:59:44 +00:00
|
|
|
#endif
|
2008-10-26 23:07:37 +00:00
|
|
|
|
2013-04-07 17:59:44 +00:00
|
|
|
#ifdef _WIN32
|
2009-09-25 05:19:18 +00:00
|
|
|
#define GUI_CONSOLE_OPEN_KEY "console_open"
|
2013-04-07 17:59:44 +00:00
|
|
|
#define ENABLE_UPDATE_KEY "enable_update"
|
|
|
|
#endif
|
|
|
|
|
2010-07-30 12:41:56 +00:00
|
|
|
#define GUI_FILEOPEN_KEY "fileopen_behavior"
|
2009-09-25 05:19:18 +00:00
|
|
|
#define GUI_FILEOPEN_PREVIEW_KEY "fileopen_preview_timeout"
|
|
|
|
#define GUI_RECENT_FILES_COUNT_KEY "recent_files_count"
|
|
|
|
#define GUI_RECENT_DF_ENTRIES_KEY "recent_display_filter_entries"
|
|
|
|
#define GUI_FILEOPEN_DIR_KEY "fileopen_directory"
|
2010-07-30 12:41:56 +00:00
|
|
|
#define GUI_ASK_UNSAVED_KEY "ask_unsaved"
|
|
|
|
#define GUI_WEBBROWSER_KEY "webbrowser"
|
|
|
|
#define GUI_FIND_WRAP_KEY "find_wrap"
|
2009-09-25 05:19:18 +00:00
|
|
|
#define GUI_USE_PREF_SAVE_KEY "use_pref_save"
|
|
|
|
#define GUI_SHOW_VERSION_KEY "show_version"
|
2011-08-08 15:27:59 +00:00
|
|
|
#define GUI_EXPERT_EYECANDY_KEY "expert_eyecandy"
|
2011-08-16 10:57:52 +00:00
|
|
|
#define GUI_AUTO_SCROLL_KEY "auto_scroll_on_expand"
|
|
|
|
#define GUI_SCROLL_PERCENT_KEY "scroll_percent_on_expand"
|
2013-11-07 07:43:11 +00:00
|
|
|
#define GUI_PACKET_EDITOR "packet_editor"
|
2003-10-16 21:19:12 +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_ = {
|
2011-05-19 19:22:49 +00:00
|
|
|
{ "FALSE", "Bold", FALSE },
|
|
|
|
{ "TRUE", "Inverse", TRUE },
|
2004-05-24 02:25:21 +00:00
|
|
|
{ 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_ = {
|
2011-05-19 19:22:49 +00:00
|
|
|
{ "ICONS", "Icons only", TB_STYLE_ICONS },
|
|
|
|
{ "TEXT", "Text only", TB_STYLE_TEXT },
|
|
|
|
{ "BOTH", "Icons & Text", TB_STYLE_BOTH },
|
2004-05-24 02:25:21 +00:00
|
|
|
{ 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
|
|
|
|
|
2012-07-31 07:27:39 +00:00
|
|
|
static const enum_val_t gui_version_placement_vals[] = {
|
|
|
|
{ "WELCOME", "Welcome only", version_welcome_only },
|
|
|
|
{ "TITLE", "Title only", version_title_only },
|
|
|
|
{ "BOTH", "Both", version_both },
|
|
|
|
{ "NEITHER", "Neither", version_neither },
|
|
|
|
{ NULL, NULL, 0 }
|
|
|
|
};
|
|
|
|
|
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
|
|
|
};
|
|
|
|
|
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] = "";
|
|
|
|
|
2011-08-16 10:57:52 +00:00
|
|
|
/* Used to contain the string from the Auto Scroll Percentage pref item */
|
|
|
|
static char scroll_percent_preview_str[128] = "";
|
|
|
|
|
1999-12-16 06:20:18 +00:00
|
|
|
GtkWidget*
|
|
|
|
gui_prefs_show(void)
|
|
|
|
{
|
2013-01-24 21:21:51 +00:00
|
|
|
GtkWidget *main_grid, *main_vb;
|
2004-05-13 15:28:02 +00:00
|
|
|
#ifdef _WIN32
|
2013-04-07 17:59:44 +00:00
|
|
|
GtkWidget *console_open_om, *enable_update_cb;
|
2004-05-13 15:28:02 +00:00
|
|
|
#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;
|
2012-07-31 07:27:39 +00:00
|
|
|
GtkWidget *show_version_om;
|
2011-08-16 10:57:52 +00:00
|
|
|
GtkWidget *auto_scroll_cb, *scroll_percent_te;
|
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;
|
2010-05-25 00:35:44 +00:00
|
|
|
#if defined(HAVE_IGE_MAC_INTEGRATION) || defined(HAVE_GTKOSXAPPLICATION)
|
2008-10-26 23:07:37 +00:00
|
|
|
GtkWidget *macosx_style_cb;
|
2008-10-27 00:18:43 +00:00
|
|
|
#endif
|
2011-08-08 15:27:59 +00:00
|
|
|
GtkWidget *expert_info_eyecandy_cb;
|
2013-11-07 07:43:11 +00:00
|
|
|
GtkWidget *packet_editor_cb;
|
2006-03-02 14:44:50 +00:00
|
|
|
|
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
|
|
|
|
2007-06-04 20:15:10 +00:00
|
|
|
/* The columns haven't been changed yet */
|
2012-09-03 15:12:49 +00:00
|
|
|
cfile.columns_changed = FALSE;
|
2007-06-04 20:15:10 +00:00
|
|
|
|
1999-12-16 06:20:18 +00:00
|
|
|
/* Main vertical box */
|
2012-04-21 16:40:14 +00:00
|
|
|
main_vb = ws_gtk_box_new(GTK_ORIENTATION_VERTICAL, 7, FALSE);
|
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
|
|
|
|
2013-01-24 21:21:51 +00:00
|
|
|
/* Main grid */
|
|
|
|
main_grid = ws_gtk_grid_new();
|
|
|
|
gtk_box_pack_start(GTK_BOX(main_vb), main_grid, FALSE, FALSE, 0);
|
2013-03-13 20:25:28 +00:00
|
|
|
#if GTK_CHECK_VERSION(3,0,0)
|
2013-03-13 20:04:48 +00:00
|
|
|
gtk_widget_set_vexpand(GTK_WIDGET(main_grid), FALSE); /* Ignore VEXPAND requests from children */
|
2013-03-13 20:25:28 +00:00
|
|
|
#endif
|
2013-01-24 21:21:51 +00:00
|
|
|
ws_gtk_grid_set_row_spacing(GTK_GRID(main_grid), 10);
|
|
|
|
ws_gtk_grid_set_column_spacing(GTK_GRID(main_grid), 15);
|
1999-12-30 23:02:56 +00:00
|
|
|
|
2001-12-31 04:41:50 +00:00
|
|
|
/* Geometry prefs */
|
2013-01-24 21:21:51 +00:00
|
|
|
save_position_cb = create_preference_check_button(main_grid, pos++,
|
2010-08-30 16:10:01 +00:00
|
|
|
"Save window position:",
|
2013-04-07 17:59:44 +00:00
|
|
|
"Save the position of the main window.",
|
2009-06-16 21:04:43 +00:00
|
|
|
prefs.gui_geometry_save_position);
|
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
|
|
|
|
2013-01-24 21:21:51 +00:00
|
|
|
save_size_cb = create_preference_check_button(main_grid, pos++,
|
2010-08-30 16:10:01 +00:00
|
|
|
"Save window size:",
|
2013-04-07 17:59:44 +00:00
|
|
|
"Save the size of the main window.",
|
2009-06-16 21:04:43 +00:00
|
|
|
prefs.gui_geometry_save_size);
|
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
|
|
|
|
2013-01-24 21:21:51 +00:00
|
|
|
save_maximized_cb = create_preference_check_button(main_grid, pos++,
|
2010-08-30 16:10:01 +00:00
|
|
|
"Save maximized state:",
|
2013-04-07 17:59:44 +00:00
|
|
|
"Save the maximized state of the main window.",
|
2009-06-16 21:04:43 +00:00
|
|
|
prefs.gui_geometry_save_maximized);
|
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
|
|
|
|
2013-04-07 17:59:44 +00:00
|
|
|
#ifdef _WIN32
|
|
|
|
enable_update_cb = create_preference_check_button(main_grid, pos++,
|
2013-04-07 18:06:19 +00:00
|
|
|
"Check for updates:",
|
2013-04-07 17:59:44 +00:00
|
|
|
"Periodically check for new versions of Wireshark.",
|
|
|
|
prefs.gui_update_enabled);
|
|
|
|
g_object_set_data(G_OBJECT(main_vb), ENABLE_UPDATE_KEY, enable_update_cb);
|
|
|
|
#endif
|
|
|
|
|
2010-05-25 00:35:44 +00:00
|
|
|
#if defined(HAVE_IGE_MAC_INTEGRATION) || defined(HAVE_GTKOSXAPPLICATION)
|
2013-01-24 21:21:51 +00:00
|
|
|
macosx_style_cb = create_preference_check_button(main_grid, pos++,
|
2010-08-30 16:10:01 +00:00
|
|
|
"Mac OS X style",
|
2013-04-07 17:59:44 +00:00
|
|
|
"Create a Mac OS X look and feel. Checking this box will move the "
|
2009-06-16 21:04:43 +00:00
|
|
|
"menu bar to the top of the screen instead of the top of the Wireshark window. "
|
|
|
|
"Requires a restart of Wireshark to take effect.",
|
|
|
|
prefs.gui_macosx_style);
|
2008-10-26 23:07:37 +00:00
|
|
|
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 */
|
2013-01-24 21:21:51 +00:00
|
|
|
console_open_om = create_preference_option_menu(main_grid, pos++,
|
2010-08-30 16:10:01 +00:00
|
|
|
"Open a console window",
|
2009-06-16 21:04:43 +00:00
|
|
|
"Whether to open a console window "
|
|
|
|
"(Automatic will open a console if messages appear).",
|
|
|
|
gui_console_open_vals, prefs.gui_console_open);
|
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 */
|
2013-01-24 21:21:51 +00:00
|
|
|
fileopen_rb = create_preference_radio_buttons(main_grid, pos++,
|
2010-08-30 16:10:01 +00:00
|
|
|
"\"File Open\" dialog behavior:",
|
|
|
|
"Which directory the \"File Open\" dialog should start with.",
|
2009-06-16 21:04:43 +00:00
|
|
|
gui_fileopen_vals, 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 */
|
2013-01-24 21:21:51 +00:00
|
|
|
fileopen_dir_te = create_preference_entry(main_grid, pos++,
|
2010-08-30 16:10:01 +00:00
|
|
|
"Directory:",
|
2009-06-16 21:04:43 +00:00
|
|
|
"The \"File Open\" dialog defaults always to this directory.",
|
|
|
|
prefs.gui_fileopen_dir);
|
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 */
|
2013-01-24 21:21:51 +00:00
|
|
|
fileopen_preview_te = create_preference_entry(main_grid, pos++,
|
2010-08-30 16:10:01 +00:00
|
|
|
"\"File Open\" preview timeout:",
|
2009-06-16 21:04:43 +00:00
|
|
|
"Reading preview data in the \"File Open\" dialog will be stopped after given seconds.",
|
|
|
|
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);
|
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 ... */
|
2013-01-24 21:21:51 +00:00
|
|
|
recent_df_entries_max_te = create_preference_entry(main_grid, pos++,
|
2013-01-19 00:57:57 +00:00
|
|
|
"Maximum recent filters:",
|
2009-06-16 21:04:43 +00:00
|
|
|
"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 ... */
|
2013-01-24 21:21:51 +00:00
|
|
|
recent_files_count_max_te = create_preference_entry(main_grid, pos++,
|
2013-01-19 00:57:57 +00:00
|
|
|
"Maximum recent files:",
|
2009-06-16 21:04:43 +00:00
|
|
|
"Maximum number of entries in the \"File/Open Recent\" list.",
|
|
|
|
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);
|
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? */
|
2013-01-24 21:21:51 +00:00
|
|
|
ask_unsaved_cb = create_preference_check_button(main_grid, pos++,
|
2013-01-19 00:57:57 +00:00
|
|
|
"Confirm unsaved capture files:",
|
2009-06-16 21:04:43 +00:00
|
|
|
"Whether a dialog should pop up in case of an unsaved capture file.",
|
|
|
|
prefs.gui_ask_unsaved);
|
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? */
|
2013-01-24 21:21:51 +00:00
|
|
|
find_wrap_cb = create_preference_check_button(main_grid, pos++,
|
2010-08-30 16:10:01 +00:00
|
|
|
"Wrap to end/beginning of file during a find:",
|
2009-06-16 21:04:43 +00:00
|
|
|
"Whether a search should wrap in a capture file.",
|
|
|
|
prefs.gui_find_wrap);
|
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)? */
|
2013-01-24 21:21:51 +00:00
|
|
|
use_pref_save_cb = create_preference_check_button(main_grid, pos++,
|
2009-06-16 21:04:43 +00:00
|
|
|
"Settings dialogs show a save button:",
|
|
|
|
"Whether the various settings dialogs (e.g. Preferences) should "
|
|
|
|
"use an explicit save button - for advanced users.",
|
|
|
|
prefs.gui_use_pref_save);
|
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
|
|
|
|
2012-07-31 07:27:39 +00:00
|
|
|
/* Show version in welcome and/or title screen */
|
2013-01-24 21:21:51 +00:00
|
|
|
show_version_om = create_preference_option_menu(main_grid, pos++,
|
2012-07-31 07:27:39 +00:00
|
|
|
"Welcome screen and title bar shows version",
|
|
|
|
"Whether version should be shown in the start page and/or main screen's title bar.",
|
|
|
|
gui_version_placement_vals, prefs.gui_version_placement);
|
|
|
|
g_object_set_data(G_OBJECT(main_vb), GUI_SHOW_VERSION_KEY, show_version_om);
|
2008-10-14 18:18:21 +00:00
|
|
|
|
2011-08-16 10:57:52 +00:00
|
|
|
/* Whether to auto scroll when expanding items */
|
2013-01-24 21:21:51 +00:00
|
|
|
auto_scroll_cb = create_preference_check_button(main_grid, pos++,
|
2011-08-16 10:57:52 +00:00
|
|
|
"Auto scroll on expansion:",
|
|
|
|
"Whether the details view should be automatically scrolled up when expanding an item.",
|
|
|
|
prefs.gui_auto_scroll_on_expand );
|
|
|
|
g_object_set_data(G_OBJECT(main_vb), GUI_AUTO_SCROLL_KEY, auto_scroll_cb);
|
|
|
|
|
|
|
|
/* Where to auto scroll to when expanding items */
|
2013-01-24 21:21:51 +00:00
|
|
|
scroll_percent_te = create_preference_entry(main_grid, pos++,
|
2011-08-16 10:57:52 +00:00
|
|
|
"Auto scroll percentage:",
|
|
|
|
"Where to scroll the expanded item to within the view e.g. 0% = top of view, 50% = center of view.",
|
|
|
|
scroll_percent_preview_str);
|
|
|
|
g_snprintf(current_val_str, sizeof(current_val_str), "%d", prefs.gui_auto_scroll_percentage);
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(scroll_percent_te), current_val_str);
|
|
|
|
g_object_set_data(G_OBJECT(main_vb), GUI_SCROLL_PERCENT_KEY, scroll_percent_te);
|
|
|
|
g_signal_connect(scroll_percent_te, "focus_out_event", G_CALLBACK(scroll_percent_changed_cb), main_vb);
|
|
|
|
|
2004-06-29 17:10:53 +00:00
|
|
|
/* Webbrowser */
|
2006-03-02 14:44:50 +00:00
|
|
|
if (browser_needs_pref()) {
|
2013-01-24 21:21:51 +00:00
|
|
|
webbrowser_te = create_preference_entry(main_grid, pos++,
|
2011-05-19 19:22:49 +00:00
|
|
|
"Web browser command:",
|
|
|
|
"Command line to desired browser.",
|
|
|
|
prefs.gui_webbrowser);
|
2004-06-29 17:10:53 +00:00
|
|
|
gtk_entry_set_text(GTK_ENTRY(webbrowser_te), prefs.gui_webbrowser);
|
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
|
|
|
|
2011-08-08 15:27:59 +00:00
|
|
|
/* Enable Expert Infos Dialog Tab Label "eye-candy" */
|
2013-01-24 21:21:51 +00:00
|
|
|
expert_info_eyecandy_cb = create_preference_check_button(main_grid, pos++,
|
2012-09-22 17:02:34 +00:00
|
|
|
"Display icons in the Expert Infos dialog tab labels:",
|
|
|
|
"Whether icon images should be displayed in the Expert Infos dialog tab labels.",
|
2011-08-08 15:27:59 +00:00
|
|
|
prefs.gui_expert_composite_eyecandy );
|
|
|
|
g_object_set_data(G_OBJECT(main_vb), GUI_EXPERT_EYECANDY_KEY, expert_info_eyecandy_cb);
|
|
|
|
|
2013-11-07 07:43:11 +00:00
|
|
|
/* Enable Experimental Packet Editor */
|
|
|
|
packet_editor_cb = create_preference_check_button(main_grid, pos++,
|
|
|
|
"Enable Packet Editor (Experimental):",
|
|
|
|
"Activate Packet Editor (Experimental)",
|
|
|
|
prefs.gui_packet_editor);
|
|
|
|
g_object_set_data(G_OBJECT(main_vb), GUI_PACKET_EDITOR, packet_editor_cb);
|
|
|
|
|
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
|
|
|
|
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
|
|
|
{
|
2002-08-28 21:04:11 +00:00
|
|
|
prefs.gui_geometry_save_position =
|
2013-03-07 07:48:33 +00:00
|
|
|
gtk_toggle_button_get_active((GtkToggleButton *)g_object_get_data(G_OBJECT(w), GEOMETRY_POSITION_KEY));
|
2002-08-28 21:04:11 +00:00
|
|
|
prefs.gui_geometry_save_size =
|
2013-03-07 07:48:33 +00:00
|
|
|
gtk_toggle_button_get_active((GtkToggleButton *)g_object_get_data(G_OBJECT(w), GEOMETRY_SIZE_KEY));
|
2004-02-01 20:28:11 +00:00
|
|
|
prefs.gui_geometry_save_maximized =
|
2013-03-07 07:48:33 +00:00
|
|
|
gtk_toggle_button_get_active((GtkToggleButton *)g_object_get_data(G_OBJECT(w), GEOMETRY_MAXIMIZED_KEY));
|
2008-08-09 16:14:34 +00:00
|
|
|
|
2013-04-07 17:59:44 +00:00
|
|
|
#ifdef _WIN32
|
|
|
|
prefs.gui_update_enabled =
|
|
|
|
gtk_toggle_button_get_active((GtkToggleButton *)g_object_get_data(G_OBJECT(w), ENABLE_UPDATE_KEY));
|
|
|
|
#endif
|
|
|
|
|
2010-05-25 00:35:44 +00:00
|
|
|
#if defined(HAVE_IGE_MAC_INTEGRATION) || defined(HAVE_GTKOSXAPPLICATION)
|
2008-10-26 23:07:37 +00:00
|
|
|
prefs.gui_macosx_style =
|
2013-03-07 07:48:33 +00:00
|
|
|
gtk_toggle_button_get_active((GtkToggleButton *)g_object_get_data(G_OBJECT(w), MACOSX_STYLE_KEY));
|
2008-10-26 23:07:37 +00:00
|
|
|
#endif
|
|
|
|
|
2004-05-13 15:28:02 +00:00
|
|
|
#ifdef _WIN32
|
|
|
|
prefs.gui_console_open = fetch_enum_value(
|
2011-05-19 19:22:49 +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(
|
2013-03-07 07:48:33 +00:00
|
|
|
(GtkWidget *)g_object_get_data(G_OBJECT(w), GUI_FILEOPEN_KEY), gui_fileopen_vals);
|
2010-08-30 16:10:01 +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(
|
2011-05-19 19:22:49 +00:00
|
|
|
GTK_ENTRY(g_object_get_data(G_OBJECT(w), GUI_FILEOPEN_DIR_KEY))));
|
2004-01-17 03:09:24 +00:00
|
|
|
|
2010-08-30 16:10:01 +00:00
|
|
|
prefs.gui_ask_unsaved =
|
2013-03-07 07:48:33 +00:00
|
|
|
gtk_toggle_button_get_active((GtkToggleButton *)g_object_get_data(G_OBJECT(w), GUI_ASK_UNSAVED_KEY));
|
2004-06-20 15:57:11 +00:00
|
|
|
|
2010-08-30 16:10:01 +00:00
|
|
|
prefs.gui_find_wrap =
|
2013-03-07 07:48:33 +00:00
|
|
|
gtk_toggle_button_get_active((GtkToggleButton *)g_object_get_data(G_OBJECT(w), GUI_FIND_WRAP_KEY));
|
2006-03-02 14:44:50 +00:00
|
|
|
|
2010-08-30 16:10:01 +00:00
|
|
|
prefs.gui_use_pref_save =
|
2013-03-07 07:48:33 +00:00
|
|
|
gtk_toggle_button_get_active((GtkToggleButton *)g_object_get_data(G_OBJECT(w), GUI_USE_PREF_SAVE_KEY));
|
2006-10-03 19:53:10 +00:00
|
|
|
|
2013-03-21 02:29:09 +00:00
|
|
|
prefs.gui_version_placement = (version_info_e)
|
2013-01-24 21:21:51 +00:00
|
|
|
fetch_enum_value(g_object_get_data(G_OBJECT(w), GUI_SHOW_VERSION_KEY), gui_version_placement_vals);
|
2008-10-14 18:18:21 +00:00
|
|
|
|
2013-01-03 01:02:30 +00:00
|
|
|
prefs.gui_auto_scroll_on_expand =
|
2013-03-07 07:48:33 +00:00
|
|
|
gtk_toggle_button_get_active((GtkToggleButton *)g_object_get_data(G_OBJECT(w), GUI_AUTO_SCROLL_KEY));
|
2011-08-16 10:57:52 +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))));
|
|
|
|
}
|
2011-08-08 15:27:59 +00:00
|
|
|
|
|
|
|
prefs.gui_expert_composite_eyecandy =
|
2013-03-07 07:48:33 +00:00
|
|
|
gtk_toggle_button_get_active((GtkToggleButton *)g_object_get_data(G_OBJECT(w), GUI_EXPERT_EYECANDY_KEY));
|
2011-08-08 15:27:59 +00:00
|
|
|
|
2013-11-07 07:43:11 +00:00
|
|
|
prefs.gui_packet_editor =
|
|
|
|
gtk_toggle_button_get_active((GtkToggleButton *)g_object_get_data(G_OBJECT(w), GUI_PACKET_EDITOR));
|
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
|
2013-01-03 01:02:30 +00:00
|
|
|
gui_prefs_apply(GtkWidget *w _U_)
|
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
|
|
|
|
|
2010-08-07 14:37:37 +00:00
|
|
|
/* Redisplay the main window's title */
|
2012-06-03 18:35:34 +00:00
|
|
|
main_titlebar_update();
|
2010-08-07 14:37:37 +00:00
|
|
|
|
2013-01-03 01:02:30 +00:00
|
|
|
/* Redisplay the default welcome header message in case the "show
|
2010-12-03 22:19:58 +00:00
|
|
|
* version" option was changed. */
|
|
|
|
welcome_header_set_message(NULL);
|
|
|
|
|
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-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-08-22 14:04:52 +00:00
|
|
|
}
|
|
|
|
|
2010-07-30 12:41:56 +00:00
|
|
|
static gboolean
|
2008-08-08 19:41:35 +00:00
|
|
|
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
|
|
|
|
2012-12-26 05:57:06 +00:00
|
|
|
newval = (guint)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
|
|
|
|
2010-08-23 15:58:48 +00:00
|
|
|
static gboolean
|
2010-08-30 16:10:01 +00:00
|
|
|
recent_files_count_changed_cb(GtkWidget *recent_files_entry _U_,
|
2003-12-29 00:48:56 +00:00
|
|
|
GdkEvent *event _U_, gpointer parent_w)
|
|
|
|
{
|
2009-04-08 19:47:09 +00:00
|
|
|
GtkWidget *recent_files_count_te;
|
|
|
|
guint newval;
|
2010-08-30 16:10:01 +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
|
|
|
|
2012-12-26 05:57:06 +00:00
|
|
|
newval = (guint)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
|
|
|
}
|
|
|
|
|
2010-07-30 12:41:56 +00:00
|
|
|
static gboolean
|
2010-08-30 16:10:01 +00:00
|
|
|
fileopen_preview_changed_cb(GtkWidget *recent_files_entry _U_,
|
2004-08-31 09:22:57 +00:00
|
|
|
GdkEvent *event _U_, gpointer parent_w)
|
|
|
|
{
|
2009-04-08 19:47:09 +00:00
|
|
|
GtkWidget *fileopen_preview_te;
|
|
|
|
guint newval;
|
2010-08-30 16:10:01 +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
|
|
|
|
2012-12-26 05:57:06 +00:00
|
|
|
newval = (guint)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
|
|
|
}
|
|
|
|
|
2010-07-30 12:41:56 +00:00
|
|
|
static gboolean
|
2011-05-19 19:22:49 +00:00
|
|
|
fileopen_dir_changed_cb(GtkWidget *fileopen_dir_te, GdkEvent *event _U_, gpointer parent_w _U_)
|
2003-10-14 23:20:17 +00:00
|
|
|
{
|
2009-04-08 19:47:09 +00:00
|
|
|
char *lastchar;
|
|
|
|
gint fileopen_dir_te_length;
|
2010-08-30 16:10:01 +00:00
|
|
|
|
2011-05-19 19:22:49 +00:00
|
|
|
fileopen_dir_te_length = (gint) strlen(gtk_entry_get_text (GTK_ENTRY(fileopen_dir_te)));
|
2009-04-08 19:47:09 +00:00
|
|
|
if (fileopen_dir_te_length == 0)
|
|
|
|
return FALSE;
|
2011-05-19 19:22:49 +00:00
|
|
|
lastchar = gtk_editable_get_chars(GTK_EDITABLE(fileopen_dir_te), fileopen_dir_te_length-1, -1);
|
2009-09-08 14:41:25 +00:00
|
|
|
if (strcmp(lastchar, G_DIR_SEPARATOR_S) != 0){
|
2011-05-19 19:22:49 +00:00
|
|
|
gtk_editable_insert_text(GTK_EDITABLE(fileopen_dir_te), G_DIR_SEPARATOR_S,
|
|
|
|
1, /* new_text_length */
|
|
|
|
&fileopen_dir_te_length); /* *position */
|
2009-09-08 14:41:25 +00:00
|
|
|
}
|
2009-04-08 19:47:09 +00:00
|
|
|
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;
|
2010-08-30 16:10:01 +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);
|
2010-08-30 16:10:01 +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
|
|
|
|
2011-08-16 10:57:52 +00:00
|
|
|
static gboolean
|
2013-01-03 01:02:30 +00:00
|
|
|
scroll_percent_changed_cb(GtkWidget *recent_files_entry _U_,
|
2011-08-16 10:57:52 +00:00
|
|
|
GdkEvent *event _U_, gpointer parent_w)
|
|
|
|
{
|
2013-01-24 21:21:51 +00:00
|
|
|
GtkWidget *scroll_percent_te;
|
|
|
|
guint newval;
|
2011-08-16 10:57:52 +00:00
|
|
|
|
2013-01-24 21:21:51 +00:00
|
|
|
scroll_percent_te = (GtkWidget*)g_object_get_data(G_OBJECT(parent_w), GUI_SCROLL_PERCENT_KEY);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Now, just convert the string to a number and store it in the prefs field ...
|
|
|
|
*/
|
2011-08-16 10:57:52 +00:00
|
|
|
|
2013-01-24 21:21:51 +00:00
|
|
|
newval = (guint)strtol(gtk_entry_get_text(GTK_ENTRY(scroll_percent_te)), NULL, 10);
|
2011-08-16 10:57:52 +00:00
|
|
|
|
2013-01-24 21:21:51 +00:00
|
|
|
if (newval <= 100) {
|
|
|
|
prefs.gui_auto_scroll_percentage = newval;
|
|
|
|
}
|
2013-01-03 01:02:30 +00:00
|
|
|
|
2013-01-24 21:21:51 +00:00
|
|
|
if (newval <= 100) {
|
|
|
|
prefs.gui_auto_scroll_percentage = newval;
|
|
|
|
}
|
2011-08-16 10:57:52 +00:00
|
|
|
|
2013-01-24 21:21:51 +00:00
|
|
|
/* We really should pop up a dialog box is newval < 0 or > 100 */
|
|
|
|
return FALSE;
|
2011-08-16 10:57:52 +00:00
|
|
|
}
|
2013-03-13 20:04:48 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Editor modelines - http://www.wireshark.org/tools/modelines.html
|
|
|
|
*
|
|
|
|
* Local variables:
|
|
|
|
* c-basic-offset: 8
|
|
|
|
* tab-width: 8
|
|
|
|
* indent-tabs-mode: t
|
|
|
|
* End:
|
|
|
|
*
|
|
|
|
* vi: set shiftwidth=8 tabstop=8 noexpandtab:
|
|
|
|
* :indentSize=8:tabSize=8:noTabs=false:
|
|
|
|
*/
|