summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Dywan <christian@twotoasts.de>2018-08-13 20:58:39 +0200
committerChristian Dywan <christian@twotoasts.de>2018-08-13 20:58:39 +0200
commita0cb67fc4795cf9addba344469ec713298a89b09 (patch)
tree0f7cb43741c9c95b90d2c805c523539622efb07b
parenta47795769ffa59adb78055f0e128544211ab52c5 (diff)
downloadmidori-git-app_menu_fallback_button.tar.gz
Provide app menu fallback in the form of a buttonapp_menu_fallback_button
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>