Fix the wireless settings button for AirPCap devices in the
[obnox/wireshark/wip.git] / gtk / main_filter_toolbar.c
index 2a26ca49c2159cb47b43235a80f9404a53784075..1a5728fd5f798de169ebe58d134a370fe401ec33 100644 (file)
@@ -34,6 +34,7 @@
 #include <string.h>
 
 #include <gtk/gtk.h>
+#include "gtk/old-gtk-compat.h"
 
 #include "filter_dlg.h"
 #include "filter_autocomplete.h"
 #include "menus.h"
 #include "main_toolbar.h"
 #include "main_filter_toolbar.h"
+#include "filter_expression_save_dlg.h"
+
+#ifdef MAIN_MENU_USE_UIMANAGER
+# define MENU_BAR_PATH_FILE_OPEN                               "/Menubar/FileMenu/Open"
+# define MENU_BAR_PATH_EDIT_COPY_AS_FLT                                "/Menubar/EditMenu/Copy/AsFilter"
+# define MENU_BAR_PATH_ANALYZE_DISPLAY_FLT                     "/Menubar/AnalyzeMenu/DisplayFilters"
+# define MENU_BAR_PATH_ANALYZE_FOLLOW_TCP_STREAM               "/Menubar/AnalyzeMenu/FollowTCPStream"
+# define MENU_BAR_PATH_ANALYZE_FOLLOW_UDP_STREAM               "/Menubar/AnalyzeMenu/FollowUDPStream"
+# define MENU_BAR_PATH_ANALYZE_FOLLOW_SSL_STREAM               "/Menubar/AnalyzeMenu/FollowSSLStream"
+# define MENU_BAR_PATH_ANALYZE_APL_AS_FLT_SEL                  "/Menubar/AnalyzeMenu/ApplyAsFilter/Selected"
+# define MENU_BAR_PATH_ANALYZE_APL_AS_FLT_NOT_SEL              "/Menubar/AnalyzeMenu/ApplyAsFilter/NotSelected"
+# define MENU_BAR_PATH_ANALYZE_APL_AS_FLT_AND_SEL              "/Menubar/AnalyzeMenu/ApplyAsFilter/AndSelected"
+# define MENU_BAR_PATH_ANALYZE_APL_AS_FLT_OR_SEL               "/Menubar/AnalyzeMenu/ApplyAsFilter/OrSelected"
+# define MENU_BAR_PATH_ANALYZE_APL_AS_FLT_AND_NOT_SEL          "/Menubar/AnalyzeMenu/ApplyAsFilter/AndNotSelected"
+# define MENU_BAR_PATH_ANALYZE_APL_AS_FLT_OR_NOT_SEL           "/Menubar/AnalyzeMenu/ApplyAsFilter/OrNotSelected"
+# define MENU_BAR_PATH_ANALYZE_PREP_A_FLT_SEL                  "/Menubar/AnalyzeMenu/PrepareaFilter/Selected"
+# define MENU_BAR_PATH_ANALYZE_PREP_A_FLT_NOT_SEL              "/Menubar/AnalyzeMenu/PrepareaFilter/NotSelected"
+# define MENU_BAR_PATH_ANALYZE_PREP_A_FLT_AND_SEL              "/Menubar/AnalyzeMenu/PrepareaFilter/AndSelected"
+# define MENU_BAR_PATH_ANALYZE_PREP_A_FLT_OR_SEL               "/Menubar/AnalyzeMenu/PrepareaFilter/OrSelected"
+# define MENU_BAR_PATH_ANALYZE_PREP_A_FLT_AND_NOT_SEL          "/Menubar/AnalyzeMenu/PrepareaFilter/AndNotSelected"
+# define MENU_BAR_PATH_ANALYZE_PREP_A_FLT_OR_NOT_SEL           "/Menubar/AnalyzeMenu/PrepareaFilter/OrNotSelected"
+#else
+# define MENU_BAR_PATH_FILE_OPEN                               "/File/Open..."
+# define MENU_BAR_PATH_EDIT_COPY_AS_FLT                                "/Edit/Copy/As Filter"
+# define MENU_BAR_PATH_ANALYZE_DISPLAY_FLT                     "/Analyze/Display Filters..."
+# define MENU_BAR_PATH_ANALYZE_FOLLOW_TCP_STREAM               "/Analyze/Follow TCP Stream"
+# define MENU_BAR_PATH_ANALYZE_FOLLOW_UDP_STREAM               "/Analyze/Follow UDP Stream"
+# define MENU_BAR_PATH_ANALYZE_FOLLOW_SSL_STREAM               "/Analyze/Follow SSL Stream"
+# define MENU_BAR_PATH_ANALYZE_APL_AS_FLT_SEL                  "/Analyze/Apply as Filter/Selected"
+# define MENU_BAR_PATH_ANALYZE_APL_AS_FLT_NOT_SEL              "/Analyze/Apply as Filter/Not Selected"
+# define MENU_BAR_PATH_ANALYZE_APL_AS_FLT_AND_SEL              "/Analyze/Apply as Filter/... and Selected"
+# define MENU_BAR_PATH_ANALYZE_APL_AS_FLT_OR_SEL               "/Analyze/Apply as Filter/... or Selected"
+# define MENU_BAR_PATH_ANALYZE_APL_AS_FLT_AND_NOT_SEL          "/Analyze/Apply as Filter/... and not Selected"
+# define MENU_BAR_PATH_ANALYZE_APL_AS_FLT_OR_NOT_SEL           "/Analyze/Apply as Filter/... or not Selected"
+
+# define MENU_BAR_PATH_ANALYZE_PREP_A_FLT_SEL                  "/Analyze/Prepare a Filter/Selected"
+# define MENU_BAR_PATH_ANALYZE_PREP_A_FLT_NOT_SEL              "/Analyze/Prepare a Filter/Not Selected"
+# define MENU_BAR_PATH_ANALYZE_PREP_A_FLT_AND_SEL              "/Analyze/Prepare a Filter/... and Selected"
+# define MENU_BAR_PATH_ANALYZE_PREP_A_FLT_OR_SEL               "/Analyze/Prepare a Filter/... or Selected"
+# define MENU_BAR_PATH_ANALYZE_PREP_A_FLT_AND_NOT_SEL          "/Analyze/Prepare a Filter/... and not Selected"
+# define MENU_BAR_PATH_ANALYZE_PREP_A_FLT_OR_NOT_SEL           "/Analyze/Prepare a Filter/... or not Selected"
+# endif /* MAIN_MENU_USE_UIMANAGER */
+
+#if 0 /* Unused? */
+# define PACKET_LIST_POPUP_PATH_ANALYZE_FOLLOW_TCP_STREAM      "/PacketListMenuPopup/FollowTCPStream"
+# define PACKET_LIST_POPUP_PATH_ANALYZE_FOLLOW_UDP_STREAM      "/PacketListMenuPopup/FollowUDPStream"
+# define PACKET_LIST_POPUP_PATH_ANALYZE_FOLLOW_SSL_STREAM      "/PacketListMenuPopup/FollowSSLStream"
+# define PACKET_LIST_POPUP_PATH_CONV_FLT_ETH                   "/PacketListMenuPopup/ConversationFilter/Ethernet"
+# define PACKET_LIST_POPUP_PATH_CONV_FLT_IP                    "/PacketListMenuPopup/ConversationFilter/IP"
+# define PACKET_LIST_POPUP_PATH_CONV_FLT_TCP                   "/PacketListMenuPopup/ConversationFilter/TCP"
+# define PACKET_LIST_POPUP_PATH_CONV_FLT_UDP                   "/PacketListMenuPopup/ConversationFilter/UDP"
+# define PACKET_LIST_POPUP_PATH_CONV_FLT_PN_CBA_SERV           "/PacketListMenuPopup/ConversationFilter/PN-CBA"
+#endif
 
 GtkWidget   *main_display_filter_widget=NULL;
 
