st: Drop StWidget theme overriding API

A StWidget could get its style from a) a theme set in the StThemeContext,
and b) directly through it's ::theme property. Generally, overriding CSS
through the latter cannot be recommended as it loses any connection with
the global theme (eg. the ones you get through selector specificity).

It sounds a bit too powerful and pervasive, there's no use for it in
gnome-shell and doesn't look like something that could be recommended on
extensions. So, just drop this piece of API.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/779
This commit is contained in:
Carlos Garnacho 2019-11-05 11:45:36 +01:00 committed by Florian Müllner
parent 28c535e341
commit 55867c40c4
3 changed files with 2 additions and 77 deletions

View File

@ -32,8 +32,7 @@ G_BEGIN_DECLS
*
* #StTheme holds a set of stylesheets. (The "cascade" of the name
* Cascading Stylesheets.) A #StTheme can be set to apply to all the actors
* in a stage using st_theme_context_set_theme() or applied to a subtree
* of actors using st_widget_set_theme().
* in a stage using st_theme_context_set_theme().
*/
#define ST_TYPE_THEME (st_theme_get_type ())

View File

@ -57,7 +57,6 @@
typedef struct _StWidgetPrivate StWidgetPrivate;
struct _StWidgetPrivate
{
StTheme *theme;
StThemeNode *theme_node;
gchar *pseudo_class;
gchar *style_class;
@ -106,7 +105,6 @@ enum
{
PROP_0,
PROP_THEME,
PROP_PSEUDO_CLASS,
PROP_STYLE_CLASS,
PROP_STYLE,
@ -154,10 +152,6 @@ st_widget_set_property (GObject *gobject,
switch (prop_id)
{
case PROP_THEME:
st_widget_set_theme (actor, g_value_get_object (value));
break;
case PROP_PSEUDO_CLASS:
st_widget_set_style_pseudo_class (actor, g_value_get_string (value));
break;
@ -211,10 +205,6 @@ st_widget_get_property (GObject *gobject,
switch (prop_id)
{
case PROP_THEME:
g_value_set_object (value, priv->theme);
break;
case PROP_PSEUDO_CLASS:
g_value_set_string (value, priv->pseudo_class);
break;
@ -312,7 +302,6 @@ st_widget_dispose (GObject *gobject)
StWidget *actor = ST_WIDGET (gobject);
StWidgetPrivate *priv = st_widget_get_instance_private (actor);
g_clear_pointer (&priv->theme, g_object_unref);
g_clear_pointer (&priv->theme_node, g_object_unref);
st_widget_remove_transition (actor);
@ -639,7 +628,7 @@ st_widget_get_theme_node (StWidget *widget)
pseudo_class = direction_pseudo_class;
context = st_theme_context_get_for_stage (stage);
tmp_node = st_theme_node_new (context, parent_node, priv->theme,
tmp_node = st_theme_node_new (context, parent_node, NULL,
G_OBJECT_TYPE (widget),
clutter_actor_get_name (CLUTTER_ACTOR (widget)),
priv->style_class,
@ -902,19 +891,6 @@ st_widget_class_init (StWidgetClass *klass)
"",
ST_PARAM_READWRITE);
/**
* StWidget:theme:
*
* A theme set on this actor overriding the global theming for this actor
* and its descendants
*/
props[PROP_THEME] =
g_param_spec_object ("theme",
"Theme",
"Theme override",
ST_TYPE_THEME,
ST_PARAM_READWRITE);
/**
* StWidget:track-hover:
*
@ -1042,52 +1018,6 @@ st_widget_class_init (StWidgetClass *klass)
G_TYPE_NONE, 0);
}
/**
* st_widget_set_theme:
* @actor: a #StWidget
* @theme: a new style class string
*
* Overrides the theme that would be inherited from the actor's parent
* or the stage with an entirely new theme (set of stylesheets).
*/
void
st_widget_set_theme (StWidget *actor,
StTheme *theme)
{
StWidgetPrivate *priv;
g_return_if_fail (ST_IS_WIDGET (actor));
priv = st_widget_get_instance_private (actor);
if (theme != priv->theme)
{
if (priv->theme)
g_object_unref (priv->theme);
priv->theme = g_object_ref (theme);
st_widget_style_changed (actor);
g_object_notify_by_pspec (G_OBJECT (actor), props[PROP_THEME]);
}
}
/**
* st_widget_get_theme:
* @actor: a #StWidget
*
* Gets the overriding theme set on the actor. See st_widget_set_theme()
*
* Return value: (transfer none): the overriding theme, or %NULL
*/
StTheme *
st_widget_get_theme (StWidget *actor)
{
g_return_val_if_fail (ST_IS_WIDGET (actor), NULL);
return ST_WIDGET_PRIVATE (actor)->theme;
}
static const gchar *
find_class_name (const gchar *class_list,
const gchar *class_name)

View File

@ -104,10 +104,6 @@ gboolean st_widget_has_style_class_name (StWidget *acto
void st_widget_set_style (StWidget *actor,
const gchar *style);
const gchar * st_widget_get_style (StWidget *actor);
void st_widget_set_theme (StWidget *actor,
StTheme *theme);
StTheme * st_widget_get_theme (StWidget *actor);
void st_widget_set_track_hover (StWidget *widget,
gboolean track_hover);
gboolean st_widget_get_track_hover (StWidget *widget);