GTK: Wrap static preference labels.

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>
This commit is contained in:
Gerald Combs 2017-02-06 10:50:22 -08:00 committed by Anders Broman
parent 420b9e061e
commit e9cf760c0c
4 changed files with 11 additions and 4 deletions

View 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");

View 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);
}

View 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,

View 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);