Ticket #40419: patch_quartz-src-wbc-gtk.c.2.diff

File patch_quartz-src-wbc-gtk.c.2.diff, 2.1 KB (added by c.herbig@…, 8 years ago)
  • src/

    old new  
    6969#include "gnm-i18n.h"
    7070#include <errno.h>
    7171#include <string.h>
     72#include <gtkmacintegration/gtkosxapplication.h>
    7273
    7374#define GET_GUI_ITEM(i_) (gpointer)(gtk_builder_get_object(wbcg->gui, (i_)))
    7475
     
    57385739                list_actions (wbcg->windows.actions);
    57395740                list_actions (wbcg->templates.actions);
    57405741        }
     5742   
     5743        // GTK-OSX-APPLICATION
     5744    GtkosxApplication *theApp = g_object_new (GTKOSX_TYPE_APPLICATION, NULL);
     5745    GtkWidget *osx_menubar, *osx_help, *osx_about, *osx_preferences, *osx_quit;
     5746   
     5747        // Define objects from gnumeric
     5748    osx_menubar = gtk_ui_manager_get_widget (wbcg->ui, "/ui/menubar");
     5749    osx_help = gtk_ui_manager_get_widget (wbcg->ui, "/menubar/Help/Help");
     5750    osx_about = gtk_ui_manager_get_widget (wbcg->ui, "/menubar/Help/HelpAbout");
     5751    osx_preferences = gtk_ui_manager_get_widget (wbcg->ui, "/menubar/Edit/EditPreferences");
     5752    osx_quit = gtk_ui_manager_get_widget (wbcg->ui, "/menubar/File/FileQuit");
     5753   
     5754        // Make the OS X menu bar object
     5755    gtkosx_application_set_menu_bar (theApp, GTK_MENU_SHELL (osx_menubar));
     5756    gtkosx_application_set_help_menu (theApp, GTK_MENU_ITEM (osx_help));
     5757    gtkosx_application_set_window_menu (theApp, NULL);
     5758    gtkosx_application_set_use_quartz_accelerators (theApp, TRUE);
     5759   
     5760        // Rearange certain menu items the way OS X users expect to see them
     5761    gtkosx_application_insert_app_menu_item (theApp, osx_about, 1);
     5762    gtkosx_application_insert_app_menu_item (theApp, gtk_separator_menu_item_new (), 2);
     5763    gtkosx_application_insert_app_menu_item (theApp, osx_preferences, 3);
     5764    gtkosx_application_insert_app_menu_item (theApp, gtk_separator_menu_item_new (), 4);
     5765   
     5766        // Hide the original menu items, but Window menu doesn't work...
     5767    gtk_widget_hide (osx_menubar);
     5768    gtk_widget_hide (osx_quit);
     5769   
     5770        // Tell OS X to show the menu bar
     5771    gtkosx_application_ready (theApp);
     5772        //END GTK-OSX-APPLICATION
    57415773}
    57425774
    57435775GSF_CLASS_FULL (WBCGtk, wbc_gtk, NULL, NULL, wbc_gtk_class_init, NULL,