forked from osmocom/wireshark
Add About, Preferences and a working Quit option to the OS X application menu
when ige mac integration is used. svn path=/trunk/; revision=26569
This commit is contained in:
parent
05b7f7314e
commit
b8b74f901d
17
gtk/main.c
17
gtk/main.c
|
@ -174,10 +174,6 @@
|
|||
#include <epan/crypt/airpdcap_ws.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_IGE_MAC_INTEGRATION
|
||||
#include <ige-mac-menu.h>
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Files under personal and global preferences directories in which
|
||||
* GTK settings for Wireshark are stored.
|
||||
|
@ -3154,15 +3150,14 @@ create_main_window (gint pl_size, gint tv_size, gint bv_size, e_prefs *prefs)
|
|||
|
||||
/* Menu bar */
|
||||
menubar = main_menu_new(&accel);
|
||||
|
||||
#ifdef HAVE_IGE_MAC_INTEGRATION
|
||||
if(prefs->gui_macosx_style) {
|
||||
ige_mac_menu_set_menu_bar(GTK_MENU_SHELL(menubar));
|
||||
ige_mac_menu_set_global_key_handler_enabled(TRUE);
|
||||
} else {
|
||||
/* MacOS X native menus are created and displayed by main_menu_new() */
|
||||
if(!prefs->gui_macosx_style) {
|
||||
#endif
|
||||
gtk_window_add_accel_group(GTK_WINDOW(top_level), accel);
|
||||
gtk_widget_show(menubar);
|
||||
#ifdef HAVE_IGE_MAC_INTEGRATION
|
||||
gtk_window_add_accel_group(GTK_WINDOW(top_level), accel);
|
||||
gtk_widget_show(menubar);
|
||||
#ifdef HAVE_IGE_MAC_INTEGRATION;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -90,6 +90,10 @@
|
|||
#include "gtk/main_toolbar.h"
|
||||
#include "gtk/main_welcome.h"
|
||||
|
||||
#ifdef HAVE_IGE_MAC_INTEGRATION
|
||||
#include <ige-mac-menu.h>
|
||||
#endif
|
||||
|
||||
typedef struct _menu_item {
|
||||
char *name;
|
||||
gint group;
|
||||
|
@ -1035,6 +1039,10 @@ static GtkAccelGroup *grp;
|
|||
GtkWidget *
|
||||
main_menu_new(GtkAccelGroup ** table) {
|
||||
GtkWidget *menubar;
|
||||
#ifdef HAVE_IGE_MAC_INTEGRATION
|
||||
GtkWidget *quit_item, *about_item, *preferences_item;
|
||||
IgeMacMenuGroup *group;
|
||||
#endif
|
||||
|
||||
grp = gtk_accel_group_new();
|
||||
|
||||
|
@ -1043,6 +1051,37 @@ main_menu_new(GtkAccelGroup ** table) {
|
|||
|
||||
menubar = main_menu_factory->widget;
|
||||
|
||||
#ifdef HAVE_IGE_MAC_INTEGRATION
|
||||
if(prefs.gui_macosx_style) {
|
||||
ige_mac_menu_set_menu_bar(GTK_MENU_SHELL(menubar));
|
||||
ige_mac_menu_set_global_key_handler_enabled(TRUE);
|
||||
|
||||
/* Create menu items to populate the application menu with. We have to
|
||||
* do this because we are still using the old GtkItemFactory API for
|
||||
* the main menu. */
|
||||
group = ige_mac_menu_add_app_menu_group();
|
||||
about_item = gtk_menu_item_new_with_label("About");
|
||||
g_signal_connect(about_item, "activate", G_CALLBACK(about_wireshark_cb),
|
||||
NULL);
|
||||
ige_mac_menu_add_app_menu_item(group, GTK_MENU_ITEM(about_item), NULL);
|
||||
|
||||
group = ige_mac_menu_add_app_menu_group();
|
||||
preferences_item = gtk_menu_item_new_with_label("Preferences");
|
||||
g_signal_connect(preferences_item, "activate", G_CALLBACK(prefs_cb),
|
||||
NULL);
|
||||
ige_mac_menu_add_app_menu_item(group, GTK_MENU_ITEM(preferences_item),
|
||||
NULL);
|
||||
}
|
||||
|
||||
/* The quit item in the application menu shows up whenever ige mac
|
||||
* integration is enabled, even if the OS X UI style in Wireshark isn't
|
||||
* turned on. */
|
||||
quit_item = gtk_menu_item_new_with_label("Quit");
|
||||
g_signal_connect(quit_item, "activate", G_CALLBACK(file_quit_cmd_cb),
|
||||
NULL);
|
||||
ige_mac_menu_set_quit_menu_item(GTK_MENU_ITEM(quit_item));
|
||||
#endif
|
||||
|
||||
if (table)
|
||||
*table = grp;
|
||||
|
||||
|
|
Loading…
Reference in New Issue