[gnome-games] iagno: use GtkApplication
- From: Robert Ancell <rancell src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-games] iagno: use GtkApplication
- Date: Sat, 31 Dec 2011 04:48:36 +0000 (UTC)
commit d72fdf6d031b495a38faecaa93f145e6f006eaef
Author: Sophia Yu <sophia receiving gmail com>
Date: Fri Dec 30 03:26:15 2011 -0600
iagno: use GtkApplication
iagno/src/iagno.vala | 24 ++++++++++++------------
1 files changed, 12 insertions(+), 12 deletions(-)
---
diff --git a/iagno/src/iagno.vala b/iagno/src/iagno.vala
index 18ecbfb..ebf2276 100644
--- a/iagno/src/iagno.vala
+++ b/iagno/src/iagno.vala
@@ -1,4 +1,4 @@
-public class Iagno
+public class Iagno : Gtk.Application
{
/* Application settings */
private Settings settings;
@@ -66,12 +66,15 @@ public class Iagno
public Iagno ()
{
+ Object (application_id: "org.gnome.iagno", flags: ApplicationFlags.FLAGS_NONE);
+
settings = new Settings ("org.gnome.iagno");
window = new Gtk.Window (Gtk.WindowType.TOPLEVEL);
window.set_title (_("Iagno"));
GnomeGamesSupport.settings_bind_window_state ("/org/gnome/iagno/", window);
+ add_window (window);
var vbox = new Gtk.Box (Gtk.Orientation.VERTICAL, 0);
vbox.show ();
@@ -101,8 +104,6 @@ public class Iagno
var menubar = (Gtk.MenuBar) ui_manager.get_widget ("/MainMenu");
vbox.pack_start (menubar, false, false, 0);
- window.delete_event.connect (window_delete_event_cb);
-
view = new GameView ();
view.game = game;
view.move.connect (player_move_cb);
@@ -150,6 +151,11 @@ public class Iagno
start_game ();
}
+ public override void activate ()
+ {
+ window.show ();
+ }
+
private void show ()
{
window.show ();
@@ -172,13 +178,7 @@ public class Iagno
private void quit_game_cb ()
{
- Gtk.main_quit ();
- }
-
- private bool window_delete_event_cb (Gtk.Widget widget, Gdk.EventAny event)
- {
- Gtk.main_quit ();
- return true;
+ window.destroy ();
}
private void new_game_cb ()
@@ -600,10 +600,10 @@ public class Iagno
var app = new Iagno ();
app.show ();
- Gtk.main ();
+ var result = app.run ();
GnomeGamesSupport.runtime_shutdown ();
- return Posix.EXIT_SUCCESS;
+ return result;
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]