launchbar: expand/collapse tree row at mouse wheel click
authorGiuseppe Penone <giuspen@gmail.com>
Sat, 1 Sep 2012 13:27:07 +0000 (15:27 +0200)
committerAndriy Grytsenko <andrej@rep.kiev.ua>
Mon, 26 Nov 2012 21:11:05 +0000 (23:11 +0200)
src/plugins/launchbar.c

index b992caa..22470f8 100644 (file)
@@ -157,6 +157,21 @@ static gboolean on_menu_view_button_press_event(GtkWidget *p_widget, GdkEventBut
             gtk_button_clicked(GTK_BUTTON(lb->p_button_add));
         }
     }
+    else if(p_event->button == 2)
+    {
+        GtkTreePath  *p_tree_path;
+        if(gtk_tree_view_get_path_at_pos(GTK_TREE_VIEW(p_widget),
+                                         p_event->x, p_event->y,
+                                         &p_tree_path,
+                                         NULL, NULL, NULL))
+        {
+            if(gtk_tree_view_row_expanded(GTK_TREE_VIEW(p_widget), p_tree_path))
+                gtk_tree_view_collapse_row(GTK_TREE_VIEW(p_widget), p_tree_path);
+            else
+                gtk_tree_view_expand_row(GTK_TREE_VIEW(p_widget), p_tree_path, FALSE);
+            gtk_tree_path_free(p_tree_path);
+        }
+    }
     return FALSE;
 }