forked from AuroraMiddleware/gtk
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).
This commit is contained in:
parent
8d97d8ca3c
commit
9986b26c0b
@ -2199,7 +2199,6 @@ static void
|
||||
gtk_tree_view_realize (GtkWidget *widget)
|
||||
{
|
||||
GtkAllocation allocation;
|
||||
GtkStyleContext *context;
|
||||
GtkTreeView *tree_view = GTK_TREE_VIEW (widget);
|
||||
GdkWindow *window;
|
||||
GdkWindowAttr attributes;
|
||||
@ -2268,14 +2267,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)
|
||||
@ -8479,16 +8471,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);
|
||||
@ -15922,13 +15905,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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user