xpra icon
Bug tracker and wiki

Opened 4 months ago

#2263 new defect

macos shadow dock and menu don't quit

Reported by: Antoine Martin Owned by: Antoine Martin
Priority: major Milestone: 3.0
Component: platforms Version: 2.5.x
Keywords: Cc:

Description

No idea what's going on here, this API looks buggy.

Here are some of the things I've tried before giving up:

--- xpra/server/shadow/gtk_shadow_server_base.py	(revision 22344)
+++ xpra/server/shadow/gtk_shadow_server_base.py	(working copy)
@@ -201,11 +201,34 @@
             tw.cleanup()
 
     def setup_tray(self):
+        from xpra.gtk_common.gobject_compat import import_gtk
+        gtk = import_gtk()
+        from xpra.gtk_common.gtk_util import menuitem
         if OSX:
+            from xpra.platform.darwin.gui import get_OSXApplication
+            #self.dock_menu = gtk.Menu()
+            #self.quit_dock_item = gtk.MenuItem("Quit Me")
+            #self.quit_dock_item.connect("activate", self.quit)
+            #self.dock_menu.add(self.quit_dock_item)
+            #self.dock_menu.show_all()
+            macapp = get_OSXApplication()
+            #macapp.set_dock_menu(self.dock_menu)
+            def quit_handler(*_args):
+                log.info("quit_handler")
+            macapp.connect("NSApplicationWillTerminate", quit_handler)
+            item = menuitem("Blah", cb=quit_handler)
+            menu = gtk.Menu()
+            #item.set_submenu(submenu)
+            #item.show_all()
+            menu.append(item)
+            menu.show_all()
+            from xpra.platform.darwin.osx_menu import getOSXMenuHelper
+            mh = getOSXMenuHelper(None)
+            mh.add_to_app_menu("Top", menu)
+            #self.menu_bar.add(item)
+            #macapp.insert_app_menu_item(item, 0)
             return
         try:
-            from xpra.gtk_common.gobject_compat import import_gtk
-            gtk = import_gtk()
             from xpra.gtk_common.gtk_util import popup_menu_workaround
             #menu:
             label = u"Xpra Shadow Server"

Change History (0)

Note: See TracTickets for help on using tickets.