Permalink
Browse files

find out which row in a tree view is currently selected

  • Loading branch information...
1 parent 7600e41 commit 41fd636ea99921232fe41abc1010f2dfa7516ee5 @OlafMerkert committed Oct 3, 2012
Showing with 9 additions and 1 deletion.
  1. +2 −1 packages.lisp
  2. +7 −0 stores-and-views.lisp
View
@@ -17,4 +17,5 @@
:define-custom-store
:make-store
:setup-tree-view
- :add-tree-view-column))
+ :add-tree-view-column
+ :tree-view-selected-row))
View
@@ -82,3 +82,10 @@ entries, and signals for the insertion of all the new entries."
(tree-view-column-pack-start column renderer)
(tree-view-column-add-attribute column renderer "text" col-index)
(tree-view-append-column view column)))
+
+(defun tree-view-selected-row (view)
+ "Return the selected row index from tree-view, which presents a
+list-store."
+ (let ((row-paths (tree-selection-selected-rows (tree-view-selection view))))
+ (when row-paths
+ (first (tree-path-indices (first row-paths))))))

0 comments on commit 41fd636

Please sign in to comment.