After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 763200 - joinDialog: implement the available rooms list
joinDialog: implement the available rooms list
Status: RESOLVED FIXED
Product: polari
Classification: Applications
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: Polari maintainers
Polari maintainers
: 768699 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2016-03-07 01:54 UTC by Isabella Ribeiro
Modified: 2017-02-16 01:08 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
joinDialog: removes the password entry (2.37 KB, patch)
2016-03-07 01:54 UTC, Isabella Ribeiro
none Details | Review
joinDialog: implements room list on join dialog (13.41 KB, patch)
2016-03-07 04:27 UTC, Isabella Ribeiro
none Details | Review
joinDialog: implements room list on join dialog (13.35 KB, patch)
2016-03-07 04:32 UTC, Isabella Ribeiro
none Details | Review
joinDialog: Remove the password entry (2.44 KB, patch)
2016-03-08 02:45 UTC, Isabella Ribeiro
none Details | Review
joinDialog: implements room list on join dialog (16.62 KB, patch)
2016-03-09 04:59 UTC, Isabella Ribeiro
none Details | Review
joinDialog: implements room list on join dialog (16.42 KB, patch)
2016-03-09 05:03 UTC, Isabella Ribeiro
none Details | Review
joinDialog: implements room list on join dialog (13.34 KB, patch)
2016-03-28 00:20 UTC, Isabella Ribeiro
none Details | Review
joinDialog: implements room list on join dialog (13.32 KB, patch)
2016-03-28 00:31 UTC, Isabella Ribeiro
none Details | Review
serverRoomManager: Add class for caching room lists (5.38 KB, patch)
2017-02-15 22:14 UTC, Florian Müllner
committed Details | Review
serverRoomManager: Add ServerRoomList widget (5.90 KB, patch)
2017-02-15 22:14 UTC, Florian Müllner
committed Details | Review
serverRoomManager: Load rooms in chunks (3.12 KB, patch)
2017-02-15 22:14 UTC, Florian Müllner
committed Details | Review
serverRoomManager: Handle already joined rooms (2.01 KB, patch)
2017-02-15 22:14 UTC, Florian Müllner
committed Details | Review
serverRoomManager: Use a treeview instead of listbox (10.18 KB, patch)
2017-02-15 22:15 UTC, Florian Müllner
committed Details | Review
joinDialog: Remove the password entry (2.44 KB, patch)
2017-02-15 22:15 UTC, Florian Müllner
committed Details | Review
joinDialog: Include room list in join dialog (9.51 KB, patch)
2017-02-15 22:15 UTC, Florian Müllner
committed Details | Review

Description Isabella Ribeiro 2016-03-07 01:54:38 UTC
The password entry on the join dialog isn't being used.
This patch removes the unused password entry from the ui.
Comment 1 Isabella Ribeiro 2016-03-07 01:54:44 UTC
Created attachment 323226 [details] [review]
joinDialog: removes the password entry
Comment 2 Isabella Ribeiro 2016-03-07 04:27:08 UTC
Created attachment 323228 [details] [review]
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.
Comment 3 Isabella Ribeiro 2016-03-07 04:32:30 UTC
Created attachment 323229 [details] [review]
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.
Comment 4 Florian Müllner 2016-03-07 18:29:44 UTC
Review of attachment 323226 [details] [review]:

Code looks good, the commit message could do a bit better:

joinDialog: Remove the password entry

The password entry in the join dialog has never been hooked
up, and is now getting in the way of a list of existing rooms
we are about to add to make joining channels easier; just
remove it.
Comment 5 Florian Müllner 2016-03-07 18:29:50 UTC
Review of attachment 323229 [details] [review]:

This is moving in the right direction, but will need a bit more work:
  - I think it makes sense to split out the list after all - while there's
    still a lot of functionality missing, it's already adding quite a bit
    to the joinDialog (which is already fairly complex, with nested stacks
    and whatnot)

  - we are clearly missing a loading indicator

  - the entry is currently really bad - it doesn't do filtering yet, but can no
    longer be used to directly join a channel either; I think in a first step,
    it makes sense to keep the entry as-is and only change it when filtering
    is implemented (including adding the current filter terms as row)

::: data/resources/join-room-dialog.ui
@@ +111,3 @@
+                    <property name="spacing">18</property>
+                    <child>
+                      <object class="GtkStack" id="roomStack">

Why a stack?

::: src/joinDialog.js
@@ +119,3 @@
         this._connectionCombo.sensitive = false;
 
