[gnome-boxes] Remove go_back(), use ui_state directly



commit ae8cb2b82bbb6527265fe441abb9ad596e7b3062
Author: Marc-Andrà Lureau <marcandre lureau gmail com>
Date:   Thu Oct 20 20:40:02 2011 +0200

    Remove go_back(), use ui_state directly

 src/app.vala     |   13 +------------
 src/sidebar.vala |    2 +-
 src/topbar.vala  |    2 +-
 src/wizard.vala  |    4 ++--
 4 files changed, 5 insertions(+), 16 deletions(-)
---
diff --git a/src/app.vala b/src/app.vala
index a14d5fa..2857415 100644
--- a/src/app.vala
+++ b/src/app.vala
@@ -127,18 +127,7 @@ private class Boxes.App: Boxes.UI {
         ui_state = UIState.COLLECTION;
     }
 
-    public void go_back () {
-        ui_state = UIState.COLLECTION;
-        current_item = null;
-    }
-
-    public void go_create () {
-        ui_state = UIState.WIZARD;
-    }
-
     public override void ui_state_changed () {
-        message ("Switching layout to %s".printf (ui_state.to_string ()));
-
         foreach (var o in new Boxes.UI[] { sidebar, topbar, view, wizard }) {
             o.ui_state = ui_state;
         }
@@ -273,7 +262,7 @@ private class Boxes.DisplayPage: GLib.Object {
         var back = new Gtk.ToolButton (null, null);
         back.icon_name =  "go-previous-symbolic";
         back.get_style_context ().add_class ("raised");
-        back.clicked.connect ((button) => { app.go_back (); });
+        back.clicked.connect ((button) => { app.ui_state = UIState.COLLECTION; });
         toolbar.insert (back, 0);
         toolbar.set_show_arrow (false);
 
diff --git a/src/sidebar.vala b/src/sidebar.vala
index dd83716..7c1e545 100644
--- a/src/sidebar.vala
+++ b/src/sidebar.vala
@@ -132,7 +132,7 @@ private class Boxes.Sidebar: Boxes.UI {
         vbox.pack_end (create, false, false, 0);
         create.show ();
         create.clicked.connect (() => {
-            app.go_create ();
+            app.ui_state = UIState.WIZARD;
         });
 
         /* SidebarPage.WIZARD */
diff --git a/src/topbar.vala b/src/topbar.vala
index 327170e..8da6693 100644
--- a/src/topbar.vala
+++ b/src/topbar.vala
@@ -56,7 +56,7 @@ private class Boxes.Topbar: Boxes.UI {
         var back = new Gtk.ToolButton (null, null);
         back.icon_name =  "go-previous-symbolic";
         back.get_style_context ().add_class ("raised");
-        back.clicked.connect ((button) => { app.go_back (); });
+        back.clicked.connect ((button) => { app.ui_state = UIState.COLLECTION; });
         toolbar_start.insert (back, 0);
         toolbar_start.set_show_arrow (false);
         hbox.pack_start (toolbar_start, false, false, 0);
diff --git a/src/wizard.vala b/src/wizard.vala
index e0f7f5f..81bff77 100644
--- a/src/wizard.vala
+++ b/src/wizard.vala
@@ -160,7 +160,7 @@ private class Boxes.Wizard: Boxes.UI {
         get { return _page; }
         set {
             if (value == WizardPage.LAST) {
-                app.go_back ();
+                app.ui_state = UIState.COLLECTION;
             }
 
             if (skip_page (value)) {
@@ -280,7 +280,7 @@ private class Boxes.Wizard: Boxes.UI {
         var cancel = new Gtk.Button.from_stock (Gtk.Stock.CANCEL);
         hbox_end.pack_start (cancel, false, false, 15);
         cancel.clicked.connect (() => {
-            app.go_back ();
+            app.ui_state = UIState.COLLECTION;
         });
         back_button = new Gtk.Button.from_stock (Gtk.Stock.GO_BACK);
         hbox_end.pack_start (back_button, false, false, 5);



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