[gnome-nibbles/wip/vala: 55/64] Add 'Scores' app menu entry
- From: Iulian Radu <iulianradu src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-nibbles/wip/vala: 55/64] Add 'Scores' app menu entry
- Date: Sun, 9 Aug 2015 12:56:02 +0000 (UTC)
commit 48ff4a74f260f956e281b06a4af3447ae0ed6e69
Author: Iulian Radu <iulian radu67 gmail com>
Date: Mon Jul 27 17:00:01 2015 +0300
Add 'Scores' app menu entry
data/Makefile.am | 1 +
src/gnome-nibbles.gresource.xml.in | 3 +++
src/gnome-nibbles.vala | 14 ++++++++++++++
3 files changed, 18 insertions(+), 0 deletions(-)
---
diff --git a/data/Makefile.am b/data/Makefile.am
index 4754005..e694d84 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -16,6 +16,7 @@ gsettings_SCHEMAS = org.gnome.nibbles.gschema.xml
dist_man_MANS = gnome-nibbles.6
dist_noinst_DATA = \
+ nibbles-menus.ui \
nibbles.ui \
nibbles.css \
scoreboard.ui \
diff --git a/src/gnome-nibbles.gresource.xml.in b/src/gnome-nibbles.gresource.xml.in
index bb2abcb..b1819c0 100644
--- a/src/gnome-nibbles.gresource.xml.in
+++ b/src/gnome-nibbles.gresource.xml.in
@@ -6,5 +6,8 @@
<file alias="scoreboard.ui">@top_srcdir@/data/scoreboard.ui</file>
<file alias="player-score-box.ui">@top_srcdir@/data/player-score-box.ui</file>
</gresource>
+ <gresource prefix="/org/gnome/nibbles/gtk">
+ <file alias="menus.ui">@top_srcdir@/data/nibbles-menus.ui</file>
+ </gresource>
</gresources>
diff --git a/src/gnome-nibbles.vala b/src/gnome-nibbles.vala
index c526f54..665d168 100644
--- a/src/gnome-nibbles.vala
+++ b/src/gnome-nibbles.vala
@@ -52,6 +52,7 @@ public class Nibbles : Gtk.Application
private const ActionEntry action_entries[] =
{
{"start-game", start_game_cb},
+ {"scores", scores_cb},
{"quit", quit}
};
@@ -369,6 +370,19 @@ public class Nibbles : Gtk.Application
scores_context.run_dialog ();
}
+ private void scores_cb ()
+ {
+ try
+ {
+ scores_context.run_dialog ();
+ }
+ catch (GLib.Error e)
+ {
+ // Translators: This error is displayed when the scores dialog fails to load
+ error ("Failed to run scores dialog: %s", e.message);
+ }
+ }
+
public static int main (string[] args)
{
var context = new OptionContext ("");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]