SF.net SVN: geany:[5030] trunk/src/sidebar.c

ntrel at users.sourceforge.net ntrel at xxxxx
Thu Jun 17 12:14:48 UTC 2010


Revision: 5030
          http://geany.svn.sourceforge.net/geany/?rev=5030&view=rev
Author:   ntrel
Date:     2010-06-17 12:14:48 +0000 (Thu, 17 Jun 2010)

Log Message:
-----------
Refactor get_doc_parent().

Modified Paths:
--------------
    trunk/src/sidebar.c

Modified: trunk/src/sidebar.c
===================================================================
--- trunk/src/sidebar.c	2010-06-17 12:12:37 UTC (rev 5029)
+++ trunk/src/sidebar.c	2010-06-17 12:14:48 UTC (rev 5030)
@@ -340,22 +340,19 @@
 }
 
 
-static GtkTreeIter *get_doc_parent(GeanyDocument *doc)
+static gchar *get_doc_folder(GeanyDocument *doc)
 {
 	gchar *tmp_dirname;
 	gchar *project_base_path;
 	gchar *dirname = NULL;
 	const gchar *home_dir = g_get_home_dir();
-	static GtkTreeIter parent;
-	GtkTreeModel *model = GTK_TREE_MODEL(store_openfiles);
 	const gchar *rest;
 
-	if (!documents_show_paths)
-		return NULL;
+	tmp_dirname = g_path_get_dirname(DOC_FILENAME(doc));
 
-	tmp_dirname = g_path_get_dirname(DOC_FILENAME(doc));
 	/* replace the project base path with the project name */
 	project_base_path = project_get_base_path();
+
 	if (project_base_path != NULL)
 	{
 		gsize len = strlen(project_base_path);
@@ -392,6 +389,21 @@
 	else
 		g_free(tmp_dirname);
 
+	return dirname;
+}
+
+
+static GtkTreeIter *get_doc_parent(GeanyDocument *doc)
+{
+	gchar *dirname = NULL;
+	static GtkTreeIter parent;
+	GtkTreeModel *model = GTK_TREE_MODEL(store_openfiles);
+
+	if (!documents_show_paths)
+		return NULL;
+
+	dirname = get_doc_folder(doc);
+
 	if (gtk_tree_model_get_iter_first(model, &parent))
 	{
 		do


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