Re: GConf 2.3.1 and GConf 1.0.x



Le lun 21/04/2003 à 19:39, Havoc Pennington a écrit :
> On Tue, Apr 15, 2003 at 12:08:25PM +0200, Frederic Crozat wrote:
> > Hi,
> > 
> > it seems latest GConf 2.3.1 local locks (with patches from CVS) doesn't
> > work very well with old GConf 1.0.9 :
> > 
> > GConf 1.0.x clients are no longer able to detect if server is running,
> > try to start their own GConf1 daemon which fails (since GConf2 is
> > already running) and returns the following message:
> > 
> > "Failed to spawn the config server (gconfd)...."
> > 
> > Any idea on how to fix this ?
> 
> We have to patch gconf 1.0.x library to look for the local locks,
> basically.

Indeed, I fixed the problem this way on cooker..

Attached is the patch I applied to Mdk cooker package..

Can I commit it to gconf-1-0 branch ?


-- 
Frederic Crozat <fcrozat mandrakesoft com>
Mandrakesoft
--- GConf-1.0.9/gconf/gconf-internals.c.locallock	2003-04-17 12:22:48.000000000 +0200
+++ GConf-1.0.9/gconf/gconf-internals.c	2003-04-17 12:31:25.000000000 +0200
@@ -2957,10 +2957,46 @@
     }
 }
 
+enum { UNKNOWN, LOCAL, NORMAL };
+
+
+static gboolean
+gconf_use_local_locks (void)
+{
+  static int local_locks = UNKNOWN;
+   
+  if (local_locks == UNKNOWN)
+    {
+      const char *l =
+        g_getenv ("GCONF_GLOBAL_LOCKS");
+ 
+      if (l && atoi (l) == 1)
+        local_locks = NORMAL;
+      else
+        local_locks = LOCAL;
+    }
+ 
+  return local_locks == LOCAL;
+}
+
 char*
 gconf_get_daemon_dir (void)
 {
-  return g_strconcat (g_get_home_dir (), "/.gconfd", NULL);
+  if (gconf_use_local_locks ())
+    {
+      char *s;
+      char *subdir;
+  
+      subdir = g_strconcat ("gconfd-", g_get_user_name (), NULL);
+        
+      s = g_strconcat (g_get_tmp_dir (),"/", subdir, NULL);
+  
+      g_free (subdir);
+  
+      return s;
+  }
+  else
+    return g_strconcat (g_get_home_dir (), "/.gconfd", NULL);
 }
 
 char*


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