Commit 78eeae1a authored by Juan Pablo Ugarte's avatar Juan Pablo Ugarte
Browse files

Removed use of custon style providers. Fixes color problems in adwaita themes

parent f51f60bf
......@@ -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
......
......@@ -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
......
......@@ -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 */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment