Replace gtk_table...() with ws_gtk_grid...();

Add an XXX comment about trying (and failing)
 to change the behavior of the grid when the
 column prefs window is horizontally resized.

Also: do whitespace cleanup: indentation & etc.

svn path=/trunk/; revision=47032
This commit is contained in:
Bill Meier 2013-01-11 18:26:35 +00:00
parent 2d2198962a
commit a63b7f9264
1 changed files with 85 additions and 77 deletions

View File

@ -99,7 +99,7 @@ visible_toggled(GtkCellRendererToggle *cell _U_, gchar *path_str, gpointer data)
*/ */
GtkWidget * GtkWidget *
column_prefs_show(GtkWidget *prefs_window) { column_prefs_show(GtkWidget *prefs_window) {
GtkWidget *main_vb, *bottom_hb, *column_l, *add_bt, *tb, *lb; GtkWidget *main_vb, *bottom_hb, *column_l, *add_bt, *grid, *lb;
GtkWidget *list_vb, *list_lb, *list_sc; GtkWidget *list_vb, *list_lb, *list_sc;
GtkWidget *add_remove_vb; GtkWidget *add_remove_vb;
GtkWidget *props_fr, *props_hb; GtkWidget *props_fr, *props_hb;
@ -126,7 +126,9 @@ column_prefs_show(GtkWidget *prefs_window) {
gtk_widget_show (list_vb); gtk_widget_show (list_vb);
gtk_box_pack_start (GTK_BOX (main_vb), list_vb, TRUE, TRUE, 0); gtk_box_pack_start (GTK_BOX (main_vb), list_vb, TRUE, TRUE, 0);
list_lb = gtk_label_new (("[The first list entry will be displayed as the leftmost column - Drag and drop entries to change column order]")); list_lb = gtk_label_new (
"[The first list entry will be displayed as the leftmost column"
" - Drag and drop entries to change column order]");
gtk_widget_show (list_lb); gtk_widget_show (list_lb);
gtk_box_pack_start (GTK_BOX (list_vb), list_lb, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (list_vb), list_lb, FALSE, FALSE, 0);
@ -206,7 +208,7 @@ column_prefs_show(GtkWidget *prefs_window) {
/* Bottom row: Add/remove buttons and properties */ /* Bottom row: Add/remove buttons and properties */
bottom_hb = ws_gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 5, FALSE); bottom_hb = ws_gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 5, FALSE);
gtk_box_pack_start (GTK_BOX (main_vb), bottom_hb, FALSE, TRUE, 0); gtk_box_pack_start (GTK_BOX (main_vb), bottom_hb, FALSE, FALSE, 0);
gtk_widget_show(bottom_hb); gtk_widget_show(bottom_hb);
/* Add / remove buttons */ /* Add / remove buttons */
@ -234,27 +236,33 @@ column_prefs_show(GtkWidget *prefs_window) {
gtk_widget_show(props_fr); gtk_widget_show(props_fr);
/* Column name entry and format selection */ /* Column name entry and format selection */
tb = gtk_table_new(2, 4, FALSE); /* XXX: IMO, the grid should have a fixed width instead of
gtk_container_set_border_width(GTK_CONTAINER(tb), 5); * expanding to the horizontal window width when the window
gtk_container_add(GTK_CONTAINER(props_fr), tb); * is resized horizontally. However, I couldn't quite make
gtk_table_set_row_spacings(GTK_TABLE(tb), 10); * things work properly when I tried to change the grid
gtk_table_set_col_spacings(GTK_TABLE(tb), 15); * behavior.
gtk_widget_show(tb); */
grid = ws_gtk_grid_new();
gtk_container_set_border_width(GTK_CONTAINER(grid), 5);
gtk_container_add(GTK_CONTAINER(props_fr), grid);
ws_gtk_grid_set_row_spacing(GTK_GRID(grid), 10);
ws_gtk_grid_set_column_spacing(GTK_GRID(grid), 15);
gtk_widget_show(grid);
lb = gtk_label_new("Field type:"); lb = gtk_label_new("Field type:");
gtk_misc_set_alignment(GTK_MISC(lb), 0.0f, 0.5f); gtk_misc_set_alignment(GTK_MISC(lb), 0.0f, 0.5f);
gtk_table_attach_defaults(GTK_TABLE(tb), lb, 0, 1, 0, 1); ws_gtk_grid_attach_extended(GTK_GRID(grid), lb, 0, 0, 1, 1, GTK_EXPAND|GTK_FILL, 0, 0, 0);
gtk_widget_set_tooltip_text(lb, "Select which packet information to present in the column."); gtk_widget_set_tooltip_text(lb, "Select which packet information to present in the column.");
gtk_widget_show(lb); gtk_widget_show(lb);
props_hb = ws_gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 5, FALSE); props_hb = ws_gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 5, FALSE);
gtk_table_attach(GTK_TABLE(tb), props_hb, 1, 2, 0, 1, GTK_FILL, GTK_SHRINK, 0, 0); ws_gtk_grid_attach_extended(GTK_GRID(grid), props_hb, 1, 0, 1, 1, GTK_EXPAND|GTK_FILL, 0, 0, 0);
gtk_widget_set_tooltip_text(props_hb, "Select which packet information to present in the column."); gtk_widget_set_tooltip_text(props_hb, "Select which packet information to present in the column.");
gtk_widget_show(props_hb); gtk_widget_show(props_hb);
field_lb = gtk_label_new("Field name:"); field_lb = gtk_label_new("Field name:");
gtk_misc_set_alignment(GTK_MISC(field_lb), 0.0f, 0.5f); gtk_misc_set_alignment(GTK_MISC(field_lb), 0.0f, 0.5f);
gtk_table_attach_defaults(GTK_TABLE(tb), field_lb, 0, 1, 1, 2); ws_gtk_grid_attach_extended(GTK_GRID(grid), field_lb, 0, 1, 1, 1, GTK_EXPAND|GTK_FILL, 0, 0, 0);
gtk_widget_set_sensitive(field_lb, FALSE); gtk_widget_set_sensitive(field_lb, FALSE);
gtk_widget_set_tooltip_text(field_lb, gtk_widget_set_tooltip_text(field_lb,
"Field name used when field type is \"Custom\". " "Field name used when field type is \"Custom\". "
@ -275,7 +283,7 @@ column_prefs_show(GtkWidget *prefs_window) {
g_signal_connect(field_te, "key-press-event", G_CALLBACK (filter_string_te_key_pressed_cb), NULL); g_signal_connect(field_te, "key-press-event", G_CALLBACK (filter_string_te_key_pressed_cb), NULL);
g_signal_connect(prefs_window, "key-press-event", G_CALLBACK (filter_parent_dlg_key_pressed_cb), NULL); g_signal_connect(prefs_window, "key-press-event", G_CALLBACK (filter_parent_dlg_key_pressed_cb), NULL);
colorize_filter_te_as_empty(field_te); colorize_filter_te_as_empty(field_te);
gtk_table_attach_defaults(GTK_TABLE(tb), field_te, 1, 2, 1, 2); ws_gtk_grid_attach_extended(GTK_GRID(grid), field_te, 1, 1, 1, 1, GTK_EXPAND|GTK_FILL, 0, 0, 0);
gtk_widget_set_sensitive(field_te, FALSE); gtk_widget_set_sensitive(field_te, FALSE);
gtk_widget_set_tooltip_text(field_te, gtk_widget_set_tooltip_text(field_te,
"Field name used when field type is \"Custom\". " "Field name used when field type is \"Custom\". "
@ -284,7 +292,7 @@ column_prefs_show(GtkWidget *prefs_window) {
occurrence_lb = gtk_label_new("Field occurrence:"); occurrence_lb = gtk_label_new("Field occurrence:");
gtk_misc_set_alignment(GTK_MISC(occurrence_lb), 0.0f, 0.5f); gtk_misc_set_alignment(GTK_MISC(occurrence_lb), 0.0f, 0.5f);
gtk_table_attach_defaults(GTK_TABLE(tb), occurrence_lb, 2, 3, 1, 2); ws_gtk_grid_attach_extended(GTK_GRID(grid), occurrence_lb, 2, 1, 1, 1, GTK_EXPAND|GTK_FILL, 0, 0, 0);
gtk_widget_set_sensitive(occurrence_lb, FALSE); gtk_widget_set_sensitive(occurrence_lb, FALSE);
gtk_widget_set_tooltip_text(occurrence_lb, gtk_widget_set_tooltip_text(occurrence_lb,
"Field occurence to use. " "Field occurence to use. "
@ -300,7 +308,7 @@ column_prefs_show(GtkWidget *prefs_window) {
column_occurrence_changed_handler_id = column_occurrence_changed_handler_id =
g_signal_connect(occurrence_te, "changed", G_CALLBACK(column_occurrence_changed_cb), column_l); g_signal_connect(occurrence_te, "changed", G_CALLBACK(column_occurrence_changed_cb), column_l);
gtk_table_attach_defaults(GTK_TABLE(tb), occurrence_te, 3, 4, 1, 2); ws_gtk_grid_attach_extended(GTK_GRID(grid), occurrence_te, 3, 1, 1, 1, GTK_EXPAND|GTK_FILL, 0, 0, 0);
gtk_widget_set_sensitive(occurrence_te, FALSE); gtk_widget_set_sensitive(occurrence_te, FALSE);
gtk_widget_set_tooltip_text(occurrence_te, gtk_widget_set_tooltip_text(occurrence_te,
"Field occurence to use. " "Field occurence to use. "