[gnome-boxes] app-window: Move show_properties() from App



commit b57445ed837f5972f2c23a99693056269671b154
Author: Adrien Plazas <kekun plazas laposte net>
Date:   Wed Jul 16 09:43:45 2014 +0200

    app-window: Move show_properties() from App
    
    show_properties () only uses things that are part of AppWindow ('view',
    'current-item') or will be moved to it in next patches ('selection-mode',
    'ui-state') and so it should be moved to AppWindow.
    
    This is needed to drop the use of AppWindow singleton and therefore to
    make multiple windows possible.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=732098

 src/app-window.vala   |   13 +++++++++++++
 src/app.vala          |   13 -------------
 src/selectionbar.vala |    2 +-
 3 files changed, 14 insertions(+), 14 deletions(-)
---
diff --git a/src/app-window.vala b/src/app-window.vala
index b7a6951..c5459ba 100644
--- a/src/app-window.vala
+++ b/src/app-window.vala
@@ -152,6 +152,19 @@ private class Boxes.AppWindow: Gtk.ApplicationWindow, Boxes.UI {
         }
     }
 
+    public void show_properties () {
+        var selected_items = view.get_selected_items ();
+
+        App.app.selection_mode = false;
+
+        // Show for the first selected item
+        foreach (var item in selected_items) {
+            current_item = item;
+            App.app.set_state (UIState.PROPERTIES);
+            break;
+        }
+    }
+
     [GtkCallback]
     public bool on_key_pressed (Widget widget, Gdk.EventKey event) {
         var default_modifiers = Gtk.accelerator_get_default_mod_mask ();
diff --git a/src/app.vala b/src/app.vala
index 5e452ef..42e257e 100644
--- a/src/app.vala
+++ b/src/app.vala
@@ -469,19 +469,6 @@ private class Boxes.App: Gtk.Application, Boxes.UI {
         owned get { return window.view.get_selected_items (); }
     }
 
-    public void show_properties () {
-        var selected_items = window.view.get_selected_items ();
-
-        selection_mode = false;
-
-        // Show for the first selected item
-        foreach (var item in selected_items) {
-            current_item = item;
-            set_state (UIState.PROPERTIES);
-            break;
-        }
-    }
-
     /**
      * Deletes specified items, while allowing user to undo it.
      *
diff --git a/src/selectionbar.vala b/src/selectionbar.vala
index 4e6d902..e091324 100644
--- a/src/selectionbar.vala
+++ b/src/selectionbar.vala
@@ -67,7 +67,7 @@ private class Boxes.Selectionbar: Gtk.Revealer {
 
     [GtkCallback]
     private void on_properties_btn_clicked () {
-        App.app.show_properties ();
+        App.window.show_properties ();
     }
 
     private void update_favorite_btn () {


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