Revision: 1219 http://geany-plugins.svn.sourceforge.net/geany-plugins/?rev=1219&view=re... Author: dimitrov-adrian Date: 2010-03-30 18:14:11 +0000 (Tue, 30 Mar 2010)
Log Message: ----------- Treebrowser, fixed expaned state when create/delete/remove files or directories
Modified Paths: -------------- trunk/geany-plugins/treebrowser/ChangeLog trunk/geany-plugins/treebrowser/src/treebrowser.c
Modified: trunk/geany-plugins/treebrowser/ChangeLog =================================================================== --- trunk/geany-plugins/treebrowser/ChangeLog 2010-03-28 10:31:32 UTC (rev 1218) +++ trunk/geany-plugins/treebrowser/ChangeLog 2010-03-30 18:14:11 UTC (rev 1219) @@ -1,6 +1,13 @@ Development release ChangeLog -----------------------------
+ +30-03-2010 Adrian Dimitrov dimitrov.adrian@gmail.com + + * src/treebrowser.c + fixed expaned state when create/delete/remove files or directories + + 26-03-2010 Adrian Dimitrov dimitrov.adrian@gmail.com
* src/treebrowser.c @@ -112,6 +119,7 @@ * In windows can choice between devices (C:, D:,...) * Windows compitable * Language files + * Saving state of Showbars in config file everytime where is changed (DONE) oneclick document opening (DONE) filter separating ex.: "*.c;*.cpp;*.h" * fix possible memory leaks (using g_free... where is need)
Modified: trunk/geany-plugins/treebrowser/src/treebrowser.c =================================================================== --- trunk/geany-plugins/treebrowser/src/treebrowser.c 2010-03-28 10:31:32 UTC (rev 1218) +++ trunk/geany-plugins/treebrowser/src/treebrowser.c 2010-03-30 18:14:11 UTC (rev 1219) @@ -170,6 +170,7 @@ { GtkTreeIter iter, *last_dir_iter = NULL; gboolean is_dir; + gboolean expanded = FALSE; gchar *utf8_name; GSList *list, *node;
@@ -180,6 +181,9 @@
directory = g_strconcat(directory, G_DIR_SEPARATOR_S, NULL);
+ if (gtk_tree_view_row_expanded(GTK_TREE_VIEW(treeview), gtk_tree_model_get_path(GTK_TREE_MODEL(treestore), parent))) + expanded = TRUE; + gtk_tree_store_iter_clear_nodes(parent, FALSE);
list = utils_get_file_list(directory, NULL, NULL); @@ -230,6 +234,9 @@ } }
+ if (expanded) + gtk_tree_view_expand_row(GTK_TREE_VIEW(treeview), gtk_tree_model_get_path(GTK_TREE_MODEL(treestore), parent), FALSE); + }
static gboolean @@ -350,8 +357,6 @@ for (i = 0; path_segments[i]; i++) { path_search = g_build_filename(path_search, path_segments[i], NULL); - /* dialogs_show_msgbox(GTK_MESSAGE_INFO, "%s", path_search); - */ treebrowser_search(path_search, NULL); return FALSE; } @@ -445,6 +450,7 @@ GtkTreeModel *model; gchar *uri, *uri_new; GtkTreePath *path_parent; + gboolean refresh_root = FALSE;
if (gtk_tree_selection_get_selected(selection, &model, &iter)) { @@ -457,8 +463,15 @@ gtk_tree_model_get_iter(GTK_TREE_MODEL(treestore), &iter, path_parent); } } - else return; + else + { + refresh_root = TRUE; + uri = addressbar_last_address; + path_parent = gtk_tree_path_new_from_string("0"); + gtk_tree_model_get_iter(GTK_TREE_MODEL(treestore), &iter, path_parent);
+ } + if (utils_str_equal(type, "directory")) uri_new = g_strconcat(uri, G_DIR_SEPARATOR_S, _("NewDirectory"), NULL); else @@ -473,12 +486,12 @@ if (utils_str_equal(type, "directory")) { if (g_mkdir(uri_new, 0755) == 0) - treebrowser_browse(uri, &iter, CONFIG_INITIAL_DIR_DEEP); + treebrowser_browse(uri, refresh_root ? NULL : &iter, CONFIG_INITIAL_DIR_DEEP); } else { if (g_creat(uri_new, 0755) != -1) - treebrowser_browse(uri, &iter, CONFIG_INITIAL_DIR_DEEP); + treebrowser_browse(uri, refresh_root ? NULL : &iter, CONFIG_INITIAL_DIR_DEEP); } }
@@ -531,8 +544,10 @@ { fs_remove(uri, TRUE); path_parent = gtk_tree_model_get_path(GTK_TREE_MODEL(treestore), &iter); + if (gtk_tree_path_up(path_parent)) gtk_tree_model_get_iter(GTK_TREE_MODEL(treestore), &iter, path_parent); + treebrowser_browse(g_path_get_dirname(uri), &iter, CONFIG_INITIAL_DIR_DEEP); } } @@ -545,20 +560,13 @@ GtkTreeIter iter; GtkTreeModel *model; gchar *uri; - gboolean expanded = FALSE;
if (gtk_tree_selection_get_selected(selection, &model, &iter)) { gtk_tree_model_get(model, &iter, TREEBROWSER_COLUMN_URI, &uri, -1); if (g_file_test(uri, G_FILE_TEST_IS_DIR)) { - if (gtk_tree_view_row_expanded(GTK_TREE_VIEW(treeview), gtk_tree_model_get_path(GTK_TREE_MODEL(treestore), &iter))) - expanded = TRUE; - treebrowser_browse(uri, &iter, CONFIG_INITIAL_DIR_DEEP); - - if (expanded) - gtk_tree_view_expand_row(GTK_TREE_VIEW(treeview), gtk_tree_model_get_path(GTK_TREE_MODEL(treestore), &iter), FALSE); } } } @@ -731,7 +739,6 @@ GtkTreeIter iter; GtkTreeModel *model; gchar *uri; - gboolean expanded = FALSE;
if (gtk_tree_selection_get_selected(GTK_TREE_SELECTION(widget), &model, &iter)) { @@ -742,14 +749,7 @@ { if (g_file_test(uri, G_FILE_TEST_IS_DIR)) { - if (gtk_tree_view_row_expanded(GTK_TREE_VIEW(treeview), gtk_tree_model_get_path(GTK_TREE_MODEL(treestore), &iter)) - || !gtk_tree_model_iter_has_child(GTK_TREE_MODEL(treestore), &iter)) - expanded = TRUE; - treebrowser_browse(uri, &iter, CONFIG_INITIAL_DIR_DEEP); - - if (expanded) - gtk_tree_view_expand_row(GTK_TREE_VIEW(treeview), gtk_tree_model_get_path(GTK_TREE_MODEL(treestore), &iter), FALSE); } else if (CONFIG_ONE_CLICK_CHDOC)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
plugins-commits@lists.geany.org