aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar mitchell <70453897+667e-11@users.noreply.github.com>2009-02-14 18:52:42 -0500
committerGravatar mitchell <70453897+667e-11@users.noreply.github.com>2009-02-14 18:52:42 -0500
commit24bc238e3d80a5a7eaf74a6199e3e71754e12f04 (patch)
tree99cac9ad4013dd0ec4a0eb438316d0d30d00c950 /src
parentdcd7413d5ef4ab03ed7f748108247e3542381f9d (diff)
Multi-depth PM cursor expands parent rows (if possible); src/lua_interface.c
Diffstat (limited to 'src')
-rw-r--r--src/lua_interface.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/lua_interface.c b/src/lua_interface.c
index 46e6ad5a..86b3150f 100644
--- a/src/lua_interface.c
+++ b/src/lua_interface.c
@@ -1272,9 +1272,19 @@ static int l_pm_mt_newindex(lua_State *lua) {
else if (streq(key, "cursor")) {
GtkTreePath *path = gtk_tree_path_new_from_string(lua_tostring(lua, 3));
luaL_argcheck(lua, path, 3, "bad path");
+ int *indices = gtk_tree_path_get_indices(path);
+ GtkTreePath *ipath = gtk_tree_path_new_from_indices(indices[0], -1);
+ for (int i = 1; i < gtk_tree_path_get_depth(path); i++)
+ if (gtk_tree_view_row_expanded(GTK_TREE_VIEW(pm_view), ipath) ||
+ gtk_tree_view_expand_row(GTK_TREE_VIEW(pm_view), ipath, FALSE))
+ gtk_tree_path_append_index(ipath, indices[i]);
+ else
+ break;
GtkTreeViewColumn *col =
gtk_tree_view_get_column(GTK_TREE_VIEW(pm_view), 0);
- gtk_tree_view_set_cursor(GTK_TREE_VIEW(pm_view), path, col, FALSE);
+ gtk_tree_view_set_cursor(GTK_TREE_VIEW(pm_view), ipath, col, FALSE);
+ gtk_tree_path_free(ipath);
+ gtk_tree_path_free(path);
} else lua_rawset(lua, 1);
return 0;
}