[geany/geany-plugins] f1ad8a: projectorganizer: re-read base path when updating project
Jiří Techet
git-noreply at xxxxx
Sun Oct 6 08:02:20 UTC 2019
Branch: refs/heads/master
Author: Jiří Techet <techet at gmail.com>
Committer: Jiří Techet <techet at gmail.com>
Date: Sun, 06 Oct 2019 08:02:20 UTC
Commit: f1ad8a3e2b765515ad8c19aa995cab50984cbe04
https://github.com/geany/geany-plugins/commit/f1ad8a3e2b765515ad8c19aa995cab50984cbe04
Log Message:
-----------
projectorganizer: re-read base path when updating project
Since the base path can change when the project dialog is open, we must
re-read the base path, otherwise it doesn't get updated.
Modified Paths:
--------------
projectorganizer/src/prjorg-project.c
Modified: projectorganizer/src/prjorg-project.c
27 lines changed, 18 insertions(+), 9 deletions(-)
===================================================================
@@ -327,13 +327,24 @@ void prjorg_project_rescan(void)
}
+static PrjOrgRoot *create_root(const gchar *utf8_base_dir)
+{
+ PrjOrgRoot *root = (PrjOrgRoot *) g_new0(PrjOrgRoot, 1);
+ root->base_dir = g_strdup(utf8_base_dir);
+ root->file_table = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, (GFreeFunc)tm_source_file_free);
+ return root;
+}
+
+
static void update_project(
gchar **source_patterns,
gchar **header_patterns,
gchar **ignored_dirs_patterns,
gchar **ignored_file_patterns,
PrjOrgTagPrefs generate_tag_prefs)
{
+ gchar *utf8_base_path;
+
if (prj_org->source_patterns)
g_strfreev(prj_org->source_patterns);
prj_org->source_patterns = g_strdupv(source_patterns);
@@ -352,6 +363,13 @@ static void update_project(
prj_org->generate_tag_prefs = generate_tag_prefs;
+ /* re-read the base path in case it was changed in project settings */
+ g_free(prj_org->roots->data);
+ prj_org->roots = g_slist_delete_link(prj_org->roots, prj_org->roots);
+ utf8_base_path = get_project_base_path();
+ prj_org->roots = g_slist_prepend(prj_org->roots, create_root(utf8_base_path));
+ g_free(utf8_base_path);
+
prjorg_project_rescan();
}
@@ -386,15 +404,6 @@ void prjorg_project_save(GKeyFile * key_file)
}
-static PrjOrgRoot *create_root(const gchar *utf8_base_dir)
-{
- PrjOrgRoot *root = (PrjOrgRoot *) g_new0(PrjOrgRoot, 1);
- root->base_dir = g_strdup(utf8_base_dir);
- root->file_table = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, (GFreeFunc)tm_source_file_free);
- return root;
-}
-
-
static void close_root(PrjOrgRoot *root, gpointer user_data)
{
GPtrArray *source_files;
--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).
More information about the Plugins-Commits
mailing list