diff options
-rw-r--r-- | gtk/main.c | 65 | ||||
-rw-r--r-- | gtk/menu.c | 63 |
2 files changed, 77 insertions, 51 deletions
diff --git a/gtk/main.c b/gtk/main.c index 91ff1f9f67..8a346aebc6 100644 --- a/gtk/main.c +++ b/gtk/main.c @@ -1,6 +1,6 @@ /* main.c * - * $Id: main.c,v 1.430 2004/05/04 20:49:33 guy Exp $ + * $Id: main.c,v 1.431 2004/05/04 21:08:02 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -3554,7 +3554,6 @@ GtkWidget *main_widget_layout(gint layout_content) */ void main_widgets_rearrange(void) { GtkWidget *pane_content[3]; - gboolean filter_toolbar_show_in_statusbar = prefs.filter_toolbar_show_in_statusbar; /* be a bit faster */ gtk_widget_hide(main_vbox); @@ -3589,12 +3588,10 @@ void main_widgets_rearrange(void) { gtk_box_pack_start(GTK_BOX(main_vbox), menubar, FALSE, TRUE, 0); /* main toolbar */ - if (recent.main_toolbar_show) { - gtk_box_pack_start(GTK_BOX(main_vbox), main_tb, FALSE, TRUE, 0); - } + gtk_box_pack_start(GTK_BOX(main_vbox), main_tb, FALSE, TRUE, 0); /* filter toolbar in toolbar area */ - if (recent.filter_toolbar_show && !filter_toolbar_show_in_statusbar) { + if (!prefs.filter_toolbar_show_in_statusbar) { gtk_box_pack_start(GTK_BOX(main_vbox), filter_tb, FALSE, TRUE, 1); } @@ -3659,26 +3656,21 @@ void main_widgets_rearrange(void) { gtk_container_add(GTK_CONTAINER(main_vbox), main_first_pane); - /* hide widgets on users recent settings */ - /* XXX - do we still need this? */ - main_widgets_show_or_hide(); - /* statusbar hbox */ - if ((recent.filter_toolbar_show && filter_toolbar_show_in_statusbar) || recent.statusbar_show) { - gtk_box_pack_start(GTK_BOX(main_vbox), stat_hbox, FALSE, TRUE, 0); - } + gtk_box_pack_start(GTK_BOX(main_vbox), stat_hbox, FALSE, TRUE, 0); /* filter toolbar in statusbar hbox */ - if (recent.filter_toolbar_show && filter_toolbar_show_in_statusbar) { + if (prefs.filter_toolbar_show_in_statusbar) { gtk_box_pack_start(GTK_BOX(stat_hbox), filter_tb, FALSE, TRUE, 1); } /* statusbar */ - if (recent.statusbar_show) { - gtk_box_pack_start(GTK_BOX(stat_hbox), status_pane, TRUE, TRUE, 0); - gtk_paned_pack1(GTK_PANED(status_pane), info_bar, FALSE, FALSE); - gtk_paned_pack2(GTK_PANED(status_pane), packets_bar, FALSE, FALSE); - } + gtk_box_pack_start(GTK_BOX(stat_hbox), status_pane, TRUE, TRUE, 0); + gtk_paned_pack1(GTK_PANED(status_pane), info_bar, FALSE, FALSE); + gtk_paned_pack2(GTK_PANED(status_pane), packets_bar, FALSE, FALSE); + + /* hide widgets on users recent settings */ + main_widgets_show_or_hide(); gtk_widget_show(main_vbox); } @@ -3699,6 +3691,41 @@ main_widgets_show_or_hide(void) { gboolean main_second_pane_show; + if (recent.main_toolbar_show) { + gtk_widget_show(main_tb); + } else { + gtk_widget_hide(main_tb); + } + + /* + * Show the status hbox if either: + * + * 1) we're showing the filter toolbar and we want it in the status + * line + * + * or + * + * 2) we're showing the status bar. + */ + if ((recent.filter_toolbar_show && prefs.filter_toolbar_show_in_statusbar) || + recent.statusbar_show) { + gtk_widget_show(stat_hbox); + } else { + gtk_widget_hide(stat_hbox); + } + + if (recent.statusbar_show) { + gtk_widget_show(status_pane); + } else { + gtk_widget_hide(status_pane); + } + + if (recent.filter_toolbar_show) { + gtk_widget_show(filter_tb); + } else { + gtk_widget_hide(filter_tb); + } + if (recent.packet_list_show) { gtk_widget_show(pkt_scrollw); } else { diff --git a/gtk/menu.c b/gtk/menu.c index 6244efc24b..a89c7ae73f 100644 --- a/gtk/menu.c +++ b/gtk/menu.c @@ -1,7 +1,7 @@ /* menu.c * Menu routines * - * $Id: menu.c,v 1.190 2004/05/04 20:49:33 guy Exp $ + * $Id: menu.c,v 1.191 2004/05/04 21:08:03 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -537,17 +537,17 @@ GList * tap_menu_item_add( GList *curnode) { menu_item_t *curr; - menu_item_t *child; + menu_item_t *child; - child = g_malloc(sizeof (menu_item_t)); + child = g_malloc(sizeof (menu_item_t)); child->group = group; - child->name = name; + child->name = name; child->callback = callback; - child->selected_packet_enabled = selected_packet_enabled; - child->selected_tree_row_enabled = selected_tree_row_enabled; + child->selected_packet_enabled = selected_packet_enabled; + child->selected_tree_row_enabled = selected_tree_row_enabled; child->callback_data = callback_data; - child->enabled = FALSE; + child->enabled = FALSE; child->children = NULL; /* insert the new child node into the parent */ @@ -589,19 +589,19 @@ register_tap_menu_item( gboolean (*selected_tree_row_enabled)(field_info *), gpointer callback_data) { - /*static const char toolspath[] = "/Statistics/";*/ - char *toolspath; - char *p; - char *menupath; - size_t menupathlen; - menu_item_t *child; + /*static const char toolspath[] = "/Statistics/";*/ + char *toolspath; + char *p; + char *menupath; + size_t menupathlen; + menu_item_t *child; GList *curnode; GList *childnode; /* * The menu path must be relative. */ - g_assert(*name != '/'); + g_assert(*name != '/'); switch(group) { case(REGISTER_TAP_GROUP_GENERIC): toolspath = "/Statistics/"; break; @@ -1061,8 +1061,7 @@ add_menu_recent_capture_file_absolute(gchar *cf_name) { #if GTK_MAJOR_VERSION < 2 menu_item = gtk_menu_item_new_with_label("<Clear File List>"); #else - menu_item = gtk_image_menu_item_new_from_stock - (GTK_STOCK_CLEAR, NULL); + menu_item = gtk_image_menu_item_new_from_stock(GTK_STOCK_CLEAR, NULL); #endif gtk_menu_append (GTK_MENU(submenu_recent_files), menu_item); SIGNAL_CONNECT_OBJECT(GTK_OBJECT(menu_item), "activate", @@ -1099,13 +1098,13 @@ add_menu_recent_capture_file(gchar *cf_name) { /* write all capture filenames of the menu to the user's recent file */ void menu_recent_file_write_all(FILE *rf) { - GtkWidget *submenu_recent_files; + GtkWidget *submenu_recent_files; GList *children; - GList *child; - gchar *cf_name; + GList *child; + gchar *cf_name; - submenu_recent_files = gtk_item_factory_get_widget(main_menu_factory, MENU_RECENT_FILES_PATH); + submenu_recent_files = gtk_item_factory_get_widget(main_menu_factory, MENU_RECENT_FILES_PATH); /* we have to iterate backwards through the children's list, * so we get the latest item last in the file. @@ -1113,16 +1112,16 @@ menu_recent_file_write_all(FILE *rf) { children = gtk_container_children(GTK_CONTAINER(submenu_recent_files)); child = g_list_last(children); while(child != NULL) { - /* get capture filename from the menu item label */ - cf_name = OBJECT_GET_DATA(child->data, MENU_RECENT_FILES_KEY); - if (cf_name) { - fprintf (rf, RECENT_KEY_CAPTURE_FILE ": %s\n", cf_name); - } + /* get capture filename from the menu item label */ + cf_name = OBJECT_GET_DATA(child->data, MENU_RECENT_FILES_KEY); + if (cf_name) { + fprintf (rf, RECENT_KEY_CAPTURE_FILE ": %s\n", cf_name); + } child = g_list_previous(child); } - g_list_free(children); + g_list_free(children); } @@ -1133,7 +1132,7 @@ main_toolbar_show_cb(GtkWidget *w _U_, gpointer d _U_) /* save current setting in recent */ recent.main_toolbar_show = GTK_CHECK_MENU_ITEM(w)->active; - main_widgets_rearrange(); + main_widgets_show_or_hide(); } @@ -1144,7 +1143,7 @@ filter_toolbar_show_cb(GtkWidget *w _U_, gpointer d _U_) /* save current setting in recent */ recent.filter_toolbar_show = GTK_CHECK_MENU_ITEM(w)->active; - main_widgets_rearrange(); + main_widgets_show_or_hide(); } @@ -1188,7 +1187,7 @@ statusbar_show_cb(GtkWidget *w _U_, gpointer d _U_) /* save current setting in recent */ recent.statusbar_show = GTK_CHECK_MENU_ITEM(w)->active; - main_widgets_rearrange(); + main_widgets_show_or_hide(); } @@ -1475,7 +1474,7 @@ walk_menu_tree_for_captured_packets(GList *node, { gboolean is_enabled; GList *child; - menu_item_t *node_data = node->data; + menu_item_t *node_data = node->data; /* * Is this a leaf node or an interior node? @@ -1585,7 +1584,7 @@ walk_menu_tree_for_selected_packet(GList *node, frame_data *fd, { gboolean is_enabled; GList *child; - menu_item_t *node_data = node->data; + menu_item_t *node_data = node->data; /* * Is this a leaf node or an interior node? @@ -1689,7 +1688,7 @@ walk_menu_tree_for_selected_tree_row(GList *node, field_info *fi) { gboolean is_enabled; GList *child; - menu_item_t *node_data = node->data; + menu_item_t *node_data = node->data; /* * Is this a leaf node or an interior node? |