[gnome-games] gnomine: Remove the .ui file and generate the menu in code
- From: Robert Ancell <rancell src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-games] gnomine: Remove the .ui file and generate the menu in code
- Date: Thu, 5 Jul 2012 21:42:30 +0000 (UTC)
commit 957a3926b3b5bbc710d925c114d838616f84317c
Author: Robert Ancell <robert ancell canonical com>
Date: Fri Jul 6 09:42:24 2012 +1200
gnomine: Remove the .ui file and generate the menu in code
gnomine/data/Makefile.am | 4 ---
gnomine/data/gnomine.ui | 55 ----------------------------------------------
gnomine/src/gnomine.vala | 35 +++++++++++++++++++++--------
3 files changed, 25 insertions(+), 69 deletions(-)
---
diff --git a/gnomine/data/Makefile.am b/gnomine/data/Makefile.am
index eaf5658..d5523af 100644
--- a/gnomine/data/Makefile.am
+++ b/gnomine/data/Makefile.am
@@ -1,8 +1,5 @@
SUBDIRS = icons
-uidir = $(datadir)/gnomine
-ui_DATA = gnomine.ui
-
gsettings_in_file = org.gnome.gnomine.gschema.xml.in
gsettings_SCHEMAS = $(gsettings_in_file:.xml.in=.xml)
@INTLTOOL_XML_NOMERGE_RULE@
@@ -21,7 +18,6 @@ desktop_DATA = $(desktop_in_files:.desktop.in.in=.desktop)
@INTLTOOL_DESKTOP_RULE@
EXTRA_DIST = \
- $(ui_DATA) \
$(gsettings_in_file) \
$(desktop_in_files) \
$(man_MANS) \
diff --git a/gnomine/src/gnomine.vala b/gnomine/src/gnomine.vala
index a56cbcb..9fb6309 100644
--- a/gnomine/src/gnomine.vala
+++ b/gnomine/src/gnomine.vala
@@ -98,16 +98,31 @@ public class GnoMine : Gtk.Application
pause = lookup_action ("pause") as SimpleAction;
pause.set_enabled (false);
- var builder = new Gtk.Builder ();
- try
- {
- builder.add_from_file (Path.build_filename (DATA_DIRECTORY, "gnomine.ui"));
- }
- catch (Error e)
- {
- error ("Unable to build menus: %s", e.message);
- }
- set_app_menu (builder.get_object ("gnomine-menu") as MenuModel);
+ var menu = new Menu ();
+ var section = new Menu ();
+ menu.append_section (null, section);
+ section.append (_("_New Game"), "app.new-game");
+ section.append (_("_Replay Size"), "app.repeat-size");
+ section.append (_("_Hint"), "app.hint");
+ section.append (_("_Pause"), "app.pause");
+ section.append (_("_Fullscreen"), "app.fullscreen");
+ section.append (_("_Scores"), "app.scores");
+ section.append (_("_Preferences"), "app.preferences");
+ section = new Menu ();
+ menu.append_section (null, section);
+ section.append (_("_Help"), "app.help");
+ section.append (_("_About"), "app.about");
+ section = new Menu ();
+ menu.append_section (null, section);
+ section.append (_("_Quit"), "app.quit");
+ set_app_menu (menu);
+
+ add_accelerator ("<Primary>n", "app.new-game", null);
+ add_accelerator ("<Primary>r", "app.repeat-size", null);
+ add_accelerator ("<Primary>p", "app.pause", null);
+ add_accelerator ("F1", "app.help", null);
+ add_accelerator ("<Primary>w", "app.quit", null);
+ add_accelerator ("<Primary>q", "app.quit", null);
window = new Gtk.ApplicationWindow (this);
window.title = _("Mines");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]