On Oct 24, 2011, at 12:34 AM, Antoine Martin wrote: Hi, I must be doing something wrong but I just can't see what. Running the attached sample code gives two problems: 1) "Application Not Responding" is shown in the dock, despite the fact that the app runs fine and responds to main menu clicks and events... 2) The menu I want to use for the dock is ignored. Any ideas? Seems to be an odd scoping problem, though I didn't try to replicate it in C, so I don't know where exactly the problem is. If I change your test program like this: --- test_dockmenu.py~ 2011-10-29 17:26:02.000000000 -0700 +++ test_dockmenu.py 2011-10-30 10:21:54.000000000 -0700 @@ -1,10 +1,13 @@ import os.path import gtk.gdk +def disconnect_cb(arg): + print "disconnect" + def setup_macdock(): import gtk_osxapplication macapp = gtk_osxapplication.OSXApplication() @@ -21,15 +24,6 @@ quit_item.hide() macapp.insert_app_menu_item(gtk.SeparatorMenuItem(), 1) - - print "setting up dock" - dockmenu = gtk.Menu() - quit_item = gtk.MenuItem("Disconnect") - quit_item.connect("activate", gtk.main_quit) - dockmenu.add(quit_item) - dockmenu.show_all() - macapp.set_dock_menu(dockmenu) - macapp.connect("NSApplicationBlockTermination", quit) def active(*args): print "active" @@ -37,7 +31,17 @@ print "inactive" macapp.connect("NSApplicationDidBecomeActive", active) macapp.connect("NSApplicationWillResignActive", inactive) - macapp.ready() + return macapp + +macapp = setup_macdock() + +print "setting up dock" +dockmenu = gtk.Menu() +quit_item = gtk.MenuItem("Disconnect") +quit_item.connect("activate", disconnect_cb) +dockmenu.add(quit_item) +dockmenu.show_all() +macapp.set_dock_menu(dockmenu) -setup_macdock() +macapp.ready() gtk.main() It works. BTW, you shouldn't connect "quit" to NSApplicationBlockTermination. You should either not connect anything to it or you should connect a function that returns a boolean (which should be False if you want it to quit). The simplest way is to connect "lambda foo: False". I never saw an "Application Not Responding" in the Dock menu, though, even with your original version. Regards, John Ralls |
------------------------------------------------------------------------------ Get your Android app more play: Bring it to the BlackBerry PlayBook in minutes. BlackBerry App World™ now supports Android™ Apps for the BlackBerry® PlayBook™. Discover just how easy and simple it is! http://p.sf.net/sfu/android-dev2dev
_______________________________________________ Gtk-osx-users mailing list Gtk-osx-users lists sourceforge net https://lists.sourceforge.net/lists/listinfo/gtk-osx-users