[gnome-games] swell-foop: Add back missing new game button



commit a2f46bf69e0b81aff656ff898ffa5cc13cf04c5c
Author: Robert Ancell <robert ancell canonical com>
Date:   Wed Aug 29 14:21:03 2012 +1200

    swell-foop: Add back missing new game button

 swell-foop/src/swell-foop.vala |   35 +++++++----------------------------
 1 files changed, 7 insertions(+), 28 deletions(-)
---
diff --git a/swell-foop/src/swell-foop.vala b/swell-foop/src/swell-foop.vala
index 6a7b2f2..791c057 100644
--- a/swell-foop/src/swell-foop.vala
+++ b/swell-foop/src/swell-foop.vala
@@ -34,11 +34,6 @@ public class SwellFoop : Gtk.Application
         { "quit",          quit_cb        }
     };
 
-    private const Gtk.ActionEntry actions[] =
-    {
-       { "NewGame", GnomeGamesSupport.STOCK_NEW_GAME, null, null, null, new_game_cb }
-    };
-
     /* Constructor */
     public SwellFoop ()
     {
@@ -55,11 +50,6 @@ public class SwellFoop : Gtk.Application
 
         add_action_entries (action_entries, this);
 
-        var action_group = new Gtk.ActionGroup ("group");
-        action_group.set_translation_domain (GETTEXT_PACKAGE);
-        action_group.add_actions (actions, this);
-        action_group.get_action ("NewGame").is_important = true;
-
         /* Create the main window */
         main_window = new Gtk.ApplicationWindow (this);
         main_window.set_title (_("Swell Foop"));
@@ -86,29 +76,18 @@ public class SwellFoop : Gtk.Application
         set_app_menu (menu);
 
         /* Create a toolbar */
-        var ui_manager = new Gtk.UIManager ();
-        ui_manager.insert_action_group (action_group, 0);
-        try
-        {
-            var ui_description =
-            "<ui>" +
-            "    <toolbar name='Toolbar'>" +
-            "    </toolbar>" +
-            "</ui>";
-            ui_manager.add_ui_from_string (ui_description, -1);
-        }
-        catch (Error e)
-        {
-            warning ("Failed to load UI: %s", e.message);
-        }
-        main_window.add_accel_group (ui_manager.get_accel_group ());
-
-        var toolbar = (Gtk.Toolbar) ui_manager.get_widget ("/Toolbar");
+        var toolbar = new Gtk.Toolbar ();
         toolbar.show_arrow = false;
         toolbar.get_style_context ().add_class (Gtk.STYLE_CLASS_PRIMARY_TOOLBAR);
         toolbar.show ();
         vbox.pack_start (toolbar, false, true, 0);
 
+        var new_game_button = new Gtk.ToolButton.from_stock (GnomeGamesSupport.STOCK_NEW_GAME);
+        new_game_button.action_name = "app.new-game";
+        new_game_button.is_important = true;
+        new_game_button.show ();
+        toolbar.insert (new_game_button, -1);
+
         /* Create a label in toolbar showing the score etc. */
         var status_box = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 10);
         status_box.halign = Gtk.Align.END;



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