GNOME Bugzilla – Bug 775250
mainWindow: Change contents of userList button to reflect the state of the room.
Last modified: 2021-06-10 11:04:36 UTC
Created attachment 340926 [details] mockup showing the different user list states on the showUserListButton. In Polari there is a button in the upper right corner labeled with a number which, when clicked shows the list of users in the current room. When you successfully joined a room with Polari, the "showUserListButton"'s label corresponds to the number of users in the selected room. But there are other cases we need to handle: 1) The button's should show a GtkSpinner while we are connecting to the room. 2) If we encounter an error, the button should show the "dialog-error" icon. To fix this bug you will need to create a GtkStack inside the button. The button should change whether to show the spinner, show the number of users or show the error icon depending on the current state of connecting to the room.
Adding this as a 'newcomers' bug.
Created attachment 359459 [details] [review] patch for addition of spinner to user list button bastianilso please review this patch for any changes
Review of attachment 359459 [details] [review]: Is it necessary to add empty line at `mainWindow.js:190` ?
(In reply to Sendy from comment #3) > Review of attachment 359459 [details] [review] [review]: > > Is it necessary to add empty line at `mainWindow.js:190` ? I'm sorry i will remove it .
Created attachment 359744 [details] [review] patch for addition of spinner to user list button I have remove the blank line.
Review of attachment 359744 [details] [review]: I'm a bit worried about not handling errors, that is just keep spinning forever on failure. But it's early in the cycle, so we can look into this at a later point. In addition to the comments below, the commit message shows up as: From: <À¿=îfU> Subject: [PATCH] main-Window.ui,mainWindow.js : Change contents of here. Can you please make sure to use UTF-8 to set the "author-name" and "author-email" git options? Also the prefix should denote the primary area of a change, not list all affected files (that information is already in the patch anyway). So use something like: mainWindow: Indicate connection progress in user list button ::: data/resources/main-window.ui @@ +167,3 @@ + <child> + <object class="GtkToggleButton" id="showUserListButton"> + - <property name="visible">True</property> Careful about invalid XML here (note the leading '-' character) ::: src/mainWindow.js @@ -173,3 @@ - - this._updateUserListLabel(); - Nit: Keep one of the empty lines @@ -187,3 @@ Lang.bind(this, this._updateDecorations)); this._updateDecorations(); - Stray whitespace change @@ -204,3 @@ this._updateUserListLabel(); }); - Dto. @@ +370,3 @@ dialog.show(); }, + _getConnectionStatus: function() { Nit: Empty line between methods @@ +378,3 @@ + _onConnectionStatusChanged: function() { + let status = this._getConnectionStatus(); + if ( !this._room.channel) This condition is wrong - if a network is offline/disconnected, then of course there won't be a channel. But showing a spinner in that case is wrong, because there is no connection of any kind in progress. @@ +379,3 @@ + let status = this._getConnectionStatus(); + if ( !this._room.channel) + {this._iconStack.visible_child_name="connecting"; Please follow the style conventions - the whitespace, indentation and line breaks are completely messed up here. This is how to write a condition with blocks of statements: if (foo) { doStuff(); doMoreStuff(); } else { doSomethingElse(); } (if all blocks only consist of a single statement, braces should be omitted according to our coding style) @@ +398,3 @@ "%d users", numMembers).format(numMembers); this._showUserListButton.get_accessible().set_name(accessibleName); + this._label.set_text('%d'.format(numMembers)); What's the motivation for this change? If you really need to track the label separately, please use a more descriptive name than 'label' - after all, the .ui file in question is the one for the entire window, which certainly contains much more than a single label :-)
GNOME is going to shut down bugzilla.gnome.org in favor of gitlab.gnome.org. As part of that, we are mass-closing older open tickets in bugzilla.gnome.org which have not seen updates for a longer time (resources are unfortunately quite limited so not every ticket can get handled). If you can still reproduce the situation described in this ticket in a recent and supported software version of Polari, then please follow https://wiki.gnome.org/GettingInTouch/BugReportingGuidelines and create a new ticket at https://gitlab.gnome.org/GNOME/polari/-/issues/ Thank you for your understanding and your help.