r18208 - gnucash/trunk/src/gnome-utils - Patch by John Ralls. Integrates the gnucash menus into the MacOSX menubar.
Charles Day
cedayiv at code.gnucash.org
Mon Jul 13 16:40:46 EDT 2009
Author: cedayiv
Date: 2009-07-13 16:40:45 -0400 (Mon, 13 Jul 2009)
New Revision: 18208
Trac: http://svn.gnucash.org/trac/changeset/18208
Modified:
gnucash/trunk/src/gnome-utils/Makefile.am
gnucash/trunk/src/gnome-utils/gnc-main-window.c
Log:
Patch by John Ralls. Integrates the gnucash menus into the MacOSX menubar.
Modified: gnucash/trunk/src/gnome-utils/Makefile.am
===================================================================
--- gnucash/trunk/src/gnome-utils/Makefile.am 2009-07-13 20:39:44 UTC (rev 18207)
+++ gnucash/trunk/src/gnome-utils/Makefile.am 2009-07-13 20:40:45 UTC (rev 18208)
@@ -20,7 +20,10 @@
${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 @@
${GLIB_LIBS} \
${DB_LIBS} \
${REGEX_LIBS} \
- ${LIBXML2_LIBS}
+ ${LIBXML2_LIBS} \
+ ${IGE_MAC_LIBS}
if HAVE_X11_XLIB_H
libgncmod_gnome_utils_la_LIBADD += -lX11
Modified: gnucash/trunk/src/gnome-utils/gnc-main-window.c
===================================================================
--- gnucash/trunk/src/gnome-utils/gnc-main-window.c 2009-07-13 20:39:44 UTC (rev 18207)
+++ gnucash/trunk/src/gnome-utils/gnc-main-window.c 2009-07-13 20:40:45 UTC (rev 18208)
@@ -32,7 +32,6 @@
@author Copyright (C) 2003 Jan Arne Petersen <jpetersen at uni-bonn.de>
@author Copyright (C) 2003,2005,2006 David Hampton <hampton at 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 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 @@
* 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 @@
"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 @@
&data);
g_free(data.action_name);
g_free(data.label);
+
LEAVE(" ");
}
@@ -1964,6 +1976,9 @@
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 @@
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,
More information about the gnucash-changes
mailing list