[gtksourceview] Revert "Completion: don't use gtk_style_context_get_background_color()"



commit 992733aed774596119429541862fc5aa0ebb9a28
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Sun Feb 8 18:09:39 2015 +0100

    Revert "Completion: don't use gtk_style_context_get_background_color()"
    
    This reverts commit 5b4d2bbf331b66981ac1b2594ab89e7c89987c89.
    
    Maybe other GTK+ themes than Adwaita have a background color. We cannot
    assume that the background color is the same for the normal and
    insensitive states.

 gtksourceview/gtksourcecompletion.c |   21 +++++++++++++++++++--
 1 files changed, 19 insertions(+), 2 deletions(-)
---
diff --git a/gtksourceview/gtksourcecompletion.c b/gtksourceview/gtksourcecompletion.c
index bd71245..6738b0b 100644
--- a/gtksourceview/gtksourcecompletion.c
+++ b/gtksourceview/gtksourcecompletion.c
@@ -1957,6 +1957,7 @@ 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"));
@@ -1993,8 +1994,18 @@ 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);
@@ -2008,17 +2019,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 */
@@ -2027,8 +2038,14 @@ 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]