[gnome-games/wip/exalm/subprocess: 24/25] error-display: Support showing crashes



commit 8b932f5f4b21595bb25054aa3220826c2b343535
Author: Alexander Mikhaylenko <alexm gnome org>
Date:   Fri Jan 10 18:57:08 2020 +0500

    error-display: Support showing crashes
    
    Add game_crashed() which would show different message and a restart button.
    
    Add restart signal.

 data/ui/error-display.ui  | 10 ++++++++++
 src/ui/error-display.vala | 10 ++++++++++
 2 files changed, 20 insertions(+)
---
diff --git a/data/ui/error-display.ui b/data/ui/error-display.ui
index dd61af6f..0ebc9edd 100644
--- a/data/ui/error-display.ui
+++ b/data/ui/error-display.ui
@@ -40,5 +40,15 @@
         <property name="wrap">True</property>
       </object>
     </child>
+    <child>
+      <object class="GtkButton" id="restart_btn">
+        <property name="visible">True</property>
+        <property name="label">_Restart Game</property>
+        <property name="use-underline">True</property>
+        <property name="margin-top">12</property>
+        <property name="halign">center</property>
+        <property name="action-name">display.restart</property>
+      </object>
+    </child>
   </template>
 </interface>
diff --git a/src/ui/error-display.vala b/src/ui/error-display.vala
index 6369ef08..2d2c6e54 100644
--- a/src/ui/error-display.vala
+++ b/src/ui/error-display.vala
@@ -6,6 +6,8 @@ private class Games.ErrorDisplay : Gtk.Box {
        private Gtk.Label primary_label;
        [GtkChild]
        private Gtk.Label secondary_label;
+       [GtkChild]
+       private Gtk.Button restart_btn;
 
        public void running_game_failed (Game game, string message) {
                string title;
@@ -15,6 +17,14 @@ private class Games.ErrorDisplay : Gtk.Box {
                        title = _("Oops! Unable to run the game");
 
                set_labels (title, message);
+               restart_btn.hide ();
+       }
+
+       public void game_crashed (Game game, string message) {
+               var title = _("Oops! The game ā€œ%sā€ crashed unexpectedly").printf (game.name);
+
+               set_labels (title, message);
+               restart_btn.show ();
        }
 
        private void set_labels (string primary, string secondary) {


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