quickSettings: Rename 'label' property to 'title'

We'll soon add a subtitle, so rename the label property to something
that is a bit more semantic.Add a warning when trying to set the old
'label' property.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2619>
This commit is contained in:
Georges Basile Stavracas Neto
2023-01-30 17:32:39 -03:00
parent 4786109adf
commit 2d2172da32
10 changed files with 31 additions and 24 deletions

View File

@ -34,7 +34,9 @@ var QuickSettingsItem = GObject.registerClass({
var QuickToggle = GObject.registerClass({
Properties: {
'label': GObject.ParamSpec.override('label', St.Button),
'title': GObject.ParamSpec.string('title', '', '',
GObject.ParamFlags.READWRITE,
null),
'icon-name': GObject.ParamSpec.override('icon-name', St.Button),
'gicon': GObject.ParamSpec.object('gicon', '', '',
GObject.ParamFlags.READWRITE,
@ -76,21 +78,26 @@ var QuickToggle = GObject.registerClass({
GObject.BindingFlags.SYNC_CREATE |
GObject.BindingFlags.BIDIRECTIONAL);
this._label = new St.Label({
style_class: 'quick-toggle-label',
this._title = new St.Label({
style_class: 'quick-toggle-title',
y_align: Clutter.ActorAlign.CENTER,
x_align: Clutter.ActorAlign.START,
x_expand: true,
});
this.label_actor = this._label;
this._box.add_child(this._label);
this.label_actor = this._title;
this._box.add_child(this._title);
this._label.clutter_text.ellipsize = Pango.EllipsizeMode.END;
this._title.clutter_text.ellipsize = Pango.EllipsizeMode.END;
this.bind_property('label',
this._label, 'text',
this.bind_property('title',
this._title, 'text',
GObject.BindingFlags.SYNC_CREATE);
}
set label(label) {
console.warn('Trying to set label on QuickToggle. Use title instead.');
this.title = label;
}
});
var QuickMenuToggle = GObject.registerClass({