+        this._roomFilterEntry.connect('changed',

The entry doesn't filter anything, so it doesn't make change to rename it (yet)

@@ +216,3 @@
+        let selectedRooms = this._selectedRooms;
+        selectedRooms.forEach(function(checkbox) {
+            let room = checkbox.label

This is too much magic. Apart from making assumptions about rows (there's a private _checkbox property that uses the room name as label), "selectedRooms" is a very confusing name for something that's not a list of selected rooms (or room names).

@@ +286,3 @@
+    },
+
+    _setupServerRoomList: function() {

"setup" is an odd name for something that is done more than once (i.e. every time the selected account changes)

@@ +299,3 @@
+            }));
+
+        this._serverRoomListId = this._serverRoomList.connect('got-room', 

You are saving a signal handler ID, not an object ID. This naming scheme will break the moment you add another signal handler (let's say 'notify::listing' to control a spinner while the list is loading ;-) ).

@@ +302,3 @@
+                                                               Lang.bind(this, this._onGotRoom));
+
+        this._serverRoomList.hscrollbar_policy = Gtk.PolicyType.NEVER;

TpRoomList doesn't have a hscrollbar-policy property - this is monkey-patching a random property that is never read, so doesn't have any effect

@@ +307,3 @@
+        this._roomList.set_sort_func(Lang.bind(this, this._sortRoomList));
+        this._roomList.connect('row-activated',
+                           Lang.bind(this, this._onRowActivated));

Indentation

@@ +308,3 @@
+        this._roomList.connect('row-activated',
+                           Lang.bind(this, this._onRowActivated));
+        this.add(this._roomList);

The list is already added via the .ui file - if 'this' wasn't a GtkBin that can only hold a single child, it would fail because the list already has a parent

@@ +311,3 @@
+    },
+
+    _destroyRoomList: function(){

'destroy' doesn't sound right - the room list isn't a widget. 'clear' maybe?

Also nit: space before brace.

@@ +312,3 @@
+
+    _destroyRoomList: function(){
+        if (this._serverRoomListId) {

_serverRoomListId is never unset

@@ +321,3 @@
+
+    _onGotRoom: function(roomList, roomInfo) {
+        let sensitive = true; //TODO check if channel is already added

We simply don't know yet how to handle already joined rooms yet, so the patch shouldn't make assumptions about sensitivity.

@@ +324,3 @@
+        let row = new ServerRoomRow({ name: roomInfo.get_name(),
+                                      sensitive: sensitive });
+        row._checkbox.connect('toggled', Lang.bind(this, this._onRowChecked));

Don't access private properties of other objects

@@ +329,3 @@
+
+    _onRowActivated: function(list, row) {
+        row._checkbox.active = !row._checkbox.active;

You should not access private properties of other objects; imho this would be better handled by the row itself:
  vfunc_activate: function() {
      this._checkbox.activate();
  }

@@ +330,3 @@
+    _onRowActivated: function(list, row) {
+        row._checkbox.active = !row._checkbox.active;
+        row._checkbox.emit('toggled');

The checkbox emits the signal when its state changes, you should *not* emit it manually

@@ +334,3 @@
+
+    _onRowChecked: function(checkbox) {
+        //TODO activate row

What is that TODO? You check the row when it is activated, so if you also activate it when checked, you end up with a circular dependency ...

@@ +339,3 @@
+
+    _sortRoomList: function(row1, row2) {
+        return row1._checkbox.label.localeCompare(row2._checkbox.label);

Accessing private properties again. Also: Allan suggested to sort by size instead of name.

@@ +342,3 @@
+    },
+
+    get _selectedRooms() {

We need to come up with something better here:
  - either use _selectedRooms, e.g. return a list of selected rooms
  - or use _selectedRows, e.g. return a list of selected rows

This currently doesn't do either, it returns a list of internal row widgets instead.

@@ +369,3 @@
+
+        this.bind_property('sensitive', this, 'activatable',
+                           GObject.BindingFlags.SYNC_CREATE);

This doesn't make sense unless there actually are insensitive rows

@@ +381,3 @@
+                                              hexpand: true,
+                                              halign: Gtk.Align.END });
+        box.add(insensitiveDesc);

Again, we haven't decided on this yet (and it's not working anyway) - better take this out for now.

@@ +386,3 @@
+        this.show_all();
+
+        this.bind_property('sensitive', insensitiveDesc, 'visible',

Dto.
Comment 6 Isabella Ribeiro 2016-03-08 02:45:13 UTC
Created attachment 323338 [details] [review]
joinDialog: Remove the password entry

The password entry in the join dialog has never been hooked
up, and is now getting in the way of a list of existing rooms
we are about to add to make joining channels easier; just
remove it.
Comment 7 Isabella Ribeiro 2016-03-09 04:59:32 UTC
Created attachment 323469 [details] [review]
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.
Comment 8 Isabella Ribeiro 2016-03-09 05:03:39 UTC
Created attachment 323470 [details] [review]
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.
Comment 9 Florian Müllner 2016-03-09 22:15:36 UTC
Review of attachment 323338 [details] [review]:

OK
Comment 10 Florian Müllner 2016-03-09 22:16:40 UTC
Review of attachment 323470 [details] [review]:

Patch doesn't apply
Comment 11 Isabella Ribeiro 2016-03-28 00:20:50 UTC
Created attachment 324853 [details] [review]
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.
Comment 12 Isabella Ribeiro 2016-03-28 00:31:01 UTC
Created attachment 324857 [details] [review]
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.
Comment 13 Florian Müllner 2016-04-08 12:10:44 UTC
Hey, great to see you back :-)

So given that we missed 3.20, let's try to do it right instead of rushing something in. From trying the patch for a while, here are a couple of observations that I think we should address:

 - loading the list can be really slow,
   so we need some form of caching
 - loading the list for a big network
   (Freenode) blocks the process here :-(
 - no horizontal scrolling! ellipsize long
   room names instead
 - the spacing in the dialog is a bit off:
   IMHO we want to horizontally align the
   room list with the networks list
 - the filter entry needs to be hooked up
 - it's not really obvious that the typed
   text is taken as channel name as well;
   you should probably add it to the list
   (as long as it doesn't match an existing
    room of course)
 - enter/escape don't do anything - we'll have
   to figure out what they *should* do of
   course
 - we need to decide how to treat already
   joined rooms
Comment 14 Florian Müllner 2016-07-11 22:31:37 UTC
*** Bug 768699 has been marked as a duplicate of this bug. ***
Comment 15 Florian Müllner 2017-02-15 22:14:20 UTC
Created attachment 345885 [details] [review]
serverRoomManager: Add class for caching room lists

Room lists tend to be mostly static and may take a while to load,
so it makes sense to cache them rather than loading them every
time a list is requested. For that purpose, add a small class to
manage and cache the room list of all active accounts.
Comment 16 Florian Müllner 2017-02-15 22:14:29 UTC
Created attachment 345886 [details] [review]
serverRoomManager: Add ServerRoomList widget

Now that we have a room list cache, we want to present the lists in
the UI, so add a list widget that'll allow users to browse and select
existing rooms in the join dialog.
Comment 17 Florian Müllner 2017-02-15 22:14:38 UTC
Created attachment 345887 [details] [review]
serverRoomManager: Load rooms in chunks

On big networks like Freenode, room lists are rather large, so loading
them can take a while. We don't want to keep blocking the UI thread for
longer periods of time, so split up the list into smaller chunks and
load them in an idle handler.
Comment 18 Florian Müllner 2017-02-15 22:14:57 UTC
Created attachment 345888 [details] [review]
serverRoomManager: Handle already joined rooms

It doesn't make sense to allow users to select already joined rooms,
or to leave rooms by unchecking them. On the other hand, hiding rooms
that clearly exist would be weird as well, so represent joined rooms
as checked but insensitive.
Comment 19 Florian Müllner 2017-02-15 22:15:07 UTC
Created attachment 345889 [details] [review]
serverRoomManager: Use a treeview instead of listbox

For potentially large lists, a treeview is significantly more performant
than a listbox with many composite row widgets. As the ServerRoomList
doesn't require anything that cannot be achieved with a treeview, drop
the listbox for a nice performance gain.
Comment 20 Florian Müllner 2017-02-15 22:15:17 UTC
Created attachment 345890 [details] [review]
joinDialog: Remove the password entry

The password entry in the join dialog has never been hooked
up, and is now getting in the way of a list of existing rooms
we are about to add to make joining channels easier; just
remove it.
Comment 21 Florian Müllner 2017-02-15 22:15:29 UTC
Created attachment 345891 [details] [review]
joinDialog: Include room list in join dialog

Currently users have to know exactly which rooms they want to join
and type in the exact name (either in the join dialog or as parameter
to the /join command). It is often more convenient to browse the list
of existing rooms and pick from that instead, so include that list
in the join dialog.
Comment 22 Florian Müllner 2017-02-16 01:08:14 UTC
Attachment 345885 [details] pushed as ebd3c7c - serverRoomManager: Add class for caching room lists
Attachment 345886 [details] pushed as 84f96b2 - serverRoomManager: Add ServerRoomList widget
Attachment 345887 [details] pushed as 70f6be4 - serverRoomManager: Load rooms in chunks
Attachment 345888 [details] pushed as 9c1d4c3 - serverRoomManager: Handle already joined rooms
Attachment 345889 [details] pushed as 8ad6ecd - serverRoomManager: Use a treeview instead of listbox
Attachment 345890 [details] pushed as e676005 - joinDialog: Remove the password entry
Attachment 345891 [details] pushed as 4aec23a - joinDialog: Include room list in join dialog