[glade/glade-3-14] Removed use of custon style providers. Fixes color problems in adwaita themes
- From: Juan Pablo Ugarte <jpu src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glade/glade-3-14] Removed use of custon style providers. Fixes color problems in adwaita themes
- Date: Sun, 14 Oct 2012 23:55:49 +0000 (UTC)
commit d302435ff5993e43ca303329d2a45f5972cba8a6
Author: Juan Pablo Ugarte <juanpablougarte gmail com>
Date: Sun Oct 7 16:31:48 2012 -0300
Removed use of custon style providers. Fixes color problems in adwaita themes
gladeui/glade-design-layout.c | 26 +++++++++++---------------
gladeui/glade-design-view.c | 12 ++----------
gladeui/glade-utils.c | 14 +++++++-------
3 files changed, 20 insertions(+), 32 deletions(-)
---
diff --git a/gladeui/glade-design-layout.c b/gladeui/glade-design-layout.c
index 01008c1..36ab923 100644
--- a/gladeui/glade-design-layout.c
+++ b/gladeui/glade-design-layout.c
@@ -1713,11 +1713,15 @@ glade_design_layout_style_updated (GtkWidget *widget)
GladeDesignLayoutPrivate *priv = GLADE_DESIGN_LAYOUT_GET_PRIVATE (widget);
GtkStyleContext *context = gtk_widget_get_style_context (widget);
- gtk_style_context_lookup_color (context, "fg_color", &priv->fg_color);
- gtk_style_context_lookup_color (context, "bg_color", &priv->frame_color[0]);
- gtk_style_context_lookup_color (context, "selected_bg_color", &priv->frame_color_active[0]);
- gtk_style_context_lookup_color (context, "selected_fg_color", &priv->frame_color_active[1]);
-
+ gtk_style_context_get_color (context, GTK_STATE_FLAG_NORMAL,
+ &priv->fg_color);
+ gtk_style_context_get_background_color (context, GTK_STATE_FLAG_NORMAL,
+ &priv->frame_color[0]);
+ gtk_style_context_get_background_color (context, GTK_STATE_FLAG_SELECTED,
+ &priv->frame_color_active[0]);
+ gtk_style_context_get_color (context, GTK_STATE_FLAG_SELECTED,
+ &priv->frame_color_active[1]);
+
priv->frame_color[1] = priv->fg_color;
/* Make border darker */
priv->frame_color[0].red -= .1;
@@ -1729,7 +1733,6 @@ static void
glade_design_layout_init (GladeDesignLayout *layout)
{
GladeDesignLayoutPrivate *priv;
- GtkCssProvider *provider;
gint i;
layout->priv = priv = GLADE_DESIGN_LAYOUT_GET_PRIVATE (layout);
@@ -1748,15 +1751,8 @@ glade_design_layout_init (GladeDesignLayout *layout)
gtk_widget_set_has_window (GTK_WIDGET (layout), TRUE);
- provider = gtk_css_provider_new ();
- gtk_css_provider_load_from_data (provider,
- "GladeDesignLayout {\n"
- " background-color : @base_color;\n"
- " }", -1, NULL);
-
- gtk_style_context_add_provider (gtk_widget_get_style_context (GTK_WIDGET (layout)),
- GTK_STYLE_PROVIDER (provider),
- GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
+ gtk_style_context_add_class (gtk_widget_get_style_context (GTK_WIDGET (layout)),
+ GTK_STYLE_CLASS_VIEW);
}
static void
diff --git a/gladeui/glade-design-view.c b/gladeui/glade-design-view.c
index 6795779..ef68f58 100644
--- a/gladeui/glade-design-view.c
+++ b/gladeui/glade-design-view.c
@@ -295,7 +295,6 @@ glade_design_view_draw (GtkWidget *widget, cairo_t *cr)
static void
glade_design_view_init (GladeDesignView *view)
{
- GtkCssProvider *provider;
GtkWidget *viewport;
view->priv = GLADE_DESIGN_VIEW_GET_PRIVATE (view);
@@ -329,15 +328,8 @@ glade_design_view_init (GladeDesignView *view)
gtk_container_set_border_width (GTK_CONTAINER (view), 0);
- provider = gtk_css_provider_new ();
- gtk_css_provider_load_from_data (provider,
- "GtkViewport {\n"
- " background-color : @base_color;\n"
- " }", -1, NULL);
-
- gtk_style_context_add_provider (gtk_widget_get_style_context (GTK_WIDGET (viewport)),
- GTK_STYLE_PROVIDER (provider),
- GTK_STYLE_PROVIDER_PRIORITY_FALLBACK);
+ gtk_style_context_add_class (gtk_widget_get_style_context (GTK_WIDGET (view)),
+ GTK_STYLE_CLASS_VIEW);
}
static void
diff --git a/gladeui/glade-utils.c b/gladeui/glade-utils.c
index 6de3ca6..aba454a 100644
--- a/gladeui/glade-utils.c
+++ b/gladeui/glade-utils.c
@@ -1787,7 +1787,7 @@ GdkPixbuf *
glade_utils_pointer_mode_render_icon (GladePointerMode mode, GtkIconSize size)
{
GtkStyleContext *ctx = gtk_style_context_new ();
- GdkRGBA c1, c2, c3, fg, bg;
+ GdkRGBA c1, c2, fg, bg;
cairo_surface_t *surface;
GtkWidgetPath *path;
gint width, height;
@@ -1804,15 +1804,15 @@ glade_utils_pointer_mode_render_icon (GladePointerMode mode, GtkIconSize size)
path = gtk_widget_path_new ();
gtk_widget_path_append_type (path, GTK_TYPE_WIDGET);
gtk_style_context_set_path (ctx, path);
+ gtk_style_context_add_class (ctx, GTK_STYLE_CLASS_VIEW);
gtk_widget_path_free (path);
/* Now get colors */
- gtk_style_context_lookup_color (ctx, "fg_color", &fg);
- gtk_style_context_lookup_color (ctx, "bg_color", &bg);
- gtk_style_context_lookup_color (ctx, "selected_bg_color", &c1);
- gtk_style_context_lookup_color (ctx, "selected_fg_color", &c2);
- gtk_style_context_lookup_color (ctx, "base_color", &c3);
-
+ gtk_style_context_get_color (ctx, GTK_STATE_FLAG_NORMAL,&fg);
+ gtk_style_context_get_background_color (ctx, GTK_STATE_FLAG_NORMAL,&bg);
+ gtk_style_context_get_background_color (ctx, GTK_STATE_FLAG_SELECTED,&c1);
+ gtk_style_context_get_color (ctx, GTK_STATE_FLAG_SELECTED,&c2);
+
g_object_unref (ctx);
/* Clear surface */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]