[polari/wip/fmuellner/room-list: 6/7] joinDialog: implements room list on join dialog
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [polari/wip/fmuellner/room-list: 6/7] joinDialog: implements room list on join dialog
- Date: Fri, 11 Nov 2016 11:56:53 +0000 (UTC)
commit c815af55aba5d1f0c1048c5ffab1d35522b405fb
Author: Isabella Ribeiro <belinhacbr gmail com>
Date: Wed Mar 23 21:54:00 2016 -0400
joinDialog: implements room list on join dialog
A list containing the rooms of a selected account should be available
to the user. This patch implements the rooms list which also enables
the functionality to select and join many rooms at once.
https://bugzilla.gnome.org/show_bug.cgi?id=763200
joinDialog: Tweak spacings
data/resources/join-room-dialog.ui | 78 ++++++++++++++++++++++-------------
src/joinDialog.js | 38 ++++++++++++-----
2 files changed, 76 insertions(+), 40 deletions(-)
---
diff --git a/data/resources/join-room-dialog.ui b/data/resources/join-room-dialog.ui
index d23f682..89545be 100644
--- a/data/resources/join-room-dialog.ui
+++ b/data/resources/join-room-dialog.ui
@@ -52,16 +52,11 @@
<child>
<object class="GtkGrid">
<property name="visible">True</property>
- <property name="margin">24</property>
- <property name="row-spacing">6</property>
+ <property name="margin">30</property>
+ <property name="margin-bottom">24</property>
+ <property name="row-spacing">18</property>
<property name="column-spacing">12</property>
<child>
- <object class="GtkLabel" id="margin">
- <property name="visible">True</property>
- <property name="width-request">24</property>
- </object>
- </child>
- <child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="halign">end</property>
@@ -104,31 +99,56 @@
</object>
</child>
<child>
- <object class="GtkLabel">
- <property name="visible">True</property>
- <property name="halign">end</property>
- <property name="margin-top">24</property>
- <property name="label" translatable="yes">Room _Name</property>
- <property name="use-underline">True</property>
- <property name="mnemonic-widget">nameEntry</property>
- </object>
- <packing>
- <property name="left-attach">1</property>
- <property name="top-attach">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkEntry" id="nameEntry">
+ <object class="GtkBox">
<property name="visible">True</property>
- <property name="hexpand">True</property>
- <property name="margin-top">24</property>
- <property name="activates-default">True</property>
- <property name="completion">nameCompletion</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">18</property>
+ <child>
+ <object class="GtkBox">
+ <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-right">30</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-right">30</property>
+ </object>
+ </child>
+ </object>
+ </child>
+ <child>
+ <object class="Gjs_ServerRoomList" id="serverRoomList">
+ <property name="visible">True</property>
+ <property name="vexpand">True</property>
+ </object>
+ </child>
+ </object>
+ </child>
</object>
<packing>
- <property name="left-attach">2</property>
+ <property name="width">3</property>
+ <property name="left-attach">0</property>
<property name="top-attach">1</property>
- <property name="width">2</property>
</packing>
</child>
</object>
diff --git a/src/joinDialog.js b/src/joinDialog.js
index 8c7f2be..6660f75 100644
--- a/src/joinDialog.js
+++ b/src/joinDialog.js
@@ -4,6 +4,7 @@ const GLib = imports.gi.GLib;
const Gtk = imports.gi.Gtk;
const Tp = imports.gi.TelepathyGLib;
const Tpl = imports.gi.TelepathyLogger;
+const GObject = imports.gi.GObject;
const AccountsMonitor = imports.accountsMonitor;
const Connections = imports.connections;
@@ -24,11 +25,13 @@ const JoinDialog = new Lang.Class({
'mainStack',
'connectionCombo',
'connectionButton',
- 'nameEntry',
'nameCompletion',
'connectionStack',
'filterEntry',
'connectionsList',
+ 'serverRoomList',
+ 'nameEntry',
+ 'spinner',
'details',
'addButton',
'customToggle'],
@@ -112,6 +115,10 @@ const JoinDialog = new Lang.Class({
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);
},
_setupConnectionPage: function() {
@@ -191,6 +198,8 @@ const JoinDialog = new Lang.Class({
}
}
}));
+
+ this._serverRoomList.setAccount(account);
},
_onAccountCreated: function(w, account) {
@@ -203,16 +212,21 @@ const JoinDialog = new Lang.Class({
let selected = this._connectionCombo.get_active_text();
let account = this._accounts[selected];
- let room = this._nameEntry.get_text();
- if (room[0] != '#')
- room = '#' + room;
+ let toJoinRooms = this._serverRoomList.selectedRooms;
+ if (this._nameEntry.get_text_length() > 0)
+ toJoinRooms.push(this._nameEntry.get_text());
- let app = Gio.Application.get_default();
- let action = app.lookup_action('join-room');
- action.activate(GLib.Variant.new('(ssu)',
- [ account.get_object_path(),
- room,
- Utils.getTpEventTime() ]));
+ toJoinRooms.forEach(function(room) {
+ if (room[0] != '#')
+ room = '#' + room;
+
+ let app = Gio.Application.get_default();
+ let action = app.lookup_action('join-room');
+ action.activate(GLib.Variant.new('(ssu)',
+ [ account.get_object_path(),
+ room,
+ Utils.getTpEventTime() ]));
+ });
},
_updateConnectionCombo: function() {
@@ -237,9 +251,11 @@ const JoinDialog = new Lang.Class({
_updateCanJoin: function() {
let sensitive = false;
+
if (this._page == DialogPage.MAIN)
sensitive = this._connectionCombo.get_active() > -1 &&
- this._nameEntry.get_text_length() > 0;
+ (this._nameEntry.get_text_length() > 0 ||
+ this._serverRoomList.can_join);
this._joinButton.sensitive = sensitive;
this.set_default_response(sensitive ? Gtk.ResponseType.OK
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]