[gtksourceview] View: don't use gtk_style_context_get_background_color()
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtksourceview] View: don't use gtk_style_context_get_background_color()
- Date: Wed, 4 Mar 2015 16:25:23 +0000 (UTC)
commit ef87baa68cbf610cc6f629a9977b900879dd3725
Author: Sébastien Wilmet <swilmet gnome org>
Date: Wed Mar 4 15:22:55 2015 +0100
View: don't use gtk_style_context_get_background_color()
The function is deprecated. Actually the code was useless, since if the
current line color isn't set, the normal background color is already
drawn.
gtksourceview/gtksourceview.c | 23 +++++------------------
1 files changed, 5 insertions(+), 18 deletions(-)
---
diff --git a/gtksourceview/gtksourceview.c b/gtksourceview/gtksourceview.c
index 88870b1..bf03668 100644
--- a/gtksourceview/gtksourceview.c
+++ b/gtksourceview/gtksourceview.c
@@ -2741,8 +2741,8 @@ gtk_source_view_paint_current_line_highlight (GtkSourceView *view,
{
GtkTextBuffer *buffer;
GtkTextIter cur;
- gint y, height;
- GdkRGBA color;
+ gint y;
+ gint height;
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view));
gtk_text_buffer_get_iter_at_mark (buffer,
@@ -2750,24 +2750,10 @@ gtk_source_view_paint_current_line_highlight (GtkSourceView *view,
gtk_text_buffer_get_insert (buffer));
gtk_text_view_get_line_yrange (GTK_TEXT_VIEW (view), &cur, &y, &height);
- if (view->priv->current_line_color_set)
- {
- color = view->priv->current_line_color;
- }
- else
- {
- GtkStyleContext *context;
- GtkStateFlags state;
-
- context = gtk_widget_get_style_context (GTK_WIDGET (view));
- state = gtk_widget_get_state_flags (GTK_WIDGET (view));
- gtk_style_context_get_background_color (context, state, &color);
- }
-
gtk_source_view_paint_line_background (GTK_TEXT_VIEW (view),
cr,
y, height,
- &color);
+ &view->priv->current_line_color);
}
static void
@@ -2822,7 +2808,8 @@ gtk_source_view_draw_layer (GtkTextView *text_view,
}
if (gtk_widget_is_sensitive (GTK_WIDGET (view)) &&
- view->priv->highlight_current_line)
+ view->priv->highlight_current_line &&
+ view->priv->current_line_color_set)
{
gtk_source_view_paint_current_line_highlight (view, cr);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]