aboutsummaryrefslogtreecommitdiffstats
path: root/epan
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2013-01-07 19:13:03 +0000
committerGerald Combs <gerald@wireshark.org>2013-01-07 19:13:03 +0000
commit0fa6a4c4216bf3c1e5e19d007893b8494e1860d0 (patch)
tree4623d8fe653f56522126acddc781e705060d27ab /epan
parentb671f8dbd6b6a2ae62ac0a5459930eb7c86979a3 (diff)
Allow editing via the advanced preferences tree. Double-clicking an
item's name, status, or type resets it to its default value. Double-clicking the item's value lets you edit it. Implement the advanced search field. (Clicking OK and Cancel still doesn't yet do anything.) Note that we could probably use a prefs_register_{uint16|port}_preference routine for 16-bit values. Make reset_pref public. Update some names and descriptions. svn path=/trunk/; revision=46986
Diffstat (limited to 'epan')
-rw-r--r--epan/libwireshark.def1
-rw-r--r--epan/prefs.c31
-rw-r--r--epan/prefs.h6
3 files changed, 29 insertions, 9 deletions
diff --git a/epan/libwireshark.def b/epan/libwireshark.def
index bd3951273a..bbd7cb0d3f 100644
--- a/epan/libwireshark.def
+++ b/epan/libwireshark.def
@@ -947,6 +947,7 @@ report_open_failure
report_read_failure
report_write_failure
req_resp_hdrs_do_reassembly
+reset_pref
reset_tap_listeners
reset_tcp_reassembly
rose_ctx_clean_data
diff --git a/epan/prefs.c b/epan/prefs.c
index 1a2714889d..99d7422396 100644
--- a/epan/prefs.c
+++ b/epan/prefs.c
@@ -841,6 +841,11 @@ prefs_register_uint_preference(module_t *module, const char *name,
}
/*
+ * XXX Add a prefs_register_{uint16|port}_preference which sets max_value?
+ */
+
+
+/*
* Register a "custom" preference with a unsigned integral value.
* XXX - This should be temporary until we can find a better way
* to do "custom" preferences
@@ -1241,11 +1246,12 @@ static prefs_set_pref_e console_log_level_set_cb(pref_t* pref, const gchar* valu
}
static const char * console_log_level_type_name_cb(void) {
- return "Console log level (for debugging)";
+ return "Log level";
}
static char * console_log_level_type_description_cb(void) {
return g_strdup_printf(
+ "Console log level (for debugging)\n"
"A bitmask of log levels:\n"
"ERROR = 4\n"
"CRITICAL = 8\n"
@@ -1693,12 +1699,12 @@ static prefs_set_pref_e capture_column_set_cb(pref_t* pref, const gchar* value,
static const char * capture_column_type_name_cb(void) {
- return "Capture options dialog column list";
+ return "Column list";
}
static char * capture_column_type_description_cb(void) {
return g_strdup_printf(
- "List of columns to be displayed.\n"
+ "List of columns to be displayed in the capture options dialog.\n"
"Possible values: INTERFACE,LINK,PMODE,SNAPLEN,MONITOR,BUFFER,FILTER\n");
}
@@ -2695,10 +2701,10 @@ pre_init_prefs(void)
/*
* Reset a single dissector preference.
*/
-static void
-reset_pref(gpointer data, gpointer user_data _U_)
+void
+reset_pref(pref_t *pref)
{
- pref_t *pref = data;
+ if (!pref) return;
switch (pref->type) {
@@ -2756,6 +2762,13 @@ reset_pref(gpointer data, gpointer user_data _U_)
}
}
+static void
+reset_pref_cb(gpointer data, gpointer user_data _U_)
+{
+ pref_t *pref = (pref_t *) data;
+ reset_pref(pref);
+}
+
typedef struct {
module_t *module;
} reset_pref_arg_t;
@@ -2769,7 +2782,7 @@ reset_module_prefs(void *value, void *data _U_)
reset_pref_arg_t arg;
arg.module = value;
- g_list_foreach(arg.module->prefs, reset_pref, &arg);
+ g_list_foreach(arg.module->prefs, reset_pref_cb, &arg);
return FALSE;
}
@@ -3926,7 +3939,7 @@ prefs_pref_type_name(pref_t *pref)
break;
case PREF_ENUM:
- type_name = "Enumeration";
+ type_name = "Choice";
break;
case PREF_STRING:
@@ -4057,7 +4070,7 @@ prefs_pref_type_description(pref_t *pref)
default:
break;
}
- return g_strdup_printf("%s.", type_desc);
+ return g_strdup(type_desc);
}
gboolean
diff --git a/epan/prefs.h b/epan/prefs.h
index de0909eac1..461a04753a 100644
--- a/epan/prefs.h
+++ b/epan/prefs.h
@@ -514,6 +514,12 @@ extern e_prefs *read_prefs(int *, int *, char **, int *, int *, char **);
into "*pf_path_return", and return the errno. */
extern int write_prefs(char **);
+/** Set a preference to its default value
+ *
+ * @param pref A preference.
+ */
+extern void reset_pref(pref_t *pref);
+
/*
* Given a string of the form "<pref name>:<pref value>", as might appear
* as an argument to a "-o" option, parse it and set the preference in