ext_menubar: Add pointer to GUI main structure

Add a pointer to the callback, which will provide an enum value,
 for each calling GUI entity, as well as a pointer to the main
 structure for that entity.

 For Qt this can be used for instance, to connect to slots of the
 main instance, to update a calling dialog.

Change-Id: Ifa6b04f868512574de53b6bce507e343f6e219d4
Reviewed-on: https://code.wireshark.org/review/8085
Petri-Dish: Graham Bloice <graham.bloice@trihedral.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Roland Knall <rknall@gmail.com>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
This commit is contained in:
Roland Knall 2015-04-16 10:20:05 +02:00 committed by Anders Broman
parent c3c8316d2e
commit 5b1d62c50b
3 changed files with 10 additions and 3 deletions

View File

@ -40,8 +40,14 @@ extern "C" {
#define EXT_MENUBAR_MAX_DEPTH 5
typedef enum
{
EXT_MENUBAR_GTK_GUI,
EXT_MENUBAR_QT_GUI
} ext_menubar_gui_type;
/* menubar callback */
typedef void (*ext_menubar_action_cb)(gpointer user_data);
typedef void (*ext_menubar_action_cb)(ext_menubar_gui_type gui_type, gpointer gui_object, gpointer user_data);
typedef enum
{
@ -69,6 +75,7 @@ struct _ext_menubar_t
gchar * tooltip;
gboolean is_plugin;
gpointer user_data;
ext_menubar_action_cb callback;

View File

@ -5469,7 +5469,7 @@ ws_menubar_external_cb(GtkAction *action _U_, gpointer data _U_)
entry = (ext_menubar_t *)data;
if ( entry->type == EXT_MENUBAR_ITEM )
{
entry->callback(entry->user_data);
entry->callback(EXT_MENUBAR_GTK_GUI, (gpointer) ((void *)GTK_WINDOW(top_level)), entry->user_data);
}
else if ( entry->type == EXT_MENUBAR_URL )
{

View File

@ -2918,7 +2918,7 @@ void MainWindow::on_actionExternalMenuItem_triggered()
if ( entry->type == EXT_MENUBAR_ITEM )
{
entry->callback(entry->user_data);
entry->callback(EXT_MENUBAR_QT_GUI, (gpointer) ((void *)main_ui_), entry->user_data);
}
else
{