[nautilus/gnome-2-32: 224/283] Support overriding .gnome2 directory.



commit 136f905058094d779378d7487f682e576d303d81
Author: Ray Strode <rstrode redhat com>
Date:   Sun Jul 4 16:08:22 2010 +0200

    Support overriding .gnome2 directory.
    
    The env var GNOME22_USER_DIR should be used for that.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=614030

 libnautilus-private/nautilus-file-utilities.c |   13 +++++++------
 src/file-manager/fm-directory-view.c          |   19 +++++++++++++------
 2 files changed, 20 insertions(+), 12 deletions(-)
---
diff --git a/libnautilus-private/nautilus-file-utilities.c b/libnautilus-private/nautilus-file-utilities.c
index b1c2a1e..ae11856 100644
--- a/libnautilus-private/nautilus-file-utilities.c
+++ b/libnautilus-private/nautilus-file-utilities.c
@@ -123,14 +123,15 @@ nautilus_get_user_directory (void)
 char *
 nautilus_get_accel_map_file (void)
 {
-	const gchar *home;
+	const gchar *override;
 
-	home = g_get_home_dir();
-	if (home != NULL) {
-		return g_build_filename (home, ".gnome2/accels/nautilus", NULL);
-	}
+	override = g_getenv ("GNOME22_USER_DIR");
 
-	return NULL;
+	if (override) {
+		return g_build_filename (override, "accels/nautilus", NULL);
+	} else {
+		return g_build_filename (g_get_home_dir (), ".gnome2/accels/nautilus", NULL);
+	}
 }
 
 typedef struct {
diff --git a/src/file-manager/fm-directory-view.c b/src/file-manager/fm-directory-view.c
index 689530f..4f2930a 100644
--- a/src/file-manager/fm-directory-view.c
+++ b/src/file-manager/fm-directory-view.c
@@ -123,9 +123,6 @@
 #define MAX_MENU_LEVELS 5
 #define TEMPLATE_LIMIT 30
 
-/* Directory where user scripts are placed */
-#define NAUTILUS_SCRIPTS_DIR ".gnome2/nautilus-scripts"
-
 enum {
 	ADD_FILE,
 	BEGIN_FILE_CHANGES,
@@ -1642,14 +1639,24 @@ static void
 set_up_scripts_directory_global (void)
 {
 	char *scripts_directory_path;
+	const char *override;
 
 	if (scripts_directory_uri != NULL) {
 		return;
 	}
 
-	scripts_directory_path = g_build_filename (g_get_home_dir (),
-						   NAUTILUS_SCRIPTS_DIR,
-						   NULL);
+	override = g_getenv ("GNOME22_USER_DIR");
+
+	if (override) {
+		scripts_directory_path = g_build_filename (override,
+							   "nautilus-scripts",
+							   NULL);
+	} else {
+		scripts_directory_path = g_build_filename (g_get_home_dir (),
+							   ".gnome2",
+							   "nautilus-scripts",
+							   NULL);
+	}
 
 	if (g_mkdir_with_parents (scripts_directory_path, 0755) == 0) {
 		scripts_directory_uri = g_filename_to_uri (scripts_directory_path, NULL, NULL);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]