summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Dywan <christian@twotoasts.de>2018-08-19 11:55:06 +0200
committerGitHub <noreply@github.com>2018-08-19 11:55:06 +0200
commit1d2b477bb39b39e20cf1fe85f8bc796200a4f0de (patch)
tree0873a3f94250f7b030cb3c744f3c9a097efd0e51
parentbf948274fbaf3bca6bce457de634477d6dbbc157 (diff)
downloadmidori-git-1d2b477bb39b39e20cf1fe85f8bc796200a4f0de.tar.gz
Provide app menu fallback in the form of a button (#12)
Rather than a menubar with a single item in it.
-rw-r--r--core/app.vala5
-rw-r--r--core/browser.vala7
-rw-r--r--ui/browser.ui16
3 files changed, 28 insertions, 0 deletions
diff --git a/core/app.vala b/core/app.vala
index a23ced7e..1762464b 100644
--- a/core/app.vala
+++ b/core/app.vala
@@ -85,6 +85,11 @@ namespace Midori {
var action = new SimpleAction ("win-new", VariantType.STRING);
action.activate.connect (win_new_activated);
add_action (action);
+
+ // Unset app menu if not handled by the shell
+ if (!Gtk.Settings.get_default ().gtk_shell_shows_app_menu){
+ app_menu = null;
+ }
}
void win_new_activated (Action action, Variant? parameter) {
diff --git a/core/browser.vala b/core/browser.vala
index 2ee9e175..09c3214c 100644
--- a/core/browser.vala
+++ b/core/browser.vala
@@ -41,6 +41,8 @@ namespace Midori {
[GtkChild]
Gtk.MenuButton profile;
[GtkChild]
+ Gtk.MenuButton app_menu;
+ [GtkChild]
Gtk.Image profile_icon;
[GtkChild]
Gtk.ActionBar navigationbar;
@@ -110,6 +112,11 @@ namespace Midori {
menubutton.menu_model = application.get_menu_by_id ("browser-menu");
application.bind_busy_property (this, "is-loading");
+ // App menu fallback as a button rather than a menu
+ if (!Gtk.Settings.get_default ().gtk_shell_shows_app_menu) {
+ app_menu.menu_model = application.get_menu_by_id ("app-menu");
+ app_menu.show ();
+ }
});
// Action for switching tabs via Alt+number
diff --git a/ui/browser.ui b/ui/browser.ui
index 9c5eca5e..d564b258 100644
--- a/ui/browser.ui
+++ b/ui/browser.ui
@@ -44,6 +44,22 @@
</packing>
</child>
<child>
+ <object class="GtkMenuButton" id="app_menu">
+ <property name="focus-on-click">no</property>
+ <property name="valign">center</property>
+ <child>
+ <object class="GtkImage">
+ <property name="icon-name">view-more-symbolic</property>
+ <property name="use-fallback">yes</property>
+ <property name="visible">yes</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="pack-type">end</property>
+ </packing>
+ </child>
+ <child>
<object class="GtkMenuButton" id="profile">
<property name="focus-on-click">no</property>
<property name="valign">center</property>