[polari/wip/dmoelgaard/initial-setup: 228/228] Fix some shit



commit e23ee1e10e175c461a529feeb026aaf47d3e5dc5
Author: Bastian Ilsø <bastianilso gnome org>
Date:   Tue Aug 1 20:54:35 2017 +0100

    Fix some shit

 data/resources/init-setup.ui |   45 +++--------------------------------------
 src/application.js           |    3 ++
 src/initSetup.js             |   19 +++++------------
 3 files changed, 13 insertions(+), 54 deletions(-)
---
diff --git a/data/resources/init-setup.ui b/data/resources/init-setup.ui
index d43b3d0..f2a1716 100644
--- a/data/resources/init-setup.ui
+++ b/data/resources/init-setup.ui
@@ -73,6 +73,7 @@
                     <property name="visible">True</property>
                     <property name="halign">end</property>
                     <property name="valign">center</property>
+                    <property name="can-default">True</property>
                     <style>
                       <class name="suggested-action"/>
                     </style>
@@ -99,7 +100,7 @@
           <object class="GtkBox">
             <property name="orientation">vertical</property>
             <property name="visible">True</property>
-            <property name="valign">center</property>
+            <property name="vexpand">True</property>
             <property name="margin">30</property>
             <property name="margin-bottom">24</property>
             <property name="spacing">25</property>
@@ -150,7 +151,6 @@
           <object class="GtkBox">
             <property name="orientation">vertical</property>
             <property name="visible">True</property>
-            <property name="valign">center</property>
             <property name="margin">30</property>
             <property name="margin-bottom">24</property>
             <property name="spacing">25</property>
@@ -193,46 +193,9 @@
                 <property name="orientation">vertical</property>
                 <property name="spacing">18</property>
                 <child>
-                  <object class="GtkBox">
+                  <object class="Gjs_ServerRoomList" id="serverRoomList">
                     <property name="visible">True</property>
-                    <property name="orientation">vertical</property>
-                    <style>
-                      <class name="linked"/>
-                      <class name="frame"/>
-                    </style>
-                    <child>
-                      <object class="GtkBox">
-                        <property name="visible">True</property>
-                        <style>
-                          <class name="polari-listbox-filterbar"/>
-                        </style>
-                        <child>
-                          <object class="GtkSearchEntry" id="nameEntry">
-                            <property name="visible">True</property>
-                            <property name="hexpand">True</property>
-                            <property name="margin">60</property>
-                            <property name="margin-top">6</property>
-                            <property name="margin-bottom">6</property>
-                            <property name="margin-end">22</property>
-                            <property name="placeholder-text" translatable="yes">Enter room name to 
add</property>
-                         </object>
-                       </child>
-                        <child>
-                          <object class="GtkSpinner" id="spinner">
-                            <property name="visible">True</property>
-                            <property name="margin-end">22</property>
-                          </object>
-                        </child>
-                      </object>
-                     </child>
-                    <child>
-                      <object class="Gjs_ServerRoomList" id="serverRoomList">
-                        <property name="min-content-height">274</property>
-                        <property name="visible">True</property>
-                        <property name="vexpand">True</property>
-                        <property name="hscrollbar-policy">never</property>
-                      </object>
-                    </child>
+                    <property name="vexpand">True</property>
                   </object>
                 </child>
               </object>
diff --git a/src/application.js b/src/application.js
index c509a5f..1c23803 100644
--- a/src/application.js
+++ b/src/application.js
@@ -307,6 +307,9 @@ var Application = new Lang.Class({
     vfunc_window_added: function(window) {
         this.parent(window);
 
+        if (!(window instanceof MainWindow.MainWindow))
+            return;
+
         let action = this.lookup_action('leave-current-room');
         window.connect('notify::active-room', () => {
             action.enabled = window.active_room != null;
diff --git a/src/initSetup.js b/src/initSetup.js
index 51a510e..053a2b9 100644
--- a/src/initSetup.js
+++ b/src/initSetup.js
@@ -17,7 +17,7 @@ const SetupPage = {
     ROOM: 1
 };
 
-const InitSetup = new Lang.Class({
+var InitSetup = new Lang.Class({
     Name: 'InitSetup',
     Extends: Gtk.Window,
     Template: 'resource:///org/gnome/Polari/ui/init-setup.ui',
@@ -29,9 +29,7 @@ const InitSetup = new Lang.Class({
                         'doneButton',
                         'contentStack',
                         'connectionPageList',
-                        'serverRoomList',
-                        'nameEntry',
-                        'spinner' ],
+                        'serverRoomList'],
 
     _init: function(params) {
 
@@ -83,15 +81,16 @@ const InitSetup = new Lang.Class({
     _setPage: function(page) {
         let isConnection = page == SetupPage.CONNECTION;
 
-        if (!isConnection)
-            this._nameEntry.grab_focus();
-
         this._contentStack.visible_child_name = isConnection ? 'connectionPage'
                                                              : 'roomPage';
         this._leftHeaderStack.visible_child_name = isConnection ? 'cancelButton'
                                                                 : 'backButton';
         this._rightHeaderStack.visible_child_name = isConnection ? 'nextButton'
                                                                  : 'doneButton';
+        if (isConnection)
+            this._nextButton.grab_default();
+        else
+            this._doneButton.grab_default();
     },
 
     _setupRoomPage: function() {
@@ -108,12 +107,8 @@ const InitSetup = new Lang.Class({
 
         this._doneButton.sensitive = false;
 
-        this._nameEntry.connect('changed',
-                                Lang.bind(this, this._updateCanJoin));
         this._serverRoomList.connect('notify::can-join',
                                      Lang.bind(this, this._updateCanJoin));
-        this._serverRoomList.bind_property('loading', this._spinner, 'active',
-                                            GObject.BindingFlags.SYNC_CREATE);
     },
 
     get _page() {
@@ -136,8 +131,6 @@ const InitSetup = new Lang.Class({
         this.hide();
 
         let toJoinRooms = this._serverRoomList.selectedRooms;
-        if (this._nameEntry.get_text_length() > 0)
-            toJoinRooms.push(this._nameEntry.get_text());
 
         let account = this._currentAccount;
         toJoinRooms.forEach(function(room) {


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