Fix gtk-critical error when setting mac menubar.

This commit is contained in:
John Ralls 2015-04-17 15:11:08 -07:00 committed by Ross Gammon
parent d6f1c65325
commit 42e52f9d3e

View File

@ -380,7 +380,7 @@ class ViewManager(CLIManager):
hpane.add2(self.notebook) hpane.add2(self.notebook)
self.menubar = self.uimanager.get_widget('/MenuBar') self.menubar = self.uimanager.get_widget('/MenuBar')
self.toolbar = self.uimanager.get_widget('/ToolBar') self.toolbar = self.uimanager.get_widget('/ToolBar')
vbox.pack_start(self.menubar, False, True, 0) self.__attach_menubar(vbox)
vbox.pack_start(self.toolbar, False, True, 0) vbox.pack_start(self.toolbar, False, True, 0)
vbox.pack_start(hpane, True, True, 0) vbox.pack_start(hpane, True, True, 0)
self.statusbar = Statusbar() self.statusbar = Statusbar()
@ -828,13 +828,15 @@ class ViewManager(CLIManager):
self.uimanager.add_ui_from_string(UIDEFAULT) self.uimanager.add_ui_from_string(UIDEFAULT)
self.uimanager.ensure_update() self.uimanager.ensure_update()
def __attach_menubar(self, vbox):
vbox.pack_start(self.menubar, False, True, 0)
if _GTKOSXAPPLICATION: if _GTKOSXAPPLICATION:
menubar = self.uimanager.get_widget("/MenuBar") self.menubar.hide()
menubar.hide()
quit_item = self.uimanager.get_widget("/MenuBar/FileMenu/Quit") quit_item = self.uimanager.get_widget("/MenuBar/FileMenu/Quit")
about_item = self.uimanager.get_widget("/MenuBar/HelpMenu/About") about_item = self.uimanager.get_widget("/MenuBar/HelpMenu/About")
prefs_item = self.uimanager.get_widget("/MenuBar/EditMenu/Preferences") prefs_item = self.uimanager.get_widget("/MenuBar/EditMenu/Preferences")
self.macapp.set_menu_bar(menubar) self.macapp.set_menu_bar(self.menubar)
self.macapp.insert_app_menu_item(about_item, 0) self.macapp.insert_app_menu_item(about_item, 0)
self.macapp.insert_app_menu_item(prefs_item, 1) self.macapp.insert_app_menu_item(prefs_item, 1)