[polari] ui: Use a GtkActionBar in selection mode



commit 4839330459566024e1276a37ea2ed60f5aa49f68
Author: Florian Müllner <fmuellner gnome org>
Date:   Tue Jun 10 18:27:21 2014 +0200

    ui: Use a GtkActionBar in selection mode
    
    It allows us to kill a bit of custom UI for the price of a small
    hack, so do it.

 data/resources/application.css |    3 +-
 data/resources/main-window.ui  |   56 ++++++++-------------------------------
 src/mainWindow.js              |    9 +++++-
 3 files changed, 21 insertions(+), 47 deletions(-)
---
diff --git a/data/resources/application.css b/data/resources/application.css
index 85271bb..9b6e157 100644
--- a/data/resources/application.css
+++ b/data/resources/application.css
@@ -32,8 +32,9 @@
     border-width: 0;
 }
 
-.polari-selection-toolbar,
+.polari-room-list .action-bar,
 .polari-input-area {
+    background-image: none;
     background-color: @polari_dark_bg_color;
     border-color: @borders;
     border-style: solid;
diff --git a/data/resources/main-window.ui b/data/resources/main-window.ui
index ea335aa..561da7b 100644
--- a/data/resources/main-window.ui
+++ b/data/resources/main-window.ui
@@ -256,52 +256,21 @@
                       </object>
                     </child>
                     <child>
-                      <object class="GtkRevealer" id="selection_toolbar_revealer">
-                        <property name="visible">True</property>
-                        <property name="transition_type">slide-up</property>
+                      <object class="GtkActionBar" id="selection_action_bar">
+                        <property name="no_show_all">True</property>
                         <child>
-                          <object class="GtkToolbar" id="selection_toolbar">
+                          <object class="GtkButton" id="button5">
+                            <property name="label" translatable="yes">_Leave</property>
+                            <property name="width_request">70</property>
                             <property name="visible">True</property>
-                            <property name="can_focus">False</property>
-                            <property name="hexpand">False</property>
-                            <property name="show_arrow">False</property>
-                            <style>
-                              <class name="menubar"/>
-                              <class name="polari-selection-toolbar"/>
-                            </style>
-                            <child>
-                              <object class="GtkSeparatorToolItem" id="toolbutton1">
-                                <property name="visible">True</property>
-                                <property name="can_focus">False</property>
-                                <property name="draw">False</property>
-                              </object>
-                              <packing>
-                                <property name="expand">True</property>
-                                <property name="homogeneous">True</property>
-                              </packing>
-                            </child>
-                            <child>
-                              <object class="GtkToolItem" id="toolbutton2">
-                                <property name="visible">True</property>
-                                <property name="can_focus">False</property>
-                                <child>
-                                  <object class="GtkButton" id="button5">
-                                    <property name="label" translatable="yes">_Leave</property>
-                                    <property name="width_request">70</property>
-                                    <property name="visible">True</property>
-                                    <property name="can_focus">True</property>
-                                    <property name="receives_default">True</property>
-                                    <property name="action_name">app.leave-selected-rooms</property>
-                                    <property name="use_underline">True</property>
-                                  </object>
-                                </child>
-                              </object>
-                              <packing>
-                                <property name="expand">False</property>
-                                <property name="homogeneous">True</property>
-                              </packing>
-                            </child>
+                            <property name="can_focus">True</property>
+                            <property name="receives_default">True</property>
+                            <property name="action_name">app.leave-selected-rooms</property>
+                            <property name="use_underline">True</property>
                           </object>
+                          <packing>
+                            <property name="pack_type">end</property>
+                          </packing>
                         </child>
                       </object>
                     </child>
@@ -344,7 +313,6 @@
   <object class="GtkSizeGroup" id="bottom_size_group">
       <property name="mode">vertical</property>
       <widgets>
-        <widget name="selection_toolbar"/>
       </widgets>
   </object>
 </interface>
diff --git a/src/mainWindow.js b/src/mainWindow.js
index 1b768c1..f88122a 100644
--- a/src/mainWindow.js
+++ b/src/mainWindow.js
@@ -162,7 +162,7 @@ const MainWindow = new Lang.Class({
 
     _onSelectionModeChanged: function() {
         let enabled = this._selectionModeAction.state.get_boolean();
-        this._selectionRevealer.reveal_child = enabled;
+        this._selectionActionBar.visible = enabled;
         this._joinMenuButton.visible = !enabled;
         this._showUserListButton.visible = !enabled;
         this._userListAction.enabled = !enabled;
@@ -273,7 +273,12 @@ const MainWindow = new Lang.Class({
         this._titleLabel = builder.get_object('title_label');
         this._subtitleLabel = builder.get_object('subtitle_label');
 
-        this._selectionRevealer = builder.get_object('selection_toolbar_revealer');
+        this._selectionActionBar = builder.get_object('selection_action_bar');
+
+        // slightly hackish:
+        // add the content of the internal revealer to size group
+        sizeGroup.add_widget(this._selectionActionBar.get_child().get_child());
+
         this._joinMenuButton = builder.get_object('join_menu_button');
         this._showUserListButton = builder.get_object('show_user_list_button');
         this._revealer = builder.get_object('room_list_revealer');


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