GTK: Wrap static preference labels.
authorGerald Combs <gerald@wireshark.org>
Mon, 6 Feb 2017 18:50:22 +0000 (10:50 -0800)
committerAnders Broman <a.broman58@gmail.com>
Tue, 7 Feb 2017 05:15:28 +0000 (05:15 +0000)
In the GTK+ prefrences dialog, enable wrapping and set a maximum width.
This should keep labels from making the dialog unusably wide.

Make a couple of enum preferences drop-downs instead of radio buttons.
Note that we might want to make the drop-down vs radio button behavior
automatic.

Change-Id: Ib72a2c8d5cfb99324be86f2218b6d57a395fa22c
Reviewed-on: https://code.wireshark.org/review/19980
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
epan/dissectors/packet-mbtcp.c
epan/dissectors/packet-vlan.c
epan/prefs.c
ui/gtk/prefs_dlg.c

index df97f6b26d3f5cecde32dc067b60b6c3bb55172f..4a71d352d77446d03d5130cafb42047a22a1d293 100644 (file)
@@ -2041,7 +2041,7 @@ proto_register_modbus(void)
                                     "Register Format",
                                     &global_mbus_register_format,
                                     mbus_register_format,
-                                    TRUE);
+                                    FALSE);
 
     /* Obsolete Preferences */
     prefs_register_obsolete_preference(mbtcp_module, "mbus_register_addr_type");
index 76aedfeaa97fd4fc187a39c9a859ea101c4ceb8b..e9c6b55119ba5740b4a2acc9a2e308563134774e 100644 (file)
@@ -421,7 +421,7 @@ proto_register_vlan(void)
   prefs_register_enum_preference(vlan_module, "priority_drop",
         "Priorities and drop eligibility",
         "Number of priorities supported, and number of those drop eligible (not used for 802.1Q-1998)",
-        &vlan_priority_drop, priority_drop_vals, TRUE);
+        &vlan_priority_drop, priority_drop_vals, FALSE);
   vlan_handle = create_dissector_handle(dissect_vlan, proto_vlan);
 }
 
index d834601a6a20b6a7eee73bdbc49f072270763a78..ed7bea648a324556ccd2d3cae4716dedbc040290 100644 (file)
@@ -1207,6 +1207,10 @@ gboolean prefs_get_bool_value(pref_t *pref, pref_source_t source)
 /*
  * Register a preference with an enumerated value.
  */
+/*
+ * XXX Should we get rid of the radio_buttons parameter and make that
+ * behavior automatic depending on the number of items?
+ */
 void
 prefs_register_enum_preference(module_t *module, const char *name,
                                const char *title, const char *description,
index f4dc581482ad56a52fbf72210763e5ebb6f6191a..0437a2b4f81ee0603f90a52804f41149ad6f52d1 100644 (file)
@@ -898,10 +898,13 @@ create_preference_static_text(GtkWidget *main_grid, int grid_position,
 {
   GtkWidget *label;
 
-  if (label_text != NULL)
+  if (label_text != NULL) {
     label = gtk_label_new(label_text);
-  else
+    gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
+    gtk_label_set_width_chars (GTK_LABEL (label), 80);
+  } else {
     label = gtk_label_new("");
+  }
   ws_gtk_grid_attach_defaults(GTK_GRID(main_grid), label, 0, grid_position, 2, 1);
   if (tooltip_text != NULL)
     gtk_widget_set_tooltip_text(label, tooltip_text);