[gnome-boxes] app-window: Add 'view_type' prop



commit fae592d886a94d111775d5f476680efa618187d0
Author: Adrien Plazas <kekun plazas laposte net>
Date:   Fri Jul 10 09:58:40 2015 +0200

    app-window: Add 'view_type' prop
    
    Allow to switch the view type of a window
    
    https://bugzilla.gnome.org/show_bug.cgi?id=733252

 src/app-window.vala |   19 ++++++++++++++++++-
 1 files changed, 18 insertions(+), 1 deletions(-)
---
diff --git a/src/app-window.vala b/src/app-window.vala
index 72d307e..4cbae32 100644
--- a/src/app-window.vala
+++ b/src/app-window.vala
@@ -6,6 +6,11 @@ using Gdk;
 private class Boxes.AppWindow: Gtk.ApplicationWindow, Boxes.UI {
     public const uint TRANSITION_DURATION = 400; // milliseconds
 
+    public enum ViewType {
+        ICON,
+        LIST,
+    }
+
     public UIState previous_ui_state { get; protected set; }
     public UIState ui_state { get; protected set; }
 
@@ -93,8 +98,18 @@ private class Boxes.AppWindow: Gtk.ApplicationWindow, Boxes.UI {
     [GtkChild]
     private ListView list_view;
 
+    public ViewType view_type { get; set; }
+
     public ICollectionView view {
-        get { return collection_view; }
+        get {
+            switch (view_type) {
+            default:
+            case ViewType.ICON:
+                return collection_view;
+            case ViewType.LIST:
+                return list_view;
+            }
+        }
     }
 
     private ICollectionView[] views;
@@ -158,6 +173,8 @@ private class Boxes.AppWindow: Gtk.ApplicationWindow, Boxes.UI {
         wizard_window = new WizardWindow (this);
         props_window = new PropertiesWindow (this);
 
+        notify["view-type"].connect (ui_state_changed);
+
         var a11y = get_accessible ();
         topbar.bind_property ("status", a11y, "accessible-name", BindingFlags.SYNC_CREATE);
     }


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