[Xfce4-commits] [xfce/thunar] 01/01: Sidepane treeview: Do not switch folder when clicking a row expander

noreply at xfce.org noreply at xfce.org
Sun Feb 22 23:39:03 CET 2015


This is an automated email from the git hooks/post-receive script.

hjudt pushed a commit to branch master
in repository xfce/thunar.

commit 85ee39fbb0f7753d6a44cb359e5c9e74ae8824bc
Author: Harald Judt <h.judt at gmx.at>
Date:   Sun Feb 22 22:38:27 2015 +0100

    Sidepane treeview: Do not switch folder when clicking a row expander
    
    With the changes introduced in commit f60acf89a1321be0faa37bfb0d91b1757085ffa4
    "Allow <ctrl> + middle click in shortcut and treeview panes", clicking
    the expander also selects the item and thus shows the content in the
    standard view. This commit fixes this and restores the previous behaviour
    for the expanders.
---
 thunar/thunar-tree-view.c |   18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/thunar/thunar-tree-view.c b/thunar/thunar-tree-view.c
index 6ea892a..ae146dd 100644
--- a/thunar/thunar-tree-view.c
+++ b/thunar/thunar-tree-view.c
@@ -688,10 +688,11 @@ static gboolean
 thunar_tree_view_button_press_event (GtkWidget      *widget,
                                      GdkEventButton *event)
 {
-  ThunarTreeView *view = THUNAR_TREE_VIEW (widget);
-  GtkTreePath    *path;
-  GtkTreeIter     iter;
-  gboolean        result;
+  ThunarTreeView    *view = THUNAR_TREE_VIEW (widget);
+  GtkTreeViewColumn *column;
+  GtkTreePath       *path;
+  GtkTreeIter        iter;
+  gboolean           result;
 
   /* reset the pressed button state */
   view->pressed_button = -1;
@@ -704,7 +705,7 @@ thunar_tree_view_button_press_event (GtkWidget      *widget,
   result = (*GTK_WIDGET_CLASS (thunar_tree_view_parent_class)->button_press_event) (widget, event);
 
   /* resolve the path at the cursor position */
-  if (gtk_tree_view_get_path_at_pos (GTK_TREE_VIEW (widget), event->x, event->y, &path, NULL, NULL, NULL))
+  if (gtk_tree_view_get_path_at_pos (GTK_TREE_VIEW (widget), event->x, event->y, &path, &column, NULL, NULL))
     {
       /* check if we should popup the context menu */
       if (G_UNLIKELY (event->button == 3 && event->type == GDK_BUTTON_PRESS))
@@ -722,7 +723,12 @@ thunar_tree_view_button_press_event (GtkWidget      *widget,
       else if ((event->button == 1 || event->button == 2)
                && event->type == GDK_BUTTON_PRESS)
         {
-          gtk_tree_view_set_cursor (GTK_TREE_VIEW (widget), path, NULL, FALSE);
+          GdkRectangle rect;
+          gtk_tree_view_get_cell_area (GTK_TREE_VIEW (widget), path, column, &rect);
+
+          /* set cursor only when the user did not click the expander */
+          if (rect.x <= event->x && event->x <= (rect.x + rect.width))
+              gtk_tree_view_set_cursor (GTK_TREE_VIEW (widget), path, NULL, FALSE);
 
           /* remember the button as pressed and handled it in the release handler */
           view->pressed_button = event->button;

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list