- Fix more callbacks.
authoretxrab <etxrab@f5534014-38df-0310-8fa8-9805f1628bb7>
Sun, 10 Oct 2010 19:33:42 +0000 (19:33 +0000)
committeretxrab <etxrab@f5534014-38df-0310-8fa8-9805f1628bb7>
Sun, 10 Oct 2010 19:33:42 +0000 (19:33 +0000)
When using the GUImanager the callback signature is (GtkAction *action , gpointer user_data) which causes problems when retreiveing
object data stored with the widget such as the filter box widget.

Work around that problem by doing
filter_cm = g_object_get_data(G_OBJECT(top_level), E_DFILTER_CM_KEY);
filter_te = gtk_bin_get_child(GTK_BIN(filter_cm));
in the follow_udp/tcp/ssl_stream.

git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@34455 f5534014-38df-0310-8fa8-9805f1628bb7

gtk/follow_ssl.c
gtk/follow_tcp.c
gtk/follow_udp.c
gtk/keys.h
gtk/main_filter_toolbar.h
gtk/menus.c

index d39c14b09ea84026cd9573b5202b402c0ea2317e..f65e7e34af79fb6649255ee5c25b3a54c7c0d65a 100644 (file)
@@ -51,6 +51,7 @@
 #include <../simple_dialog.h>
 #include <../util.h>
 
+#include "gtkglobals.h"
 #include <gtk/color_utils.h>
 #include <gtk/main.h>
 #include <gtk/dlg_utils.h>
@@ -139,7 +140,7 @@ packet_is_ssl(epan_dissect_t* edt);
 void
 follow_ssl_stream_cb(GtkWidget * w, gpointer data _U_)
 {
-    GtkWidget  *filter_te;
+    GtkWidget  *filter_te, *filter_cm;
     gchar      *follow_filter;
     const gchar        *previous_filter;
     int                filter_out_filter_len, previous_filter_len;
@@ -177,7 +178,8 @@ follow_ssl_stream_cb(GtkWidget * w, gpointer data _U_)
     }
 
     /* Set the display filter entry accordingly */
-    filter_te = g_object_get_data(G_OBJECT(w), E_DFILTER_TE_KEY);
+       filter_cm = g_object_get_data(G_OBJECT(top_level), E_DFILTER_CM_KEY);
+       filter_te = gtk_bin_get_child(GTK_BIN(filter_cm));
 
     /* needed in follow_filter_out_stream(), is there a better way? */
     follow_info->filter_te = filter_te;
index c517592e4a00e478ee1aa92eb5c80e77d1e27a32..f20b02dd8c08e323401d6dbfbd15c655a6f83866 100644 (file)
@@ -56,6 +56,7 @@
 #include "../tempfile.h"
 #include <wsutil/file_util.h>
 
+#include "gtkglobals.h"
 #include "gtk/color_utils.h"
 #include "gtk/follow_tcp.h"
 #include "gtk/dlg_utils.h"
@@ -89,8 +90,9 @@ follow_tcp_redraw_all(void)
    a dissection routine on belongs (this might be the most recently
    selected packet, or it might be the last packet in the file). */
 void
-follow_tcp_stream_cb(GtkWidget * w, gpointer data _U_)
+follow_tcp_stream_cb(GtkWidget * w _U_, gpointer data _U_)
 {
+       GtkWidget *filter_cm;
        GtkWidget       *filter_te;
        int             tmp_fd;
        gchar           *follow_filter;
@@ -165,7 +167,8 @@ follow_tcp_stream_cb(GtkWidget * w, gpointer data _U_)
        }
 
        /* Set the display filter entry accordingly */
-       filter_te = g_object_get_data(G_OBJECT(w), E_DFILTER_TE_KEY);
+       filter_cm = g_object_get_data(G_OBJECT(top_level), E_DFILTER_CM_KEY);
+       filter_te = gtk_bin_get_child(GTK_BIN(filter_cm));
 
        /* needed in follow_filter_out_stream(), is there a better way? */
        follow_info->filter_te = filter_te;
index 11950282918b85e51dfbe5fe2822c8e78f2ae752..81af8f3378be1c20d8786d36a6d98c60a3b78d86 100644 (file)
@@ -39,6 +39,7 @@
 
 #include <../simple_dialog.h>
 
+#include "gtkglobals.h"
 #include "gtk/follow_stream.h"
 #include <gtk/keys.h>
 #include <gtk/main.h>
