← Back to team overview

simple-scan-team team mailing list archive

[Merge] lp:~elementary-apps/simple-scan/elementary-headerbar into lp:simple-scan

 

Daniel Fore has proposed merging lp:~elementary-apps/simple-scan/elementary-headerbar into lp:simple-scan.

Requested reviews:
  Simple Scan Development Team (simple-scan-team)

For more details, see:
https://code.launchpad.net/~elementary-apps/simple-scan/elementary-headerbar/+merge/226623

This branch makes the headerbar show in Pantheon (elementary OS) by using the logic from GNOME Mahjongg (at Robert's suggestion).
-- 
https://code.launchpad.net/~elementary-apps/simple-scan/elementary-headerbar/+merge/226623
Your team Simple Scan Development Team is requested to review the proposed merge of lp:~elementary-apps/simple-scan/elementary-headerbar into lp:simple-scan.
=== modified file 'src/ui.vala'
--- src/ui.vala	2014-07-02 00:06:53 +0000
+++ src/ui.vala	2014-07-14 00:28:48 +0000
@@ -1648,20 +1648,14 @@
         copy_to_clipboard_menuitem.sensitive = true;
     }
 
-    private bool has_app_menu (Gtk.Application app)
+    private bool shell_shows_menubar
     {
-        /* We have three cases:
-         * - GNOME 3: show-app-menu true, show-menubar false -> use the app menu
-         * - Unity, OSX: show-app-menu and show-menubar true -> use the normal menu
-         * - Other WM, Windows: show-app-menu and show-menubar false -> use the normal menu
-         */
-        var gtk_settings = Gtk.Settings.get_default ();
-
-        bool show_app_menu = false;
-        bool show_menubar = true;
-        gtk_settings.get ("gtk-shell-shows-app-menu", &show_app_menu, "gtk-shell-shows-menubar", &show_menubar, null);
-
-        return show_app_menu && !show_menubar;
+        get
+        {
+            bool shell_shows_menubar;
+            Gtk.Settings.get_default ().get ("gtk-shell-shows-menubar", out shell_shows_menubar);
+            return shell_shows_menubar;
+        }
     }
 
     private void load ()
@@ -1672,7 +1666,7 @@
 
         var app = Application.get_default () as Gtk.Application;
 
-        if (has_app_menu (app))
+        if (!shell_shows_menubar)
         {
             app.add_action_entries (action_entries, this);
 
@@ -2165,4 +2159,4 @@
 
         return true;
     }
-}
+}
\ No newline at end of file


Follow ups