Integrated with Mac Menu
authorPete Fotheringham <pete.fotheringham@codethink.co.uk>
Mon, 16 Jan 2012 14:46:22 +0000 (14:46 +0000)
committerPete Fotheringham <pete.fotheringham@codethink.co.uk>
Mon, 16 Jan 2012 14:46:22 +0000 (14:46 +0000)
Makefile.am
src/moonshot-identity-management-view.vala
vapi/gtk-mac-integration.vapi

index 29ffcf0..c9a64a1 100644 (file)
@@ -57,7 +57,7 @@ src_moonshot_VALAFLAGS = --pkg gdk-2.0 --pkg gtk+-2.0 --pkg gee-1.0 $(AM_VALAFLA
 src_moonshot_CPPFLAGS = $(moonshot_CFLAGS) $(AM_CPPFLAGS)  
 src_moonshot_LDADD = $(moonshot_LIBS) 
 
-src_moonshot_webp_VALAFLAGS = --vapidir=$(top_srcdir)/libmoonshot --pkg gdk-2.0 --pkg libmoonshot $(AM_VALAFLAGS)
+src_moonshot_webp_VALAFLAGS = --vapidir=$(top_srcdir)/libmoonshot  --pkg gtk+-2.0 --pkg gdk-2.0 --pkg libmoonshot $(AM_VALAFLAGS)
 src_moonshot_webp_CPPFLAGS = $(moonshot_CFLAGS) $(AM_CPPFLAGS)
 src_moonshot_webp_LDADD = $(moonshot_LIBS) ${top_builddir}/libmoonshot/libmoonshot.la
 
@@ -85,7 +85,7 @@ if  OS_MACOS
 AM_CPPFLAGS += -DOS_MACOS $(MAC_CFLAGS)
 AM_VALAFLAGS += --define=OS_MACOS --pkg gtk-mac-integration
 moonshot_LIBS += $(MAC_LIBS)
-
+src_moonshot_LDADD += $(MAC_LIBS)
 endif
 
 if OS_LINUX
index 6090fb8..3372a2d 100644 (file)
@@ -931,18 +931,26 @@ SUCH DAMAGE.
 
         var main_vbox = new VBox (false, 0);
         main_vbox.set_border_width (12);
-        var menubar = this.ui_manager.get_widget ("/MenuBar");
-        main_vbox.pack_start (menubar, false, false, 0);
-        main_vbox.pack_start (hbox, true, true, 0);
 #if OS_MACOS
-               var menushell = this.ui_manager.get_widget("/Menu") as Gtk.MenuShell;
+        // hide the  File | Quit menu item which is now on the Mac Menu
+        Gtk.Widget quit_item =  this.ui_manager.get_widget("/MenuBar/FileMenu/Quit");
+        quit_item.hide();
+        
+               Gtk.MenuShell menushell = this.ui_manager.get_widget("/MenuBar") as Gtk.MenuShell;
                osxApp.set_menu_bar(menushell);
+               osxApp.set_use_quartz_accelerators(true);
+               osxApp.sync_menu_bar();
+               osxApp.ready(); 
+#else
+        var menubar = this.ui_manager.get_widget ("/MenuBar");
+        main_vbox.pack_start (menubar, false, false, 0);
 #endif
+        main_vbox.pack_start (hbox, true, true, 0);
         add (main_vbox);
-
         main_vbox.show_all();
         this.vbox_right.hide ();
-    }
+  } 
 
     private void set_atk_name_description (Widget widget, string name, string description)
     {
index 5323bb5..d4da637 100644 (file)
@@ -1,17 +1,43 @@
-[CCode(cheader_filename="gtkosxapplication.h")]
-public class Gtk.OSXApplication : GLib.Object {
-       [CCode(cname="GTK_TYPE_OSX_APPLICATION")]
-       public static GLib.Type GTK_TYPE_OSX_APPLICATION;
+/*
+ * Vala Bindings for gtk-mac-integration-1.0.1
+ *
+ */
+    [CCode(cheader_filename="gtkosxapplication.h")]
+       public class Gtk.OSXApplication : GLib.Object {
+               [CCode(cname="GTK_TYPE_OSX_APPLICATION")]
+               public static GLib.Type GTK_TYPE_OSX_APPLICATION;
 
-       public static OSXApplication get_instance() {
-               return (Gtk.OSXApplication) GLib.Object.new(GTK_TYPE_OSX_APPLICATION);
-       }
-       [CCode(cname="gtk_osxapplication_set_menu_bar")]
-       public void set_menu_bar(Gtk.MenuShell shell);
+               public static Gtk.OSXApplication get_instance() {
+                       return (Gtk.OSXApplication) GLib.Object.new(GTK_TYPE_OSX_APPLICATION);
+               }
+               
+           [CCode(cname="gtk_osxapplication_ready")]
+           public void ready();
+           
+    /*Menu functions*/
+       
+           [CCode(cname="gtk_osxapplication_set_menu_bar")]
+           public void set_menu_bar(Gtk.MenuShell shell);
 
-       [CCode(cname="gtk_osxapplication_ready")]
-       public void ready();
+           [CCode(cname="gtk_osxapplication_sync_menubar")]
+           public void sync_menu_bar();
+       
+           [CCode(cname="gtk_osxapplication_insert_app_menu_item")]
+           public void insert_app_menu_item(Gtk.Widget menu_item, int index);
+
+               [CCode(cname="gtk_osxapplication_set_window_menu")]
+               public void set_window_menu (Gtk.MenuItem menu_item);
+
+        [CCode(cname="gtk_osxapplication_set_help_menu")]
+        public void set_help_menu (Gtk.MenuItem menu_item);
+
+       /*Accelerator functions*/
+       
+           [CCode(cname="gtk_osxapplication_set_use_quartz_accelerators")]
+           public void set_use_quartz_accelerators(bool use_quartz_accelerators);
+       
+           [CCode(cname="gtk_osxapplication_use_quartz_accelerators")]
+           public bool use_quartz_accelerators();
+       
+    }
 
-       [CCode(cname="gtk_osxapplication_sync_menubar")]
-       public void sync_menu_bar();
-}