[geany/geany-plugins] 48a871: Make it more clear what's going on with "sentinel"

Jiří Techet git-noreply at xxxxx
Mon Apr 1 01:03:40 UTC 2019


Branch:      refs/heads/master
Author:      Jiří Techet <techet at gmail.com>
Committer:   Jiří Techet <techet at gmail.com>
Date:        Mon, 15 Oct 2018 14:18:13 UTC
Commit:      48a8717d27e76dfc1fc0c0e900950126132a65ac
             https://github.com/geany/geany-plugins/commit/48a8717d27e76dfc1fc0c0e900950126132a65ac

Log Message:
-----------
Make it more clear what's going on with "sentinel"

The "sentinel" entry is a dummy entry for an empty directory - make this
more clear in the code and explicitly disable tag manager attempts to
parse such entries.


Modified Paths:
--------------
    projectorganizer/src/prjorg-project.c
    projectorganizer/src/prjorg-project.h
    projectorganizer/src/prjorg-sidebar.c

Modified: projectorganizer/src/prjorg-project.c
12 lines changed, 8 insertions(+), 4 deletions(-)
===================================================================
@@ -114,11 +114,12 @@ static GSList *get_file_list(const gchar *utf8_path, GSList *patterns,
 
 			if (!patterns_match(ignored_dirs_patterns, utf8_name))
 			{
-				list = g_slist_prepend(list, g_build_path(G_DIR_SEPARATOR_S, utf8_filename, PROJORG_SENTINEL_FILENAME, NULL));
 				lst = get_file_list(utf8_filename, patterns, ignored_dirs_patterns,
 						ignored_file_patterns, visited_paths);
 				if (lst)
 					list = g_slist_concat(list, lst);
+				else
+					list = g_slist_prepend(list, g_build_path(G_DIR_SEPARATOR_S, utf8_filename, PROJORG_DIR_ENTRY, NULL));
 			}
 		}
 		else if (g_file_test(locale_filename, G_FILE_TEST_IS_REGULAR))
@@ -285,16 +286,19 @@ static void regenerate_tags(PrjOrgRoot *root, gpointer user_data)
 	g_hash_table_iter_init(&iter, root->file_table);
 	while (g_hash_table_iter_next(&iter, &key, &value))
 	{
-		TMSourceFile *sf;
+		TMSourceFile *sf = NULL;
 		gchar *utf8_path = key;
 		gchar *locale_path = utils_get_locale_from_utf8(utf8_path);
+		gchar *basename = g_path_get_basename(locale_path);
 
-		sf = tm_source_file_new(locale_path, filetypes_detect(utf8_path)->name);
-		if (sf && !document_find_by_filename(utf8_path))
+		if (g_strcmp0(PROJORG_DIR_ENTRY, basename) != 0)
+			sf = tm_source_file_new(locale_path, filetypes_detect(utf8_path)->name);
+		if (sf && !document_find_by_filename(utf8_path)  )
 			g_ptr_array_add(source_files, sf);
 
 		g_hash_table_insert(file_table, g_strdup(utf8_path), sf);
 		g_free(locale_path);
+		g_free(basename);
 	}
 	g_hash_table_destroy(root->file_table);
 	root->file_table = file_table;


Modified: projectorganizer/src/prjorg-project.h
5 lines changed, 4 insertions(+), 1 deletions(-)
===================================================================
@@ -63,6 +63,9 @@ void prjorg_project_remove_single_tm_file(gchar *utf8_filename);
 
 gboolean prjorg_project_is_in_project(const gchar *utf8_filename);
 
-#define PROJORG_SENTINEL_FILENAME "..."
+/* In the code we create a list of all files but we want to keep empty directories
+ * in the list for which we create a fake file name with the PROJORG_DIR_ENTRY
+ * value. */
+#define PROJORG_DIR_ENTRY "..."
 
 #endif


Modified: projectorganizer/src/prjorg-sidebar.c
2 lines changed, 1 insertions(+), 1 deletions(-)
===================================================================
@@ -1072,7 +1072,7 @@ static void create_branch(gint level, GSList *leaf_list, GtkTreeIter *parent,
 		gchar **path_arr = elem->data;
 		GIcon *icon = NULL;
 
-		if (g_strcmp0(PROJORG_SENTINEL_FILENAME, path_arr[level]) == 0)
+		if (g_strcmp0(PROJORG_DIR_ENTRY, path_arr[level]) == 0)
 			continue;
 
 		gchar *content_type = g_content_type_guess(path_arr[level], NULL, 0, NULL);



--------------
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