Index: src_plugins/lib_gtk_config/gui-config.c =================================================================== --- src_plugins/lib_gtk_config/gui-config.c (revision 8114) +++ src_plugins/lib_gtk_config/gui-config.c (revision 8115) @@ -2778,3 +2778,49 @@ config_window = NULL; gui_config_treeview = NULL; } + +void pcb_gtk_config_set_cursor(const char *string_path) +{ + gchar **split; + gchar *p; + int i = 0; + gboolean found; + GtkTreeModel *model; + GtkTreeIter parent, *iter; + GtkTreePath *tree_path = NULL; + + model = gtk_tree_view_get_model(gui_config_treeview); + gtk_tree_model_get_iter_first(model, &parent); + + /* Split the path, then search for matched column name */ + split = g_strsplit(string_path, "/", 0); + while (split[i] != NULL) { + found = FALSE; + iter = gtk_tree_iter_copy(&parent); + do { /* Explore hierarchy */ + gtk_tree_model_get(model, iter, CONFIG_NAME_COLUMN, &p, -1); + found = (pcb_strcasecmp(split[i], p) == 0) ? TRUE : FALSE; + if (found) { + if (tree_path != NULL) + gtk_tree_path_free(tree_path); + /* If node has children, go down. Otherwise, keep memory of this node */ + tree_path = gtk_tree_model_get_path(model, iter); + if (gtk_tree_model_iter_children(model, iter, &parent)) { + gtk_tree_path_free(tree_path); + tree_path = gtk_tree_model_get_path(model, iter); + gtk_tree_model_get_iter(model, &parent, tree_path); + } + } + } while (!found && gtk_tree_model_iter_next(model, iter)); + gtk_tree_iter_free(iter); + i++; + } + g_strfreev(split); + + /* Expand and select the path */ + if (tree_path != NULL) { + gtk_tree_view_expand_to_path(gui_config_treeview, tree_path); + gtk_tree_view_set_cursor(gui_config_treeview, tree_path, NULL, FALSE); + gtk_tree_path_free(tree_path); + } +} Index: src_plugins/lib_gtk_config/lib_gtk_config.h =================================================================== --- src_plugins/lib_gtk_config/lib_gtk_config.h (revision 8114) +++ src_plugins/lib_gtk_config/lib_gtk_config.h (revision 8115) @@ -13,6 +13,9 @@ void ghid_config_handle_units_changed(pcb_gtk_common_t *com); +/** Parses \p string_path to expand and select the corresponding path in tree view. */ +void pcb_gtk_config_set_cursor(const char *string_path); + void config_color_button_update(pcb_gtk_common_t *com, conf_native_t *cfg, int idx); void ghid_wgeo_save(int save_to_file, int skip_user); Index: src_plugins/lib_gtk_hid/actions.c =================================================================== --- src_plugins/lib_gtk_hid/actions.c (revision 8114) +++ src_plugins/lib_gtk_hid/actions.c (revision 8115) @@ -100,14 +100,15 @@ static int EditLayerGroups(int argc, const char **argv, pcb_coord_t x, pcb_coord_t y) { + char *s; if (argc != 0) PCB_AFAIL(editlayergroups); -#warning TODO: extend the DoWindows action so it opens the right preferences tab + s = pcb_concat(_("User PoV"), "/", _("Layers"), NULL); + pcb_hid_actionl("DoWindows", "Preferences", "1", s, NULL); + free(s); - pcb_hid_actionl("DoWindows", "Preferences", NULL); - return 0; } @@ -271,6 +272,10 @@ } else if (strcmp(a, "5") == 0 || pcb_strcasecmp(a, "Preferences") == 0) { pcb_gtk_config_window_show(&ghidgui->common, raise); + /* The 3rd argument will be the path (as a text string, not numbers) to select, once dialog is opened */ + if (argc >= 3) { + pcb_gtk_config_set_cursor(argv[2]); + } } else if (strcmp(a, "6") == 0 || pcb_strcasecmp(a, "DRC") == 0) { ghid_drc_window_show(&ghidgui->common, raise);