Re: gconf path problem, Sun GNOME
- From: Ryan Lovett <ryan OCF Berkeley EDU>
- To: gconf-list gnome org
- Subject: Re: gconf path problem, Sun GNOME
- Date: Wed, 28 May 2003 10:13:18 -0700
On Tue, May 13, 2003 at 02:04:34AM -0400, Havoc Pennington wrote:
> > Can one configure gconfd (2.2.0) where it reads and writes the ior?
> > (or is this only with GCONF_LOCAL_LOCKS) I'd like to try writing it
> > to ~/.gconfd/lock/ior-SunOS or something.
>
> I think the /tmp refers to GCONF_LOCAL_LOCKS - being able to configure
> the IOR would make sense, but unfortunately there's no such feature.
I've attached a patch for an initial stab at configuring the ior name. I
tried it out with a Sun GNOME installation using gconf defaults and
Debian Linux GNOME using ~/.gconf-Linux and ~/.gconfd/lock/ior-Linux. I
was able to log a user into to two different machines simultaneously
using different gconf storages.
Its against 2.2.0, but glancing at cvs gconf I don't think it'll be a
problem there. Suggestions, corrections, etc. are welcome.
Ryan
diff -urN GConf-2.2.0.orig/gconf/Makefile.am GConf-2.2.0/gconf/Makefile.am
--- GConf-2.2.0.orig/gconf/Makefile.am 2002-09-18 18:47:14.000000000 -0700
+++ GConf-2.2.0/gconf/Makefile.am 2003-05-22 10:32:33.000000000 -0700
@@ -119,11 +119,12 @@
libgconf_2_la_LIBADD = $(INTLLIBS) $(DEPENDENT_LIBS)
-EXTRA_DIST=GConfX.idl default.path.in gconfmarshal.list regenerate-enum-header.sh regenerate-enum-footer.sh
+EXTRA_DIST=GConfX.idl default.path.in default.conf gconfmarshal.list regenerate-enum-header.sh regenerate-enum-footer.sh
install-data-local:
-mkdir -p $(DESTDIR)$(sysconfdir)/gconf/$(MAJOR_VERSION)
$(INSTALL_DATA) default.path $(DESTDIR)$(sysconfdir)/gconf/$(MAJOR_VERSION)/path
+ $(INSTALL_DATA) default.conf $(DESTDIR)$(sysconfdir)/gconf/$(MAJOR_VERSION)/conf
gconfmarshal.h: @REBUILD@ stamp-gconfmarshal.h
@true
diff -urN GConf-2.2.0.orig/gconf/default.conf GConf-2.2.0/gconf/default.conf
--- GConf-2.2.0.orig/gconf/default.conf 1969-12-31 16:00:00.000000000 -0800
+++ GConf-2.2.0/gconf/default.conf 2003-05-22 10:31:35.000000000 -0700
@@ -0,0 +1,5 @@
+# Simultaneous logins utilizing different gconf storage locations
+# require different lock files. Modify the readwrite path in the path file,
+# for example $(HOME)/.gconf-ARCH, and define the lock parameter,
+# for example $(HOME)/.gconfd/lock/ior-ARCH
+# lock "$(HOME)/.gconfd/lock/ior"
diff -urN GConf-2.2.0.orig/gconf/gconf-internals.c GConf-2.2.0/gconf/gconf-internals.c
--- GConf-2.2.0.orig/gconf/gconf-internals.c 2002-11-02 07:36:10.000000000 -0800
+++ GConf-2.2.0/gconf/gconf-internals.c 2003-05-22 10:10:52.000000000 -0700
@@ -2486,6 +2486,77 @@
return server;
}
+gchar *
+gconf_get_lock_filename (GError** err)
+{
+ FILE* f;
+ gchar buf[512], *conffile, *lockfile = NULL;
+
+ conffile = g_strconcat(GCONF_CONFDIR, "/conf", NULL);
+
+ f = fopen(conffile, "r");
+
+ if (f == NULL)
+ {
+ if (err)
+ *err = gconf_error_new(GCONF_ERROR_FAILED,
+ _("Couldn't open conf file `%s': %s\n"),
+ conffile,
+ strerror(errno));
+ return NULL;
+ }
+
+ while (fgets(buf, 512, f) != NULL)
+ {
+ gchar* s = buf;
+
+ while (*s && g_ascii_isspace(*s))
+ ++s;
+
+ if (*s == '#')
+ {
+ /* Allow comments, why not */
+ }
+ else if (*s == '\0')
+ {
+ /* Blank line */
+ }
+ else if (strncmp("lock", s, 4) == 0)
+ {
+ gchar* unq;
+
+ s += 4;
+ while (g_ascii_isspace(*s))
+ s++;
+ unq = unquote_string(s);
+
+ lockfile = subst_variables (unq);
+ }
+ }
+
+ if (ferror(f))
+ {
+ /* This should basically never happen */
+ if (err)
+ *err = gconf_error_new(GCONF_ERROR_FAILED,
+ _("Read error on file `%s': %s\n"),
+ conffile,
+ strerror(errno));
+ /* don't return, we want to go ahead and return the
+ default filename. */
+ }
+
+ fclose(f);
+
+ /* Fallback */
+ if (lockfile == NULL)
+ lockfile = g_strconcat (gconf_get_lock_dir (), "/ior", NULL);
+
+ gconf_log(GCL_DEBUG, _("Using lock file `%s'\n"), lockfile);
+
+ return lockfile;
+}
+
GConfLock*
gconf_get_lock_or_current_holder (const gchar *lock_directory,
ConfigServer *current_server,
@@ -2516,7 +2593,7 @@
lock->lock_directory = g_strdup (lock_directory);
- lock->iorfile = g_strconcat (lock->lock_directory, "/ior", NULL);
+ lock->iorfile = gconf_get_lock_filename (NULL);
/* Check the current IOR file and ping its daemon */
@@ -2695,7 +2772,7 @@
char *iorfile;
ConfigServer server;
- iorfile = g_strconcat (lock_directory, "/ior", NULL);
+ iorfile = gconf_get_lock_filename (NULL);
server = read_current_server_and_set_warning (iorfile, failure_log);
g_free (iorfile);
return server;
diff -urN GConf-2.2.0.orig/gconf/gconf-internals.h GConf-2.2.0/gconf/gconf-internals.h
--- GConf-2.2.0.orig/gconf/gconf-internals.h 2002-09-18 18:47:14.000000000 -0700
+++ GConf-2.2.0/gconf/gconf-internals.h 2003-05-22 09:51:50.000000000 -0700
@@ -184,6 +184,7 @@
GError **err);
gboolean gconf_release_lock (GConfLock *lock,
GError **err);
+gchar* gconf_get_lock_filename (GError** err);
GConfLock* gconf_get_lock_or_current_holder (const gchar *lock_directory,
ConfigServer *current_server,
GError **err);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]