@@ -85,9 +86,9 @@ udp_queue_packet_data(void *tapdata, packet_info *pinfo,
    a dissection routine on belongs (this might be the most recently
    selected packet, or it might be the last packet in the file). */
 void
-follow_udp_stream_cb(GtkWidget *w, gpointer data _U_)
+follow_udp_stream_cb(GtkWidget *w _U_, gpointer data _U_)
 {
-       GtkWidget *filter_te;
+       GtkWidget *filter_te, *filter_cm;
        gchar *follow_filter;
        const gchar *previous_filter;
        int filter_out_filter_len, previous_filter_len;
@@ -124,7 +125,8 @@ follow_udp_stream_cb(GtkWidget *w, gpointer data _U_)
                }
 
        /* Set the display filter entry accordingly */
-       filter_te = g_object_get_data(G_OBJECT(w), E_DFILTER_TE_KEY);
+       filter_cm = g_object_get_data(G_OBJECT(top_level), E_DFILTER_CM_KEY);
+       filter_te = gtk_bin_get_child(GTK_BIN(filter_cm));
 
        /* needed in follow_filter_out_stream(), is there a better way? */
        follow_info->filter_te = filter_te;
index bdbbfee2c6d993c72b542ea2ad23470162f56fa0..ac294fa5f70ab8854aeff454d755c13fe7e2c833 100644 (file)
@@ -28,6 +28,7 @@
 /** @file
  * Various keys for g_object_set_data().
  */
+#define E_DFILTER_CM_KEY                               "display_filter_combo"
 
 #define E_DFILTER_TE_KEY                               "display_filter_entry"
 #define E_RFILTER_TE_KEY                               "read_filter_te"
index 52cd1e0cc2799a2814e9896b038f113079023fae..e85aba61636e789d6c2892459433c879622dcfd7 100644 (file)
@@ -26,7 +26,6 @@
 #ifndef __MAIN_FILTER_TOOLBAR_H__
 #define __MAIN_FILTER_TOOLBAR_H__
 
-#define E_DFILTER_CM_KEY          "display_filter_combo"
 #define E_DFILTER_APPLY_KEY       "display_filter_apply"
 #define E_DFILTER_CLEAR_KEY       "display_filter_clear"
 
index 54d3480cc7a2af708813a50280ae1fed8f41fa66..d4fce32905359c668c792d78a4e15d6a1df59df4 100644 (file)
 #include <igemacintegration/gtkosxapplication.h>
 #endif
 
+static int initialize = TRUE;
+#ifdef MAIN_MENU_USE_UIMANAGER
+    GtkActionGroup    *main_menu_bar_action_group;
+#else
+static GtkItemFactory *main_menu_factory = NULL;
+#endif /* MAIN_MENU_USE_UIMANAGER */
+static GtkUIManager *ui_manager_main_menubar = NULL;
+static GtkUIManager *ui_manager_packet_list_heading = NULL;
+static GtkUIManager *ui_manager_packet_list_menu = NULL;
+static GtkUIManager *ui_manager_tree_view_menu = NULL;
+static GtkUIManager *ui_manager_bytes_menu = NULL;
+static GtkUIManager *ui_manager_statusbar_profiles_menu = NULL;
+static GSList *popup_menu_list = NULL;
+
+static GtkAccelGroup *grp;
+
 typedef struct _menu_item {
     char    *name;
     gint    group;
@@ -456,6 +472,19 @@ goto_conversation_frame(gboolean dir)
         g_free(filter);
 }
 
+#ifdef MAIN_MENU_USE_UIMANAGER
+static void
+goto_next_frame_conversation_cb(GtkAction *action _U_, gpointer user_data)
+{
+    goto_conversation_frame(FALSE);
+}
+
+static void
+goto_previous_frame_conversation_cb(GtkAction *action _U_, gpointer user_data)
+{
+    goto_conversation_frame(TRUE);
+}
+#else
 static void
 goto_next_frame_conversation_cb(GtkWidget *w _U_, gpointer d _U_)
 {
@@ -467,78 +496,93 @@ goto_previous_frame_conversation_cb(GtkWidget *w _U_, gpointer d _U_)
 {
     goto_conversation_frame(TRUE);
 }
+#endif /* MAIN_MENU_USE_UIMANAGER */
+
+
 
 /*Apply a filter */
 
 static void
-tree_view_menu_apply_selected_cb(GtkWidget *widget, gpointer user_data)
+tree_view_menu_apply_selected_cb(GtkAction *action _U_, gpointer user_data)
 {
+       GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_tree_view_menu, "/TreeViewPopup/ApplyAsFilter/Selected");
        match_selected_ptree_cb( widget , user_data, MATCH_SELECTED_REPLACE|MATCH_SELECTED_APPLY_NOW);
 }
 
 static void
-tree_view_menu_apply_not_selected_cb(GtkWidget *widget, gpointer user_data)
+tree_view_menu_apply_not_selected_cb(GtkAction *action _U_, gpointer user_data)
 {
+       GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_tree_view_menu, "/TreeViewPopup/ApplyAsFilter/NotSelected");
        match_selected_ptree_cb( widget , user_data, MATCH_SELECTED_NOT|MATCH_SELECTED_APPLY_NOW);
 }
 
 static void
