[gtksourceview] Completion: 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] Completion: don't use gtk_style_context_get_background_color()
- Date: Sat, 29 Nov 2014 12:54:36 +0000 (UTC)
commit 5b4d2bbf331b66981ac1b2594ab89e7c89987c89
Author: Sébastien Wilmet <swilmet gnome org>
Date: Sat Nov 29 13:40:48 2014 +0100
Completion: don't use gtk_style_context_get_background_color()
The function is deprecated.
With Adwaita the background color was anyway white, so it had no
effects. With some early GTK+ 3 versions the background color was a
little different, see for example this screenshot:
http://blogs.gnome.org/swilmet/files/2013/03/completion_calltip_before.png
(see the background color of the header, "LaTeX")
The best would be to write some CSS that we attach to the GtkTreeView,
so we apply the exact style that we want for the headers and
accelerators, but I think CSS is not really supported by GtkTreeView.
Using the GtkCellRenderer:sensitive property almost works, but a detail
is different: the accelerator in the selected row is difficult to see,
since the digit is still gray. For unselected rows the accelerators must
be gray, but for the selected row the accelerator must have a white
foreground color so it's clearly visible with the blue background color
(with Adwaita).
gtksourceview/gtksourcecompletion.c | 21 ++-------------------
1 files changed, 2 insertions(+), 19 deletions(-)
---
diff --git a/gtksourceview/gtksourcecompletion.c b/gtksourceview/gtksourcecompletion.c
index 38b8075..67b0671 100644
--- a/gtksourceview/gtksourcecompletion.c
+++ b/gtksourceview/gtksourcecompletion.c
@@ -1957,7 +1957,6 @@ init_tree_view (GtkSourceCompletion *completion,
GtkTreeViewColumn *column;
GtkCellRenderer *cell_renderer;
GtkStyleContext *style_context;
- GdkRGBA background_color;
GdkRGBA foreground_color;
completion->priv->tree_view_proposals = GTK_TREE_VIEW (gtk_builder_get_object (builder,
"tree_view_proposals"));
@@ -1994,18 +1993,8 @@ init_tree_view (GtkSourceCompletion *completion,
gtk_tree_view_column_set_attributes (column, cell_renderer,
"pixbuf", GTK_SOURCE_COMPLETION_MODEL_COLUMN_ICON,
- "cell-background-set",
GTK_SOURCE_COMPLETION_MODEL_COLUMN_IS_HEADER,
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);
-
- g_object_set (cell_renderer,
- "cell-background-rgba", &background_color,
- NULL);
-
g_object_bind_property (completion, "show-icons",
cell_renderer, "visible",
G_BINDING_SYNC_CREATE);
@@ -2019,17 +2008,17 @@ init_tree_view (GtkSourceCompletion *completion,
gtk_tree_view_column_set_attributes (column, cell_renderer,
"markup", GTK_SOURCE_COMPLETION_MODEL_COLUMN_MARKUP,
- "cell-background-set",
GTK_SOURCE_COMPLETION_MODEL_COLUMN_IS_HEADER,
"foreground-set", GTK_SOURCE_COMPLETION_MODEL_COLUMN_IS_HEADER,
NULL);
+ style_context = gtk_widget_get_style_context (GTK_WIDGET (completion->priv->tree_view_proposals));
+
gtk_style_context_get_color (style_context,
GTK_STATE_FLAG_INSENSITIVE,
&foreground_color);
g_object_set (cell_renderer,
"foreground-rgba", &foreground_color,
- "cell-background-rgba", &background_color,
NULL);
/* Accelerators cell renderer */
@@ -2038,14 +2027,8 @@ init_tree_view (GtkSourceCompletion *completion,
cell_renderer = GTK_CELL_RENDERER (gtk_builder_get_object (builder, "cell_renderer_accelerator"));
- gtk_tree_view_column_set_attributes (column,
- cell_renderer,
- "cell-background-set",
GTK_SOURCE_COMPLETION_MODEL_COLUMN_IS_HEADER,
- NULL);
-
g_object_set (cell_renderer,
"foreground-rgba", &foreground_color,
- "cell-background-rgba", &background_color,
NULL);
gtk_tree_view_column_set_cell_data_func (column,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]