[gnome-games] ui: Add ErrorDisplay



commit 7627afef0cf3e6b34191d3fa4255b4d5070e8de8
Author: Adrien Plazas <kekun plazas laposte net>
Date:   Mon Aug 15 08:30:25 2016 +0200

    ui: Add ErrorDisplay
    
    This will be used in the next commit to display the errors related to
    running a game in a nicer way.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=769801

 data/org.gnome.Games.gresource.xml |    1 +
 data/ui/error-display.ui           |   57 ++++++++++++++++++++++++++++++++++++
 po/POTFILES.in                     |    1 +
 po/POTFILES.skip                   |    1 +
 src/Makefile.am                    |    1 +
 src/ui/error-display.vala          |   17 +++++++++++
 6 files changed, 78 insertions(+), 0 deletions(-)
---
diff --git a/data/org.gnome.Games.gresource.xml b/data/org.gnome.Games.gresource.xml
index 01f0c5d..3bd2c27 100644
--- a/data/org.gnome.Games.gresource.xml
+++ b/data/org.gnome.Games.gresource.xml
@@ -12,6 +12,7 @@
     <file preprocess="xml-stripblanks">ui/display-header-bar.ui</file>
     <file preprocess="xml-stripblanks">ui/dummy-display.ui</file>
     <file preprocess="xml-stripblanks">ui/empty-collection.ui</file>
+    <file preprocess="xml-stripblanks">ui/error-display.ui</file>
     <file preprocess="xml-stripblanks">ui/error-info-bar.ui</file>
     <file preprocess="xml-stripblanks">ui/game-icon-view.ui</file>
     <file preprocess="xml-stripblanks">ui/preferences-page-plugins.ui</file>
diff --git a/data/ui/error-display.ui b/data/ui/error-display.ui
new file mode 100644
index 0000000..6d06d3d
--- /dev/null
+++ b/data/ui/error-display.ui
@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <requires lib="gtk+" version="3.16"/>
+  <template class="GamesErrorDisplay" parent="GtkBox">
+    <property name="visible">True</property>
+    <property name="orientation">vertical</property>
+    <property name="can_focus">False</property>
+    <property name="halign">center</property>
+    <property name="valign">center</property>
+    <child>
+      <object class="GtkImage" id="icon">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="valign">center</property>
+        <property name="pixel_size">128</property>
+        <property name="icon_name">face-uncertain-symbolic</property>
+        <property name="icon-size">0</property>
+        <property name="margin-bottom">18</property>
+        <style>
+          <class name="dim-label"/>
+        </style>
+      </object>
+      <packing>
+        <property name="expand">False</property>
+        <property name="fill">True</property>
+        <property name="position">0</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkBox" id="box">
+        <property name="visible">True</property>
+        <property name="orientation">vertical</property>
+        <child>
+          <object class="GtkLabel" id="label">
+            <property name="visible">True</property>
+            <property name="opacity">0.5</property>
+            <property name="can_focus">False</property>
+            <property name="halign">center</property>
+            <property name="xalign">0</property>
+            <property name="margin-bottom">12</property>
+            <property name="use-markup">True</property>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
+      </object>
+      <packing>
+        <property name="expand">False</property>
+        <property name="fill">True</property>
+        <property name="position">1</property>
+      </packing>
+    </child>
+  </template>
+</interface>
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 5ba9c43..8f6da69 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -35,5 +35,6 @@ src/gamepad/gamepad-mapping.vala
 src/gamepad/linux/linux-raw-gamepad.vala
 src/retro/retro-runner.vala
 src/ui/application.vala
+src/ui/error-display.vala
 src/ui/preferences-page-plugins.vala
 src/utils/cue-sheet/cue-sheet.vala
diff --git a/po/POTFILES.skip b/po/POTFILES.skip
index f9c2f1f..2862c35 100644
--- a/po/POTFILES.skip
+++ b/po/POTFILES.skip
@@ -22,5 +22,6 @@ src/gamepad/gamepad-mapping.c
 src/gamepad/linux/linux-raw-gamepad.c
 src/retro/retro-runner.c
 src/ui/application.c
+src/ui/error-display.c
 src/ui/preferences-page-plugins.c
 src/utils/cue-sheet/cue-sheet.c
diff --git a/src/Makefile.am b/src/Makefile.am
index ab8d1f8..62adf38 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -95,6 +95,7 @@ gnome_games_SOURCES = \
        ui/display-header-bar.vala \
        ui/dummy-display.vala \
        ui/empty-collection.vala \
+       ui/error-display.vala \
        ui/error-info-bar.vala \
        ui/game-icon-view.vala \
        ui/game-thumbnail.vala \
diff --git a/src/ui/error-display.vala b/src/ui/error-display.vala
new file mode 100644
index 0000000..1b7fa05
--- /dev/null
+++ b/src/ui/error-display.vala
@@ -0,0 +1,17 @@
+// This file is part of GNOME Games. License: GPLv3
+
+[GtkTemplate (ui = "/org/gnome/Games/ui/error-display.ui")]
+private class Games.ErrorDisplay : Gtk.Box {
+       [GtkChild]
+       private Gtk.Label label;
+
+       public void running_game_failed (Game game) {
+               string message;
+               if (game != null)
+                       message = _("Oops! Unable to run ā€œ%sā€").printf (game.name);
+               else
+                       message = _("Oops! Unable to run the game");
+
+               label.label = @"<big><b>$message</b></big>";
+       }
+}


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