-tree_view_menu_apply_and_selected_cb(GtkWidget *widget, gpointer user_data)
+tree_view_menu_apply_and_selected_cb(GtkAction *action _U_, gpointer user_data)
 {
+       GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_tree_view_menu, "/TreeViewPopup/ApplyAsFilter/AndSelected");
        match_selected_ptree_cb( widget , user_data, MATCH_SELECTED_AND|MATCH_SELECTED_APPLY_NOW);
 }
 
 static void
-tree_view_menu_apply_or_selected_cb(GtkWidget *widget, gpointer user_data)
+tree_view_menu_apply_or_selected_cb(GtkAction *action _U_, gpointer user_data)
 {
+       GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_tree_view_menu, "/TreeViewPopup/ApplyAsFilter/OrSelected");
        match_selected_ptree_cb( widget , user_data, MATCH_SELECTED_OR|MATCH_SELECTED_APPLY_NOW);
 }
 
 static void
-tree_view_menu_apply_and_not_selected_cb(GtkWidget *widget, gpointer user_data)
+tree_view_menu_apply_and_not_selected_cb(GtkAction *action _U_, gpointer user_data)
 {
+       GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_tree_view_menu, "/TreeViewPopup/ApplyAsFilter/AndNotSelected");
        match_selected_ptree_cb( widget , user_data, MATCH_SELECTED_AND_NOT|MATCH_SELECTED_APPLY_NOW);
 }
 
 static void
-tree_view_menu_apply_or_not_selected_cb(GtkWidget *widget, gpointer user_data)
+tree_view_menu_apply_or_not_selected_cb(GtkAction *action _U_, gpointer user_data)
 {
+       GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_tree_view_menu, "/TreeViewPopup/ApplyAsFilter/OrNotSelected");
        match_selected_ptree_cb( widget , user_data,MATCH_SELECTED_OR_NOT|MATCH_SELECTED_APPLY_NOW);
 }
 /* Prepare a filter */
 static void
-tree_view_menu_prepare_selected_cb(GtkWidget *widget, gpointer user_data)
+tree_view_menu_prepare_selected_cb(GtkAction *action _U_, gpointer user_data)
 {
+       GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_tree_view_menu, "/TreeViewPopup/PrepareaFilter/Selected");
        match_selected_ptree_cb( widget , user_data, MATCH_SELECTED_REPLACE);
 }
 
 static void
-tree_view_menu_prepare_not_selected_cb(GtkWidget *widget, gpointer user_data)
+tree_view_menu_prepare_not_selected_cb(GtkAction *action _U_, gpointer user_data)
 {
+       GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_tree_view_menu, "/TreeViewPopup/PrepareaFilter/NotSelected");
        match_selected_ptree_cb( widget , user_data, MATCH_SELECTED_NOT);
 }
 
 static void
-tree_view_menu_prepare_and_selected_cb(GtkWidget *widget, gpointer user_data)
+tree_view_menu_prepare_and_selected_cb(GtkAction *action _U_, gpointer user_data)
 {
+       GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_tree_view_menu, "/TreeViewPopup/PrepareaFilter/AndSelected");
        match_selected_ptree_cb( widget , user_data, MATCH_SELECTED_AND);
 }
 
 static void
-tree_view_menu_prepare_or_selected_cb(GtkWidget *widget, gpointer user_data)
+tree_view_menu_prepare_or_selected_cb(GtkAction *action _U_, gpointer user_data)
 {
+       GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_tree_view_menu, "/TreeViewPopup/PrepareaFilter/OrSelected");
        match_selected_ptree_cb( widget , user_data, MATCH_SELECTED_OR);
 }
 
 static void
-tree_view_menu_prepare_and_not_selected_cb(GtkWidget *widget, gpointer user_data)
+tree_view_menu_prepare_and_not_selected_cb(GtkAction *action _U_, gpointer user_data)
 {
+       GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_tree_view_menu, "/TreeViewPopup/PrepareaFilter/AndNotSelected");
        match_selected_ptree_cb( widget , user_data, MATCH_SELECTED_AND_NOT);
 }
 
 static void
-tree_view_menu_prepare_or_not_selected_cb(GtkWidget *widget, gpointer user_data)
+tree_view_menu_prepare_or_not_selected_cb(GtkAction *action _U_, gpointer user_data)
 {
+       GtkWidget *widget = gtk_ui_manager_get_widget(ui_manager_tree_view_menu, "/TreeViewPopup/PrepareaFilter/OrNotSelected");
        match_selected_ptree_cb( widget , user_data, MATCH_SELECTED_OR_NOT);
 }
 
