st: Remove StBin's align properties

They are now completely unused, so remove them and stop the confusing
shadowing of ClutterActor's own x/y-align properties.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/803
This commit is contained in:
Florian Müllner 2019-10-17 23:27:27 +02:00
parent f2bd39b20c
commit 2c62e45168
12 changed files with 45 additions and 169 deletions

View File

@ -162,9 +162,9 @@ var AuthPrompt = GObject.registerClass({
can_focus: true,
label: _("Cancel"),
x_expand: true,
x_align: Clutter.ActorAlign.START,
y_align: Clutter.ActorAlign.END,
});
this.cancelButton.set_x_align(Clutter.ActorAlign.START);
this.cancelButton.set_y_align(Clutter.ActorAlign.END);
this.cancelButton.connect('clicked', () => this.cancel());
this._buttonBox.add_child(this.cancelButton);
@ -175,9 +175,9 @@ var AuthPrompt = GObject.registerClass({
reactive: true,
can_focus: true,
label: _("Next"),
x_align: Clutter.ActorAlign.END,
y_align: Clutter.ActorAlign.END,
});
this.nextButton.set_x_align(Clutter.ActorAlign.END);
this.nextButton.set_y_align(Clutter.ActorAlign.END);
this.nextButton.connect('clicked', () => this.emit('next'));
this.nextButton.add_style_pseudo_class('default');
this._buttonBox.add_child(this.nextButton);

View File

