aboutsummaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorBill Meier <wmeier@newsguy.com>2013-01-24 21:21:51 +0000
committerBill Meier <wmeier@newsguy.com>2013-01-24 21:21:51 +0000
commit92bc64a2acb254a728bd6f79ae5ec20c3d5c560a (patch)
tree6b31ea6e725009fb63d18c9f275c7dcf67b743ee /ui
parentfae8a2aeb54eb879b611fc54bee1f7c6c2272022 (diff)
Use ws_gtk_grid...() in place of gtk_table...().
This completes the process of replacing Wireshark gtk_table...() usage !! (However: the prefs dialogs still have a few Gtk3 related Expand/Fill issues which need to be fixed). svn path=/trunk/; revision=47262
Diffstat (limited to 'ui')
-rw-r--r--ui/gtk/prefs_capture.c133
-rw-r--r--ui/gtk/prefs_dlg.c102
-rw-r--r--ui/gtk/prefs_dlg.h38
-rw-r--r--ui/gtk/prefs_gui.c80
-rw-r--r--ui/gtk/prefs_layout.c29
5 files changed, 184 insertions, 198 deletions
diff --git a/ui/gtk/prefs_capture.c b/ui/gtk/prefs_capture.c
index 47560acc8c..695cbfba03 100644
--- a/ui/gtk/prefs_capture.c
+++ b/ui/gtk/prefs_capture.c
@@ -56,14 +56,11 @@
#define AUTO_SCROLL_KEY "auto_scroll"
#define SHOW_INFO_KEY "show_info"
-#define CAPTURE_TABLE_ROWS 6
-
#define IFOPTS_CALLER_PTR_KEY "ifopts_caller_ptr"
#define IFOPTS_DIALOG_PTR_KEY "ifopts_dialog_ptr"
-#define IFOPTS_TABLE_ROWS 2
-#define IFOPTS_LIST_TEXT_COLS 4
-#define IFOPTS_MAX_DESCR_LEN 128
-#define IFOPTS_IF_NOSEL -1
+#define IFOPTS_LIST_TEXT_COLS 4
+#define IFOPTS_MAX_DESCR_LEN 128
+#define IFOPTS_IF_NOSEL -1
#define COLOPTS_CALLER_PTR_KEY "colopts_caller_ptr"
#define COLOPTS_DIALOG_PTR_KEY "colopts_dialog_ptr"
@@ -113,7 +110,7 @@ static void colopts_edit_ok_cb(GtkWidget *w, gpointer parent_w);
GtkWidget*
capture_prefs_show(void)
{
- GtkWidget *main_tb, *main_vb;
+ GtkWidget *main_grid, *main_vb;
GtkWidget *if_cbxe, *if_lb, *promisc_cb, *pcap_ng_cb, *sync_cb, *auto_scroll_cb, *show_info_cb;
GtkWidget *ifopts_lb, *ifopts_bt, *colopts_lb, *colopts_bt;
GList *if_list, *combo_list;
@@ -125,16 +122,16 @@ capture_prefs_show(void)
main_vb = ws_gtk_box_new(GTK_ORIENTATION_VERTICAL, 7, FALSE);
gtk_container_set_border_width(GTK_CONTAINER(main_vb), 5);
- /* Main table */
- main_tb = gtk_table_new(CAPTURE_TABLE_ROWS, 2, FALSE);
- gtk_box_pack_start(GTK_BOX(main_vb), main_tb, FALSE, FALSE, 0);
- gtk_table_set_row_spacings(GTK_TABLE(main_tb), 10);
- gtk_table_set_col_spacings(GTK_TABLE(main_tb), 15);
- gtk_widget_show(main_tb);
+ /* Main grid */
+ main_grid = ws_gtk_grid_new();
+ gtk_box_pack_start(GTK_BOX(main_vb), main_grid, FALSE, FALSE, 0);
+ ws_gtk_grid_set_row_spacing(GTK_GRID(main_grid), 10);
+ ws_gtk_grid_set_column_spacing(GTK_GRID(main_grid), 15);
+ gtk_widget_show(main_grid);
/* Default device */
if_lb = gtk_label_new("Default interface:");
- gtk_table_attach_defaults(GTK_TABLE(main_tb), if_lb, 0, 1, row, row+1);
+ ws_gtk_grid_attach_defaults(GTK_GRID(main_grid), if_lb, 0, row, 1, 1);
gtk_misc_set_alignment(GTK_MISC(if_lb), 1.0f, 0.5f);
gtk_widget_show(if_lb);
@@ -160,7 +157,7 @@ capture_prefs_show(void)
}
free_capture_combo_list(combo_list);
- gtk_table_attach_defaults(GTK_TABLE(main_tb), if_cbxe, 1, 2, row, row+1);
+ ws_gtk_grid_attach_defaults(GTK_GRID(main_grid), if_cbxe, 1, row, 1, 1);
tooltips_text = "The default interface to be captured from.";
gtk_widget_set_tooltip_text(if_lb, tooltips_text);
gtk_widget_set_tooltip_text(gtk_bin_get_child(GTK_BIN(if_cbxe)), tooltips_text);
@@ -170,7 +167,7 @@ capture_prefs_show(void)
/* Interface properties */
ifopts_lb = gtk_label_new("Interfaces:");
- gtk_table_attach_defaults(GTK_TABLE(main_tb), ifopts_lb, 0, 1, row, row+1);
+ ws_gtk_grid_attach_defaults(GTK_GRID(main_grid), ifopts_lb, 0, row, 1, 1);
gtk_misc_set_alignment(GTK_MISC(ifopts_lb), 1.0f, 0.5f);
gtk_widget_show(ifopts_lb);
@@ -179,11 +176,11 @@ capture_prefs_show(void)
gtk_widget_set_tooltip_text(ifopts_lb, tooltips_text);
gtk_widget_set_tooltip_text(ifopts_bt, tooltips_text);
g_signal_connect(ifopts_bt, "clicked", G_CALLBACK(ifopts_edit_cb), NULL);
- gtk_table_attach_defaults(GTK_TABLE(main_tb), ifopts_bt, 1, 2, row, row+1);
+ ws_gtk_grid_attach_defaults(GTK_GRID(main_grid), ifopts_bt, 1, row, 1, 1);
row++;
/* Promiscuous mode */
- promisc_cb = create_preference_check_button(main_tb, row++,
+ promisc_cb = create_preference_check_button(main_grid, row++,
"Capture packets in promiscuous mode:",
"Usually a network card will only capture the traffic sent to its own network address. "
"If you want to capture all traffic that the network card can \"see\", mark this option. "
@@ -192,14 +189,14 @@ capture_prefs_show(void)
g_object_set_data(G_OBJECT(main_vb), PROM_MODE_KEY, promisc_cb);
/* Pcap-NG format */
- pcap_ng_cb = create_preference_check_button(main_tb, row++,
+ pcap_ng_cb = create_preference_check_button(main_grid, row++,
"Capture packets in pcap-ng format:",
"Capture packets in the next-generation capture file format.",
prefs.capture_pcap_ng);
g_object_set_data(G_OBJECT(main_vb), PCAP_NG_KEY, pcap_ng_cb);
/* Real-time capture */
- sync_cb = create_preference_check_button(main_tb, row++,
+ sync_cb = create_preference_check_button(main_grid, row++,
"Update list of packets in real time:",
"Update the list of packets while capture is in progress. "
"Don't use this option if you notice packet drops.",
@@ -207,14 +204,14 @@ capture_prefs_show(void)
g_object_set_data(G_OBJECT(main_vb), CAPTURE_REAL_TIME_KEY, sync_cb);
/* Auto-scroll real-time capture */
- auto_scroll_cb = create_preference_check_button(main_tb, row++,
+ auto_scroll_cb = create_preference_check_button(main_grid, row++,
"Automatic scrolling in live capture:",
"Automatic scrolling of the packet list while live capture is in progress. ",
prefs.capture_auto_scroll);
g_object_set_data(G_OBJECT(main_vb), AUTO_SCROLL_KEY, auto_scroll_cb);
/* Show capture info dialog */
- show_info_cb = create_preference_check_button(main_tb, row++,
+ show_info_cb = create_preference_check_button(main_grid, row++,
"Hide capture info dialog:",
"Hide the capture info dialog while capturing. ",
!prefs.capture_show_info);
@@ -222,7 +219,7 @@ capture_prefs_show(void)
/* Column properties */
colopts_lb = gtk_label_new("Columns:");
- gtk_table_attach_defaults(GTK_TABLE(main_tb), colopts_lb, 0, 1, row, row+1);
+ ws_gtk_grid_attach_defaults(GTK_GRID(main_grid), colopts_lb, 0, row, 1, 1);
gtk_misc_set_alignment(GTK_MISC(colopts_lb), 1.0f, 0.5f);
gtk_widget_show(colopts_lb);
@@ -231,7 +228,7 @@ capture_prefs_show(void)
gtk_widget_set_tooltip_text(colopts_lb, tooltips_text);
gtk_widget_set_tooltip_text(colopts_bt, tooltips_text);
g_signal_connect(colopts_bt, "clicked", G_CALLBACK(colopts_edit_cb), NULL);
- gtk_table_attach_defaults(GTK_TABLE(main_tb), colopts_bt, 1, 2, row, row+1);
+ ws_gtk_grid_attach_defaults(GTK_GRID(main_grid), colopts_bt, 1, row, 1, 1);
row++;
/* Show 'em what we got */
@@ -335,7 +332,7 @@ enum
static void
colopts_edit_cb(GtkWidget *w, gpointer data _U_)
{
- GtkWidget *colopts_edit_dlg, *main_hb, *main_tb,
+ GtkWidget *colopts_edit_dlg, *main_hb, *main_grid,
*ed_opts_fr, *main_vb,
*bbox, *ok_bt, *cancel_bt, *help_bt, *column_lb,
*col_interface_lb, *col_link_lb,
@@ -380,22 +377,22 @@ colopts_edit_cb(GtkWidget *w, gpointer data _U_)
gtk_container_add(GTK_CONTAINER(ed_opts_fr), main_hb);
gtk_widget_show(main_hb);
- /* table to hold description text entry and hide button */
- main_tb = gtk_table_new(IFOPTS_TABLE_ROWS, 4, FALSE);
- gtk_box_pack_start(GTK_BOX(main_hb), main_tb, TRUE, FALSE, 10);
- gtk_table_set_row_spacings(GTK_TABLE(main_tb), 10);
- gtk_table_set_col_spacings(GTK_TABLE(main_tb), 10);
- gtk_widget_show(main_tb);
+ /* grid to hold description text entry and hide button */
+ main_grid = ws_gtk_grid_new();
+ gtk_box_pack_start(GTK_BOX(main_hb), main_grid, TRUE, FALSE, 10);
+ ws_gtk_grid_set_row_spacing(GTK_GRID(main_grid), 10);
+ ws_gtk_grid_set_column_spacing(GTK_GRID(main_grid), 10);
+ gtk_widget_show(main_grid);
column_lb = gtk_label_new("Select the columns to be displayed");
- gtk_table_attach_defaults(GTK_TABLE(main_tb), column_lb, 0, 2, row, row+1);
+ ws_gtk_grid_attach_defaults(GTK_GRID(main_grid), column_lb, 0, row, 2, 1);
gtk_misc_set_alignment(GTK_MISC(column_lb), 0, 0.5f);
gtk_widget_show(column_lb);
row++;
/* create "Interface" label and button */
col_interface_cb = gtk_check_button_new();
- gtk_table_attach_defaults(GTK_TABLE(main_tb), col_interface_cb, 0, 1, row, row+1);
+ ws_gtk_grid_attach_defaults(GTK_GRID(main_grid), col_interface_cb, 0, row, 1, 1);
if (!prefs.capture_columns || prefs_capture_options_dialog_column_is_visible("INTERFACE"))
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(col_interface_cb), TRUE);
else
@@ -403,14 +400,14 @@ colopts_edit_cb(GtkWidget *w, gpointer data _U_)
gtk_widget_show(col_interface_cb);
col_interface_lb = gtk_label_new("Interface and its addresses");
- gtk_table_attach_defaults(GTK_TABLE(main_tb), col_interface_lb, 1, 2, row, row+1);
+ ws_gtk_grid_attach_defaults(GTK_GRID(main_grid), col_interface_lb, 1, row, 1, 1);
gtk_misc_set_alignment(GTK_MISC(col_interface_lb), 0, 0.5f);
gtk_widget_show(col_interface_lb);
row++;
/* create "Link Layer" label and button */
col_link_cb = gtk_check_button_new();
- gtk_table_attach_defaults(GTK_TABLE(main_tb), col_link_cb, 0, 1, row, row+1);
+ ws_gtk_grid_attach_defaults(GTK_GRID(main_grid), col_link_cb, 0, row, 1, 1);
if (!prefs.capture_columns || prefs_capture_options_dialog_column_is_visible("LINK"))
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(col_link_cb), TRUE);
else
@@ -418,14 +415,14 @@ colopts_edit_cb(GtkWidget *w, gpointer data _U_)
gtk_widget_show(col_link_cb);
col_link_lb = gtk_label_new("Link layer header");
- gtk_table_attach_defaults(GTK_TABLE(main_tb), col_link_lb, 1, 2, row, row+1);
+ ws_gtk_grid_attach_defaults(GTK_GRID(main_grid), col_link_lb, 1, row, 1, 1);
gtk_misc_set_alignment(GTK_MISC(col_link_lb), 0, 0.5f);
gtk_widget_show(col_link_lb);
row++;
/* create "Promiscous Mode" label and button */
col_pmode_cb = gtk_check_button_new();
- gtk_table_attach_defaults(GTK_TABLE(main_tb), col_pmode_cb, 0, 1, row, row+1);
+ ws_gtk_grid_attach_defaults(GTK_GRID(main_grid), col_pmode_cb, 0, row, 1, 1);
if (!prefs.capture_columns || prefs_capture_options_dialog_column_is_visible("PMODE"))
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(col_pmode_cb), TRUE);
else
@@ -433,14 +430,14 @@ colopts_edit_cb(GtkWidget *w, gpointer data _U_)
gtk_widget_show(col_pmode_cb);
col_pmode_lb = gtk_label_new("Promiscous Mode");
- gtk_table_attach_defaults(GTK_TABLE(main_tb), col_pmode_lb, 1, 2, row, row+1);
+ ws_gtk_grid_attach_defaults(GTK_GRID(main_grid), col_pmode_lb, 1, row, 1, 1);
gtk_misc_set_alignment(GTK_MISC(col_pmode_lb), 0, 0.5f);
gtk_widget_show(col_pmode_lb);
row++;
/* create "Snap length in Bytes" label and button */
col_snap_cb = gtk_check_button_new();
- gtk_table_attach_defaults(GTK_TABLE(main_tb), col_snap_cb, 0, 1, row, row+1);
+ ws_gtk_grid_attach_defaults(GTK_GRID(main_grid), col_snap_cb, 0, row, 1, 1);
if (!prefs.capture_columns || prefs_capture_options_dialog_column_is_visible("SNAPLEN"))
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(col_snap_cb), TRUE);
else
@@ -448,7 +445,7 @@ colopts_edit_cb(GtkWidget *w, gpointer data _U_)
gtk_widget_show(col_snap_cb);
col_snap_lb = gtk_label_new("Snap length in Bytes");
- gtk_table_attach_defaults(GTK_TABLE(main_tb), col_snap_lb, 1, 2, row, row+1);
+ ws_gtk_grid_attach_defaults(GTK_GRID(main_grid), col_snap_lb, 1, row, 1, 1);
gtk_misc_set_alignment(GTK_MISC(col_snap_lb), 0, 0.5f);
gtk_widget_show(col_snap_lb);
row++;
@@ -456,7 +453,7 @@ colopts_edit_cb(GtkWidget *w, gpointer data _U_)
#if defined(_WIN32) || defined(HAVE_PCAP_CREATE)
/* create "Buffer in Megabytes" label and button */
col_buf_cb = gtk_check_button_new();
- gtk_table_attach_defaults(GTK_TABLE(main_tb), col_buf_cb, 0, 1, row, row+1);
+ ws_gtk_grid_attach_defaults(GTK_GRID(main_grid), col_buf_cb, 0, row, 1, 1);
if (!prefs.capture_columns || prefs_capture_options_dialog_column_is_visible("BUFFER"))
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(col_buf_cb), TRUE);
else
@@ -464,7 +461,7 @@ colopts_edit_cb(GtkWidget *w, gpointer data _U_)
gtk_widget_show(col_buf_cb);
col_buf_lb = gtk_label_new("Buffer in Megabytes");
- gtk_table_attach_defaults(GTK_TABLE(main_tb), col_buf_lb, 1, 2, row, row+1);
+ ws_gtk_grid_attach_defaults(GTK_GRID(main_grid), col_buf_lb, 1, row, 1, 1);
gtk_misc_set_alignment(GTK_MISC(col_buf_lb), 0, 0.5f);
gtk_widget_show(col_buf_lb);
row++;
@@ -473,12 +470,12 @@ colopts_edit_cb(GtkWidget *w, gpointer data _U_)
#ifdef HAVE_PCAP_CREATE
/* create "monitor mode" label and button */
col_monitor_lb = gtk_label_new("Monitor mode");
- gtk_table_attach_defaults(GTK_TABLE(main_tb), col_monitor_lb, 1, 2, row, row+1);
+ ws_gtk_grid_attach_defaults(GTK_GRID(main_grid), col_monitor_lb, 1, row, 1, 1);
gtk_misc_set_alignment(GTK_MISC(col_monitor_lb), 0, 0.5f);
gtk_widget_show(col_monitor_lb);
-
+
col_monitor_cb = gtk_check_button_new();
- gtk_table_attach_defaults(GTK_TABLE(main_tb), col_monitor_cb, 0, 1, row, row+1);
+ ws_gtk_grid_attach_defaults(GTK_GRID(main_grid), col_monitor_cb, 0, row, 1, 1);
if (!prefs.capture_columns || prefs_capture_options_dialog_column_is_visible("MONITOR"))
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(col_monitor_cb), TRUE);
else
@@ -490,12 +487,12 @@ colopts_edit_cb(GtkWidget *w, gpointer data _U_)
/* create "Capture Filter" label and button */
col_filter_lb = gtk_label_new("Capture filter");
- gtk_table_attach_defaults(GTK_TABLE(main_tb), col_filter_lb, 1, 2, row, row+1);
+ ws_gtk_grid_attach_defaults(GTK_GRID(main_grid), col_filter_lb, 1, row, 1, 1);
gtk_misc_set_alignment(GTK_MISC(col_filter_lb), 0, 0.5f);
gtk_widget_show(col_filter_lb);
col_filter_cb = gtk_check_button_new();
- gtk_table_attach_defaults(GTK_TABLE(main_tb), col_filter_cb, 0, 1, row, row+1);
+ ws_gtk_grid_attach_defaults(GTK_GRID(main_grid), col_filter_cb, 0, row, 1, 1);
if (!prefs.capture_columns || prefs_capture_options_dialog_column_is_visible("FILTER"))
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(col_filter_cb), TRUE);
else
@@ -543,7 +540,7 @@ colopts_edit_cb(GtkWidget *w, gpointer data _U_)
static void
ifopts_edit_cb(GtkWidget *w, gpointer data _U_)
{
- GtkWidget *ifopts_edit_dlg, *cur_scr_win, *main_hb, *main_tb,
+ GtkWidget *ifopts_edit_dlg, *cur_scr_win, *main_hb, *main_grid,
*cur_opts_fr, *ed_opts_fr, *main_vb,
*if_descr_lb,
*if_hide_lb,
@@ -728,31 +725,31 @@ ifopts_edit_cb(GtkWidget *w, gpointer data _U_)
gtk_container_add(GTK_CONTAINER(ed_opts_fr), main_hb);
gtk_widget_show(main_hb);
- /* table to hold description text entry and hide button */
- main_tb = gtk_table_new(IFOPTS_TABLE_ROWS, 4, FALSE);
- gtk_box_pack_start(GTK_BOX(main_hb), main_tb, TRUE, FALSE, 10);
- gtk_table_set_row_spacings(GTK_TABLE(main_tb), 10);
- gtk_table_set_col_spacings(GTK_TABLE(main_tb), 10);
- gtk_widget_show(main_tb);
+ /* grid to hold description text entry and hide button */
+ main_grid = ws_gtk_grid_new();
+ gtk_box_pack_start(GTK_BOX(main_hb), main_grid, TRUE, FALSE, 10);
+ ws_gtk_grid_set_row_spacing(GTK_GRID(main_grid), 10);
+ ws_gtk_grid_set_column_spacing(GTK_GRID(main_grid), 10);
+ gtk_widget_show(main_grid);
if_dev_lb = gtk_label_new("Device:");
- gtk_table_attach_defaults(GTK_TABLE(main_tb), if_dev_lb, 0, 1, row, row+1);
+ ws_gtk_grid_attach_defaults(GTK_GRID(main_grid), if_dev_lb, 0, row, 1, 1);
gtk_misc_set_alignment(GTK_MISC(if_dev_lb), 1.0f, 0.5f);
gtk_widget_show(if_dev_lb);
if_dev_lb = gtk_label_new("");
- gtk_table_attach_defaults(GTK_TABLE(main_tb), if_dev_lb, 1, 2, row, row+1);
+ ws_gtk_grid_attach_defaults(GTK_GRID(main_grid), if_dev_lb, 1, row, 1, 1);
gtk_misc_set_alignment(GTK_MISC(if_dev_lb), 0.0f, 0.5f);
gtk_widget_show(if_dev_lb);
row++;
if_name_lb = gtk_label_new("Description:");
- gtk_table_attach_defaults(GTK_TABLE(main_tb), if_name_lb, 0, 1, row, row+1);
+ ws_gtk_grid_attach_defaults(GTK_GRID(main_grid), if_name_lb, 0, row, 1, 1);
gtk_misc_set_alignment(GTK_MISC(if_name_lb), 1.0f, 0.5f);
gtk_widget_show(if_name_lb);
if_name_lb = gtk_label_new("");
- gtk_table_attach_defaults(GTK_TABLE(main_tb), if_name_lb, 1, 2, row, row+1);
+ ws_gtk_grid_attach_defaults(GTK_GRID(main_grid), if_name_lb, 1, row, 1, 1);
gtk_misc_set_alignment(GTK_MISC(if_name_lb), 0.0f, 0.5f);
gtk_widget_show(if_name_lb);
row++;
@@ -760,20 +757,20 @@ ifopts_edit_cb(GtkWidget *w, gpointer data _U_)
#ifdef HAVE_PCAP_CREATE
/* create "monitor mode" label and button */
if_monitor_lb = gtk_label_new("Monitor mode:");
- gtk_table_attach_defaults(GTK_TABLE(main_tb), if_monitor_lb, 0, 1, row, row+1);
+ ws_gtk_grid_attach_defaults(GTK_GRID(main_grid), if_monitor_lb, 0, row, 1, 1);
gtk_misc_set_alignment(GTK_MISC(if_monitor_lb), 1.0f, 0.5f);
gtk_widget_show(if_monitor_lb);
if_monitor_cb = gtk_check_button_new();
g_signal_connect(if_monitor_cb, "toggled", G_CALLBACK(ifopts_edit_monitor_changed_cb),
cur_list);
- gtk_table_attach_defaults(GTK_TABLE(main_tb), if_monitor_cb, 1, 2, row, row+1);
+ ws_gtk_grid_attach_defaults(GTK_GRID(main_grid), if_monitor_cb, 1, row, 1, 1);
gtk_widget_show(if_monitor_cb);
row++;
#endif
if_linktype_lb = gtk_label_new("Default link-layer header type:");
- gtk_table_attach_defaults(GTK_TABLE(main_tb), if_linktype_lb, 0, 1, row, row+1);
+ ws_gtk_grid_attach_defaults(GTK_GRID(main_grid), if_linktype_lb, 0, row, 1, 1);
gtk_misc_set_alignment(GTK_MISC(if_linktype_lb), 1.0f, 0.5f);
gtk_widget_show(if_linktype_lb);
@@ -782,13 +779,13 @@ ifopts_edit_cb(GtkWidget *w, gpointer data _U_)
interfaces_info_nochange = FALSE;
g_signal_connect(if_linktype_cb, "changed", G_CALLBACK(ifopts_edit_linktype_changed_cb),
cur_list);
- gtk_table_attach_defaults(GTK_TABLE(main_tb), if_linktype_cb, 1, 2, row, row+1);
+ ws_gtk_grid_attach_defaults(GTK_GRID(main_grid), if_linktype_cb, 1, row, 1, 1);
gtk_widget_show(if_linktype_cb);
row++;
/* create interface description label and text entry */
if_descr_lb = gtk_label_new("Comment:");
- gtk_table_attach_defaults(GTK_TABLE(main_tb), if_descr_lb, 0, 1, row, row+1);
+ ws_gtk_grid_attach_defaults(GTK_GRID(main_grid), if_descr_lb, 0, row, 1, 1);
gtk_misc_set_alignment(GTK_MISC(if_descr_lb), 1.0f, 0.5f);
gtk_widget_show(if_descr_lb);
@@ -796,24 +793,24 @@ ifopts_edit_cb(GtkWidget *w, gpointer data _U_)
g_signal_connect(if_descr_te, "changed", G_CALLBACK(ifopts_edit_descr_changed_cb),
cur_list);
gtk_entry_set_max_length(GTK_ENTRY(if_descr_te), IFOPTS_MAX_DESCR_LEN);
- gtk_table_attach_defaults(GTK_TABLE(main_tb), if_descr_te, 1, 2, row, row+1);
+ ws_gtk_grid_attach_defaults(GTK_GRID(main_grid), if_descr_te, 1, row, 1, 1);
gtk_widget_show(if_descr_te);
row++;
/* create "hide interface" label and button */
if_hide_lb = gtk_label_new("Hide interface?:");
- gtk_table_attach_defaults(GTK_TABLE(main_tb), if_hide_lb, 0, 1, row, row+1);
+ ws_gtk_grid_attach_defaults(GTK_GRID(main_grid), if_hide_lb, 0, row, 1, 1);
gtk_misc_set_alignment(GTK_MISC(if_hide_lb), 1.0f, 0.5f);
gtk_widget_show(if_hide_lb);
if_hide_cb = gtk_check_button_new();
g_signal_connect(if_hide_cb, "toggled", G_CALLBACK(ifopts_edit_hide_changed_cb),
cur_list);
- gtk_table_attach_defaults(GTK_TABLE(main_tb), if_hide_cb, 1, 2, row, row+1);
+ ws_gtk_grid_attach_defaults(GTK_GRID(main_grid), if_hide_cb, 1, row, 1, 1);
gtk_widget_show(if_hide_cb);
if_default_if_lb = gtk_label_new("(Default interface cannot be hidden)");
- gtk_table_attach_defaults(GTK_TABLE(main_tb), if_default_if_lb, 1, 3, row, row+1);
+ ws_gtk_grid_attach_defaults(GTK_GRID(main_grid), if_default_if_lb, 1, row, 2, 1);
gtk_misc_set_alignment(GTK_MISC(if_default_if_lb), 0.15f, 0.5f);
row++;
@@ -858,7 +855,7 @@ ifopts_edit_cb(GtkWidget *w, gpointer data _U_)
*/
static void
colopts_edit_ok_cb(GtkWidget *w _U_, gpointer parent_w)
-{
+{
g_list_free(prefs.capture_columns);
prefs.capture_columns = NULL;
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(col_interface_cb))) {
diff --git a/ui/gtk/prefs_dlg.c b/ui/gtk/prefs_dlg.c
index 9a6a2080eb..f3a2189593 100644
--- a/ui/gtk/prefs_dlg.c
+++ b/ui/gtk/prefs_dlg.c
@@ -95,7 +95,7 @@ static GtkWidget *create_preference_filename_entry(GtkWidget *, int,
#define E_CAPTURE_PAGE_KEY "capture_options_page"
#define E_NAMERES_PAGE_KEY "nameres_options_page"
#define E_FILTER_EXPRESSIONS_PAGE_KEY "filter_expressions_page"
-#define E_TABLE_MODULE_KEY "table_module"
+#define E_GRID_MODULE_KEY "grid_module"
/*
* Keep a static pointer to the current "Preferences" window, if any, so that
@@ -120,12 +120,12 @@ pref_exists(pref_t *pref _U_, gpointer user_data _U_)
return 1;
}
-/* show a single preference on the GtkTable of a preference page */
+/* show a single preference on the GtkGrid of a preference page */
static guint
pref_show(pref_t *pref, gpointer user_data)
{
- GtkWidget *main_tb = user_data;
- module_t *module = g_object_get_data(G_OBJECT(main_tb), E_TABLE_MODULE_KEY);
+ GtkWidget *main_grid = user_data;
+ module_t *module = g_object_get_data(G_OBJECT(main_grid), E_GRID_MODULE_KEY);
const char *title;
const char *type_name = prefs_pref_type_name(pref);
char *label_string;
@@ -179,13 +179,13 @@ pref_show(pref_t *pref, gpointer user_data)
g_snprintf(uint_str, sizeof(uint_str), "%x", pref->stashed_val.uint);
break;
}
- pref->control = create_preference_entry(main_tb, pref->ordinal,
+ pref->control = create_preference_entry(main_grid, pref->ordinal,
label_string, tooltip_txt,
uint_str);
break;
case PREF_BOOL:
- pref->control = create_preference_check_button(main_tb, pref->ordinal,
+ pref->control = create_preference_check_button(main_grid, pref->ordinal,
label_string, tooltip_txt,
pref->stashed_val.boolval);
break;
@@ -193,13 +193,13 @@ pref_show(pref_t *pref, gpointer user_data)
case PREF_ENUM:
if (pref->info.enum_info.radio_buttons) {
/* Show it as radio buttons. */
- pref->control = create_preference_radio_buttons(main_tb, pref->ordinal,
+ pref->control = create_preference_radio_buttons(main_grid, pref->ordinal,
label_string, tooltip_txt,
pref->info.enum_info.enumvals,
pref->stashed_val.enumval);
} else {
/* Show it as an option menu. */
- pref->control = create_preference_option_menu(main_tb, pref->ordinal,
+ pref->control = create_preference_option_menu(main_grid, pref->ordinal,
label_string, tooltip_txt,
pref->info.enum_info.enumvals,
pref->stashed_val.enumval);
@@ -207,13 +207,13 @@ pref_show(pref_t *pref, gpointer user_data)
break;
case PREF_STRING:
- pref->control = create_preference_entry(main_tb, pref->ordinal,
+ pref->control = create_preference_entry(main_grid, pref->ordinal,
label_string, tooltip_txt,
pref->stashed_val.string);
break;
case PREF_FILENAME:
- pref->control = create_preference_filename_entry(main_tb, pref->ordinal,
+ pref->control = create_preference_filename_entry(main_grid, pref->ordinal,
label_string,
tooltip_txt,
pref->stashed_val.string);
@@ -224,7 +224,7 @@ pref_show(pref_t *pref, gpointer user_data)
char *range_str_p;
range_str_p = range_convert_range(*pref->varp.range);
- pref->control = create_preference_entry(main_tb, pref->ordinal,
+ pref->control = create_preference_entry(main_grid, pref->ordinal,
label_string, tooltip_txt,
range_str_p);
break;
@@ -232,14 +232,14 @@ pref_show(pref_t *pref, gpointer user_data)
case PREF_STATIC_TEXT:
{
- pref->control = create_preference_static_text(main_tb, pref->ordinal,
+ pref->control = create_preference_static_text(main_grid, pref->ordinal,
label_string, tooltip_txt);
break;
}
case PREF_UAT:
{
- pref->control = create_preference_uat(main_tb, pref->ordinal,
+ pref->control = create_preference_uat(main_grid, pref->ordinal,
label_string, tooltip_txt,
pref->varp.uat);
break;
@@ -308,7 +308,7 @@ module_prefs_show(module_t *module, gpointer user_data)
{
struct ct_struct *cts = user_data;
struct ct_struct child_cts;
- GtkWidget *main_vb, *main_tb, *frame, *main_sw;
+ GtkWidget *main_vb, *main_grid, *frame, *main_sw;
gchar label_str[MAX_TREE_NODE_NAME_LEN];
GtkTreeStore *model;
GtkTreeIter iter;
@@ -394,16 +394,16 @@ module_prefs_show(module_t *module, gpointer user_data)
gtk_container_set_border_width(GTK_CONTAINER(main_vb), 5);
gtk_container_add(GTK_CONTAINER(frame), main_vb);
- /* Main table */
- main_tb = gtk_table_new(module->numprefs, 2, FALSE);
- gtk_box_pack_start(GTK_BOX(main_vb), main_tb, FALSE, FALSE, 0);
- gtk_table_set_row_spacings(GTK_TABLE(main_tb), 10);
- gtk_table_set_col_spacings(GTK_TABLE(main_tb), 15);
+ /* Main grid */
+ main_grid = ws_gtk_grid_new();
+ gtk_box_pack_start(GTK_BOX(main_vb), main_grid, FALSE, FALSE, 0);
+ ws_gtk_grid_set_row_spacing(GTK_GRID(main_grid), 10);
+ ws_gtk_grid_set_column_spacing(GTK_GRID(main_grid), 15);
/* Add items for each of the preferences */
- g_object_set_data(G_OBJECT(main_tb), E_TABLE_MODULE_KEY, module);
- prefs_pref_foreach(module, pref_show, main_tb);
- g_object_set_data(G_OBJECT(main_tb), E_TABLE_MODULE_KEY, NULL);
+ g_object_set_data(G_OBJECT(main_grid), E_GRID_MODULE_KEY, module);
+ prefs_pref_foreach(module, pref_show, main_grid);
+ g_object_set_data(G_OBJECT(main_grid), E_GRID_MODULE_KEY, NULL);
/* Associate this module with the page's frame. */
g_object_set_data(G_OBJECT(frame), E_PAGE_MODULE_KEY, module);
@@ -458,8 +458,8 @@ prefs_page_cb(GtkWidget *w _U_, gpointer dummy _U_, PREFS_PAGE_E prefs_page)
gtk_window_set_default_size(GTK_WINDOW(prefs_w), 400, 650);
/*
- * Unfortunately, we can't arrange that a GtkTable widget wrap an event box
- * around a table row, so the spacing between the preference item's label
+ * Unfortunately, we can't arrange that a GtkGrid widget wrap an event box
+ * around a grid row, so the spacing between the preference item's label
* and its control widgets is inactive and the tooltip doesn't pop up when
* the mouse is over it.
*/
@@ -631,7 +631,7 @@ prefs_page_cb(GtkWidget *w _U_, gpointer dummy _U_, PREFS_PAGE_E prefs_page)
}
static void
-set_option_label(GtkWidget *main_tb, int table_position,
+set_option_label(GtkWidget *main_grid, int grid_position,
const gchar *label_text, const gchar *tooltip_text)
{
GtkWidget *label;
@@ -643,8 +643,7 @@ set_option_label(GtkWidget *main_tb, int table_position,
event_box = gtk_event_box_new();
gtk_event_box_set_visible_window (GTK_EVENT_BOX(event_box), FALSE);
- gtk_table_attach_defaults(GTK_TABLE(main_tb), event_box, 0, 1,
- table_position, table_position + 1);
+ ws_gtk_grid_attach_defaults(GTK_GRID(main_grid), event_box, 0, grid_position, 1, 1);
if (tooltip_text != NULL)
gtk_widget_set_tooltip_text(event_box, tooltip_text);
gtk_container_add(GTK_CONTAINER(event_box), label);
@@ -652,17 +651,16 @@ set_option_label(GtkWidget *main_tb, int table_position,
}
GtkWidget *
-create_preference_check_button(GtkWidget *main_tb, int table_position,
+create_preference_check_button(GtkWidget *main_grid, int grid_position,
const gchar *label_text, const gchar *tooltip_text, gboolean active)
{
GtkWidget *check_box;
- set_option_label(main_tb, table_position, label_text, tooltip_text);
+ set_option_label(main_grid, grid_position, label_text, tooltip_text);
check_box = gtk_check_button_new();
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check_box), active);
- gtk_table_attach_defaults(GTK_TABLE(main_tb), check_box, 1, 2,
- table_position, table_position + 1);
+ ws_gtk_grid_attach_defaults(GTK_GRID(main_grid), check_box, 1, grid_position, 1, 1);
if (tooltip_text != NULL)
gtk_widget_set_tooltip_text(check_box, tooltip_text);
@@ -670,7 +668,7 @@ create_preference_check_button(GtkWidget *main_tb, int table_position,
}
GtkWidget *
-create_preference_radio_buttons(GtkWidget *main_tb, int table_position,
+create_preference_radio_buttons(GtkWidget *main_grid, int grid_position,
const gchar *label_text, const gchar *tooltip_text,
const enum_val_t *enumvals, gint current_val)
{
@@ -680,7 +678,7 @@ create_preference_radio_buttons(GtkWidget *main_tb, int table_position,
const enum_val_t *enum_valp;
GtkWidget *event_box;
- set_option_label(main_tb, table_position, label_text, tooltip_text);
+ set_option_label(main_grid, grid_position, label_text, tooltip_text);
radio_button_hbox = ws_gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0, FALSE);
rb_group = NULL;
@@ -702,8 +700,7 @@ create_preference_radio_buttons(GtkWidget *main_tb, int table_position,
event_box = gtk_event_box_new();
gtk_event_box_set_visible_window (GTK_EVENT_BOX(event_box), FALSE);
gtk_container_add(GTK_CONTAINER(event_box), radio_button_hbox);
- gtk_table_attach_defaults(GTK_TABLE(main_tb), event_box, 1, 2,
- table_position, table_position+1);
+ ws_gtk_grid_attach_defaults(GTK_GRID(main_grid), event_box, 1, grid_position, 1, 1);
if (tooltip_text != NULL)
gtk_widget_set_tooltip_text(event_box, tooltip_text);
gtk_widget_show(event_box);
@@ -762,7 +759,7 @@ fetch_preference_radio_buttons_val(GtkWidget *button,
}
GtkWidget *
-create_preference_option_menu(GtkWidget *main_tb, int table_position,
+create_preference_option_menu(GtkWidget *main_grid, int grid_position,
const gchar *label_text, const gchar *tooltip_text,
const enum_val_t *enumvals, gint current_val)
{
@@ -771,7 +768,7 @@ create_preference_option_menu(GtkWidget *main_tb, int table_position,
const enum_val_t *enum_valp;
GtkWidget *event_box;
- set_option_label(main_tb, table_position, label_text, tooltip_text);
+ set_option_label(main_grid, grid_position, label_text, tooltip_text);
/* Create a menu from the enumvals */
combo_box = gtk_combo_box_text_new();
@@ -789,7 +786,7 @@ create_preference_option_menu(GtkWidget *main_tb, int table_position,
/*
* Put the combo box in an hbox, so that it's only as wide
- * as the widest entry, rather than being as wide as the table
+ * as the widest entry, rather than being as wide as the grid
* space.
*/
menu_box = ws_gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0, FALSE);
@@ -797,8 +794,7 @@ create_preference_option_menu(GtkWidget *main_tb, int table_position,
event_box = gtk_event_box_new();
gtk_event_box_set_visible_window (GTK_EVENT_BOX(event_box), FALSE);
- gtk_table_attach_defaults(GTK_TABLE(main_tb), event_box,
- 1, 2, table_position, table_position + 1);
+ ws_gtk_grid_attach_defaults(GTK_GRID(main_grid), event_box, 1, grid_position, 1, 1);
if (tooltip_text != NULL)
gtk_widget_set_tooltip_text(event_box, tooltip_text);
gtk_container_add(GTK_CONTAINER(event_box), menu_box);
@@ -821,18 +817,17 @@ fetch_preference_option_menu_val(GtkWidget *combo_box, const enum_val_t *enumval
}
GtkWidget *
-create_preference_entry(GtkWidget *main_tb, int table_position,
+create_preference_entry(GtkWidget *main_grid, int grid_position,
const gchar *label_text, const gchar *tooltip_text, char *value)
{
GtkWidget *entry;
- set_option_label(main_tb, table_position, label_text, tooltip_text);
+ set_option_label(main_grid, grid_position, label_text, tooltip_text);
entry = gtk_entry_new();
if (value != NULL)
gtk_entry_set_text(GTK_ENTRY(entry), value);
- gtk_table_attach_defaults(GTK_TABLE(main_tb), entry, 1, 2,
- table_position, table_position + 1);
+ ws_gtk_grid_attach_defaults(GTK_GRID(main_grid), entry, 1, grid_position, 1, 1);
if (tooltip_text != NULL)
gtk_widget_set_tooltip_text(entry, tooltip_text);
gtk_widget_show(entry);
@@ -849,16 +844,15 @@ preference_filename_entry_cb(GtkWidget *button, GtkWidget *filename_te)
}
static GtkWidget *
-create_preference_filename_entry(GtkWidget *main_tb, int table_position,
+create_preference_filename_entry(GtkWidget *main_grid, int grid_position,
const gchar *label_text, const gchar *tooltip_text, char *value)
{
GtkWidget *entry;
GtkWidget *button, *file_bt_hb;
- set_option_label(main_tb, table_position, label_text, tooltip_text);
+ set_option_label(main_grid, grid_position, label_text, tooltip_text);
file_bt_hb = ws_gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0, FALSE);
- gtk_table_attach_defaults(GTK_TABLE(main_tb), file_bt_hb, 1, 2,
- table_position, table_position + 1);
+ ws_gtk_grid_attach_defaults(GTK_GRID(main_grid), file_bt_hb, 1, grid_position, 1, 1);
gtk_widget_show(file_bt_hb);
button = gtk_button_new_from_stock(WIRESHARK_STOCK_BROWSE);
@@ -880,7 +874,7 @@ create_preference_filename_entry(GtkWidget *main_tb, int table_position,
}
GtkWidget *
-create_preference_static_text(GtkWidget *main_tb, int table_position,
+create_preference_static_text(GtkWidget *main_grid, int grid_position,
const gchar *label_text, const gchar *tooltip_text)
{
GtkWidget *label;
@@ -889,8 +883,7 @@ create_preference_static_text(GtkWidget *main_tb, int table_position,
label = gtk_label_new(label_text);
else
label = gtk_label_new("");
- gtk_table_attach_defaults(GTK_TABLE(main_tb), label, 0, 2,
- table_position, table_position + 1);
+ 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);
gtk_widget_show(label);
@@ -899,19 +892,18 @@ create_preference_static_text(GtkWidget *main_tb, int table_position,
}
GtkWidget *
-create_preference_uat(GtkWidget *main_tb, int table_position,
+create_preference_uat(GtkWidget *main_grid, int grid_position,
const gchar *label_text, const gchar *tooltip_text, void* uat)
{
GtkWidget *button;
- set_option_label(main_tb, table_position, label_text, tooltip_text);
+ set_option_label(main_grid, grid_position, label_text, tooltip_text);
button = gtk_button_new_from_stock(WIRESHARK_STOCK_EDIT);
g_signal_connect(button, "clicked", G_CALLBACK(uat_window_cb), uat);
- gtk_table_attach_defaults(GTK_TABLE(main_tb), button, 1, 2,
- table_position, table_position+1);
+ ws_gtk_grid_attach_defaults(GTK_GRID(main_grid), button, 1, grid_position, 1, 1);
if (tooltip_text != NULL)
gtk_widget_set_tooltip_text(button, tooltip_text);
gtk_widget_show(button);
diff --git a/ui/gtk/prefs_dlg.h b/ui/gtk/prefs_dlg.h
index efb84a9167..863a057221 100644
--- a/ui/gtk/prefs_dlg.h
+++ b/ui/gtk/prefs_dlg.h
@@ -94,27 +94,27 @@ extern void properties_cb(GtkWidget *widget, gpointer data);
/** Create a check button for a preferences page.
*
- * @param main_tb the table to put this button into
- * @param table_row row in the table
+ * @param main_grid the grid to put this button into
+ * @param grid_row row in the grid
* @param label_text the label text for the left side
* @param tooltip_text the tooltip for this check button
* @param active the check button is initially active
* @return the new check button
*/
-extern GtkWidget *create_preference_check_button(GtkWidget *main_tb, int table_row,
+extern GtkWidget *create_preference_check_button(GtkWidget *main_grid, int grid_row,
const gchar *label_text, const gchar *tooltip_text, gboolean active);
/** Create a radio button for a preferences page.
*
- * @param main_tb the table to put this button into
- * @param table_row row in the table
+ * @param main_grid the grid to put this button into
+ * @param grid_row row in the grid
* @param label_text the label text for the left side
* @param tooltip_text the tooltip for this radio button
* @param enumvals the values
* @param current_val the initially selected value
* @return the new radio button
*/
-extern GtkWidget *create_preference_radio_buttons(GtkWidget *main_tb, int table_row,
+extern GtkWidget *create_preference_radio_buttons(GtkWidget *main_grid, int grid_row,
const gchar *label_text, const gchar *tooltip_text,
const enum_val_t *enumvals, gint current_val);
@@ -128,15 +128,15 @@ extern gint fetch_preference_radio_buttons_val(GtkWidget *button, const enum_val
/** Create an option menu for a preferences page.
*
- * @param main_tb the table to put this menu into
- * @param table_row row in the table
+ * @param main_grid the grid to put this menu into
+ * @param grid_row row in the grid
* @param label_text the label text for the left side
* @param tooltip_text the tooltip for this option menu
* @param enumvals the values
* @param current_val the initially selected value
* @return the new option menu
*/
-extern GtkWidget *create_preference_option_menu(GtkWidget *main_tb, int table_row,
+extern GtkWidget *create_preference_option_menu(GtkWidget *main_grid, int grid_row,
const gchar *label_text, const gchar *tooltip_text,
const enum_val_t *enumvals, gint current_val);
@@ -150,39 +150,37 @@ extern gint fetch_preference_option_menu_val(GtkWidget *optmenu, const enum_val_
/** Create a text entry for a preferences page.
*
- * @param main_tb the table to put this entry into
- * @param table_row row in the table
+ * @param main_grid the grid to put this entry into
+ * @param grid_row row in the grid
* @param label_text the label text for the left side
* @param tooltip_text the tooltip for this text entry
* @param value the initially value
* @return the new text entry
*/
-extern GtkWidget *create_preference_entry(GtkWidget *main_tb, int table_row,
+extern GtkWidget *create_preference_entry(GtkWidget *main_grid, int grid_row,
const gchar *label_text, const gchar *tooltip_text, char *value);
/** Create a static text for a preferences page.
*
- * @param main_tb the table to put this entry into
- * @param table_position row in the table
+ * @param main_grid the grid to put this entry into
+ * @param grid_position row in the grid
* @param label_text the label text
* @param tooltip_text the tooltip for this text (not needed at all...)
* @return the new static text label
*/
-GtkWidget *
-create_preference_static_text(GtkWidget *main_tb, int table_position,
+extern GtkWidget *create_preference_static_text(GtkWidget *main_grid, int grid_position,
const gchar *label_text, const gchar *tooltip_text);
/** Create a UAT button for a preferences page.
*
- * @param main_tb the table to put this entry into
- * @param table_position row in the table
+ * @param main_grid the grid to put this entry into
+ * @param grid_position row in the grid
* @param label_text the label text
* @param tooltip_text the tooltip for this text
* @param uat pointer to the UAT
* @return the new UAT button
*/
-GtkWidget *
-create_preference_uat(GtkWidget *main_tb, int table_position,
+extern GtkWidget *create_preference_uat(GtkWidget *main_grid, int grid_position,
const gchar *label_text, const gchar *tooltip_text, void *uat);
#endif
diff --git a/ui/gtk/prefs_gui.c b/ui/gtk/prefs_gui.c
index 79dc92dc4c..1326984a58 100644
--- a/ui/gtk/prefs_gui.c
+++ b/ui/gtk/prefs_gui.c
@@ -135,12 +135,10 @@ static char open_file_preview_str[128] = "";
/* Used to contain the string from the Auto Scroll Percentage pref item */
static char scroll_percent_preview_str[128] = "";
-#define GUI_TABLE_ROWS 4
-
GtkWidget*
gui_prefs_show(void)
{
- GtkWidget *main_tb, *main_vb;
+ GtkWidget *main_grid, *main_vb;
#ifdef _WIN32
GtkWidget *console_open_om;
#endif
@@ -166,33 +164,33 @@ gui_prefs_show(void)
main_vb = ws_gtk_box_new(GTK_ORIENTATION_VERTICAL, 7, FALSE);
gtk_container_set_border_width( GTK_CONTAINER(main_vb), 5 );
- /* Main table */
- main_tb = gtk_table_new(GUI_TABLE_ROWS, 2, FALSE);
- gtk_box_pack_start(GTK_BOX(main_vb), main_tb, FALSE, FALSE, 0);
- gtk_table_set_row_spacings(GTK_TABLE(main_tb), 10);
- gtk_table_set_col_spacings(GTK_TABLE(main_tb), 15);
+ /* Main grid */
+ main_grid = ws_gtk_grid_new();
+ gtk_box_pack_start(GTK_BOX(main_vb), main_grid, FALSE, FALSE, 0);
+ ws_gtk_grid_set_row_spacing(GTK_GRID(main_grid), 10);
+ ws_gtk_grid_set_column_spacing(GTK_GRID(main_grid), 15);
/* Geometry prefs */
- save_position_cb = create_preference_check_button(main_tb, pos++,
+ save_position_cb = create_preference_check_button(main_grid, pos++,
"Save window position:",
"Whether to save the position of the main window.",
prefs.gui_geometry_save_position);
g_object_set_data(G_OBJECT(main_vb), GEOMETRY_POSITION_KEY, save_position_cb);
- save_size_cb = create_preference_check_button(main_tb, pos++,
+ save_size_cb = create_preference_check_button(main_grid, pos++,
"Save window size:",
"Whether to save the size of the main window.",
prefs.gui_geometry_save_size);
g_object_set_data(G_OBJECT(main_vb), GEOMETRY_SIZE_KEY, save_size_cb);
- save_maximized_cb = create_preference_check_button(main_tb, pos++,
+ save_maximized_cb = create_preference_check_button(main_grid, pos++,
"Save maximized state:",
"Whether to save the maximized state of the main window.",
prefs.gui_geometry_save_maximized);
g_object_set_data(G_OBJECT(main_vb), GEOMETRY_MAXIMIZED_KEY, save_maximized_cb);
#if defined(HAVE_IGE_MAC_INTEGRATION) || defined(HAVE_GTKOSXAPPLICATION)
- macosx_style_cb = create_preference_check_button(main_tb, pos++,
+ macosx_style_cb = create_preference_check_button(main_grid, pos++,
"Mac OS X style",
"Whether to create a Mac OS X look and feel. Checking this box will move the "
"menu bar to the top of the screen instead of the top of the Wireshark window. "
@@ -203,7 +201,7 @@ gui_prefs_show(void)
#ifdef _WIN32
/* How the console window should be opened */
- console_open_om = create_preference_option_menu(main_tb, pos++,
+ console_open_om = create_preference_option_menu(main_grid, pos++,
"Open a console window",
"Whether to open a console window "
"(Automatic will open a console if messages appear).",
@@ -213,13 +211,13 @@ gui_prefs_show(void)
/* Allow user to select where they want the File Open dialog to open to
* by default */
- fileopen_rb = create_preference_radio_buttons(main_tb, pos++,
+ fileopen_rb = create_preference_radio_buttons(main_grid, pos++,
"\"File Open\" dialog behavior:",
"Which directory the \"File Open\" dialog should start with.",
gui_fileopen_vals, prefs.gui_fileopen_style);
/* Directory to default File Open dialog to */
- fileopen_dir_te = create_preference_entry(main_tb, pos++,
+ fileopen_dir_te = create_preference_entry(main_grid, pos++,
"Directory:",
"The \"File Open\" dialog defaults always to this directory.",
prefs.gui_fileopen_dir);
@@ -230,7 +228,7 @@ gui_prefs_show(void)
G_CALLBACK(fileopen_dir_changed_cb), main_vb);
/* File Open dialog preview timeout */
- fileopen_preview_te = create_preference_entry(main_tb, pos++,
+ fileopen_preview_te = create_preference_entry(main_grid, pos++,
"\"File Open\" preview timeout:",
"Reading preview data in the \"File Open\" dialog will be stopped after given seconds.",
open_file_preview_str);
@@ -240,7 +238,7 @@ gui_prefs_show(void)
g_signal_connect(fileopen_preview_te, "focus_out_event", G_CALLBACK(fileopen_preview_changed_cb), main_vb);
/* Number of recent entries in the display filter list ... */
- recent_df_entries_max_te = create_preference_entry(main_tb, pos++,
+ recent_df_entries_max_te = create_preference_entry(main_grid, pos++,
"Maximum recent filters:",
"Maximum number of recent entries in filter display list.",
recent_df_entries_max_str);
@@ -250,7 +248,7 @@ gui_prefs_show(void)
g_signal_connect(recent_df_entries_max_te, "focus_out_event", G_CALLBACK(recent_df_entries_changed_cb), main_vb);
/* Number of entries in the recent_files list ... */
- recent_files_count_max_te = create_preference_entry(main_tb, pos++,
+ recent_files_count_max_te = create_preference_entry(main_grid, pos++,
"Maximum recent files:",
"Maximum number of entries in the \"File/Open Recent\" list.",
recent_files_count_max_str);
@@ -262,21 +260,21 @@ gui_prefs_show(void)
fileopen_selected_cb(NULL, main_vb);
/* ask for unsaved capture files? */
- ask_unsaved_cb = create_preference_check_button(main_tb, pos++,
+ ask_unsaved_cb = create_preference_check_button(main_grid, pos++,
"Confirm unsaved capture files:",
"Whether a dialog should pop up in case of an unsaved capture file.",
prefs.gui_ask_unsaved);
g_object_set_data(G_OBJECT(main_vb), GUI_ASK_UNSAVED_KEY, ask_unsaved_cb);
/* do we want to wrap when searching for data? */
- find_wrap_cb = create_preference_check_button(main_tb, pos++,
+ find_wrap_cb = create_preference_check_button(main_grid, pos++,
"Wrap to end/beginning of file during a find:",
"Whether a search should wrap in a capture file.",
prefs.gui_find_wrap);
g_object_set_data(G_OBJECT(main_vb), GUI_FIND_WRAP_KEY, find_wrap_cb);
/* show an explicit Save button for settings dialogs (preferences and alike)? */
- use_pref_save_cb = create_preference_check_button(main_tb, pos++,
+ use_pref_save_cb = create_preference_check_button(main_grid, pos++,
"Settings dialogs show a save button:",
"Whether the various settings dialogs (e.g. Preferences) should "
"use an explicit save button - for advanced users.",
@@ -284,21 +282,21 @@ gui_prefs_show(void)
g_object_set_data(G_OBJECT(main_vb), GUI_USE_PREF_SAVE_KEY, use_pref_save_cb);
/* Show version in welcome and/or title screen */
- show_version_om = create_preference_option_menu(main_tb, pos++,
+ show_version_om = create_preference_option_menu(main_grid, pos++,
"Welcome screen and title bar shows version",
"Whether version should be shown in the start page and/or main screen's title bar.",
gui_version_placement_vals, prefs.gui_version_placement);
g_object_set_data(G_OBJECT(main_vb), GUI_SHOW_VERSION_KEY, show_version_om);
/* Whether to auto scroll when expanding items */
- auto_scroll_cb = create_preference_check_button(main_tb, pos++,
+ auto_scroll_cb = create_preference_check_button(main_grid, pos++,
"Auto scroll on expansion:",
"Whether the details view should be automatically scrolled up when expanding an item.",
prefs.gui_auto_scroll_on_expand );
g_object_set_data(G_OBJECT(main_vb), GUI_AUTO_SCROLL_KEY, auto_scroll_cb);
/* Where to auto scroll to when expanding items */
- scroll_percent_te = create_preference_entry(main_tb, pos++,
+ scroll_percent_te = create_preference_entry(main_grid, pos++,
"Auto scroll percentage:",
"Where to scroll the expanded item to within the view e.g. 0% = top of view, 50% = center of view.",
scroll_percent_preview_str);
@@ -309,7 +307,7 @@ gui_prefs_show(void)
/* Webbrowser */
if (browser_needs_pref()) {
- webbrowser_te = create_preference_entry(main_tb, pos++,
+ webbrowser_te = create_preference_entry(main_grid, pos++,
"Web browser command:",
"Command line to desired browser.",
prefs.gui_webbrowser);
@@ -318,7 +316,7 @@ gui_prefs_show(void)
}
/* Enable Expert Infos Dialog Tab Label "eye-candy" */
- expert_info_eyecandy_cb = create_preference_check_button(main_tb, pos++,
+ expert_info_eyecandy_cb = create_preference_check_button(main_grid, pos++,
"Display icons in the Expert Infos dialog tab labels:",
"Whether icon images should be displayed in the Expert Infos dialog tab labels.",
prefs.gui_expert_composite_eyecandy );
@@ -373,7 +371,7 @@ gui_prefs_fetch(GtkWidget *w)
gtk_toggle_button_get_active(g_object_get_data(G_OBJECT(w), GUI_USE_PREF_SAVE_KEY));
prefs.gui_version_placement =
- fetch_enum_value(g_object_get_data(G_OBJECT(w), GUI_SHOW_VERSION_KEY), gui_version_placement_vals);
+ fetch_enum_value(g_object_get_data(G_OBJECT(w), GUI_SHOW_VERSION_KEY), gui_version_placement_vals);
prefs.gui_auto_scroll_on_expand =
gtk_toggle_button_get_active(g_object_get_data(G_OBJECT(w), GUI_AUTO_SCROLL_KEY));
@@ -541,21 +539,25 @@ static gboolean
scroll_percent_changed_cb(GtkWidget *recent_files_entry _U_,
GdkEvent *event _U_, gpointer parent_w)
{
- GtkWidget *scroll_percent_te;
- guint newval;
+ GtkWidget *scroll_percent_te;
+ guint newval;
- scroll_percent_te = (GtkWidget*)g_object_get_data(G_OBJECT(parent_w), GUI_SCROLL_PERCENT_KEY);
+ scroll_percent_te = (GtkWidget*)g_object_get_data(G_OBJECT(parent_w), GUI_SCROLL_PERCENT_KEY);
+
+ /*
+ * Now, just convert the string to a number and store it in the prefs field ...
+ */
- /*
- * Now, just convert the string to a number and store it in the prefs field ...
- */
+ newval = (guint)strtol(gtk_entry_get_text(GTK_ENTRY(scroll_percent_te)), NULL, 10);
- newval = (guint)strtol(gtk_entry_get_text(GTK_ENTRY(scroll_percent_te)), NULL, 10);
+ if (newval <= 100) {
+ prefs.gui_auto_scroll_percentage = newval;
+ }
- if (newval <= 100) {
- prefs.gui_auto_scroll_percentage = newval;
- }
+ if (newval <= 100) {
+ prefs.gui_auto_scroll_percentage = newval;
+ }
- /* We really should pop up a dialog box is newval < 0 or > 100 */
- return FALSE;
+ /* We really should pop up a dialog box is newval < 0 or > 100 */
+ return FALSE;
}
diff --git a/ui/gtk/prefs_layout.c b/ui/gtk/prefs_layout.c
index a21fd945a8..916ddec417 100644
--- a/ui/gtk/prefs_layout.c
+++ b/ui/gtk/prefs_layout.c
@@ -278,9 +278,6 @@ layout_defaults_cb (GtkWidget * w _U_, gpointer data)
#define GUI_FILTER_TOOLBAR_STYLE_KEY "filter_toolbar_style"
#define GUI_WINDOW_TITLE_KEY "window_title"
-
-#define GUI_TABLE_ROWS 6
-
static const enum_val_t altern_colors_vals[] = {
{ "FALSE", "No", FALSE },
{ "TRUE", "Yes", TRUE },
@@ -310,7 +307,7 @@ layout_prefs_show(void)
GtkWidget *pane_fr, *pane_vb;
GtkWidget *radio_hb, *radio_vb;
GtkWidget *default_vb, *default_bt;
- GtkWidget *main_tb, *hbox;
+ GtkWidget *main_grid, *hbox;
GtkWidget *altern_colors_om;
GtkWidget *highlight_style_om;
GtkWidget *toolbar_style_om;
@@ -395,53 +392,53 @@ layout_prefs_show(void)
gtk_box_pack_end(GTK_BOX(radio_hb), default_vb, FALSE, FALSE, 0);
/* Main horizontal box */
- /* XXX - Is there a better way to center the table? */
+ /* XXX - Is there a better way to center the grid ? */
hbox = ws_gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 7, FALSE);
gtk_box_pack_start (GTK_BOX(main_vb), hbox, TRUE, FALSE, 0);
- /* Main table */
- main_tb = gtk_table_new(GUI_TABLE_ROWS, 2, FALSE);
- gtk_box_pack_start( GTK_BOX(hbox), main_tb, FALSE, FALSE, 0 );
- gtk_table_set_row_spacings( GTK_TABLE(main_tb), 10 );
- gtk_table_set_col_spacings( GTK_TABLE(main_tb), 15 );
+ /* Main grid */
+ main_grid = ws_gtk_grid_new();
+ gtk_box_pack_start( GTK_BOX(hbox), main_grid, FALSE, FALSE, 0 );
+ ws_gtk_grid_set_row_spacing( GTK_GRID(main_grid), 10 );
+ ws_gtk_grid_set_column_spacing( GTK_GRID(main_grid), 15 );
/* Alternating row colors in list and tree views */
- altern_colors_om = create_preference_option_menu(main_tb, pos++,
+ altern_colors_om = create_preference_option_menu(main_grid, pos++,
"Alternating row colors in lists and trees:",
"Select whether or not the rows of lists and trees have alternating color.",
altern_colors_vals, prefs.gui_altern_colors);
g_object_set_data(G_OBJECT(main_vb), ALTERN_COLORS_KEY, altern_colors_om);
/* Packet Bytes Dump highlight style */
- highlight_style_om = create_preference_option_menu(main_tb, pos++,
+ highlight_style_om = create_preference_option_menu(main_grid, pos++,
"Packet bytes highlight style:",
"Select the style in which the packet bytes dump will be displayed.",
highlight_style_vals, prefs.gui_hex_dump_highlight_style);
g_object_set_data(G_OBJECT(main_vb), HEX_DUMP_HIGHLIGHT_STYLE_KEY, highlight_style_om);
/* Toolbar prefs */
- toolbar_style_om = create_preference_option_menu(main_tb, pos++,
+ toolbar_style_om = create_preference_option_menu(main_grid, pos++,
"Toolbar style:",
"Select the style in which the toolbar will be displayed.",
toolbar_style_vals, prefs.gui_toolbar_main_style);
g_object_set_data(G_OBJECT(main_vb), GUI_TOOLBAR_STYLE_KEY, toolbar_style_om);
/* Filter toolbar prefs */
- filter_toolbar_style_om = create_preference_option_menu(main_tb, pos++,
+ filter_toolbar_style_om = create_preference_option_menu(main_grid, pos++,
"Filter toolbar style:",
"Select the style in which the filter toolbar will be displayed.",
toolbar_style_vals, prefs.gui_toolbar_filter_style);
g_object_set_data(G_OBJECT(main_vb), GUI_FILTER_TOOLBAR_STYLE_KEY, filter_toolbar_style_om);
/* Placement of Filter toolbar */
- filter_toolbar_placement_om = create_preference_option_menu(main_tb, pos++,
+ filter_toolbar_placement_om = create_preference_option_menu(main_grid, pos++,
"Filter toolbar placement:",
"Select where the filter toolbar will be displayed.",
filter_toolbar_placement_vals, prefs.filter_toolbar_show_in_statusbar);
g_object_set_data(G_OBJECT(main_vb), FILTER_TOOLBAR_PLACEMENT_KEY, filter_toolbar_placement_om);
/* Window title */
- window_title_te = create_preference_entry(main_tb, pos++,
+ window_title_te = create_preference_entry(main_grid, pos++,
"Custom window title (appended to existing titles):",
"Enter the text to be appended to the window title.",
prefs.gui_window_title);