[geary] Add menu setting to decoration-layout if it is missing
- From: Michael Gratton <mjog src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [geary] Add menu setting to decoration-layout if it is missing
- Date: Mon, 17 Oct 2016 12:29:31 +0000 (UTC)
commit 67cf38a6779eb39cb87db4a3d9c2a161bc461ec6
Author: Kacper Bielecki <kazjote gmail com>
Date: Sun Oct 9 19:06:48 2016 +0200
Add menu setting to decoration-layout if it is missing
Bug 770617
Check if gtk_decoration_layout contains menu setting.
Add it to the left if it is missing. This will force displaying menu for
clients having both:
* disabled Gtk/ShellShowsAppMenu setting
* no 'menu' setting in Gtk/DecorationLayout
which would have no possibility of using menu otherwise.
src/client/application/geary-controller.vala | 27 ++++++++++++++++++++++++++
1 files changed, 27 insertions(+), 0 deletions(-)
---
diff --git a/src/client/application/geary-controller.vala b/src/client/application/geary-controller.vala
index 0e85cf4..2be739f 100644
--- a/src/client/application/geary-controller.vala
+++ b/src/client/application/geary-controller.vala
@@ -176,6 +176,8 @@ public class GearyController : Geary.BaseObject {
// Ensure all geary windows have an icon
Gtk.Window.set_default_icon_name("geary");
+ apply_app_menu_fix();
+
// Setup actions.
setup_actions();
this.application.load_ui_resource("accelerators.ui");
@@ -400,6 +402,31 @@ public class GearyController : Geary.BaseObject {
accelerator, action);
}
+ // Fix for clients having both:
+ // * disabled Gtk/ShellShowsAppMenu setting
+ // * no 'menu' setting in Gtk/DecorationLayout
+ // See https://bugzilla.gnome.org/show_bug.cgi?id=770617
+ private void apply_app_menu_fix() {
+ Gtk.Settings? settings = Gtk.Settings.get_default();
+
+ if (settings == null) {
+ warning("Couldn't fetch Gtk default settings");
+ return ;
+ }
+
+ string? decoration_layout = settings.gtk_decoration_layout;
+
+ if (decoration_layout == null) decoration_layout = "";
+
+ if (!decoration_layout.contains("menu")) {
+ string prefix = "menu:";
+ if (decoration_layout.contains(":")) {
+ prefix = (decoration_layout.has_prefix(":")) ? "menu" : "menu,";
+ }
+ settings.gtk_decoration_layout = prefix + settings.gtk_decoration_layout;
+ }
+ }
+
private Gtk.ActionEntry[] create_actions() {
Gtk.ActionEntry[] entries = new Gtk.ActionEntry[0];
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]