[gnome-shell/wip/carlosg/stylesheet-updates: 12/13] st: Drop StWidget theme overriding API
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/wip/carlosg/stylesheet-updates: 12/13] st: Drop StWidget theme overriding API
- Date: Tue, 5 Nov 2019 11:02:12 +0000 (UTC)
commit 72140373dd6fdfa9a7fb2e62cf5329613dd9b39d
Author: Carlos Garnacho <carlosg gnome org>
Date: Tue Nov 5 11:45:36 2019 +0100
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
src/st/st-theme.h | 3 +--
src/st/st-widget.c | 72 +-----------------------------------------------------
src/st/st-widget.h | 4 ---
3 files changed, 2 insertions(+), 77 deletions(-)
---
diff --git a/src/st/st-theme.h b/src/st/st-theme.h
index 6cee089a16..d3f242c2d2 100644
--- a/src/st/st-theme.h
+++ b/src/st/st-theme.h
@@ -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 ())
diff --git a/src/st/st-widget.c b/src/st/st-widget.c
index 586954b468..fd0f19b224 100644
--- a/src/st/st-widget.c
+++ b/src/st/st-widget.c
@@ -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)
diff --git a/src/st/st-widget.h b/src/st/st-widget.h
index 2f593e3d34..9b6efd559d 100644
--- a/src/st/st-widget.h
+++ b/src/st/st-widget.h
@@ -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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]