Patch by John Ralls. Integrates the gnucash menus into the MacOSX menubar.

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@18208 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Charles Day 2009-07-13 20:40:45 +00:00
parent afe64deb46
commit 5318f379fd
2 changed files with 60 additions and 4 deletions

View File

@ -20,7 +20,10 @@ AM_CPPFLAGS = \
${GNOME_CFLAGS} \
${GNOME_PRINT_CFLAGS} \
${GUILE_INCS} \
${QOF_CFLAGS}
${QOF_CFLAGS} \
${GOFFICE_CFLAGS} \
${LIBGDA_CFLAGS} \
${IGE_MAC_CFLAGS}
libgncmod_gnome_utils_la_SOURCES = \
QuickFill.c \
@ -186,7 +189,8 @@ libgncmod_gnome_utils_la_LIBADD = \
${GLIB_LIBS} \
${DB_LIBS} \
${REGEX_LIBS} \
${LIBXML2_LIBS}
${LIBXML2_LIBS} \
${IGE_MAC_LIBS}
if HAVE_X11_XLIB_H
libgncmod_gnome_utils_la_LIBADD += -lX11

View File

@ -32,7 +32,6 @@
@author Copyright (C) 2003 Jan Arne Petersen <jpetersen@uni-bonn.de>
@author Copyright (C) 2003,2005,2006 David Hampton <hampton@employees.org>
*/
#include "config.h"
#include <gnome.h>
@ -70,6 +69,9 @@
#ifdef HAVE_GTK_2_10
# include "print-session.h"
#endif
#ifdef MAC_INTEGRATION
#include <igemacintegration/ige-mac-menu.h>
#endif
/** Names of signals generated by the main window. */
enum {
@ -152,6 +154,9 @@ static void do_popup_menu(GncPluginPage *page, GdkEventButton *event);
static gboolean gnc_main_window_popup_menu_cb (GtkWidget *widget, GncPluginPage *page);
static GtkAction *gnc_main_window_find_action (GncMainWindow *window, const gchar *name);
#ifdef MAC_INTEGRATION
static void gtk_quartz_set_menu(GncMainWindow* window);
#endif
/** The instance private data structure for an embedded window
* object. */
@ -162,7 +167,7 @@ typedef struct GncMainWindowPrivate
* manager and stored here when the UI manager provides them
* to the main window. */
GtkWidget *menu_dock;
/* The toolbar created by the UI manager. This pointer
/** The toolbar created by the UI manager. This pointer
* provides easy access for showing/hiding the toolbar. */
GtkWidget *toolbar;
/** The notebook containing all the pages in this window. */
@ -1407,6 +1412,12 @@ gnc_main_window_update_one_menu_action (GncMainWindow *window,
"label", data->label,
"visible", data->visible,
(char *)NULL);
#ifdef MAC_INTEGRATION
{
GtkWidget *menu = gtk_ui_manager_get_widget(window->ui_merge, "/menubar");
ige_mac_menu_sync(GTK_MENU_SHELL( menu ));
}
#endif
LEAVE(" ");
}
@ -1507,6 +1518,7 @@ gnc_main_window_update_menu_item (GncMainWindow *window)
&data);
g_free(data.action_name);
g_free(data.label);
LEAVE(" ");
}
@ -1964,6 +1976,9 @@ gnc_main_window_init (GncMainWindow *window,
qof_event_register_handler(gnc_main_window_event_handler, window);
gnc_main_window_setup_window (window);
#ifdef MAC_INTEGRATION
gtk_quartz_set_menu(window);
#endif
gnc_gobject_tracking_remember(G_OBJECT(window),
G_OBJECT_CLASS(klass));
}
@ -3032,6 +3047,43 @@ gnc_main_window_setup_window (GncMainWindow *window)
LEAVE(" ");
}
#ifdef MAC_INTEGRATION
static void
gtk_quartz_set_menu(GncMainWindow* window) {
IgeMacMenuGroup *group;
GtkWidget *menu;
GtkWidget *item;
menu = gtk_ui_manager_get_widget (window->ui_merge, "/menubar");
if (GTK_IS_MENU_ITEM (menu))
menu = gtk_menu_item_get_submenu (GTK_MENU_ITEM (menu));
gtk_widget_hide(menu);
ige_mac_menu_set_menu_bar (GTK_MENU_SHELL (menu));
item = gtk_ui_manager_get_widget (window->ui_merge,
"/menubar/File/FileQuit");
if (GTK_IS_MENU_ITEM (item))
ige_mac_menu_set_quit_menu_item (GTK_MENU_ITEM (item));
/* the about group */
group = ige_mac_menu_add_app_menu_group ();
item = gtk_ui_manager_get_widget (window->ui_merge,
"/menubar/Help/HelpAbout");
if (GTK_IS_MENU_ITEM (item))
ige_mac_menu_add_app_menu_item (group, GTK_MENU_ITEM (item), _("About GnuCash"));
/* the preferences group */
group = ige_mac_menu_add_app_menu_group ();
item = gtk_ui_manager_get_widget (window->ui_merge,
"/menubar/Edit/EditPreferences");
if (GTK_IS_MENU_ITEM (item))
ige_mac_menu_add_app_menu_item (group, GTK_MENU_ITEM (item), NULL);
}
#endif //MAC_INTEGRATION
/* Callbacks */
static void
gnc_main_window_add_widget (GtkUIManager *merge,