[gtk+/wip/otte/gadget: 1/18] treeview: Reposition dnd button css node properly



commit 4ed0cfa869adc9580112e43ee943282a64af455c
Author: Benjamin Otte <otte redhat com>
Date:   Wed Dec 9 18:20:06 2015 +0100

    treeview: Reposition dnd button css node properly
    
    After the drag ends, the button node went to the wrong place and then
    looked like a regular button. Fix that.

 gtk/gtktreeview.c |   33 +++++++++++++++++----------------
 1 files changed, 17 insertions(+), 16 deletions(-)
---
diff --git a/gtk/gtktreeview.c b/gtk/gtktreeview.c
index c14a4fb..afac61f 100644
--- a/gtk/gtktreeview.c
+++ b/gtk/gtktreeview.c
@@ -3482,6 +3482,22 @@ gtk_tree_view_column_drag_gesture_begin (GtkGestureDrag *gesture,
     }
 }
 
+static void
+gtk_tree_view_update_button_position (GtkTreeView       *tree_view,
+                                      GtkTreeViewColumn *column)
+{
+  GtkTreeViewPrivate *priv = tree_view->priv;
+  GList *column_el;
+
+  column_el = g_list_find (priv->columns, column);
+  g_return_if_fail (column_el != NULL);
+
+  gtk_css_node_insert_after (priv->header_node,
+                             gtk_widget_get_css_node (gtk_tree_view_column_get_button (column)),
+                             column_el->prev ? gtk_widget_get_css_node (
+                                gtk_tree_view_column_get_button (column_el->prev->data)) : NULL);
+}
+
 /* column drag gesture helper */
 static gboolean
 gtk_tree_view_button_release_drag_column (GtkTreeView *tree_view)
@@ -3502,6 +3518,7 @@ gtk_tree_view_button_release_drag_column (GtkTreeView *tree_view)
   g_object_ref (button);
   gtk_container_remove (GTK_CONTAINER (tree_view), button);
   gtk_widget_set_parent_window (button, tree_view->priv->header_window);
+  gtk_tree_view_update_button_position (tree_view, tree_view->priv->drag_column);
   gtk_widget_set_parent (button, GTK_WIDGET (tree_view));
   g_object_unref (button);
   gtk_widget_queue_resize (widget);
@@ -12028,22 +12045,6 @@ gtk_tree_view_remove_column (GtkTreeView       *tree_view,
   return tree_view->priv->n_columns;
 }
 
-static void
-gtk_tree_view_update_button_position (GtkTreeView       *tree_view,
-                                      GtkTreeViewColumn *column)
-{
-  GtkTreeViewPrivate *priv = tree_view->priv;
-  GList *column_el;
-
-  column_el = g_list_find (priv->columns, column);
-  g_return_if_fail (column_el != NULL);
-
-  gtk_css_node_insert_after (priv->header_node,
-                             gtk_widget_get_css_node (gtk_tree_view_column_get_button (column)),
-                             column_el->prev ? gtk_widget_get_css_node (
-                                gtk_tree_view_column_get_button (column_el->prev->data)) : NULL);
-}
-
 /**
  * gtk_tree_view_insert_column:
  * @tree_view: A #GtkTreeView.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]