[polari/wip/fmuellner/combined-gsoc: 3/103] added stack and hooked togglebutton with switching



commit e80dd8fa6a5481c34a6f9d1a24db40f892eacc73
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 ab2bc37..0e4e0fe 100644
--- a/data/resources/main-window.ui
+++ b/data/resources/main-window.ui
@@ -225,6 +225,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>
@@ -232,7 +236,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 f0b32e3..6d93b07 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',
@@ -221,6 +222,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' }"
@@ -237,6 +247,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]