aboutsummaryrefslogtreecommitdiffstats
path: root/gtk/recent.c
diff options
context:
space:
mode:
authorStig Bjørlykke <stig@bjorlykke.org>2008-01-14 16:40:23 +0000
committerStig Bjørlykke <stig@bjorlykke.org>2008-01-14 16:40:23 +0000
commita2d1e9005dc447486e14903f5d53d5ee8d6d725f (patch)
tree78bc861dc4a2907a73ee807f8893914875221a25 /gtk/recent.c
parente189eb88870cf39f5785918b56d2284e14f36f0c (diff)
downloadwireshark-a2d1e9005dc447486e14903f5d53d5ee8d6d725f.tar.gz
wireshark-a2d1e9005dc447486e14903f5d53d5ee8d6d725f.tar.bz2
wireshark-a2d1e9005dc447486e14903f5d53d5ee8d6d725f.zip
This patch adds support for configuration profiles, which can be used to
configure and use more than one set of preferences and configuration files. This can be found in the "Configuration Profiles..." menu item from the Edit menu, or by pressing Shift-Ctrl-A. It's also possible to start wireshark and tshark with a named profile by using the "-C ProfileName" option. A new status pane in the main window will show the current profile. The configuration files currently stored in the Profiles are: - Preferences - Capture Filters - Display Filters - Coloring Rules - Disabled Protocols - User Accessible Tables The recent data are by design not added to the profile. Planned future enhancements: - make a more convenient function to switch between profiles - add a "clone profile" button to copy an existing profile - make the profiles list active and accept return as OK - save users "Decode as" in the profile - make new, clone and deletion of profiles more secure - make some of the recent values available in the profile This patch also fixes: - setting default status pane sizes - a bug setting status pane for packets when not having main lower pane. svn path=/trunk/; revision=24089
Diffstat (limited to 'gtk/recent.c')
-rw-r--r--gtk/recent.c37
1 files changed, 27 insertions, 10 deletions
diff --git a/gtk/recent.c b/gtk/recent.c
index 913812094d..7f0dfe46ea 100644
--- a/gtk/recent.c
+++ b/gtk/recent.c
@@ -72,7 +72,8 @@
#define RECENT_GUI_GEOMETRY_MAIN_MAXIMIZED "gui.geometry_main_maximized"
#define RECENT_GUI_GEOMETRY_MAIN_UPPER_PANE "gui.geometry_main_upper_pane"
#define RECENT_GUI_GEOMETRY_MAIN_LOWER_PANE "gui.geometry_main_lower_pane"
-#define RECENT_GUI_GEOMETRY_STATUS_PANE "gui.geometry_status_pane"
+#define RECENT_GUI_GEOMETRY_STATUS_PANE_LEFT "gui.geometry_status_pane"
+#define RECENT_GUI_GEOMETRY_STATUS_PANE_RIGHT "gui.geometry_status_pane_right"
#define RECENT_GUI_FILEOPEN_REMEMBERED_DIR "gui.fileopen_remembered_dir"
#define RECENT_GUI_GEOMETRY "gui.geom."
#define RECENT_KEY_PRIVS_WARN_IF_ELEVATED "privs.warn_if_elevated"
@@ -133,7 +134,7 @@ write_recent(void)
return FALSE;
}
- rf_path = get_persconffile_path(RECENT_FILE_NAME, TRUE);
+ rf_path = get_persconffile_path(RECENT_FILE_NAME, FALSE, TRUE);
if ((rf = eth_fopen(rf_path, "w")) == NULL) {
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
"Can't open recent file\n\"%s\": %s.", rf_path,
@@ -259,9 +260,16 @@ write_recent(void)
fprintf(rf, "\n# Statusbar left pane size.\n");
fprintf(rf, "# (GTK1: has no effect here, command line -o usage only).\n");
fprintf(rf, "# Decimal number.\n");
- if (recent.gui_geometry_status_pane != 0) {
- fprintf(rf, RECENT_GUI_GEOMETRY_STATUS_PANE ": %d\n",
- recent.gui_geometry_status_pane);
+ if (recent.gui_geometry_status_pane_left != 0) {
+ fprintf(rf, RECENT_GUI_GEOMETRY_STATUS_PANE_LEFT ": %d\n",
+ recent.gui_geometry_status_pane_left);
+ }
+ fprintf(rf, "\n# Statusbar middle pane size.\n");
+ fprintf(rf, "# (GTK1: has no effect here, command line -o usage only).\n");
+ fprintf(rf, "# Decimal number.\n");
+ if (recent.gui_geometry_status_pane_right != 0) {
+ fprintf(rf, RECENT_GUI_GEOMETRY_STATUS_PANE_RIGHT ": %d\n",
+ recent.gui_geometry_status_pane_right);
}
fprintf(rf, "\n# Warn if running with elevated permissions (e.g. as root).\n");
@@ -446,13 +454,21 @@ read_set_recent_pair_static(gchar *key, gchar *value, void *private_data _U_)
return PREFS_SET_SYNTAX_ERR; /* number must be positive */
recent.gui_geometry_main_lower_pane = num;
recent.has_gui_geometry_main_lower_pane = TRUE;
- } else if (strcmp(key, RECENT_GUI_GEOMETRY_STATUS_PANE) == 0) {
+ } else if (strcmp(key, RECENT_GUI_GEOMETRY_STATUS_PANE_RIGHT) == 0) {
+ num = strtol(value, &p, 0);
+ if (p == value || *p != '\0')
+ return PREFS_SET_SYNTAX_ERR; /* number was bad */
+ if (num <= 0)
+ return PREFS_SET_SYNTAX_ERR; /* number must be positive */
+ recent.gui_geometry_status_pane_right = num;
+ recent.has_gui_geometry_status_pane = TRUE;
+ } else if (strcmp(key, RECENT_GUI_GEOMETRY_STATUS_PANE_LEFT) == 0) {
num = strtol(value, &p, 0);
if (p == value || *p != '\0')
return PREFS_SET_SYNTAX_ERR; /* number was bad */
if (num <= 0)
return PREFS_SET_SYNTAX_ERR; /* number must be positive */
- recent.gui_geometry_status_pane = num;
+ recent.gui_geometry_status_pane_left = num;
recent.has_gui_geometry_status_pane = TRUE;
} else if (strcmp(key, RECENT_GUI_FILEOPEN_REMEMBERED_DIR) == 0) {
if(u3_active())
@@ -580,7 +596,8 @@ recent_read_static(char **rf_path_return, int *rf_errno_return)
/* pane size of zero will autodetect */
recent.gui_geometry_main_upper_pane = 0;
recent.gui_geometry_main_lower_pane = 0;
- recent.gui_geometry_status_pane = 0;
+ recent.gui_geometry_status_pane_left = (DEF_WIDTH/3);
+ recent.gui_geometry_status_pane_right = (DEF_WIDTH/3);
/* the following are only used if GTK2 is used (as GTK1 cannot read these geometry values) */
/* or if set through command line */
@@ -598,7 +615,7 @@ recent_read_static(char **rf_path_return, int *rf_errno_return)
recent.privs_warn_if_no_npf = TRUE;
/* Construct the pathname of the user's recent file. */
- rf_path = get_persconffile_path(RECENT_FILE_NAME, FALSE);
+ rf_path = get_persconffile_path(RECENT_FILE_NAME, FALSE, FALSE);
/* Read the user's recent file, if it exists. */
*rf_path_return = NULL;
@@ -630,7 +647,7 @@ recent_read_dynamic(char **rf_path_return, int *rf_errno_return)
/* Construct the pathname of the user's recent file. */
- rf_path = get_persconffile_path(RECENT_FILE_NAME, FALSE);
+ rf_path = get_persconffile_path(RECENT_FILE_NAME, FALSE, FALSE);
/* Read the user's recent file, if it exists. */
*rf_path_return = NULL;