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 755477 - userList: ellipsize usernames
userList: ellipsize usernames
Status: RESOLVED FIXED
Product: polari
Classification: Applications
Component: general
3.18.x
Other Linux
: Normal normal
: ---
Assigned To: Polari maintainers
Polari maintainers
Depends on:
Blocks:
 
 
Reported: 2015-09-23 16:19 UTC by Bastian Ilsø
Modified: 2015-10-02 07:52 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
screenshot of userlist containing too long name (38.82 KB, image/png)
2015-09-23 16:19 UTC, Bastian Ilsø
  Details
userList: ellipsize usernames (1.51 KB, patch)
2015-10-01 12:27 UTC, jurikolo
reviewed Details | Review
Demo of attachment 312474 (74.95 KB, image/png)
2015-10-01 12:49 UTC, jurikolo
  Details
userList: Ellipsize usernames (1.49 KB, patch)
2015-10-01 14:05 UTC, jurikolo
reviewed Details | Review

Description Bastian Ilsø 2015-09-23 16:19:07 UTC
Created attachment 311953 [details]
screenshot of userlist containing too long name

If I have a very long username, then we have some weird sizing behavior in the userList. It would be better to handle this case by ellipsizing the name.

(this could be a good newcomer bug).
Comment 1 jurikolo 2015-10-01 12:27:12 UTC
Created attachment 312474 [details] [review]
userList: ellipsize usernames

This patch added max_width_chars parameter to popover Gtk.Label

Although there was ellipsize parameter for the Gtk.Label, it didn't work due to there was no limitation on Label size. max_width_chars adds necessary limitation to replace ending of long names to dots.
Comment 2 jurikolo 2015-10-01 12:49:26 UTC
Created attachment 312476 [details]
Demo of attachment 312474 [details] [review]
Comment 3 Bastian Ilsø 2015-10-01 12:57:27 UTC
Review of attachment 312474 [details] [review]:

>> const MAX_POPOVER_WIDTH = 17;
Perhaps a more accurate name would be "MAX_USERNAME_WIDTH" ?

>> Although there was ellipsize parameter for the Gtk.Label, it didn't work due to there was no limitation on Label size. max_width_chars adds necessary limitation to replace ending of long names to dots.
You need to manually wrap the commit message at < 80 characters. :)

The commit message is worded a bit funny to me. Maybe something like this?

"The userListRow labels is set to ellipsize, but had no maximum width.
We should set the max_width_chars for each label so longer labels 
ellipsize instead of making the user list grow beyond its default width."
Comment 4 Florian Müllner 2015-10-01 13:01:39 UTC
Review of attachment 312474 [details] [review]:

(In reply to jurikolo from comment #1)
> Although there was ellipsize parameter for the Gtk.Label, it didn't work due
> to there was no limitation on Label size.

For context:
It stopped working when the parent container no longer enforced a fixed width[0].

Some nits on the commit message:
- subject should use header capitalization ("userList: Ellipsize usernames")
- body should use present tense + active style: "Add max_width ..." instead of "This patch added max_width ...".
- commit messages should contain line breaks at around 75 characters

[0] https://git.gnome.org/browse/polari/commit?id=cf953db84bf29d

::: src/userList.js
@@ +15,2 @@
 const MAX_USERS_SHOWN = 8;
+const MAX_POPOVER_WIDTH = 17;

The name is misleading - "width" usually refers to pixel sizes, and it's used for the nick label rather than the popover itself.
How about "MAX_NICK_WIDTH_CHARS" instead?
Comment 5 jurikolo 2015-10-01 14:05:56 UTC
Created attachment 312487 [details] [review]
userList: Ellipsize usernames

Add max_width_chars parameter to popover Gtk.Label

Username ellipsizing stopped working when the parent container no longer
enforced a fixed width[0], so set GtkLabel:max-width-chars for the
username label to make ellipsizing work again
Comment 6 Florian Müllner 2015-10-01 21:46:41 UTC
Review of attachment 312487 [details] [review]:

Sorry, still some minor nits in the commit message:
> Add max_width_chars parameter to popover Gtk.Label

The following sentence already says that slightly differently, so leave this out please.


> the parent container no longer enforced a fixed width[0]

"[0]" references the 0th footnote, but the footnote is missing - either add it, or remove the reference.


However those are really just nits, so no need for another review - if you have git access, simply fix up the message before pushing, otherwise tell us and we'll push the patch for you. Thanks for the patch by the way :-)

::: src/userList.js
@@ +15,2 @@
 const MAX_USERS_SHOWN = 8;
+const MAX_USERS_WIDTH_CHARS = 17;

The consistency is a bit forced here, as "max-users" in the existing constant translates to "maximum number of users", while it's "maximum length of a single user (string)" in the new one. The context for each constant is obvious enough though, so OK to leave it like that.
Comment 7 Bastian Ilsø 2015-10-02 07:52:52 UTC
(In reply to Florian Müllner from comment #6)
> > the parent container no longer enforced a fixed width[0]
> 
> "[0]" references the 0th footnote, but the footnote is missing - either add
> it, or remove the reference.

Fixed and pushed commit ebd0aa05843c9dd4b6a9cd422c8a4b227ba8ab53 to master now.