system: Use username if full name is longer than 100 characters
The current code relies on unstable behavior of ClutterText, and does not really work as expected. Still, limiting the label size is important. Use a hardcoded limit of 100 characters instead of checking if the layout is ellipsized already.
This commit is contained in:
parent
1ee73ac357
commit
5813850fe1
@ -164,18 +164,15 @@ var Indicator = class extends PanelMenu.SystemIndicator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_updateSwitchUserSubMenu() {
|
_updateSwitchUserSubMenu() {
|
||||||
this._switchUserSubMenu.label.text = this._user.get_real_name();
|
let realName = this._user.get_real_name();
|
||||||
let clutterText = this._switchUserSubMenu.label.clutter_text;
|
|
||||||
|
|
||||||
// XXX -- for some reason, the ClutterText's width changes
|
// In theory, GNOME allows creating users with names up to 255
|
||||||
// rapidly unless we force a relayout of the actor. Probably
|
// characters, but such long names look terribly bad, so limit
|
||||||
// a size cache issue or something. Moving this to be a layout
|
// to 100 and it should fit the vast majority of screen sizes.
|
||||||
// manager would be a much better idea.
|
if (realName.length > 100)
|
||||||
clutterText.get_allocation_box();
|
|
||||||
|
|
||||||
let layout = clutterText.get_layout();
|
|
||||||
if (layout.is_ellipsized())
|
|
||||||
this._switchUserSubMenu.label.text = this._user.get_user_name();
|
this._switchUserSubMenu.label.text = this._user.get_user_name();
|
||||||
|
else
|
||||||
|
this._switchUserSubMenu.label.text = realName;
|
||||||
|
|
||||||
let iconFile = this._user.get_icon_file();
|
let iconFile = this._user.get_icon_file();
|
||||||
if (iconFile && !GLib.file_test(iconFile, GLib.FileTest.EXISTS))
|
if (iconFile && !GLib.file_test(iconFile, GLib.FileTest.EXISTS))
|
||||||
|
Loading…
Reference in New Issue
Block a user