SF.net SVN: geany: [2047] trunk

ntrel at users.sourceforge.net ntrel at xxxxx
Tue Nov 13 16:41:59 UTC 2007


Revision: 2047
          http://geany.svn.sourceforge.net/geany/?rev=2047&view=rev
Author:   ntrel
Date:     2007-11-13 08:41:59 -0800 (Tue, 13 Nov 2007)

Log Message:
-----------
Make 'Set path from document' use the current working directory or
the project base path when no document is open.

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/plugins/filebrowser.c

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2007-11-13 14:46:58 UTC (rev 2046)
+++ trunk/ChangeLog	2007-11-13 16:41:59 UTC (rev 2047)
@@ -1,3 +1,10 @@
+2007-11-13  Nick Treleaven  <nick(dot)treleaven(at)btinternet(dot)com>
+
+ * plugins/filebrowser.c:
+   Make 'Set path from document' use the current working directory or
+   the project base path when no document is open.
+
+
 2007-11-13  Enrico Tröger  <enrico(dot)troeger(at)uvena(dot)de>
 
  * src/highlighting.c: Don't change control char symbol in Scintilla.

Modified: trunk/plugins/filebrowser.c
===================================================================
--- trunk/plugins/filebrowser.c	2007-11-13 14:46:58 UTC (rev 2046)
+++ trunk/plugins/filebrowser.c	2007-11-13 16:41:59 UTC (rev 2047)
@@ -33,6 +33,7 @@
 #include "document.h"
 #include "utils.h"
 #include "keybindings.h"
+#include "project.h"
 
 #include "plugindata.h"
 #include "pluginmacros.h"
@@ -174,6 +175,19 @@
 }
 
 
+static gchar *get_default_dir()
+{
+	const gchar *dir = NULL;
+
+	if (project)
+		dir = project->base_path;
+	if (NZV(dir))
+		return g_strdup(dir);
+
+	return g_get_current_dir();
+}
+
+
 static void on_current_path()
 {
 	gchar *fname;
@@ -183,7 +197,8 @@
 	if (! DOC_IDX_VALID(idx) || doc_list[idx].file_name == NULL ||
 		! g_path_is_absolute(doc_list[idx].file_name))
 	{
-		on_go_home();
+		setptr(current_dir, get_default_dir());
+		refresh();
 		return;
 	}
 	fname = doc_list[idx].file_name;


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