overriding ~/.gnome2 via env variable
- From: Havoc Pennington <hp redhat com>
- To: gnome-libs-devel gnome org
- Subject: overriding ~/.gnome2 via env variable
- Date: 03 Nov 2002 22:17:44 -0500
Hi,
This is a feature that I'd added to gnome-libs 1.4 a while ago that's
important to some customers. It lets you set an environment variable
to move ~/.gnome2 ; the reason is that there can be issues when mixing
multiple GNOME versions with the same home directory, and often the
easiest approach to that is "screw it" (though the official rules for
config keys are that you should make this work even sharing the same
config files and gconf database).
I should have put this in for 2.0.x, but anyway, we should add it now
I think. (And then fix other code that's hardcoding "~/.gnome2")
Havoc
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/libgnome/ChangeLog,v
retrieving revision 1.251
diff -u -p -u -r1.251 ChangeLog
--- ChangeLog 3 Nov 2002 04:24:39 -0000 1.251
+++ ChangeLog 4 Nov 2002 03:09:52 -0000
@@ -1,3 +1,17 @@
+2002-11-03 Havoc Pennington <hp pobox com>
+
+ * libgnome/parse-path.cP (parse_path): don't hardcode
+ GNOME_DOT_GNOME, use gnome_user_dir_get() and
+ gnome_user_private_dir_get()
+
+ * libgnome/gnome-init.c (libgnome_userdir_setup): allow overriding
+ gnome_user_dir via environment variable GNOME22_USER_DIR, this
+ allows people to install multiple GNOME versions and isolate the
+ configuration of each one.
+
+ * libgnome/gnome-init.h: add comment about how GNOME_DOT_GNOME and
+ GNOME_DOT_GNOME_PRIVATE macros should not be used
+
2002-11-03 Dmitry G. Mastrukov <dmitry taurussoft org>
* configure.in: Added Belarusian to ALL_LINGUAS
Index: libgnome/gnome-init.c
===================================================================
RCS file: /cvs/gnome/libgnome/libgnome/gnome-init.c,v
retrieving revision 1.103
diff -u -p -u -r1.103 gnome-init.c
--- libgnome/gnome-init.c 30 May 2002 00:44:58 -0000 1.103
+++ libgnome/gnome-init.c 4 Nov 2002 03:09:52 -0000
@@ -265,9 +265,33 @@ static void
libgnome_userdir_setup (gboolean create_dirs)
{
if(!gnome_user_dir) {
- gnome_user_dir = g_build_filename (g_get_home_dir(), GNOME_DOT_GNOME, NULL);
- gnome_user_private_dir = g_build_filename (g_get_home_dir(),
- GNOME_DOT_GNOME_PRIVATE, NULL);
+ const char *override;
+
+ /* FIXME this env variable should be changed
+ * for each major GNOME release, would be easier to
+ * remember if not hardcoded.
+ */
+ override = g_getenv ("GNOME22_USER_DIR");
+
+ if (override != NULL) {
+ int len;
+
+ gnome_user_dir = g_strdup (override);
+
+ /* chop trailing slash */
+ len = strlen (gnome_user_dir);
+ if (len > 1 && gnome_user_dir[len-1] == '/')
+ gnome_user_dir[len - 1] = '\0';
+
+ gnome_user_private_dir = g_strconcat (gnome_user_dir,
+ "_private",
+ NULL);
+ } else {
+ gnome_user_dir = g_build_filename (g_get_home_dir(), GNOME_DOT_GNOME, NULL);
+ gnome_user_private_dir = g_build_filename (g_get_home_dir(),
+ GNOME_DOT_GNOME_PRIVATE, NULL);
+ }
+
gnome_user_accels_dir = g_build_filename (gnome_user_dir,
"accels", NULL);
}
Index: libgnome/gnome-init.h
===================================================================
RCS file: /cvs/gnome/libgnome/libgnome/gnome-init.h,v
retrieving revision 1.17
diff -u -p -u -r1.17 gnome-init.h
--- libgnome/gnome-init.h 3 Dec 2001 11:29:38 -0000 1.17
+++ libgnome/gnome-init.h 4 Nov 2002 03:09:52 -0000
@@ -31,7 +31,11 @@
G_BEGIN_DECLS
-/* This is where the user specific files are stored under $HOME */
+/* This is where the user specific files are stored under $HOME
+ * (do not use these macros; use gnome_user_dir_get(); it's possible
+ * to override .gnome2 via environment variable and this is
+ * an important feature for environments that mix GNOME versions)
+ */
#define GNOME_DOT_GNOME ".gnome2/"
#define GNOME_DOT_GNOME_PRIVATE ".gnome2_private/"
Index: libgnome/parse-path.cP
===================================================================
RCS file: /cvs/gnome/libgnome/libgnome/parse-path.cP,v
retrieving revision 1.13
diff -u -p -u -r1.13 parse-path.cP
--- libgnome/parse-path.cP 3 Dec 2001 11:29:38 -0000 1.13
+++ libgnome/parse-path.cP 4 Nov 2002 03:09:52 -0000
@@ -85,9 +85,11 @@ parse_path (const char *path, gboolean p
p->file++;
if (priv){
- p->file = g_strconcat (g_get_home_dir(), "/", GNOME_DOT_GNOME_PRIVATE, (p->file), NULL);
+ p->file = g_build_filename (gnome_user_private_dir_get (),
+ (p->file), NULL);
} else {
- p->file = g_strconcat (g_get_home_dir(), "/", GNOME_DOT_GNOME, (p->file), NULL);
+ p->file = g_build_filename (gnome_user_dir_get (),
+ (p->file), NULL);
}
}
if (p->file == GNOME_CONFIG_PARSE_ERROR ||
[Date Prev][
Date Next] [Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]