From Jim Young and updated by Max Romanov:
The modification to acinclude.m4 adds a new test in the AC_WIRESHARK_OSX_INTEGRATION_CHECK section to first look for the library gtkmacintegration. "gtkmacintegration" is the new internal name for GTK+ MAC OSX library after the project was moved to www.gtk.org. Previously this library was known as igemacintegration. The patches to the three gtk/*.c files update the conditional #include <gtkmacintegration/gtkosxapplication.h> to use the new folder name. The Option 1 patch will break any build environment that expects to find the gtkosapplication.h file in the older igemacintegration folder. In addition the patch includes updates to gtk/main.c and gtk/main_menubar.c for a more standard looking App menu. https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=6702 svn path=/trunk/; revision=45869
This commit is contained in:
parent
a43acbd8c3
commit
d54b681f84
30
acinclude.m4
30
acinclude.m4
|
@ -1726,14 +1726,20 @@ fi
|
|||
# Checks for the presence of OS X integration functions in the GTK+ framework
|
||||
# or as a separate library.
|
||||
#
|
||||
# http://sourceforge.net/apps/trac/gtk-osx/wiki/Integrate
|
||||
# GTK+ for MAC OS X now lives on www.gtk.org at:
|
||||
#
|
||||
# http://www.gtk.org/download/macos.php
|
||||
#
|
||||
# Details on building with GTK-OSX are available at:
|
||||
#
|
||||
# http://live.gnome.org/GTK%2B/OSX/Building
|
||||
#
|
||||
# The GTK-OSX library has been renamed to gtkmacintegration.
|
||||
# It was previously named igemacintegration.
|
||||
#
|
||||
# http://live.gnome.org/GTK%2B/OSX/Integration
|
||||
# for the old Carbon-based integration functions
|
||||
#
|
||||
# http://gtk-osx.sourceforge.net/ige-mac-integration/
|
||||
# for the new Cocoa-based integration functions
|
||||
#
|
||||
AC_DEFUN([AC_WIRESHARK_OSX_INTEGRATION_CHECK],
|
||||
[
|
||||
ac_save_CFLAGS="$CFLAGS"
|
||||
|
@ -1742,17 +1748,17 @@ AC_DEFUN([AC_WIRESHARK_OSX_INTEGRATION_CHECK],
|
|||
LIBS="$GTK_LIBS $LIBS"
|
||||
|
||||
#
|
||||
# Check for the new integration functions in a -ligemacintegration
|
||||
# Check for the new integration functions in a -lgtkmacintegration
|
||||
# library.
|
||||
#
|
||||
AC_CHECK_LIB(igemacintegration, gtk_osxapplication_set_menu_bar,
|
||||
AC_CHECK_LIB(gtkmacintegration, gtkosx_application_set_menu_bar,
|
||||
[
|
||||
AC_DEFINE(HAVE_GTKOSXAPPLICATION, 1,
|
||||
[Define to 1 if -ligemacintegration includes the GtkOSXApplication Integration functions.])
|
||||
[Define to 1 if -lgtkmacintegration includes the GtkOSXApplication Integration functions.])
|
||||
have_ige_mac=yes
|
||||
# We don't want gtk stuff in LIBS (which is reset below) so
|
||||
# manually set GTK_LIBS (which is more appropriate)
|
||||
GTK_LIBS="$GTK_LIBS -ligemacintegration"
|
||||
GTK_LIBS="$GTK_LIBS -lgtkmacintegration"
|
||||
])
|
||||
|
||||
if test x$have_ige_mac = x
|
||||
|
@ -1761,7 +1767,7 @@ AC_DEFUN([AC_WIRESHARK_OSX_INTEGRATION_CHECK],
|
|||
# Not found - check for the old integration functions in
|
||||
# the Gtk framework.
|
||||
#
|
||||
AC_CHECK_LIB(Gtk, ige_mac_menu_set_menu_bar,
|
||||
AC_CHECK_LIB(Gtk, gtk_mac_menu_set_menu_bar,
|
||||
[
|
||||
AC_DEFINE(HAVE_IGE_MAC_INTEGRATION, 1,
|
||||
[Define to 1 if the the Gtk+ framework or a separate library includes the Imendio IGE Mac OS X Integration functions.])
|
||||
|
@ -1776,16 +1782,16 @@ AC_DEFUN([AC_WIRESHARK_OSX_INTEGRATION_CHECK],
|
|||
then
|
||||
#
|
||||
# Not found - check for the old integration functions in
|
||||
# a -ligemacintegration library.
|
||||
# a -lgtkmacintegration library.
|
||||
#
|
||||
AC_CHECK_LIB(igemacintegration, ige_mac_menu_set_menu_bar,
|
||||
AC_CHECK_LIB(gtkmacintegration, gtk_mac_menu_set_menu_bar,
|
||||
[
|
||||
AC_DEFINE(HAVE_IGE_MAC_INTEGRATION, 1,
|
||||
[Define to 1 if the the Gtk+ framework or a separate library includes the Imendio IGE Mac OS X Integration functions.])
|
||||
have_ige_mac=yes
|
||||
# We don't want gtk stuff in LIBS (which is reset below) so
|
||||
# manually set GTK_LIBS (which is more appropriate)
|
||||
GTK_LIBS="$GTK_LIBS -ligemacintegration"
|
||||
GTK_LIBS="$GTK_LIBS -lgtkmacintegration"
|
||||
])
|
||||
fi
|
||||
CFLAGS="$ac_save_CFLAGS"
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
#include "ui/gtk/old-gtk-compat.h"
|
||||
|
||||
#ifdef HAVE_GTKOSXAPPLICATION
|
||||
#include <igemacintegration/gtkosxapplication.h>
|
||||
#include <gtkmacintegration/gtkosxapplication.h>
|
||||
#endif
|
||||
|
||||
enum { DND_TARGET_STRING, DND_TARGET_ROOTWIN, DND_TARGET_URL };
|
||||
|
@ -212,6 +212,7 @@ dnd_open_file_cmd(gchar *cf_names_freeme)
|
|||
int files_work;
|
||||
char **in_filenames;
|
||||
|
||||
if (cf_names_freeme == NULL) return;
|
||||
|
||||
/* DND_TARGET_URL:
|
||||
* The cf_name_freeme is a single string, containing one or more URI's,
|
||||
|
@ -225,6 +226,10 @@ dnd_open_file_cmd(gchar *cf_names_freeme)
|
|||
cf_name += 2;
|
||||
in_files++;
|
||||
}
|
||||
if (in_files == 0) {
|
||||
g_free(cf_names_freeme);
|
||||
return;
|
||||
}
|
||||
|
||||
in_filenames = g_malloc(sizeof(char*) * in_files);
|
||||
|
||||
|
@ -327,14 +332,10 @@ dnd_data_received(GtkWidget *widget _U_, GdkDragContext *dc _U_, gint x _U_, gin
|
|||
/* the data string is not zero terminated -> make a zero terminated "copy" of it */
|
||||
sel_data_len = gtk_selection_data_get_length(selection_data);
|
||||
sel_data_data = gtk_selection_data_get_data(selection_data);
|
||||
cf_names_freeme = g_malloc(sel_data_len + 3);
|
||||
cf_names_freeme = g_malloc(sel_data_len + 1);
|
||||
memcpy(cf_names_freeme, sel_data_data, sel_data_len);
|
||||
if (cf_names_freeme[sel_data_len - 1] != '\n') {
|
||||
cf_names_freeme[sel_data_len++] = '\r';
|
||||
cf_names_freeme[sel_data_len++] = '\n';
|
||||
}
|
||||
cf_names_freeme[sel_data_len] = '\0';
|
||||
|
||||
|
||||
/* If there's unsaved data, let the user save it first.
|
||||
If they cancel out of it, don't open the file. */
|
||||
if (do_file_close(&cfile, FALSE, " before opening a new capture file"))
|
||||
|
@ -344,12 +345,22 @@ dnd_data_received(GtkWidget *widget _U_, GdkDragContext *dc _U_, gint x _U_, gin
|
|||
|
||||
#ifdef HAVE_GTKOSXAPPLICATION
|
||||
gboolean
|
||||
gtk_osx_openFile (GtkOSXApplication *app _U_, gchar *path, gpointer user_data _U_)
|
||||
gtk_osx_openFile (GtkosxApplication *app _U_, gchar *path, gpointer user_data _U_)
|
||||
{
|
||||
GtkSelectionData selection_data;
|
||||
gchar* selection_path;
|
||||
int length = strlen(path);
|
||||
|
||||
gtk_selection_data_set_text(&selection_data, path, length);
|
||||
|
||||
selection_path = g_malloc(length + 3);
|
||||
memcpy(selection_path, path, length);
|
||||
|
||||
selection_path[length] = '\r';
|
||||
selection_path[length + 1] = '\n';
|
||||
selection_path[length + 2] = '\0';
|
||||
|
||||
memset(&selection_data, 0, sizeof(selection_data));
|
||||
|
||||
gtk_selection_data_set(&selection_data, gdk_atom_intern_static_string ("text/uri-list"), 8, (guchar*) selection_path, length + 2);
|
||||
dnd_data_received(NULL, NULL, 0, 0, &selection_data, DND_TARGET_URL, 0, 0);
|
||||
|
||||
return TRUE;
|
||||
|
@ -376,7 +387,7 @@ dnd_init(GtkWidget *w)
|
|||
/* get notified, if some dnd coming in */
|
||||
g_signal_connect(w, "drag_data_received", G_CALLBACK(dnd_data_received), NULL);
|
||||
#ifdef HAVE_GTKOSXAPPLICATION
|
||||
g_signal_connect(g_object_new(GTK_TYPE_OSX_APPLICATION, NULL), "NSApplicationOpenFile", G_CALLBACK(gtk_osx_openFile), NULL);
|
||||
g_signal_connect(g_object_new(GTKOSX_TYPE_APPLICATION, NULL), "NSApplicationOpenFile", G_CALLBACK(gtk_osx_openFile), NULL);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -199,7 +199,7 @@
|
|||
|
||||
|
||||
#ifdef HAVE_GTKOSXAPPLICATION
|
||||
#include <igemacintegration/gtkosxapplication.h>
|
||||
#include <gtkmacintegration/gtkosxapplication.h>
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
@ -1870,7 +1870,7 @@ static void
|
|||
main_capture_callback(gint event, capture_options *capture_opts, gpointer user_data _U_)
|
||||
{
|
||||
#ifdef HAVE_GTKOSXAPPLICATION
|
||||
GtkOSXApplication *theApp;
|
||||
GtkosxApplication *theApp;
|
||||
#endif
|
||||
switch(event) {
|
||||
case(capture_cb_capture_prepared):
|
||||
|
@ -1881,8 +1881,8 @@ main_capture_callback(gint event, capture_options *capture_opts, gpointer user_d
|
|||
g_log(LOG_DOMAIN_MAIN, G_LOG_LEVEL_DEBUG, "Callback: capture update started");
|
||||
main_capture_cb_capture_update_started(capture_opts);
|
||||
#ifdef HAVE_GTKOSXAPPLICATION
|
||||
theApp = g_object_new(GTK_TYPE_OSX_APPLICATION, NULL);
|
||||
gtk_osxapplication_set_dock_icon_pixbuf(theApp,gdk_pixbuf_new_from_xpm_data(wsiconcap48_xpm));
|
||||
theApp = g_object_new(GTKOSX_TYPE_APPLICATION, NULL);
|
||||
gtkosx_application_set_dock_icon_pixbuf(theApp,gdk_pixbuf_new_from_xpm_data(wsiconcap48_xpm));
|
||||
#endif
|
||||
break;
|
||||
case(capture_cb_capture_update_continue):
|
||||
|
@ -1908,8 +1908,8 @@ main_capture_callback(gint event, capture_options *capture_opts, gpointer user_d
|
|||
/* Beware: this state won't be called, if the capture child
|
||||
* closes the capturing on it's own! */
|
||||
#ifdef HAVE_GTKOSXAPPLICATION
|
||||
theApp = g_object_new(GTK_TYPE_OSX_APPLICATION, NULL);
|
||||
gtk_osxapplication_set_dock_icon_pixbuf(theApp,gdk_pixbuf_new_from_xpm_data(wsicon64_xpm));
|
||||
theApp = g_object_new(GTKOSX_TYPE_APPLICATION, NULL);
|
||||
gtkosx_application_set_dock_icon_pixbuf(theApp,gdk_pixbuf_new_from_xpm_data(wsicon64_xpm));
|
||||
#endif
|
||||
main_capture_cb_capture_stopping(capture_opts);
|
||||
break;
|
||||
|
@ -2187,7 +2187,7 @@ main(int argc, char *argv[])
|
|||
int optind_initial;
|
||||
int status;
|
||||
#ifdef HAVE_GTKOSXAPPLICATION
|
||||
GtkOSXApplication *theApp;
|
||||
GtkosxApplication *theApp;
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_LIBPCAP
|
||||
|
@ -2797,7 +2797,14 @@ main(int argc, char *argv[])
|
|||
* file - yes, you could have "-r" as the last part of the command,
|
||||
* but that's a bit ugly.
|
||||
*/
|
||||
#ifndef HAVE_GTKOSXAPPLICATION
|
||||
/*
|
||||
* For GTK+ Mac Integration, file name passed as free argument passed
|
||||
* through grag-and-drop and opened twice sometimes causing crashes.
|
||||
* Subject to report to GTK+ MAC.
|
||||
*/
|
||||
cf_name = g_strdup(argv[0]);
|
||||
#endif
|
||||
}
|
||||
argc--;
|
||||
argv++;
|
||||
|
@ -3182,9 +3189,9 @@ main(int argc, char *argv[])
|
|||
profile_store_persconffiles (FALSE);
|
||||
|
||||
#ifdef HAVE_GTKOSXAPPLICATION
|
||||
theApp = g_object_new(GTK_TYPE_OSX_APPLICATION, NULL);
|
||||
gtk_osxapplication_set_dock_icon_pixbuf(theApp,gdk_pixbuf_new_from_xpm_data(wsicon64_xpm));
|
||||
gtk_osxapplication_ready(theApp);
|
||||
theApp = g_object_new(GTKOSX_TYPE_APPLICATION, NULL);
|
||||
gtkosx_application_set_dock_icon_pixbuf(theApp,gdk_pixbuf_new_from_xpm_data(wsicon64_xpm));
|
||||
gtkosx_application_ready(theApp);
|
||||
#endif
|
||||
|
||||
g_log(LOG_DOMAIN_MAIN, G_LOG_LEVEL_INFO, "Wireshark is up and ready to go");
|
||||
|
@ -3682,6 +3689,8 @@ create_main_window (gint pl_size, gint tv_size, gint bv_size, e_prefs *prefs_p)
|
|||
gtk_window_add_accel_group(GTK_WINDOW(top_level), accel);
|
||||
gtk_widget_show(menubar);
|
||||
#if defined(HAVE_IGE_MAC_INTEGRATION) || defined(HAVE_GTKOSXAPPLICATION)
|
||||
} else {
|
||||
gtk_widget_hide(menubar);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -121,7 +121,7 @@
|
|||
#endif
|
||||
|
||||
#ifdef HAVE_GTKOSXAPPLICATION
|
||||
#include <igemacintegration/gtkosxapplication.h>
|
||||
#include <gtkmacintegration/gtkosxapplication.h>
|
||||
#endif
|
||||
|
||||
static int initialize = TRUE;
|
||||
|
@ -3064,7 +3064,7 @@ main_menu_new(GtkAccelGroup ** table) {
|
|||
IgeMacMenuGroup *group;
|
||||
#endif
|
||||
#ifdef HAVE_GTKOSXAPPLICATION
|
||||
GtkOSXApplication *theApp;
|
||||
GtkosxApplication *theApp;
|
||||
GtkWidget * item;
|
||||
GtkWidget * dock_menu;
|
||||
#endif
|
||||
|
@ -3106,25 +3106,33 @@ main_menu_new(GtkAccelGroup ** table) {
|
|||
#endif
|
||||
|
||||
#ifdef HAVE_GTKOSXAPPLICATION
|
||||
theApp = g_object_new(GTK_TYPE_OSX_APPLICATION, NULL);
|
||||
theApp = g_object_new(GTKOSX_TYPE_APPLICATION, NULL);
|
||||
|
||||
if(prefs.gui_macosx_style) {
|
||||
gtk_osxapplication_set_menu_bar(theApp, GTK_MENU_SHELL(menubar));
|
||||
gtk_osxapplication_set_use_quartz_accelerators(theApp, TRUE);
|
||||
gtk_widget_hide(menubar);
|
||||
|
||||
gtkosx_application_set_menu_bar(theApp, GTK_MENU_SHELL(menubar));
|
||||
gtkosx_application_set_use_quartz_accelerators(theApp, TRUE);
|
||||
|
||||
/* Construct a conventional looking OSX App menu */
|
||||
|
||||
item = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/HelpMenu/AboutWireshark");
|
||||
gtk_osxapplication_insert_app_menu_item(theApp, item, 0);
|
||||
gtkosx_application_insert_app_menu_item(theApp, item, 0);
|
||||
|
||||
gtkosx_application_insert_app_menu_item(theApp, gtk_separator_menu_item_new(), 1);
|
||||
|
||||
item = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/EditMenu/Preferences");
|
||||
gtk_osxapplication_insert_app_menu_item(theApp, item, 0);
|
||||
gtkosx_application_insert_app_menu_item(theApp, item, 2);
|
||||
|
||||
/* Set OSX help menu */
|
||||
|
||||
item = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/HelpMenu");
|
||||
gtk_osxapplication_set_help_menu(theApp,GTK_MENU_ITEM(item));
|
||||
gtkosx_application_set_help_menu(theApp,GTK_MENU_ITEM(item));
|
||||
|
||||
/* Quit item is not needed */
|
||||
/* XXXX FIX ME */
|
||||
/*gtk_item_factory_delete_item(main_menu_factory,"/File/Quit");*/
|
||||
/* Hide the File menu Quit item (a Quit item is automagically placed within the OSX App menu) */
|
||||
|
||||
item = gtk_ui_manager_get_widget(ui_manager_main_menubar, "/Menubar/FileMenu/Quit");
|
||||
gtk_widget_hide(item);
|
||||
}
|
||||
|
||||
/* generate dock menu */
|
||||
|
@ -3142,7 +3150,7 @@ main_menu_new(GtkAccelGroup ** table) {
|
|||
g_signal_connect(item, "activate", G_CALLBACK (capture_restart_cb), NULL);
|
||||
gtk_menu_shell_append(GTK_MENU_SHELL(dock_menu), item);
|
||||
|
||||
gtk_osxapplication_set_dock_menu(theApp, GTK_MENU_SHELL(dock_menu));
|
||||
gtkosx_application_set_dock_menu(theApp, GTK_MENU_SHELL(dock_menu));
|
||||
#endif
|
||||
|
||||
if (table)
|
||||
|
@ -5427,7 +5435,7 @@ rebuild_visible_columns_menu (void)
|
|||
col_id++;
|
||||
}
|
||||
|
||||
menu_item = gtk_menu_item_new();
|
||||
menu_item = gtk_separator_menu_item_new();
|
||||
gtk_menu_shell_append (GTK_MENU_SHELL(sub_menu), menu_item);
|
||||
gtk_widget_show (menu_item);
|
||||
|
||||
|
|
Loading…
Reference in New Issue