SF.net SVN: geany:[3751] branches/unstable

ntrel at users.sourceforge.net ntrel at xxxxx
Thu Apr 30 12:54:15 UTC 2009


Revision: 3751
          http://geany.svn.sourceforge.net/geany/?rev=3751&view=rev
Author:   ntrel
Date:     2009-04-30 12:54:15 +0000 (Thu, 30 Apr 2009)

Log Message:
-----------
Read custom system global tags files from $prefix/share/geany/tags.
Closes #2778923.

Modified Paths:
--------------
    branches/unstable/ChangeLog
    branches/unstable/src/symbols.c

Modified: branches/unstable/ChangeLog
===================================================================
--- branches/unstable/ChangeLog	2009-04-30 12:48:07 UTC (rev 3750)
+++ branches/unstable/ChangeLog	2009-04-30 12:54:15 UTC (rev 3751)
@@ -1,3 +1,10 @@
+2009-04-30  Nick Treleaven  <nick(dot)treleaven(at)btinternet(dot)com>
+
+ * src/symbols.c:
+   Read custom system global tags files from $prefix/share/geany/tags.
+   Closes #2778923.
+
+
 2009-04-27  Enrico Tröger  <enrico(dot)troeger(at)uvena(dot)de>
 
  * src/callbacks.c, src/keyfile.c, src/main.c, src/ui_utils.c,

Modified: branches/unstable/src/symbols.c
===================================================================
--- branches/unstable/src/symbols.c	2009-04-30 12:48:07 UTC (rev 3750)
+++ branches/unstable/src/symbols.c	2009-04-30 12:54:15 UTC (rev 3751)
@@ -87,8 +87,6 @@
 	{FALSE, "python.tags"}
 };
 
-static gchar *user_tags_dir;
-
 static GPtrArray *top_level_iter_names = NULL;
 
 static struct
@@ -1419,23 +1417,42 @@
 }
 
 
+static void utils_slist_add_path(GSList *list, const gchar *path)
+{
+	GSList *node;
+
+	for (node = list; node != NULL; node = g_slist_next(node))
+	{
+		setptr(node->data,
+			g_build_path(G_DIR_SEPARATOR_S, path, node->data, NULL));
+	}
+}
+
+
 static GHashTable *init_user_tags(void)
 {
-	GSList *file_list;
+	GSList *file_list = NULL, *list = NULL;
 	GHashTable *lang_hash;
+	const gchar *dir;
 
-	user_tags_dir = g_strconcat(app->configdir, G_DIR_SEPARATOR_S, "tags", NULL);
-	file_list = utils_get_file_list(user_tags_dir, NULL, NULL);
+	dir = utils_build_path(app->configdir, "tags", NULL);
+	/* create the user tags dir for next time if it doesn't exist */
+	if (! g_file_test(dir, G_FILE_TEST_IS_DIR))
+	{
+		utils_mkdir(dir, FALSE);
+	}
+	file_list = utils_get_file_list(dir, NULL, NULL);
+	utils_slist_add_path(file_list, dir);
+
+	dir = utils_build_path(app->datadir, "tags", NULL);
+	list = utils_get_file_list(dir, NULL, NULL);
+	utils_slist_add_path(list, dir);
+	file_list = g_slist_concat(file_list, list);
+
 	lang_hash = get_tagfile_hash(file_list);
-
 	/* don't need to delete list contents because they are now used for hash contents */
 	g_slist_free(file_list);
 
-	/* create the tags dir for next time if it doesn't exist */
-	if (! g_file_test(user_tags_dir, G_FILE_TEST_IS_DIR))
-	{
-		utils_mkdir(user_tags_dir, FALSE);
-	}
 	return lang_hash;
 }
 
@@ -1463,15 +1480,13 @@
 	for (node = fnames; node != NULL; node = g_list_next(node))
 	{
 		const gint tm_lang = ft->lang;
-		gchar *fname;
+		const gchar *fname = node->data;
 
-		fname = g_strconcat(user_tags_dir, G_DIR_SEPARATOR_S, node->data, NULL);
 		if (tm_workspace_load_global_tags(fname, tm_lang))
 		{
 			geany_debug("Loaded %s (%s), total tags: %u.", fname, ft->name,
 				tm_get_workspace()->global_tags->len);
 		}
-		g_free(fname);
 	}
 	g_list_foreach(fnames, (GFunc) g_free, NULL);
 	g_list_free(fnames);


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.



More information about the Commits mailing list