[gnome-games] ui: Add secondary label to ErrorDisplay
- From: Adrien Plazas <aplazas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-games] ui: Add secondary label to ErrorDisplay
- Date: Thu, 16 Feb 2017 21:59:03 +0000 (UTC)
commit 1a38d7ba94e7cad405a2956af1999a69cf941645
Author: Adrien Plazas <kekun plazas laposte net>
Date: Thu Feb 16 14:06:15 2017 +0100
ui: Add secondary label to ErrorDisplay
Add a secondary label to the ErrorDisplay, this will be used in the next
commit to display a message describing the error.
https://bugzilla.gnome.org/show_bug.cgi?id=778773
data/ui/error-display.ui | 16 +++++++++++++++-
src/ui/application-window.vala | 4 ++--
src/ui/display-box.vala | 4 ++--
src/ui/error-display.vala | 19 +++++++++++++------
4 files changed, 32 insertions(+), 11 deletions(-)
---
diff --git a/data/ui/error-display.ui b/data/ui/error-display.ui
index 54410ae..e581378 100644
--- a/data/ui/error-display.ui
+++ b/data/ui/error-display.ui
@@ -31,7 +31,7 @@
<property name="orientation">vertical</property>
<property name="spacing">12</property>
<child>
- <object class="GtkLabel" id="label">
+ <object class="GtkLabel" id="primary_label">
<property name="visible">True</property>
<property name="opacity">0.5</property>
<property name="can_focus">False</property>
@@ -44,6 +44,20 @@
<property name="fill">True</property>
</packing>
</child>
+ <child>
+ <object class="GtkLabel" id="secondary_label">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="halign">center</property>
+ <property name="valign">center</property>
+ <property name="use-markup">True</property>
+ <property name="wrap">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
</object>
<packing>
<property name="expand">False</property>
diff --git a/src/ui/application-window.vala b/src/ui/application-window.vala
index 8a13089..c4a64d6 100644
--- a/src/ui/application-window.vala
+++ b/src/ui/application-window.vala
@@ -246,8 +246,8 @@ private class Games.ApplicationWindow : Gtk.ApplicationWindow {
return runner;
}
catch (Error e) {
- warning ("%s\n", e.message);
- display_box.display_running_game_failed (e, game);
+ warning (e.message);
+ display_box.display_running_game_failed (game, _("An unexpected error occured."));
return null;
}
diff --git a/src/ui/display-box.vala b/src/ui/display-box.vala
index d6ea73a..1d788ab 100644
--- a/src/ui/display-box.vala
+++ b/src/ui/display-box.vala
@@ -54,9 +54,9 @@ private class Games.DisplayBox : Gtk.EventBox {
timeout_id = -1;
}
- public void display_running_game_failed (Error e, Game game) {
+ public void display_running_game_failed (Game game, string error_message) {
stack.visible_child = error_display;
- error_display.running_game_failed (game);
+ error_display.running_game_failed (game, error_message);
}
[GtkCallback]
diff --git a/src/ui/error-display.vala b/src/ui/error-display.vala
index 1b7fa05..5dfb5a7 100644
--- a/src/ui/error-display.vala
+++ b/src/ui/error-display.vala
@@ -3,15 +3,22 @@
[GtkTemplate (ui = "/org/gnome/Games/ui/error-display.ui")]
private class Games.ErrorDisplay : Gtk.Box {
[GtkChild]
- private Gtk.Label label;
+ private Gtk.Label primary_label;
+ [GtkChild]
+ private Gtk.Label secondary_label;
- public void running_game_failed (Game game) {
- string message;
+ public void running_game_failed (Game game, string message) {
+ string title;
if (game != null)
- message = _("Oops! Unable to run “%sâ€").printf (game.name);
+ title = _("Oops! Unable to run “%sâ€").printf (game.name);
else
- message = _("Oops! Unable to run the game");
+ title = _("Oops! Unable to run the game");
+
+ set_labels (title, message);
+ }
- label.label = @"<big><b>$message</b></big>";
+ private void set_labels (string primary, string secondary) {
+ primary_label.label = @"<big><b>$(Markup.escape_text (primary))</b></big>";
+ secondary_label.label = Markup.escape_text (secondary);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]