[polari/wip/kunaljain/polari-search] added stack and hooked togglebutton with switching



commit 331a23240f10141b58db6d103f2b67420e0d90bf
Author: Kunaal Jain <kunaalus gmail com>
Date:   Thu Jun 9 02:43:46 2016 +0530

    added stack and hooked togglebutton with switching

 data/resources/main-window.ui |   19 +++++++++++++++++++
 src/mainWindow.js             |   14 +++++++++++++-
 2 files changed, 32 insertions(+), 1 deletions(-)
---
diff --git a/data/resources/main-window.ui b/data/resources/main-window.ui
index 445b1bb..a3df24e 100644
--- a/data/resources/main-window.ui
+++ b/data/resources/main-window.ui
@@ -232,6 +232,10 @@
                     <property name="vexpand">True</property>
                     <property name="hexpand">True</property>
                     <child>
+          <object class="GtkStack" id="mainStack">
+            <property name="visible">True</property>
+            <property name="transition-type">slide-left-right</property>
+                    <child>
                       <object class="Gjs_RoomList">
                         <property name="visible">True</property>
                         <property name="selection-mode">browse</property>
@@ -239,7 +243,22 @@
                           <class name="sidebar"/>
                         </style>
                       </object>
+                      <packing>
+                <property name="name">roomList</property>
+              </packing>
                     </child>
+                    <child>
+                  <object class="GtkImage">
+                    <property name="visible">True</property>
+                    <property name="icon-name">list-add-symbolic</property>
+                    <property name="icon-size">1</property>
+                  </object>
+                  <packing>
+                <property name="name">image</property>
+              </packing>
+                </child>
+                  </object>
+                </child>
                   </object>
                 </child>
               </object>
diff --git a/src/mainWindow.js b/src/mainWindow.js
index 82d546c..a640a0e 100644
--- a/src/mainWindow.js
+++ b/src/mainWindow.js
@@ -102,7 +102,8 @@ const MainWindow = new Lang.Class({
                        'userListPopover',
                        'roomListRevealer',
                        'overlay',
-                       'roomStack'],
+                       'roomStack',
+                       'mainStack'],
     Properties: {
         subtitle: GObject.ParamSpec.string('subtitle',
                                            'subtitle',
@@ -224,6 +225,15 @@ const MainWindow = new Lang.Class({
                            GObject.BindingFlags.BIDIRECTIONAL);
         this._search_bar.connect_entry(this._search_entry);
 
+        this._search_active_button.connect(
+            'toggled',
+            Lang.bind(this, function() {
+                if (this._mainStack.visible_child_name == 'image')
+                    this._mainStack.visible_child_name = 'roomList';
+                else
+                    this._mainStack.visible_child_name = 'image';
+            }));
+
         //test
         let logManager = LogManager.getDefault();
         let query = "select ?text as ?mms where { ?msg a nmo:IMMessage; nie:plainTextContent ?text. ?msg 
nmo:communicationChannel ?channel. ?channel nie:title '#tracker'. ?msg nmo:from ?contact. ?contact 
nco:nickname 'bijan' . ?msg fts:match 'wonderful' }"
@@ -240,6 +250,8 @@ const MainWindow = new Lang.Class({
         if (this._settings.get_boolean('window-maximized'))
             this.maximize();
 
+        this._mainStack.visible_child_name = 'roomList';
+
         this.show_all();
     },
 


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