[gnome-boxes] Only add back item in Collection state



commit 42fd77ec20e4b63d4b37c31e6abe3c3dc615cd9c
Author: Marc-Andrà Lureau <marcandre lureau gmail com>
Date:   Thu Nov 3 00:10:18 2011 +0100

    Only add back item in Collection state
    
    Without that change, add_item() is also done when switching to Properties
    state, which should not happen, or a second add_item() can happen when
    switching to Collection

 src/collection-view.vala |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)
---
diff --git a/src/collection-view.vala b/src/collection-view.vala
index 63fc12d..4d73384 100644
--- a/src/collection-view.vala
+++ b/src/collection-view.vala
@@ -33,11 +33,8 @@ private class Boxes.CollectionView: Boxes.UI {
     private void set_main_ui_state () {
         actor_remove (app.wizard.actor);
         actor_remove (app.properties.actor);
-
-        if (app.current_item != null) {
+        if (app.current_item != null)
             actor_remove (app.current_item.actor);
-            add_item (app.current_item);
-        }
 
         /* follow main table layout again */
         actor_unpin (boxes);
@@ -97,6 +94,8 @@ private class Boxes.CollectionView: Boxes.UI {
 
         case UIState.COLLECTION:
             set_main_ui_state ();
+            if (app.current_item != null)
+                add_item (app.current_item);
             break;
 
         case UIState.WIZARD:
@@ -246,7 +245,8 @@ private class Boxes.CollectionView: Boxes.UI {
 
         public void remove (CollectionItem item) {
             var iter = sequence.lookup (item, compare);
-            sequence.remove (iter);
+            if (iter != null)
+                sequence.remove (iter);
         }
 
         public string to_string () {



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