ANNOUNCEMENT: Live Wireshark University & Allegro Packets online APAC Wireshark Training Session
April 17th, 2024 | 14:30-16:00 SGT (UTC+8) | Online

Wireshark-dev: [Wireshark-dev] [Patch] Change to preferences dialog title

From: Stephen Fisher <stephentfisher@xxxxxxxxx>
Date: Fri, 29 Sep 2006 12:57:54 -0700
Attached is a patch for consideration that changes the title in the 
preferences notebook to be the full description of the preference (but 
leaves the short name in the preferences list on the left).

Current:

    +- EXEC ----------
    |

New:

    +- Remote Process Execution --------
    |


Thanks,
  Steve

Index: gtk/prefs_dlg.c
===================================================================
--- gtk/prefs_dlg.c	(revision 19364)
+++ gtk/prefs_dlg.c	(working copy)
@@ -316,7 +316,7 @@
     gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(main_sw), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
 
     /* Frame */
-    frame = gtk_frame_new(module->title);
+    frame = gtk_frame_new(module->description);
     gtk_container_set_border_width(GTK_CONTAINER(frame), 5);
     gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(main_sw), frame);
     OBJECT_SET_DATA(main_sw, E_PAGESW_FRAME_KEY, frame);
Index: epan/prefs.c
===================================================================
--- epan/prefs.c	(revision 19364)
+++ epan/prefs.c	(working copy)
@@ -52,7 +52,7 @@
 /* Internal functions */
 static module_t *find_module(const char *name);
 static module_t *prefs_register_module_or_subtree(module_t *parent,
-    const char *name, const char *title, gboolean is_subtree,
+    const char *name, const char *title, const char *description, gboolean is_subtree,
     void (*apply_cb)(void));
 static struct preference *find_preference(module_t *, const char *);
 static int    set_pref(gchar*, gchar*);
@@ -139,10 +139,10 @@
  */
 module_t *
 prefs_register_module(module_t *parent, const char *name, const char *title,
-    void (*apply_cb)(void))
+    const char *description, void (*apply_cb)(void))
 {
-	return prefs_register_module_or_subtree(parent, name, title, FALSE,
-	    apply_cb);
+	return prefs_register_module_or_subtree(parent, name, title, description,
+	    FALSE, apply_cb);
 }
 
 /*
@@ -152,15 +152,15 @@
  * dialog box.
  */
 module_t *
-prefs_register_subtree(module_t *parent, const char *title)
+prefs_register_subtree(module_t *parent, const char *title, const char *description)
 {
-	return prefs_register_module_or_subtree(parent, NULL, title, TRUE,
+	return prefs_register_module_or_subtree(parent, NULL, title, description, TRUE,
 	    NULL);
 }
 
 static module_t *
 prefs_register_module_or_subtree(module_t *parent, const char *name,
-    const char *title, gboolean is_subtree, void (*apply_cb)(void))
+    const char *title, const char *description, gboolean is_subtree, void (*apply_cb)(void))
 {
 	module_t *module;
 	const char *p;
@@ -169,6 +169,7 @@
 	module = g_malloc(sizeof (module_t));
 	module->name = name;
 	module->title = title;
+	module->description = description;
 	module->is_subtree = is_subtree;
 	module->apply_cb = apply_cb;
 	module->prefs = NULL;	/* no preferences, to start */
@@ -261,12 +262,13 @@
 		/*
 		 * No.  Do so.
 		 */
-		protocols_module = prefs_register_subtree(NULL, "Protocols");
+		protocols_module = prefs_register_subtree(NULL, "Protocols", NULL);
 	}
 	protocol = find_protocol_by_id(id);
 	return prefs_register_module(protocols_module,
 	    proto_get_protocol_filter_name(id),
-	    proto_get_protocol_short_name(protocol), apply_cb);
+	    proto_get_protocol_short_name(protocol),
+	    proto_get_protocol_name(id), apply_cb);
 }
 
 /*
@@ -286,12 +288,13 @@
 		/*
 		 * No.  Do so.
 		 */
-		protocols_module = prefs_register_subtree(NULL, "Protocols");
+		protocols_module = prefs_register_subtree(NULL, "Protocols", NULL);
 	}
 	protocol = find_protocol_by_id(id);
 	module = prefs_register_module(protocols_module,
 	    proto_get_protocol_filter_name(id),
-	    proto_get_protocol_short_name(protocol), NULL);
+	    proto_get_protocol_short_name(protocol),
+	    proto_get_protocol_name(id), NULL);
 	module->obsolete = TRUE;
 	return module;
 }
Index: epan/prefs.h
===================================================================
--- epan/prefs.h	(revision 19364)
+++ epan/prefs.h	(working copy)
@@ -176,7 +176,7 @@
  * call so that the "Protocol Properties..." menu item works.
  */
 extern module_t *prefs_register_module(module_t *parent, const char *name,
-    const char *title, void (*apply_cb)(void));
+    const char *title, const char *description, void (*apply_cb)(void));
 
 /*
  * Register a subtree that will have modules under it.
@@ -184,7 +184,8 @@
  * at the top level and the title used in the tab for it in a preferences
  * dialog box.
  */
-extern module_t *prefs_register_subtree(module_t *parent, const char *title);
+extern module_t *prefs_register_subtree(module_t *parent, const char *title,
+    const char *description);
 
 /*
  * Register that a protocol has preferences.
Index: epan/prefs-int.h
===================================================================
--- epan/prefs-int.h	(revision 19364)
+++ epan/prefs-int.h	(working copy)
@@ -28,7 +28,8 @@
 
 struct pref_module {
 	const char *name;	/* name of module */
-	const char *title;	/* title of module (displayed in preferences notebook) */
+	const char *title;	/* title of module (displayed in preferences list) */
+	const char *description;/* Description of module (displayed in preferences notebook) */
 	gboolean is_subtree;	/* if TRUE, this has other modules, not preferences, under it */
 	void (*apply_cb)(void);	/* routine to call when preferences applied */
 	GList	*prefs;		/* list of its preferences or submodules */