system: Ellipsize user names

Users may have long user names, (but not too long [1])
so it makes sense to limit how much the label can grow.
Otherwise, the popup may overflow even the biggest
screens.

Ellipsize the user name label.

[1] https://gitlab.gnome.org/GNOME/gnome-control-center/merge_requests/385
This commit is contained in:
Georges Basile Stavracas Neto 2019-02-07 17:51:21 -02:00
parent 5ca039c1db
commit 65cbf4aa45
No known key found for this signature in database
GPG Key ID: 886C17EE170D1385

View File

@ -4,6 +4,7 @@ const AccountsService = imports.gi.AccountsService;
const Clutter = imports.gi.Clutter;
const Gio = imports.gi.Gio;
const GLib = imports.gi.GLib;
const Pango = imports.gi.Pango;
const Shell = imports.gi.Shell;
const St = imports.gi.St;
const GObject = imports.gi.GObject;
@ -211,6 +212,7 @@ var Indicator = class extends PanelMenu.SystemIndicator {
this._switchUserSubMenu = new PopupMenu.PopupSubMenuMenuItem('', true);
this._switchUserSubMenu.icon.style_class = 'system-switch-user-submenu-icon';
this._switchUserSubMenu.label.clutter_text.ellipsize = Pango.EllipsizeMode.END;
// Since the label of the switch user submenu depends on the width of
// the popup menu, and we can't easily connect on allocation-changed