[evince] Respect GNOME22_USER_DIR env variable



commit d578d4048cd4cb85bcb3f84a30e552ddd1709bd3
Author: Carlos Garcia Campos <carlosgc gnome org>
Date:   Sun Apr 25 16:24:17 2010 +0200

    Respect GNOME22_USER_DIR env variable
    
    Based on patch by Ray Strode. Fixes bug #613637.

 shell/ev-application.c |   37 +++++++++++++++++++++++++++----------
 1 files changed, 27 insertions(+), 10 deletions(-)
---
diff --git a/shell/ev-application.c b/shell/ev-application.c
index 0719ded..497ce21 100644
--- a/shell/ev-application.c
+++ b/shell/ev-application.c
@@ -94,6 +94,8 @@ G_DEFINE_TYPE (EvApplication, ev_application, G_TYPE_OBJECT);
 #define APPLICATION_DBUS_INTERFACE   "org.gnome.evince.Application"
 #endif
 
+static const gchar *userdir = NULL;
+
 /**
  * ev_application_get_instance:
  *
@@ -813,9 +815,14 @@ ev_application_accel_map_save (EvApplication *application)
 	gchar *tmp_filename;
 	gint   fd;
 
-	accel_map_file = g_build_filename (g_get_home_dir (),
-					   ".gnome2", "accels",
-					   "evince", NULL);
+	if (userdir) {
+		accel_map_file = g_build_filename (userdir, "accels",
+						   "evince", NULL);
+	} else {
+		accel_map_file = g_build_filename (g_get_home_dir (),
+						   ".gnome2", "accels",
+						   "evince", NULL);
+	}
 
 	tmp_filename = g_strdup_printf ("%s.XXXXXX", accel_map_file);
 
@@ -843,9 +850,15 @@ ev_application_accel_map_load (EvApplication *application)
 {
 	gchar *accel_map_file;
 
-	accel_map_file = g_build_filename (g_get_home_dir (),
-					   ".gnome2", "accels",
-					   "evince", NULL);
+	if (userdir) {
+		accel_map_file = g_build_filename (userdir, "accels",
+						   "evince", NULL);
+	} else {
+		accel_map_file = g_build_filename (g_get_home_dir (),
+						   ".gnome2", "accels",
+						   "evince", NULL);
+	}
+
 	gtk_accel_map_load (accel_map_file);
 	g_free (accel_map_file);
 }
@@ -903,10 +916,14 @@ ev_application_init (EvApplication *ev_application)
 {
 	GError *error = NULL;
 
-        ev_application->dot_dir = g_build_filename (g_get_home_dir (),
-                                                    ".gnome2",
-                                                    "evince",
-                                                    NULL);
+	userdir = g_getenv ("GNOME22_USER_DIR");
+	if (userdir)
+		ev_application->dot_dir = g_build_filename (userdir, "evince", NULL);
+	else
+		ev_application->dot_dir = g_build_filename (g_get_home_dir (),
+							    ".gnome2",
+							    "evince",
+							    NULL);
 
 #ifdef G_OS_WIN32
 {



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