-#define NEW_FILTER_COMBO_BOX 1
 /* Run the current display filter on the current packet set, and
    redisplay. */
 static void
@@ -64,6 +117,15 @@ filter_activate_cb(GtkWidget *w _U_, gpointer data)
     main_filter_packets(&cfile, s, FALSE);
 }
 
+/* Enable both Clear and Apply button when filter is changed */
+static void
+filter_changed_cb(GtkWidget *w _U_, gpointer data)
+{
+    gtk_widget_set_sensitive (g_object_get_data (G_OBJECT(data), E_DFILTER_APPLY_KEY), TRUE);
+    gtk_widget_set_sensitive (g_object_get_data (G_OBJECT(data), E_DFILTER_CLEAR_KEY), TRUE);
+    gtk_widget_set_sensitive (g_object_get_data (G_OBJECT(data), E_DFILTER_SAVE_KEY), TRUE);
+}
+
 /* redisplay with no display filter */
 static void
 filter_reset_cb(GtkWidget *w, gpointer data _U_)
@@ -76,18 +138,20 @@ filter_reset_cb(GtkWidget *w, gpointer data _U_)
     main_filter_packets(&cfile, NULL, FALSE);
 }
 
+static void
+filter_save_cb(GtkWidget *w _U_, GtkWindow *parent_w)
+{
+    filter_expression_save_dlg(parent_w);
+}
+
+
 GtkWidget *filter_toolbar_new(void)
 {
     GtkWidget     *filter_cm;
     GtkWidget     *filter_te;
     GtkWidget     *filter_tb;
-#ifdef NEW_FILTER_COMBO_BOX
-#else
-    GList         *dfilter_list = NULL;
-#endif
-    GtkTooltips   *tooltips;
-    GtkToolItem   *filter_bt, *filter_add_expr_bt, *filter_reset;
-    GtkToolItem   *filter_apply, *item;
+    GtkToolItem          *filter_bt, *filter_add_expr_bt, *filter_reset;
+    GtkToolItem   *filter_apply, *filter_save, *item;
 
 
     /* Display filter construct dialog has an Apply button, and "OK" not
@@ -100,11 +164,9 @@ GtkWidget *filter_toolbar_new(void)
         FALSE
     };
 
-    tooltips = gtk_tooltips_new();
-
     /* filter toolbar */
     filter_tb = gtk_toolbar_new();
-    gtk_toolbar_set_orientation(GTK_TOOLBAR(filter_tb),
+    gtk_orientable_set_orientation(GTK_ORIENTABLE(filter_tb),
                                 GTK_ORIENTATION_HORIZONTAL);
 
     g_object_set_data(G_OBJECT(top_level), E_TB_FILTER_KEY, filter_tb);
@@ -119,27 +181,17 @@ GtkWidget *filter_toolbar_new(void)
     gtk_toolbar_insert(GTK_TOOLBAR(filter_tb),
                        filter_bt,
                        -1);
-    gtk_tooltips_set_tip(GTK_TOOLTIPS(tooltips), GTK_WIDGET(filter_bt),
-                         "Open the \"Display Filter\" dialog, to edit/apply filters",
-                         "Private");
+       gtk_widget_set_tooltip_text( GTK_WIDGET(filter_bt), "Open the \"Display Filter\" dialog, to edit/apply filters");
 
     /* Create the filter combobox */
-#ifdef NEW_FILTER_COMBO_BOX
-    filter_cm = gtk_combo_box_entry_new_text ();
+    filter_cm = gtk_combo_box_text_new_with_entry ();
     filter_te = gtk_bin_get_child(GTK_BIN(filter_cm));
-#else
-    filter_cm = gtk_combo_new();
-    dfilter_list = NULL;
-    gtk_combo_disable_activate(GTK_COMBO(filter_cm));
-    gtk_combo_set_case_sensitive(GTK_COMBO(filter_cm), TRUE);
-    g_object_set_data(G_OBJECT(filter_cm), E_DFILTER_FL_KEY, dfilter_list);
-    filter_te = GTK_COMBO(filter_cm)->entry;
-#endif
     main_display_filter_widget=filter_te;
     g_object_set_data(G_OBJECT(filter_bt), E_FILT_TE_PTR_KEY, filter_te);
     g_object_set_data(G_OBJECT(filter_te), E_DFILTER_CM_KEY, filter_cm);
     g_object_set_data(G_OBJECT(top_level), E_DFILTER_CM_KEY, filter_cm);
     g_signal_connect(filter_te, "activate", G_CALLBACK(filter_activate_cb), filter_te);
+    g_signal_connect(filter_te, "changed", G_CALLBACK(filter_changed_cb), filter_cm);
     g_signal_connect(filter_te, "changed", G_CALLBACK(filter_te_syntax_check_cb), NULL);
     g_object_set_data(G_OBJECT(filter_tb), E_FILT_AUTOCOMP_PTR_KEY, NULL);
     g_object_set_data(G_OBJECT(filter_te), E_FILT_FIELD_USE_STATUSBAR_KEY, "");
@@ -157,15 +209,10 @@ GtkWidget *filter_toolbar_new(void)
                        -1);
 
     /* setting a tooltip for a combobox will do nothing, so add it to the corresponding text entry */
-#ifdef NEW_FILTER_COMBO_BOX
-    gtk_tooltips_set_tip(tooltips, filter_cm,
-#else
-    gtk_tooltips_set_tip(tooltips, filter_te,
-#endif
+       gtk_widget_set_tooltip_text(filter_cm,
         "Enter a display filter, or choose one of your recently used filters. "
         "The background color of this field is changed by a continuous syntax check "
-        "(green is valid, red is invalid, yellow may have unexpected results).",
-        NULL);
+        "(green is valid, red is invalid, yellow may have unexpected results).");
 
     /* Create the "Add Expression..." button, to pop up a dialog
        for constructing filter comparison expressions. */
@@ -178,95 +225,99 @@ GtkWidget *filter_toolbar_new(void)
                        filter_add_expr_bt,
                        -1);
 
-    gtk_tooltips_set_tip(GTK_TOOLTIPS(tooltips), GTK_WIDGET(filter_add_expr_bt),
-                         "Add an expression to this filter string",
-                         "Private");
+    gtk_widget_set_tooltip_text(GTK_WIDGET(filter_add_expr_bt), "Add an expression to this filter string");
 
     /* Create the "Clear" button */
     filter_reset = gtk_tool_button_new_from_stock(WIRESHARK_STOCK_CLEAR_EXPRESSION);
     g_object_set_data(G_OBJECT(filter_reset), E_DFILTER_TE_KEY, filter_te);
+    g_object_set_data (G_OBJECT(filter_cm), E_DFILTER_CLEAR_KEY, filter_reset);
     g_signal_connect(filter_reset, "clicked", G_CALLBACK(filter_reset_cb), NULL);
+    gtk_widget_set_sensitive (GTK_WIDGET(filter_reset), FALSE);
     gtk_widget_show(GTK_WIDGET(filter_reset));
     gtk_toolbar_insert(GTK_TOOLBAR(filter_tb),
                        filter_reset,
                        -1);
 
-    gtk_tooltips_set_tip(GTK_TOOLTIPS(tooltips), GTK_WIDGET(filter_reset),
-                         "Clear this filter string and update the display",
-                         "Private");
+    gtk_widget_set_tooltip_text(GTK_WIDGET(filter_reset), "Clear this filter string and update the display");
 
     /* Create the "Apply" button */
     filter_apply = gtk_tool_button_new_from_stock(WIRESHARK_STOCK_APPLY_EXPRESSION);
     g_object_set_data(G_OBJECT(filter_apply), E_DFILTER_CM_KEY, filter_cm);
+    g_object_set_data (G_OBJECT(filter_cm), E_DFILTER_APPLY_KEY, filter_apply);
     g_signal_connect(filter_apply, "clicked", G_CALLBACK(filter_activate_cb), filter_te);
+    gtk_widget_set_sensitive (GTK_WIDGET(filter_apply), FALSE);
     gtk_widget_show(GTK_WIDGET(filter_apply));
 
     gtk_toolbar_insert(GTK_TOOLBAR(filter_tb),
                        filter_apply,
                        -1);
 
-    gtk_tooltips_set_tip(GTK_TOOLTIPS(tooltips), GTK_WIDGET(filter_apply),
-                         "Apply this filter string to the display",
-                         "Private");
+    gtk_widget_set_tooltip_text(GTK_WIDGET(filter_apply), "Apply this filter string to the display");
+
+    /* Create the "Save" button */
+    filter_save = gtk_tool_button_new_from_stock(GTK_STOCK_SAVE);
+    g_object_set_data(G_OBJECT(filter_save), E_DFILTER_CM_KEY, filter_cm);
+    g_object_set_data(G_OBJECT(filter_cm), E_DFILTER_SAVE_KEY, filter_save);
+    g_signal_connect(filter_save, "clicked", G_CALLBACK(filter_save_cb), filter_te);
+    gtk_widget_set_sensitive (GTK_WIDGET(filter_save), FALSE);
+    gtk_widget_show(GTK_WIDGET(filter_save));
+
+    gtk_toolbar_insert(GTK_TOOLBAR(filter_tb),
+                       filter_save,
+                       -1);
+
+    gtk_widget_set_tooltip_text(GTK_WIDGET(filter_save), "Save this filter string");
 
     /* Sets the text entry widget pointer as the E_DILTER_TE_KEY data
      * of any widget that ends up calling a callback which needs
      * that text entry pointer */
-    set_menu_object_data("/File/Open...", E_DFILTER_TE_KEY, filter_te);
-    set_menu_object_data("/Edit/Copy/As Filter", E_DFILTER_TE_KEY,
-                         filter_te);
-    set_menu_object_data("/Analyze/Display Filters...", E_FILT_TE_PTR_KEY,
+    set_menu_object_data(MENU_BAR_PATH_FILE_OPEN, E_DFILTER_TE_KEY, filter_te);
+    set_menu_object_data(MENU_BAR_PATH_EDIT_COPY_AS_FLT, E_DFILTER_TE_KEY,
                          filter_te);
-    set_menu_object_data("/Analyze/Follow TCP Stream", E_DFILTER_TE_KEY,
+    set_menu_object_data(MENU_BAR_PATH_ANALYZE_DISPLAY_FLT, E_FILT_TE_PTR_KEY,
                          filter_te);
-    set_menu_object_data("/Analyze/Follow UDP Stream", E_DFILTER_TE_KEY,
+    set_menu_object_data(MENU_BAR_PATH_ANALYZE_FOLLOW_TCP_STREAM, E_DFILTER_TE_KEY,
                          filter_te);
-    set_menu_object_data("/Analyze/Follow SSL Stream", E_DFILTER_TE_KEY,
+    set_menu_object_data(MENU_BAR_PATH_ANALYZE_FOLLOW_UDP_STREAM, E_DFILTER_TE_KEY,
                          filter_te);
-    set_menu_object_data("/Analyze/Apply as Filter/Selected", E_DFILTER_TE_KEY,
+    set_menu_object_data(MENU_BAR_PATH_ANALYZE_FOLLOW_SSL_STREAM, E_DFILTER_TE_KEY,
                          filter_te);
-    set_menu_object_data("/Analyze/Apply as Filter/Not Selected", E_DFILTER_TE_KEY,
+    set_menu_object_data(MENU_BAR_PATH_ANALYZE_APL_AS_FLT_SEL, E_DFILTER_TE_KEY,
                          filter_te);
-    set_menu_object_data("/Analyze/Apply as Filter/... and Selected", E_DFILTER_TE_KEY,
+    set_menu_object_data(MENU_BAR_PATH_ANALYZE_APL_AS_FLT_NOT_SEL, E_DFILTER_TE_KEY,
                          filter_te);
-    set_menu_object_data("/Analyze/Apply as Filter/... or Selected", E_DFILTER_TE_KEY,
+    set_menu_object_data(MENU_BAR_PATH_ANALYZE_APL_AS_FLT_AND_SEL, E_DFILTER_TE_KEY,
                          filter_te);
-    set_menu_object_data("/Analyze/Apply as Filter/... and not Selected", E_DFILTER_TE_KEY,
+    set_menu_object_data(MENU_BAR_PATH_ANALYZE_APL_AS_FLT_OR_SEL, E_DFILTER_TE_KEY,
                          filter_te);
-    set_menu_object_data("/Analyze/Apply as Filter/... or not Selected", E_DFILTER_TE_KEY,
+    set_menu_object_data(MENU_BAR_PATH_ANALYZE_APL_AS_FLT_AND_NOT_SEL, E_DFILTER_TE_KEY,
                          filter_te);
-    set_menu_object_data("/Analyze/Prepare a Filter/Selected", E_DFILTER_TE_KEY,
+    set_menu_object_data(MENU_BAR_PATH_ANALYZE_APL_AS_FLT_OR_NOT_SEL, E_DFILTER_TE_KEY,
                          filter_te);
-    set_menu_object_data("/Analyze/Prepare a Filter/Not Selected", E_DFILTER_TE_KEY,
+    set_menu_object_data(MENU_BAR_PATH_ANALYZE_PREP_A_FLT_SEL, E_DFILTER_TE_KEY,
                          filter_te);
-    set_menu_object_data("/Analyze/Prepare a Filter/... and Selected", E_DFILTER_TE_KEY,
+    set_menu_object_data(MENU_BAR_PATH_ANALYZE_PREP_A_FLT_NOT_SEL, E_DFILTER_TE_KEY,
                          filter_te);
-    set_menu_object_data("/Analyze/Prepare a Filter/... or Selected", E_DFILTER_TE_KEY,
+    set_menu_object_data(MENU_BAR_PATH_ANALYZE_PREP_A_FLT_AND_SEL, E_DFILTER_TE_KEY,
                          filter_te);
-    set_menu_object_data("/Analyze/Prepare a Filter/... and not Selected", E_DFILTER_TE_KEY,
+    set_menu_object_data(MENU_BAR_PATH_ANALYZE_PREP_A_FLT_OR_SEL, E_DFILTER_TE_KEY,
                          filter_te);
-    set_menu_object_data("/Analyze/Prepare a Filter/... or not Selected", E_DFILTER_TE_KEY,
+    set_menu_object_data(MENU_BAR_PATH_ANALYZE_PREP_A_FLT_AND_NOT_SEL, E_DFILTER_TE_KEY,
                          filter_te);
-    set_menu_object_data("/Conversation Filter/Ethernet", E_DFILTER_TE_KEY,
-                         filter_te);
-    set_menu_object_data("/Conversation Filter/IP", E_DFILTER_TE_KEY,
-                         filter_te);
-    set_menu_object_data("/Conversation Filter/TCP", E_DFILTER_TE_KEY,
-                         filter_te);
-    set_menu_object_data("/Conversation Filter/UDP", E_DFILTER_TE_KEY,
-                         filter_te);
-    set_menu_object_data("/Conversation Filter/PN-CBA Server", E_DFILTER_TE_KEY,
+    set_menu_object_data(MENU_BAR_PATH_ANALYZE_PREP_A_FLT_OR_NOT_SEL, E_DFILTER_TE_KEY,
                          filter_te);
+
     set_toolbar_object_data(E_DFILTER_TE_KEY, filter_te);
     g_object_set_data(G_OBJECT(popup_menu_object), E_DFILTER_TE_KEY, filter_te);
 
+    filter_expression_save_dlg_init(filter_tb, filter_te);
+
     /* make current preferences effective */
     toolbar_redraw_all();
 
     return filter_tb;
 }
 
-#ifdef NEW_FILTER_COMBO_BOX
 static gboolean
 dfilter_entry_match(GtkWidget *filter_cm, char *s, int *index)
 {
@@ -298,43 +349,15 @@ dfilter_entry_match(GtkWidget *filter_cm, char *s, int *index)
     *index = i;
     return FALSE;
 }
-#else
-static gint
-dfilter_entry_match(gconstpointer a, gconstpointer b)
-{
-    const char *s1 = a;
-    const char *s2 = b;
-
-    return strcmp(s1, s2);
-}
-#endif
 
 /* add a display filter to the combo box */
 /* Note: a new filter string will not replace an old identical one */
 static gboolean
 dfilter_combo_add(GtkWidget *filter_cm, char *s) {
-#ifdef NEW_FILTER_COMBO_BOX
     int index;
 
     if(!dfilter_entry_match(filter_cm,s, &index))
-        gtk_combo_box_append_text(GTK_COMBO_BOX(filter_cm), s);
-#else
-    GList     *dfilter_list = g_object_get_data(G_OBJECT(filter_cm), E_DFILTER_FL_KEY);
-
-    /* GtkCombos don't let us get at their list contents easily, so we maintain
-       our own filter list, and feed it to gtk_combo_set_popdown_strings when
-       a new filter is added. */
-    if (s && strlen(s) > 0 &&
-        g_list_length(dfilter_list) < prefs.gui_recent_df_entries_max &&
-        g_list_find_custom(dfilter_list, s, dfilter_entry_match) == NULL) {
-
-        dfilter_list = g_list_append(dfilter_list, s);
-        s = NULL;
-        g_object_set_data(G_OBJECT(filter_cm), E_DFILTER_FL_KEY, dfilter_list);
-        gtk_combo_set_popdown_strings(GTK_COMBO(filter_cm), dfilter_list);
-        gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(filter_cm)->entry), g_list_first(dfilter_list)->data);
-    }
-#endif
+         gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT(filter_cm), s);
     g_free(s);
 
     return TRUE;
@@ -346,7 +369,6 @@ dfilter_combo_add(GtkWidget *filter_cm, char *s) {
 void
 dfilter_recent_combo_write_all(FILE *rf) {
     GtkWidget *filter_cm = g_object_get_data(G_OBJECT(top_level), E_DFILTER_CM_KEY);
-#ifdef NEW_FILTER_COMBO_BOX
     GtkTreeModel *model = gtk_combo_box_get_model (GTK_COMBO_BOX(filter_cm));
     GtkTreeIter   iter;
     GValue value = { 0, {{0}}};
@@ -364,35 +386,8 @@ dfilter_recent_combo_write_all(FILE *rf) {
 
     }while (gtk_tree_model_iter_next (model, &iter)&& (max_count++ < prefs.gui_recent_df_entries_max));
 
-#else
-    GList     *dfilter_list = g_object_get_data(G_OBJECT(filter_cm), E_DFILTER_FL_KEY);
-    GList     *li;
-    guint      max_count = 0;
-
-    /* write all non empty display filter strings to the recent file (until max count) */
-    li = g_list_first(dfilter_list);
-    while ( li && (max_count++ < prefs.gui_recent_df_entries_max) ) {
-        if (strlen(li->data)) {
-            fprintf (rf, RECENT_KEY_DISPLAY_FILTER ": %s\n", (char *)li->data);
-        }
-        li = li->next;
-    }
-#endif
 }
 
-/* empty the combobox entry field */
-void
-dfilter_combo_add_empty(void) {
-
-#ifdef NEW_FILTER_COMBO_BOX
-    /* This doesn't seem to be necessary with a Combo Box */
-#else
-    GtkWidget *filter_cm = g_object_get_data(G_OBJECT(top_level), E_DFILTER_CM_KEY);
-    gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(filter_cm)->entry), "");
-#endif
-}
-
-
 /* add a display filter coming from the user's recent file to the dfilter combo box */
 gboolean
 dfilter_combo_add_recent(gchar *s) {
@@ -408,12 +403,7 @@ dfilter_combo_add_recent(gchar *s) {
 gboolean
 main_filter_packets(capture_file *cf, const gchar *dftext, gboolean force)
 {
-#ifdef NEW_FILTER_COMBO_BOX
     GtkWidget *filter_cm = g_object_get_data(G_OBJECT(top_level), E_DFILTER_CM_KEY);
-#else
-    GtkCombo  *filter_cm = g_object_get_data(G_OBJECT(top_level), E_DFILTER_CM_KEY);
-    GList     *dfilter_list = g_object_get_data(G_OBJECT(filter_cm), E_DFILTER_FL_KEY);
-#endif
     gboolean   free_filter = TRUE;
     char      *s;
     cf_status_t cf_status;
@@ -421,6 +411,15 @@ main_filter_packets(capture_file *cf, const gchar *dftext, gboolean force)
     s = g_strdup(dftext);
 
     cf_status = cf_filter_packets(cf, s, force);
+
+    if (cf_status == CF_OK) {
+        gtk_widget_set_sensitive (g_object_get_data (G_OBJECT(filter_cm), E_DFILTER_APPLY_KEY), FALSE);
+       if (!s || strlen (s) == 0) {
+           gtk_widget_set_sensitive (g_object_get_data (G_OBJECT(filter_cm), E_DFILTER_CLEAR_KEY), FALSE);
+           gtk_widget_set_sensitive (g_object_get_data (G_OBJECT(filter_cm), E_DFILTER_SAVE_KEY), FALSE);
+       }
+    }
+
     if (!s)
         return (cf_status == CF_OK);
 
@@ -428,35 +427,16 @@ main_filter_packets(capture_file *cf, const gchar *dftext, gboolean force)
        our own filter list, and feed it to gtk_combo_set_popdown_strings when
        a new filter is added. */
     if (cf_status == CF_OK && strlen(s) > 0) {
-#ifdef NEW_FILTER_COMBO_BOX
         int index;
 
         if(!dfilter_entry_match(filter_cm,s, &index)){
-            gtk_combo_box_prepend_text(GTK_COMBO_BOX(filter_cm), s);
+            gtk_combo_box_text_prepend_text(GTK_COMBO_BOX_TEXT(filter_cm), s);
             index++;
         }
         while ((guint)index >= prefs.gui_recent_df_entries_max){
-            gtk_combo_box_remove_text(GTK_COMBO_BOX(filter_cm), index);
+            gtk_combo_box_text_remove(GTK_COMBO_BOX_TEXT(filter_cm), index);
             index--;
         }
-#else
-        GList *li;
-
-        while ((li = g_list_find_custom(dfilter_list, s, dfilter_entry_match)) != NULL)
-            /* Delete old/duplicate entry now. We'll re-add it later */
-            dfilter_list = g_list_delete_link(dfilter_list, li);
-
-        /* trim list size first */
-        while (g_list_length(dfilter_list) >= prefs.gui_recent_df_entries_max)
-            dfilter_list = g_list_delete_link(dfilter_list, g_list_last(dfilter_list));
-
-        free_filter = FALSE;
-        /* Push the filter to the front of the list */
-        dfilter_list = g_list_prepend(dfilter_list, s);
-        g_object_set_data(G_OBJECT(filter_cm), E_DFILTER_FL_KEY, dfilter_list);
-        gtk_combo_set_popdown_strings(filter_cm, dfilter_list);
-        gtk_entry_set_text(GTK_ENTRY(filter_cm->entry), g_list_first(dfilter_list)->data);
-#endif
     }
     if (free_filter)
         g_free(s);