[gtk+/gtk-3-2] treeview: use gtk_tree_view_ensure_background() consistently
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/gtk-3-2] treeview: use gtk_tree_view_ensure_background() consistently
- Date: Wed, 16 Nov 2011 21:11:45 +0000 (UTC)
commit 722517dacb7e888117ca44031ef580a245c0627a
Author: Cosimo Cecchi <cosimoc gnome org>
Date: Wed Nov 16 16:01:36 2011 -0500
treeview: use gtk_tree_view_ensure_background() consistently
In gtk_tree_view_state_flags_changed() we were setting the background on
the bin_window without the necessary "view" style class, making the
treeview render with the wrong color in some circumstances (such as when
adding an empty treeview in a window, as spotted by Brian Smith).
gtk/gtktreeview.c | 29 +++--------------------------
1 files changed, 3 insertions(+), 26 deletions(-)
---
diff --git a/gtk/gtktreeview.c b/gtk/gtktreeview.c
index adf1106..7d84651 100644
--- a/gtk/gtktreeview.c
+++ b/gtk/gtktreeview.c
@@ -2198,7 +2198,6 @@ static void
gtk_tree_view_realize (GtkWidget *widget)
{
GtkAllocation allocation;
- GtkStyleContext *context;
GtkTreeView *tree_view = GTK_TREE_VIEW (widget);
GdkWindow *window;
GdkWindowAttr attributes;
@@ -2267,14 +2266,7 @@ gtk_tree_view_realize (GtkWidget *widget)
&attributes, attributes_mask);
gdk_window_set_user_data (tree_view->priv->header_window, widget);
- context = gtk_widget_get_style_context (widget);
-
- gtk_style_context_save (context);
- gtk_style_context_add_class (context, GTK_STYLE_CLASS_VIEW);
- gtk_style_context_set_background (context, tree_view->priv->bin_window);
- gtk_style_context_restore (context);
-
- gtk_style_context_set_background (context, tree_view->priv->header_window);
+ gtk_tree_view_ensure_background (tree_view);
tmp_list = tree_view->priv->children;
while (tmp_list)
@@ -8460,16 +8452,7 @@ gtk_tree_view_style_updated (GtkWidget *widget)
if (gtk_widget_get_realized (widget))
{
- GtkStyleContext *context;
-
- context = gtk_widget_get_style_context (widget);
-
- gtk_style_context_save (context);
- gtk_style_context_add_class (context, GTK_STYLE_CLASS_VIEW);
- gtk_style_context_set_background (context, tree_view->priv->bin_window);
- gtk_style_context_restore (context);
-
- gtk_style_context_set_background (context, tree_view->priv->header_window);
+ gtk_tree_view_ensure_background (tree_view);
gtk_tree_view_set_grid_lines (tree_view, tree_view->priv->grid_lines);
gtk_tree_view_set_enable_tree_lines (tree_view, tree_view->priv->tree_lines_enabled);
@@ -15840,13 +15823,7 @@ gtk_tree_view_state_flags_changed (GtkWidget *widget,
GtkStateFlags previous_state)
{
if (gtk_widget_get_realized (widget))
- {
- GtkTreeView *tree_view = GTK_TREE_VIEW (widget);
- GtkStyleContext *context;
-
- context = gtk_widget_get_style_context (widget);
- gtk_style_context_set_background (context, tree_view->priv->bin_window);
- }
+ gtk_tree_view_ensure_background (GTK_TREE_VIEW (widget));
gtk_widget_queue_draw (widget);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]