[gnome-builder/wip/project-selector: 9/56] project-window: add search bar to project window



commit 83ba560ffe533f6aa1067cc88b6d073b70db8541
Author: Christian Hergert <christian hergert me>
Date:   Mon Mar 30 13:55:43 2015 -0700

    project-window: add search bar to project window

 data/ui/gb-project-window.ui      |   13 ++++++++++++-
 src/workbench/gb-project-window.c |    8 ++++++++
 2 files changed, 20 insertions(+), 1 deletions(-)
---
diff --git a/data/ui/gb-project-window.ui b/data/ui/gb-project-window.ui
index fde543f..d94038d 100644
--- a/data/ui/gb-project-window.ui
+++ b/data/ui/gb-project-window.ui
@@ -61,7 +61,7 @@
           </packing>
         </child>
         <child>
-          <object class="GtkToggleButton">
+          <object class="GtkToggleButton" id="search_button">
             <property name="visible">true</property>
             <style>
               <class name="image-button"/>
@@ -85,6 +85,17 @@
         <property name="orientation">vertical</property>
         <property name="visible">true</property>
         <child>
+          <object class="GtkSearchBar" id="search_bar">
+            <property name="visible">true</property>
+            <child>
+              <object class="GtkSearchEntry" id="search_entry">
+                <property name="width-chars">40</property>
+                <property name="visible">true</property>
+              </object>
+            </child>
+          </object>
+        </child>
+        <child>
           <object class="GtkScrolledWindow">
             <property name="vexpand">true</property>
             <property name="visible">true</property>
diff --git a/src/workbench/gb-project-window.c b/src/workbench/gb-project-window.c
index 55ab520..bf87d65 100644
--- a/src/workbench/gb-project-window.c
+++ b/src/workbench/gb-project-window.c
@@ -34,6 +34,8 @@ struct _GbProjectWindow
   GtkApplicationWindow parent_instance;
 
   GtkListBox      *listbox;
+  GtkSearchBar    *search_bar;
+  GtkToggleButton *search_button;
   GtkToggleButton *select_button;
 };
 
@@ -328,6 +330,10 @@ gb_project_window_constructed (GObject *object)
                            self,
                            G_CONNECT_SWAPPED);
 
+  g_object_bind_property (self->search_button, "active",
+                          self->search_bar, "search-mode-enabled",
+                          G_BINDING_SYNC_CREATE);
+
   ide_project_miner_mine_async (miner,
                                 NULL,
                                 gb_project_window__miner_mine_cb,
@@ -394,6 +400,8 @@ gb_project_window_class_init (GbProjectWindowClass *klass)
   GB_WIDGET_CLASS_TEMPLATE (klass, "gb-project-window.ui");
 
   GB_WIDGET_CLASS_BIND (klass, GbProjectWindow, listbox);
+  GB_WIDGET_CLASS_BIND (klass, GbProjectWindow, search_bar);
+  GB_WIDGET_CLASS_BIND (klass, GbProjectWindow, search_button);
   GB_WIDGET_CLASS_BIND (klass, GbProjectWindow, select_button);
 }
 


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