r42085 - in /desktop/unstable/gnome-mines/debian: changelog patches/ patches/hide-headerbar.patch patches/series

noskcaj-guest at users.alioth.debian.org noskcaj-guest at users.alioth.debian.org
Mon Jul 21 07:52:21 UTC 2014


Author: noskcaj-guest
Date: Mon Jul 21 07:52:20 2014
New Revision: 42085

URL: http://svn.debian.org/wsvn/pkg-gnome/?sc=1&rev=42085
Log:
Add hide-headerbar.patch: Don't show HeaderBar / app menu on systems that
don't support it

Added:
    desktop/unstable/gnome-mines/debian/patches/
    desktop/unstable/gnome-mines/debian/patches/hide-headerbar.patch
    desktop/unstable/gnome-mines/debian/patches/series
Modified:
    desktop/unstable/gnome-mines/debian/changelog

Modified: desktop/unstable/gnome-mines/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-gnome/desktop/unstable/gnome-mines/debian/changelog?rev=42085&op=diff
==============================================================================
--- desktop/unstable/gnome-mines/debian/changelog	[utf-8] (original)
+++ desktop/unstable/gnome-mines/debian/changelog	[utf-8] Mon Jul 21 07:52:20 2014
@@ -1,3 +1,10 @@
+gnome-mines (1:3.12.2-2) UNRELEASED; urgency=medium
+
+  * Add hide-headerbar.patch: Don't show HeaderBar / app menu on systems that
+    don't support it
+
+ -- Jackson Doak <noskcaj at ubuntu.com>  Mon, 21 Jul 2014 17:50:18 +1000
+
 gnome-mines (1:3.12.2-1) unstable; urgency=low
 
   * Team upload.

Added: desktop/unstable/gnome-mines/debian/patches/hide-headerbar.patch
URL: http://svn.debian.org/wsvn/pkg-gnome/desktop/unstable/gnome-mines/debian/patches/hide-headerbar.patch?rev=42085&op=file
==============================================================================
--- desktop/unstable/gnome-mines/debian/patches/hide-headerbar.patch	(added)
+++ desktop/unstable/gnome-mines/debian/patches/hide-headerbar.patch	[utf-8] Mon Jul 21 07:52:20 2014
@@ -0,0 +1,143 @@
+From 449555c3d715657612304cfe65c59cd05b9b7c4f Mon Sep 17 00:00:00 2001
+From: Robert Ancell <robert.ancell at canonical.com>
+Date: Thu, 3 Jul 2014 09:57:53 +1200
+Subject: [PATCH] Don't show HeaderBar / app menu on systems that don't support
+ it
+
+---
+ src/gnome-mines.vala | 98 ++++++++++++++++++++++++++++++++++++++++++++++++----
+ 1 file changed, 92 insertions(+), 6 deletions(-)
+
+diff --git a/src/gnome-mines.vala b/src/gnome-mines.vala
+index f9232cb..c583bdd 100644
+--- a/src/gnome-mines.vala
++++ b/src/gnome-mines.vala
+@@ -117,7 +117,8 @@ public class Mines : Gtk.Application
+         section.append (_("_Help"), "app.help");
+         section.append (_("_About"), "app.about");
+         section.append (_("_Quit"), "app.quit");
+-        set_app_menu (menu);
++        if (has_app_menu ())
++            set_app_menu (menu);
+ 
+         add_accelerator ("<Primary>n", "app.new-game", null);
+         add_accelerator ("<Primary>r", "app.repeat-size", null);
+@@ -137,11 +138,14 @@ public class Mines : Gtk.Application
+         if (settings.get_boolean ("window-is-maximized"))
+             window.maximize ();
+ 
+-        var headerbar = new Gtk.HeaderBar ();
+-        headerbar.show_close_button = true;
+-        headerbar.set_title (_("Mines"));
+-        headerbar.show ();
+-        window.set_titlebar (headerbar);
++        if (has_app_menu ())
++        {
++            var headerbar = new Gtk.HeaderBar ();
++            headerbar.show_close_button = true;
++            headerbar.set_title (_("Mines"));
++            headerbar.show ();
++            window.set_titlebar (headerbar);
++        }
+ 
+         add_window (window);
+ 
+@@ -150,6 +154,72 @@ public class Mines : Gtk.Application
+         window.add (main_vbox);
+         main_vbox.show ();
+ 
++        if (!has_app_menu ())
++        {
++            var menubar = new Gtk.MenuBar ();
++
++            var item = new Gtk.MenuItem ();
++            item.show ();
++            item.set_label (_("_Mines"));
++            item.use_underline = true;
++            var mines_menu = new Gtk.Menu ();
++            item.submenu = mines_menu;
++            menubar.append (item);
++
++            item = new Gtk.MenuItem ();
++            item.show ();
++            item.set_label (_("_New Game"));
++            item.use_underline = true;
++            item.activate.connect (() => { new_game_cb (); });
++            mines_menu.append (item);
++
++            item = new Gtk.MenuItem ();
++            item.show ();
++            item.set_label (_("_Scores"));
++            item.use_underline = true;
++            item.activate.connect (() => { scores_cb (); });
++            mines_menu.append (item);
++
++            item = new Gtk.MenuItem ();
++            item.show ();
++            item.set_label (_("_Preferences"));
++            item.use_underline = true;
++            item.activate.connect (() => { preferences_cb (); });
++            mines_menu.append (item);
++
++            item = new Gtk.MenuItem ();
++            item.show ();
++            item.set_label (_("_Quit"));
++            item.use_underline = true;
++            item.activate.connect (() => { quit_cb (); });
++            mines_menu.append (item);
++
++            item = new Gtk.MenuItem ();
++            item.show ();
++            item.set_label (_("_Help"));
++            item.use_underline = true;
++            var help_menu = new Gtk.Menu ();
++            item.submenu = help_menu;
++            menubar.append (item);
++
++            item = new Gtk.MenuItem ();
++            item.show ();
++            item.set_label (_("_Contents"));
++            item.use_underline = true;
++            item.activate.connect (() => { help_cb (); });
++            help_menu.append (item);
++
++            item = new Gtk.MenuItem ();
++            item.show ();
++            item.set_label (_("_About"));
++            item.use_underline = true;
++            item.activate.connect (() => { about_cb (); });
++            help_menu.append (item);
++
++            menubar.show ();
++            main_vbox.pack_start (menubar, false, true, 0);
++        }
++
+         var view_box = new Gtk.Box (Gtk.Orientation.VERTICAL, 0);
+         view_box.border_width = 3;
+         view_box.show ();
+@@ -210,6 +280,22 @@ public class Mines : Gtk.Application
+         size.add_widget (play_pause_button);
+     }
+ 
++    private bool has_app_menu ()
++    {
++        /* 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;
++    }
++
+     private void startup_new_game_screen ()
+     {
+         new_game_screen = new Gtk.AspectFrame (null, 0.5f, 0.5f, 1.0f, false);
+-- 
+2.0.1
+

Added: desktop/unstable/gnome-mines/debian/patches/series
URL: http://svn.debian.org/wsvn/pkg-gnome/desktop/unstable/gnome-mines/debian/patches/series?rev=42085&op=file
==============================================================================
--- desktop/unstable/gnome-mines/debian/patches/series	(added)
+++ desktop/unstable/gnome-mines/debian/patches/series	[utf-8] Mon Jul 21 07:52:20 2014
@@ -0,0 +1 @@
+hide-headerbar.patch




More information about the pkg-gnome-commits mailing list