aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2002-05-25 01:47:46 +0000
committerGuy Harris <guy@alum.mit.edu>2002-05-25 01:47:46 +0000
commitd3604ae33eb8a9269c82386c0f202993f583846d (patch)
tree2d095d84d29984e320dd22b5802d41046b26f7cc
parent16c7726c049f49168d2bd2f0b92e35a6272acd4e (diff)
Don't give ordinal numbers to preferences that aren't displayed.
svn path=/trunk/; revision=5554
-rw-r--r--prefs-int.h4
-rw-r--r--prefs.c14
2 files changed, 13 insertions, 5 deletions
diff --git a/prefs-int.h b/prefs-int.h
index d20cd0a19d..b5227c4f4c 100644
--- a/prefs-int.h
+++ b/prefs-int.h
@@ -2,7 +2,7 @@
* Definitions for implementation of preference handling routines;
* used by "friends" of the preferences type.
*
- * $Id: prefs-int.h,v 1.5 2002/05/11 18:58:02 guy Exp $
+ * $Id: prefs-int.h,v 1.6 2002/05/25 01:47:46 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -31,7 +31,7 @@ struct pref_module {
const char *title; /* title of module (displayed in preferences notebook) */
void (*apply_cb)(void); /* routine to call when preferences applied */
GList *prefs; /* list of its preferences */
- int numprefs; /* number of preferences */
+ int numprefs; /* number of non-obsolete preferences */
gboolean prefs_changed; /* if TRUE, a preference has changed since we last checked */
gboolean obsolete; /* if TRUE, this is a module that used to
exist but no longer does */
diff --git a/prefs.c b/prefs.c
index 35a672c2d4..336fd1724a 100644
--- a/prefs.c
+++ b/prefs.c
@@ -1,7 +1,7 @@
/* prefs.c
* Routines for handling preferences
*
- * $Id: prefs.c,v 1.82 2002/05/11 18:58:02 guy Exp $
+ * $Id: prefs.c,v 1.83 2002/05/25 01:47:46 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -260,6 +260,10 @@ prefs_apply_all(void)
/*
* Register a preference in a module's list of preferences.
+ * If it has a title, give it an ordinal number; otherwise, it's a
+ * preference that won't show up in the UI, so it shouldn't get an
+ * ordinal number (the ordinal should be the ordinal in the set of
+ * *visible* preferences).
*/
static pref_t *
register_preference(module_t *module, const char *name, const char *title,
@@ -272,7 +276,10 @@ register_preference(module_t *module, const char *name, const char *title,
preference->name = name;
preference->title = title;
preference->description = description;
- preference->ordinal = module->numprefs;
+ if (title != NULL)
+ preference->ordinal = module->numprefs;
+ else
+ preference->ordinal = -1; /* no ordinal for you */
/*
* Make sure that only lower-case ASCII letters, numbers,
@@ -301,7 +308,8 @@ register_preference(module_t *module, const char *name, const char *title,
* preference.
*/
module->prefs = g_list_append(module->prefs, preference);
- module->numprefs++;
+ if (title != NULL)
+ module->numprefs++;
return preference;
}