Closed harry-cpp closed 8 years ago
I don't use the App menu only on the Mac OS X release. Here we use gtk-mac-integration. So I don't test that part of the wrapper.
Personally I think the App menu is a stupid idea also on Mac. Mac has finally made the menu follow the screen the app is on, but Gnome do not do that, and it sucks.
Solution:
app = new Application("test.app", GLib.ApplicationFlags.None);
app.Register(GLib.Cancellable.Current);
Application.Init();
var builder = new Builder(null, "GtkTTest.interfaces.MainWindow.glade", null);
app.AppMenu = new GLib.MenuModel(builder.GetObject("appmenu").Handle);
var win = MainWindow.Create();
app.AddWindow(win);
win.Show();
Application.Run();
<interface>
<requires lib="gtk+" version="3.16"/>
<menu id="appmenu">
<section>
<item>
<attribute name="label" translatable="yes">_Help</attribute>
</item>
<item>
<attribute name="label" translatable="yes">_About</attribute>
</item>
<item>
<attribute name="label" translatable="yes">_Quit</attribute>
</item>
</section>
</menu>
</interface>
Sorry if I am asking this in the wrong place, but there is literally a handful of people who are using gtk-sharp wrappers higher then 3.0
So, app menu is: https://developer.gnome.org/gtk3/stable/getting-started-app4.png and looking at how to set it up from https://developer.gnome.org/gtk3/stable/ch01s04.html I though using:
might be the right way, but it turns out "this.Application" is null.
I also thought about setting up a wrapper and manually calling: https://developer.gnome.org/gtk3/stable/GtkApplication.html#gtk-application-set-app-menu but then I still wouldn't know what to use for "GtkApplication".
So anyone know anything on how to setup app menu? Thanks in advance.