[gtksourceview] Don't use gtk_style_context_get_background_color() (deprecated)
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtksourceview] Don't use gtk_style_context_get_background_color() (deprecated)
- Date: Wed, 11 Mar 2015 12:42:32 +0000 (UTC)
commit c465187b3bf2bbb4333fbe7d0c73427aab964d3f
Author: Sébastien Wilmet <swilmet gnome org>
Date: Wed Mar 11 13:26:41 2015 +0100
Don't use gtk_style_context_get_background_color() (deprecated)
The API says to use gtk_render_background() instead, but for the two
cases here it isn't possible.
In GtkSourceCompletion, the background color is applied to a GtkTreeView
cell renderer, which doesn't support CSS.
In GtkSourceStyleScheme, the background color is retrieved to generate
CSS code. AFAIK it isn't possible in CSS to refer to the
background-color value, especially since the background color can be
modified by changing the style scheme, so it isn't always the default
value.
gtksourceview/gtksourcecompletion.c | 8 +++++---
gtksourceview/gtksourcestylescheme.c | 7 ++++---
2 files changed, 9 insertions(+), 6 deletions(-)
---
diff --git a/gtksourceview/gtksourcecompletion.c b/gtksourceview/gtksourcecompletion.c
index 6738b0b..e80d9f8 100644
--- a/gtksourceview/gtksourcecompletion.c
+++ b/gtksourceview/gtksourcecompletion.c
@@ -1998,9 +1998,11 @@ init_tree_view (GtkSourceCompletion *completion,
NULL);
style_context = gtk_widget_get_style_context (GTK_WIDGET (completion->priv->tree_view_proposals));
- gtk_style_context_get_background_color (style_context,
- GTK_STATE_FLAG_INSENSITIVE,
- &background_color);
+
+ gtk_style_context_get (style_context,
+ GTK_STATE_FLAG_INSENSITIVE,
+ "background-color", &background_color,
+ NULL);
g_object_set (cell_renderer,
"cell-background-rgba", &background_color,
diff --git a/gtksourceview/gtksourcestylescheme.c b/gtksourceview/gtksourcestylescheme.c
index 5610a5f..71813aa 100644
--- a/gtksourceview/gtksourcestylescheme.c
+++ b/gtksourceview/gtksourcestylescheme.c
@@ -655,9 +655,10 @@ get_cursors_css_style (GtkSourceStyleScheme *scheme,
context = gtk_widget_get_style_context (widget);
- gtk_style_context_get_background_color (context,
- GTK_STATE_FLAG_NORMAL,
- &secondary_color);
+ gtk_style_context_get (context,
+ GTK_STATE_FLAG_NORMAL,
+ "background-color", &secondary_color,
+ NULL);
/* shade the secondary cursor */
secondary_color.red *= 0.5;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]