@ -346,19 +346,13 @@ function insertSorted(array, val, cmp) {
var CloseButton = GObject.registerClass(
class CloseButton extends St.Button {
_init(boxpointer) {
super._init({ style_class: 'notification-close' });
// This is a bit tricky. St.Bin has its own x-align/y-align properties
// that compete with Clutter's properties. This should be fixed for
// Clutter 2.0. Since St.Bin doesn't define its own setters, the
// setters are a workaround to get Clutter's version.
this.set_x_align(Clutter.ActorAlign.END);
this.set_y_align(Clutter.ActorAlign.START);
// XXX Clutter 2.0 workaround: ClutterBinLayout needs expand
// to respect the alignments.
this.set_x_expand(true);
this.set_y_expand(true);
super._init({
style_class: 'notification-close',
x_expand: true,
y_expand: true,
x_align: Clutter.ActorAlign.END,
y_align: Clutter.ActorAlign.START,
});
this._boxPointer = boxpointer;
if (boxpointer)

View File

@ -1082,10 +1082,12 @@ class CalendarMessageList extends St.Widget {
this._scrollView.set_policy(St.PolicyType.NEVER, St.PolicyType.AUTOMATIC);
box.add_actor(this._scrollView);
this._clearButton = new St.Button({ style_class: 'message-list-clear-button button',
label: _("Clear"),
can_focus: true });
this._clearButton.set_x_align(Clutter.ActorAlign.END);
this._clearButton = new St.Button({
style_class: 'message-list-clear-button button',
label: _('Clear'),
can_focus: true,
x_align: Clutter.ActorAlign.END,
});
this._clearButton.connect('clicked', () => {
this._sectionList.get_children().forEach(s => s.clear());
});

View File

@ -16,8 +16,8 @@ class CheckBox extends St.Button {
this._box = new St.Bin({
x_expand: true,
y_expand: true,
y_align: Clutter.ActorAlign.START,
});
this._box.set_y_align(Clutter.ActorAlign.START);
container.add_actor(this._box);
this._label = new St.Label();

View File

@ -272,8 +272,8 @@ class EndSessionDialog extends ModalDialog.ModalDialog {
this._iconBin = new St.Bin({
x_expand: true,
x_align: Clutter.ActorAlign.END,
});
this._iconBin.set_x_align(Clutter.ActorAlign.END);
mainContentLayout.add_child(this._iconBin);
let messageLayout = new St.BoxLayout({ vertical: true,

View File

@ -265,8 +265,8 @@ class ObjLink extends St.Button {
track_hover: true,
style_class: 'shell-link',
label: text,
x_align: Clutter.ActorAlign.START,
});
this.set_x_align(Clutter.ActorAlign.START);
this.get_child().single_line_mode = true;
this._obj = o;

View File

@ -735,10 +735,12 @@ var PadOsd = GObject.registerClass({
x_align: Clutter.ActorAlign.CENTER,
y_align: Clutter.ActorAlign.CENTER });
this.add_actor(buttonBox);
this._editButton = new St.Button({ label: _("Edit…"),
style_class: 'button',
can_focus: true });
this._editButton.set_x_align(Clutter.ActorAlign.CENTER);
this._editButton = new St.Button({
label: _('Edit…'),
style_class: 'button',
can_focus: true,
x_align: Clutter.ActorAlign.CENTER,
});
this._editButton.connect('clicked', () => {
this.setEditionMode(true);
});

View File

@ -340,9 +340,9 @@ var PopupSwitchMenuItem = GObject.registerClass({
this.add_child(this.label);
this._statusBin = new St.Bin({
x_align: Clutter.ActorAlign.END,
x_expand: true,
});
this._statusBin.set_x_align(Clutter.ActorAlign.END);
this.add_child(this._statusBin);
this._statusLabel = new St.Label({

View File

@ -770,13 +770,15 @@ var ProviderInfo = GObject.registerClass(
class ProviderInfo extends St.Button {
_init(provider) {
this.provider = provider;
super._init({ style_class: 'search-provider-icon',
reactive: true,
can_focus: true,
accessible_name: provider.appInfo.get_name(),
track_hover: true });
super._init({
style_class: 'search-provider-icon',
reactive: true,
can_focus: true,
accessible_name: provider.appInfo.get_name(),
track_hover: true,
y_align: Clutter.ActorAlign.START,
});
this.set_y_align(Clutter.ActorAlign.START);
this._content = new St.BoxLayout({ vertical: false,
style_class: 'list-search-provider-content' });
this.set_child(this._content);

View File

@ -175,15 +175,16 @@ class Indicator extends PanelMenu.SystemIndicator {
}
_createActionButton(iconName, accessibleName) {
let icon = new St.Button({ reactive: true,
can_focus: true,
track_hover: true,
accessible_name: accessibleName,
x_expand: true,
style_class: 'system-menu-action' });
icon.set_x_align(Clutter.ActorAlign.CENTER);
icon.child = new St.Icon({ icon_name: iconName });
return icon;
return new St.Button({
child: new St.Icon({ icon_name: iconName }),
reactive: true,
can_focus: true,
track_hover: true,
accessible_name: accessibleName,
x_expand: true,
x_align: Clutter.ActorAlign.CENTER,
style_class: 'system-menu-action',
});
}
_createSubMenu() {

View File

@ -43,9 +43,6 @@ struct _StBinPrivate
{
ClutterActor *child;
StAlign x_align;
StAlign y_align;
guint x_fill : 1;
guint y_fill : 1;
};
@ -55,8 +52,6 @@ enum
PROP_0,
PROP_CHILD,
PROP_X_ALIGN,
PROP_Y_ALIGN,
PROP_X_FILL,
PROP_Y_FILL,
@ -273,18 +268,6 @@ st_bin_set_property (GObject *gobject,
st_bin_set_child (bin, g_value_get_object (value));
break;
case PROP_X_ALIGN:
st_bin_set_alignment (bin,
g_value_get_enum (value),
priv->y_align);
break;
case PROP_Y_ALIGN:
st_bin_set_alignment (bin,
priv->x_align,
g_value_get_enum (value));
break;
case PROP_X_FILL:
st_bin_set_fill (bin,
g_value_get_boolean (value),
@ -324,14 +307,6 @@ st_bin_get_property (GObject *gobject,
g_value_set_boolean (value, priv->y_fill);
break;
case PROP_X_ALIGN:
g_value_set_enum (value, priv->x_align);
break;
case PROP_Y_ALIGN:
g_value_set_enum (value, priv->y_align);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
}
@ -367,32 +342,6 @@ st_bin_class_init (StBinClass *klass)
CLUTTER_TYPE_ACTOR,
ST_PARAM_READWRITE);
/**
* StBin:x-align:
*
* The horizontal alignment of the #StBin child.
*/
props[PROP_X_ALIGN] =
g_param_spec_enum ("x-align",
"X Align",
"The horizontal alignment",
ST_TYPE_ALIGN,
ST_ALIGN_MIDDLE,
ST_PARAM_READWRITE | G_PARAM_DEPRECATED);
/**
* StBin:y-align:
*
* The vertical alignment of the #StBin child.
*/
props[PROP_Y_ALIGN] =
g_param_spec_enum ("y-align",
"Y Align",
"The vertical alignment",
ST_TYPE_ALIGN,
ST_ALIGN_MIDDLE,
ST_PARAM_READWRITE | G_PARAM_DEPRECATED);
/**
* StBin:x-fill:
*
@ -425,10 +374,6 @@ st_bin_class_init (StBinClass *klass)
static void
st_bin_init (StBin *bin)
{
StBinPrivate *priv = st_bin_get_instance_private (bin);
priv->x_align = ST_ALIGN_MIDDLE;
priv->y_align = ST_ALIGN_MIDDLE;
}
/**
@ -499,70 +444,6 @@ st_bin_get_child (StBin *bin)
return ((StBinPrivate *)st_bin_get_instance_private (bin))->child;
}
/**
* st_bin_set_alignment:
* @bin: a #StBin
* @x_align: horizontal alignment
* @y_align: vertical alignment
*
* Sets the horizontal and vertical alignment of the child
* inside a #StBin.
*/
void
st_bin_set_alignment (StBin *bin,
StAlign x_align,
StAlign y_align)
{
StBinPrivate *priv;
g_return_if_fail (ST_IS_BIN (bin));
priv = st_bin_get_instance_private (bin);
g_object_freeze_notify (G_OBJECT (bin));
if (priv->x_align != x_align)
{
priv->x_align = x_align;
g_object_notify_by_pspec (G_OBJECT (bin), props[PROP_X_ALIGN]);
}
if (priv->y_align != y_align)
{
priv->y_align = y_align;
g_object_notify_by_pspec (G_OBJECT (bin), props[PROP_Y_ALIGN]);
}
g_object_thaw_notify (G_OBJECT (bin));
}
/**
* st_bin_get_alignment:
* @bin: a #StBin
* @x_align: return location for the horizontal alignment, or %NULL
* @y_align: return location for the vertical alignment, or %NULL
*
* Retrieves the horizontal and vertical alignment of the child
* inside a #StBin, as set by st_bin_set_alignment().
*/
void
st_bin_get_alignment (StBin *bin,
StAlign *x_align,
StAlign *y_align)
{
StBinPrivate *priv;
g_return_if_fail (ST_IS_BIN (bin));
priv = st_bin_get_instance_private (bin);
if (x_align)
*x_align = priv->x_align;
if (y_align)
*y_align = priv->y_align;
}
/**
* st_bin_set_fill:
* @bin: a #StBin

View File

@ -47,12 +47,6 @@ StWidget * st_bin_new (void);
void st_bin_set_child (StBin *bin,
ClutterActor *child);
ClutterActor *st_bin_get_child (StBin *bin);
void st_bin_set_alignment (StBin *bin,
StAlign x_align,
StAlign y_align);
void st_bin_get_alignment (StBin *bin,
StAlign *x_align,
StAlign *y_align);
void st_bin_set_fill (StBin *bin,
gboolean x_fill,
gboolean y_fill);