st: Use consistent type for properties/getters
gjs now optimizes property accesses if possible, by calling the corresponding getter/setter method. For this to work, the method not only has to exist (obviously), but also match the type of the corresponding property. Both `Label` and `Entry` currently define their `clutter-text` property as `Clutter.Text`, while the corresponding getter returns the more generic `Clutter.Actor`. Fix that so that both property and getter use the more specific type. Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3620>
This commit is contained in:
parent
f79e5ad42b
commit
73928c9b29
@ -1165,12 +1165,16 @@ st_entry_set_text (StEntry *entry,
|
||||
*
|
||||
* Returns: (transfer none): the #ClutterText used by @entry
|
||||
*/
|
||||
ClutterActor*
|
||||
ClutterText *
|
||||
st_entry_get_clutter_text (StEntry *entry)
|
||||
{
|
||||
StEntryPrivate *priv;
|
||||
|
||||
g_return_val_if_fail (ST_ENTRY (entry), NULL);
|
||||
|
||||
return ((StEntryPrivate *)ST_ENTRY_PRIV (entry))->entry;
|
||||
priv = st_entry_get_instance_private (entry);
|
||||
|
||||
return CLUTTER_TEXT (priv->entry);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -43,7 +43,7 @@ StWidget *st_entry_new (const gchar *text);
|
||||
const gchar *st_entry_get_text (StEntry *entry);
|
||||
void st_entry_set_text (StEntry *entry,
|
||||
const gchar *text);
|
||||
ClutterActor *st_entry_get_clutter_text (StEntry *entry);
|
||||
ClutterText *st_entry_get_clutter_text (StEntry *entry);
|
||||
|
||||
void st_entry_set_hint_text (StEntry *entry,
|
||||
const gchar *text);
|
||||
|
@ -429,12 +429,12 @@ st_label_set_text (StLabel *label,
|
||||
* Returns: (transfer none): the #ClutterText used by #StLabel. The actor
|
||||
* is owned by the #StLabel and should not be destroyed by the application.
|
||||
*/
|
||||
ClutterActor*
|
||||
ClutterText *
|
||||
st_label_get_clutter_text (StLabel *label)
|
||||
{
|
||||
g_return_val_if_fail (ST_LABEL (label), NULL);
|
||||
|
||||
return label->priv->label;
|
||||
return CLUTTER_TEXT (label->priv->label);
|
||||
}
|
||||
|
||||
|
||||
|
@ -44,7 +44,7 @@ StWidget * st_label_new (const gchar *text);
|
||||
const gchar * st_label_get_text (StLabel *label);
|
||||
void st_label_set_text (StLabel *label,
|
||||
const gchar *text);
|
||||
ClutterActor * st_label_get_clutter_text (StLabel *label);
|
||||
ClutterText * st_label_get_clutter_text (StLabel *label);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
@ -205,10 +205,10 @@ clutter_text_password_char_cb (GObject *object,
|
||||
gpointer user_data)
|
||||
{
|
||||
StPasswordEntry *entry = ST_PASSWORD_ENTRY (user_data);
|
||||
ClutterActor *clutter_text;
|
||||
ClutterText *clutter_text;
|
||||
|
||||
clutter_text = st_entry_get_clutter_text (ST_ENTRY (entry));
|
||||
if (clutter_text_get_password_char (CLUTTER_TEXT (clutter_text)) == 0)
|
||||
if (clutter_text_get_password_char (clutter_text) == 0)
|
||||
st_password_entry_set_password_visible (entry, TRUE);
|
||||
else
|
||||
st_password_entry_set_password_visible (entry, FALSE);
|
||||
@ -218,7 +218,7 @@ static void
|
||||
st_password_entry_init (StPasswordEntry *entry)
|
||||
{
|
||||
StPasswordEntryPrivate *priv = ST_PASSWORD_ENTRY_PRIV (entry);
|
||||
ClutterActor *clutter_text;
|
||||
ClutterText *clutter_text;
|
||||
|
||||
priv->peek_password_icon = g_object_new (ST_TYPE_ICON,
|
||||
"style-class", "peek-password",
|
||||
@ -235,7 +235,7 @@ st_password_entry_init (StPasswordEntry *entry)
|
||||
0);
|
||||
|
||||
clutter_text = st_entry_get_clutter_text (ST_ENTRY (entry));
|
||||
clutter_text_set_password_char (CLUTTER_TEXT (clutter_text), BLACK_CIRCLE);
|
||||
clutter_text_set_password_char (clutter_text, BLACK_CIRCLE);
|
||||
|
||||
st_entry_set_input_purpose (ST_ENTRY (entry), CLUTTER_INPUT_CONTENT_PURPOSE_PASSWORD);
|
||||
|
||||
@ -316,7 +316,7 @@ st_password_entry_set_password_visible (StPasswordEntry *entry,
|
||||
gboolean value)
|
||||
{
|
||||
StPasswordEntryPrivate *priv;
|
||||
ClutterActor *clutter_text;
|
||||
ClutterText *clutter_text;
|
||||
|
||||
g_return_if_fail (ST_IS_PASSWORD_ENTRY (entry));
|
||||
|
||||
@ -329,12 +329,12 @@ st_password_entry_set_password_visible (StPasswordEntry *entry,
|
||||
clutter_text = st_entry_get_clutter_text (ST_ENTRY (entry));
|
||||
if (priv->password_visible)
|
||||
{
|
||||
clutter_text_set_password_char (CLUTTER_TEXT (clutter_text), 0);
|
||||
clutter_text_set_password_char (clutter_text, 0);
|
||||
st_icon_set_icon_name (ST_ICON (priv->peek_password_icon), "view-conceal-symbolic");
|
||||
}
|
||||
else
|
||||
{
|
||||
clutter_text_set_password_char (CLUTTER_TEXT (clutter_text), BLACK_CIRCLE);
|
||||
clutter_text_set_password_char (clutter_text, BLACK_CIRCLE);
|
||||
st_icon_set_icon_name (ST_ICON (priv->peek_password_icon), "view-reveal-symbolic");
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user