@@ -547,51 +591,51 @@ tree_view_menu_prepare_or_not_selected_cb(GtkWidget *widget, gpointer user_data)
 guint merge_id = 0;
 
 static void
-copy_description_cb(GtkWidget *widget, gpointer user_data)
+copy_description_cb(GtkAction *action _U_, gpointer user_data)
 {
-       copy_selected_plist_cb( widget , user_data, COPY_SELECTED_DESCRIPTION);
+       copy_selected_plist_cb( NULL /* widget _U_ */ , user_data, COPY_SELECTED_DESCRIPTION);
 }
 
 static void
-copy_fieldname_cb(GtkWidget *widget, gpointer user_data)
+copy_fieldname_cb(GtkAction *action _U_, gpointer user_data)
 {
-       copy_selected_plist_cb( widget , user_data, COPY_SELECTED_FIELDNAME);
+       copy_selected_plist_cb( NULL /* widget _U_ */ , user_data, COPY_SELECTED_FIELDNAME);
 }
 
 static void
-copy_value_cb(GtkWidget *widget, gpointer user_data)
+copy_value_cb(GtkAction *action _U_, gpointer user_data)
 {
-       copy_selected_plist_cb( widget , user_data, COPY_SELECTED_VALUE);
+       copy_selected_plist_cb( NULL /* widget _U_ */ , user_data, COPY_SELECTED_VALUE);
 }
 
 static void
-copy_as_filter_cb(GtkWidget *widget, gpointer user_data)
+copy_as_filter_cb(GtkAction *action _U_, gpointer user_data)
 {
-       match_selected_ptree_cb( widget , user_data, MATCH_SELECTED_REPLACE|MATCH_SELECTED_COPY_ONLY);
+       match_selected_ptree_cb( NULL /* widget _U_ */ , user_data, MATCH_SELECTED_REPLACE|MATCH_SELECTED_COPY_ONLY);
 }
 
 static void
-set_reftime_cb(GtkWidget *widget, gpointer user_data)
+set_reftime_cb(GtkAction *action _U_, gpointer user_data)
 {
-       reftime_frame_cb( widget , user_data, REFTIME_TOGGLE);
+       reftime_frame_cb( NULL /* widget _U_ */ , user_data, REFTIME_TOGGLE);
 }
 
 static void
-find_next_ref_time_cb(GtkWidget *widget, gpointer user_data)
+find_next_ref_time_cb(GtkAction *action _U_, gpointer user_data)
 {
-       reftime_frame_cb( widget , user_data, REFTIME_FIND_NEXT);
+       reftime_frame_cb( NULL /* widget _U_ */ , user_data, REFTIME_FIND_NEXT);
 }
 
 static void
-find_previous_ref_time_cb(GtkWidget *widget, gpointer user_data)
+find_previous_ref_time_cb(GtkAction *action _U_, gpointer user_data)
 {
-       reftime_frame_cb( widget , user_data, REFTIME_FIND_PREV);
+       reftime_frame_cb( NULL /* widget _U_ */ , user_data, REFTIME_FIND_PREV);
 }
 
 static void
-menus_prefs_cb(GtkWidget *widget, gpointer user_data)
+menus_prefs_cb(GtkAction *action _U_, gpointer user_data)
 {
-       prefs_page_cb( widget , user_data, PREFS_PAGE_USER_INTERFACE);
+       prefs_page_cb( NULL /* widget _U_ */ , user_data, PREFS_PAGE_USER_INTERFACE);
 }
 
 static void
@@ -2025,21 +2069,6 @@ static GtkItemFactoryEntry menu_items[] =
 static int nmenu_items = sizeof(menu_items) / sizeof(menu_items[0]);
 #endif /* MAIN_MENU_USE_UIMANAGER */
 
-static int initialize = TRUE;
-#ifdef MAIN_MENU_USE_UIMANAGER
-    GtkActionGroup    *main_menu_bar_action_group;
-#else
-static GtkItemFactory *main_menu_factory = NULL;
-#endif
-static GtkUIManager *ui_manager_main_menubar = NULL;
-static GtkUIManager *ui_manager_packet_list_heading = NULL;
-static GtkUIManager *ui_manager_packet_list_menu = NULL;
-static GtkUIManager *ui_manager_tree_view_menu = NULL;
-static GtkUIManager *ui_manager_bytes_menu = NULL;
-static GtkUIManager *ui_manager_statusbar_profiles_menu = NULL;
-static GSList *popup_menu_list = NULL;
-
-static GtkAccelGroup *grp;
 
 static void
 select_bytes_view_cb (GtkRadioAction *action, GtkRadioAction *current _U_, gpointer user_data _U_)