[gtk-osx-users] [Gtk-osx-users] "Application Not Responding" and set_dock_menu



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?

Thanks
Antoine
import os.path
import gtk.gdk

def setup_macdock():
    import gtk_osxapplication
    macapp = gtk_osxapplication.OSXApplication()
    icon_filename = os.path.join(os.path.expanduser("~"), "test.png")
    pixbuf = gtk.gdk.pixbuf_new_from_file(icon_filename)
    macapp.set_dock_icon_pixbuf(pixbuf)

    print "setting up menu"
    menu = gtk.MenuBar()
    # We need to add it to a widget (otherwise it just does not work)
    hidden_window = gtk.Window()
    hidden_window.add(menu)
    quit_item = gtk.MenuItem("Quit")
    quit_item.connect("activate", gtk.main_quit)
    menu.add(quit_item)
    menu.show_all()
    macapp.set_menu_bar(menu)
    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"
    def inactive(*args):
        print "inactive"
    macapp.connect("NSApplicationDidBecomeActive", active)
    macapp.connect("NSApplicationWillResignActive", inactive)
    macapp.ready()

setup_macdock()
gtk.main()
------------------------------------------------------------------------------
The demand for IT networking professionals continues to grow, and the
demand for specialized networking skills is growing even more rapidly.
Take a complimentary Learning@Cisco Self-Assessment and learn 
about Cisco certifications, training, and career opportunities. 
http://p.sf.net/sfu/cisco-dev2dev
_______________________________________________
Gtk-osx-users mailing list
Gtk-osx-users lists sourceforge net
https://lists.sourceforge.net/lists/listinfo/gtk-osx-users


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]