Commit a0c71ea7 authored by Zander's avatar Zander 💥 Committed by Alberto Fanjul

Update menus for AppMenu removal

Resolve #141 by always using
the fallback in-window menu and removing the 'Quit' item
parent a81c3df5
......@@ -412,16 +412,6 @@ public class Application : Gtk.Application
set_accels_for_action(accel.name, accel.accels);
}
if (Gtk.Settings.get_default().gtk_shell_shows_app_menu)
{
MenuModel? menu = Builder.load_object<MenuModel>("ui/gitg-menus.ui", "app-menu");
if (menu != null)
{
set_app_menu(menu);
}
}
add_css("style.css");
add_css(@"style-$(Config.PLATFORM_NAME).css");;
......
......@@ -54,6 +54,8 @@ public class Window : Gtk.ApplicationWindow, GitgExt.Application, Initable
private Gtk.ToggleButton d_search_button;
[GtkChild]
private Gtk.MenuButton d_gear_menu;
[GtkChild]
private Gtk.Image gear_image;
private MenuModel d_activities_model;
private MenuModel? d_dash_model;
......@@ -286,22 +288,11 @@ public class Window : Gtk.ApplicationWindow, GitgExt.Application, Initable
d_interface_settings = new Settings("org.gnome.gitg.preferences.interface");
string menuname;
if (Gtk.Settings.get_default().gtk_shell_shows_app_menu)
{
menuname = "win-menu";
d_dash_model = null;
}
else
{
menuname = "app-win-menu";
d_dash_model = Builder.load_object<MenuModel>("ui/gitg-menus.ui", menuname + "-dash");
}
d_dash_model = Builder.load_object<MenuModel>("ui/gitg-menus.ui", "win-menu-dash");
d_dash_view.application = this;
d_activities_model = Builder.load_object<MenuModel>("ui/gitg-menus.ui", menuname + "-views");
d_activities_model = Builder.load_object<MenuModel>("ui/gitg-menus.ui", "win-menu-views");
// search bar
d_search_bar.connect_entry(d_search_entry);
......@@ -529,6 +520,7 @@ public class Window : Gtk.ApplicationWindow, GitgExt.Application, Initable
d_dash_view.add_repository(d_repository);
d_gear_menu.menu_model = d_activities_model;
gear_image.set_from_icon_name ("view-more-symbolic", BUTTON);
d_gear_menu.show();
d_gear_menu.sensitive = true;
}
......@@ -544,6 +536,7 @@ public class Window : Gtk.ApplicationWindow, GitgExt.Application, Initable
d_add_button.show();
d_gear_menu.menu_model = d_dash_model;
gear_image.set_from_icon_name ("open-menu-symbolic", BUTTON);
d_gear_menu.visible = d_dash_model != null;
d_gear_menu.sensitive = d_dash_model != null;
}
......
<?xml version="1.0"?>
<interface>
<!-- interface-requires gtk+ 3.0 -->
<menu id="app-menu">
<section>
<item>
<attribute name="label" translatable="yes">_New Window</attribute>
<attribute name="action">app.new</attribute>
</item>
</section>
<section>
<item>
<attribute name="label" translatable="yes">_Author Details</attribute>
<attribute name="action">app.author-details-global</attribute>
</item>
</section>
<section>
<item>
<attribute name="label" translatable="yes">_Preferences</attribute>
<attribute name="action">app.preferences</attribute>
</item>
</section>
<section>
<item>
<attribute name="label" translatable="yes">_Keyboard Shortcuts</attribute>
<attribute name="action">app.shortcuts</attribute>
</item>
<item>
<attribute name="label" translatable="yes">_About</attribute>
<attribute name="action">app.about</attribute>
</item>
<item>
<attribute name="label" translatable="yes">_Quit</attribute>
<attribute name="action">app.quit</attribute>
</item>
</section>
</menu>
<menu id="win-menu-views">
<section>
<item>
......@@ -49,7 +15,7 @@
</item>
</section>
</menu>
<menu id="app-win-menu-dash">
<menu id="win-menu-dash">
<section>
<item>
<attribute name="label" translatable="yes">_New Window</attribute>
......@@ -78,53 +44,6 @@
<attribute name="action">app.about</attribute>
</item>
</section>
<section>
<item>
<attribute name="label" translatable="yes">_Quit</attribute>
<attribute name="action">app.quit</attribute>
</item>
</section>
</menu>
<menu id="app-win-menu-views">
<section>
<item>
<attribute name="label" translatable="yes">_New Window</attribute>
<attribute name="action">app.new</attribute>
</item>
</section>
<section>
<item>
<attribute name="label" translatable="yes">_Reload</attribute>
<attribute name="action">win.reload</attribute>
</item>
</section>
<section>
<item>
<attribute name="label" translatable="yes">_Author Details</attribute>
<attribute name="action">win.author-details-repo</attribute>
</item>
</section>
<section>
<item>
<attribute name="label" translatable="yes">_Preferences</attribute>
<attribute name="action">app.preferences</attribute>
</item>
</section>
<section>
<item>
<attribute name="label" translatable="yes">_Keyboard Shortcuts</attribute>
<attribute name="action">app.shortcuts</attribute>
</item>
<item>
<attribute name="label" translatable="yes">_About</attribute>
<attribute name="action">app.about</attribute>
</item>
</section>
<section>
<item>
<attribute name="label" translatable="yes">_Quit</attribute>
<attribute name="action">app.quit</attribute>
</item>
</section>
</menu>
</interface>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment