[gnome-boxes] collection-toolbar: Add collection filter switcher



commit 9bd112b00f960e4343355227f343466e0bc7f432
Author: Adrien Plazas <kekun plazas laposte net>
Date:   Mon Jun 29 12:15:42 2015 +0200

    collection-toolbar: Add collection filter switcher
    
    Add a CollectionFilterSwitcher as the collection toolbar's custom title
    widget, allowing to switch between multiple filtering functions.
    
    This allows to switch between multiple ready-made searches.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=751710

 data/ui/collection-toolbar.ui |    6 ++++++
 src/collection-toolbar.vala   |    6 ++++++
 2 files changed, 12 insertions(+), 0 deletions(-)
---
diff --git a/data/ui/collection-toolbar.ui b/data/ui/collection-toolbar.ui
index 19192ad..77fd751 100644
--- a/data/ui/collection-toolbar.ui
+++ b/data/ui/collection-toolbar.ui
@@ -8,6 +8,12 @@
       <class name="titlebar"/>
     </style>
 
+    <child type="title">
+      <object class="BoxesCollectionFilterSwitcher" id="filter_switcher">
+        <property name="visible">True</property>
+      </object>
+    </child>
+
     <child>
       <object class="GtkButton" id="new_btn">
         <property name="visible">True</property>
diff --git a/src/collection-toolbar.vala b/src/collection-toolbar.vala
index edf8bab..d92918b 100644
--- a/src/collection-toolbar.vala
+++ b/src/collection-toolbar.vala
@@ -11,6 +11,8 @@ private class Boxes.CollectionToolbar: HeaderBar {
     private Button back_btn;
     [GtkChild]
     private Button new_btn;
+    [GtkChild]
+    private CollectionFilterSwitcher filter_switcher;
 
     private AppWindow window;
 
@@ -29,6 +31,8 @@ private class Boxes.CollectionToolbar: HeaderBar {
 
         window.notify["ui-state"].connect (ui_state_changed);
         App.app.notify["main-window"].connect (ui_state_changed);
+
+        filter_switcher.setup_ui (window);
     }
 
     public void click_back_button () {
@@ -73,6 +77,7 @@ private class Boxes.CollectionToolbar: HeaderBar {
             select_btn.show ();
             search_btn.show ();
             new_btn.show ();
+            custom_title = filter_switcher;
             break;
 
         case UIState.CREDS:
@@ -80,6 +85,7 @@ private class Boxes.CollectionToolbar: HeaderBar {
             back_btn.visible = (window == App.app.main_window);
             select_btn.hide ();
             search_btn.hide ();
+            custom_title = null;
             break;
 
         default:


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