2 * Definitions for implementation of preference handling routines;
3 * used by "friends" of the preferences type.
7 * Wireshark - Network traffic analyzer
8 * By Gerald Combs <gerald@wireshark.org>
9 * Copyright 1998 Gerald Combs
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License
13 * as published by the Free Software Foundation; either version 2
14 * of the License, or (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26 #ifndef __PREFS_INT_H__
27 #define __PREFS_INT_H__
32 const char *name; /* name of module */
33 const char *title; /* title of module (displayed in preferences list) */
34 const char *description;/* Description of module (displayed in preferences notebook) */
35 void (*apply_cb)(void); /* routine to call when preferences applied */
36 GList *prefs; /* list of its preferences */
37 emem_tree_t *submodules;/* list of its submodules */
38 int numprefs; /* number of non-obsolete preferences */
39 gboolean prefs_changed; /* if TRUE, a preference has changed since we last checked */
40 gboolean obsolete; /* if TRUE, this is a module that used to
41 exist but no longer does */
45 * Module used for protocol preferences.
46 * With MSVC and a libwireshark.dll, we need a special declaration.
48 WS_VAR_IMPORT module_t *protocols_module;
51 * PREF_OBSOLETE is used for preferences that a module used to support
52 * but no longer supports; we give different error messages for them.
66 const char *name; /* name of preference */
67 const char *title; /* title to use in GUI */
68 const char *description; /* human-readable description of preference */
69 int ordinal; /* ordinal number of this preference */
70 pref_type_t type; /* type of that preference */
78 } varp; /* pointer to variable storing the value */
85 } saved_val; /* original value, when editing from the GUI */
87 guint base; /* input/output base, for PREF_UINT */
88 guint32 max_value; /* maximum value of a range */
90 const enum_val_t *enumvals; /* list of name & values */
91 gboolean radio_buttons; /* TRUE if it should be shown as
92 radio buttons rather than as an
93 option menu or combo box in
94 the preferences tab */
95 } enum_info; /* for PREF_ENUM */
96 } info; /* display/text file information */
97 void *control; /* handle for GUI control for this preference */
100 gint find_val_for_string(const char *needle, const enum_val_t *haystack,
104 /* read_prefs_file: read in a generic config file and do a callback to */
105 /* pref_set_pair_fct() for every key/value pair found */
106 typedef prefs_set_pref_e (*pref_set_pair_cb) (gchar *key, gchar *value, void *private_data);
109 read_prefs_file(const char *pf_path, FILE *pf, pref_set_pair_cb pref_set_pair_fct, void *private_data);
113 #endif /* prefs-int.h */