[gnome-2048/gnome-3-34] Fix showing icon in GNOME Shell.



commit ce7fa5d5d023950dc6492a4d46330187657d3c8f
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date:   Sun Oct 13 13:31:08 2019 +0200

    Fix showing icon in GNOME Shell.
    
    The important part of the
    patch is not the renaming
    of the Application class;
    it is the setting, during
    construct, of the visible
    property to true, instead
    of using the show method.
    Surely there is a reason.
    
    Fixes #13.

 src/application.vala | 9 ++++-----
 src/game-window.vala | 6 +++++-
 2 files changed, 9 insertions(+), 6 deletions(-)
---
diff --git a/src/application.vala b/src/application.vala
index de4f747..03bf6f1 100644
--- a/src/application.vala
+++ b/src/application.vala
@@ -19,7 +19,7 @@
 
 using Gtk;
 
-private class Application : Gtk.Application
+private class TwentyFortyEight : Gtk.Application
 {
     private GameWindow _window;
 
@@ -66,11 +66,11 @@ private class Application : Gtk.Application
             return Posix.EXIT_FAILURE;
         }
 
-        Application app = new Application ();
+        TwentyFortyEight app = new TwentyFortyEight ();
         return app.run (args);
     }
 
-    private Application ()
+    private TwentyFortyEight ()
     {
         Object (application_id: "org.gnome.TwentyFortyEight", flags: ApplicationFlags.FLAGS_NONE);
     }
@@ -81,8 +81,7 @@ private class Application : Gtk.Application
 
         add_action_entries (action_entries, this);
 
-        _window = new GameWindow ();
-        add_window (_window);
+        _window = new GameWindow (this);
 
         set_accels_for_action ("ui.toggle-new-game",    {        "<Primary>n"       });
         set_accels_for_action ("ui.new-game",           { "<Shift><Primary>n"       });
diff --git a/src/game-window.vala b/src/game-window.vala
index 9b5b624..8ff248e 100644
--- a/src/game-window.vala
+++ b/src/game-window.vala
@@ -44,7 +44,6 @@ private class GameWindow : ApplicationWindow
         _create_scores_dialog ();   // the library forbids to delay the dialog creation
 
         notify ["has-toplevel-focus"].connect (() => _embed.grab_focus ());
-        show ();
 
         if (!_game.restore_game (ref _settings))
             new_game_cb ();
@@ -54,6 +53,11 @@ private class GameWindow : ApplicationWindow
         _init_gestures ();
     }
 
+    internal GameWindow (TwentyFortyEight application)
+    {
+        Object (application: application, visible: true);
+    }
+
     [GtkCallback]
     private void on_destroy ()
     {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]