Re: [PATCH] default source



> Looks good otherwise. Can you send along a revised version of the
> patch?
> 
> Thanks!
> 
> Havoc
> 

Hi,

I hope to have not screwed anything this time :)
Let me know.

I attach also a separate mini patch for the wrong message about copying
the path file, I hope it's useful ...

Thanks

Marco


Index: Makefile.am
===================================================================
RCS file: /cvs/gnome/gconf/Makefile.am,v
retrieving revision 1.19.2.2
diff -u -r1.19.2.2 Makefile.am
--- Makefile.am	2001/03/23 22:52:30	1.19.2.2
+++ Makefile.am	2001/08/01 19:50:08
@@ -5,7 +5,7 @@
 EXTRA_DIST=gconf-config.in gconf.m4.in gconf.spec.in gconf.spec TODO \
 	gconf.pc gconfgtk.pc
 
-WARNING_MESSAGE="If this is your first install of GConf, you may need to move $(prefix)/etc/gconf/$(MAJOR_VERSION)/path.example to $(prefix)/etc/gconf/$(MAJOR_VERSION)/path, so that the default configuration is sane. If you are already using GConf, you may need to move your old configuration into place if $(MAJOR_VERSION) is not the same as your old version."
+WARNING_MESSAGE="If this is your first install of GConf, you may need to move $(sysconfdir)/gconf/$(MAJOR_VERSION)/path.example to $(sysconfdir)/gconf/$(MAJOR_VERSION)/path, so that the default configuration is sane. If you are already using GConf, you may need to move your old configuration into place if $(MAJOR_VERSION) is not the same as your old version."
 
 all-local:
 	@echo "**** NOTE ****"
? sourcepatch
? wrongmessage
Index: gconf.m4.in
===================================================================
RCS file: /cvs/gnome/gconf/Attic/gconf.m4.in,v
retrieving revision 1.1
diff -u -r1.1 gconf.m4.in
--- gconf.m4.in	2000/07/19 03:40:23	1.1
+++ gconf.m4.in	2001/08/01 20:15:50
@@ -64,3 +64,21 @@
   AC_SUBST(GCONF_LIBS)
   rm -f conf.gconftest
 ])
+
+dnl AM_PATH_GCONF
+dnl Define GCONF_SCHEMA_CONFIG_SOURCE
+dnl
+AC_DEFUN(AM_GCONF_SOURCE,
+[
+if test "x$GCONF_SCHEMA_INSTALL_SOURCE" = "x"; then
+  GCONF_SCHEMA_CONFIG_SOURCE=`gconftool --get-default-source`
+else
+  GCONF_SCHEMA_CONFIG_SOURCE=$GCONF_SCHEMA_INSTALL_SOURCE
+fi
+
+AC_ARG_WITH(gconf-source, 
+[  --with-gconf-source=sourceaddress      Where to install schema files.],GCONF_SCHEMA_CONFIG_SOURCE="$withval",)
+
+  AC_SUBST(GCONF_SCHEMA_CONFIG_SOURCE)
+  AC_MSG_RESULT("Using config source $GCONF_SCHEMA_CONFIG_SOURCE for schema installation")
+])
Index: gconf/Makefile.am
===================================================================
RCS file: /cvs/gnome/gconf/gconf/Makefile.am,v
retrieving revision 1.52.2.4
diff -u -r1.52.2.4 Makefile.am
--- gconf/Makefile.am	2001/04/17 23:16:49	1.52.2.4
+++ gconf/Makefile.am	2001/08/01 20:15:50
@@ -11,6 +11,7 @@
 	-DGCONF_LOCALE_DIR=\""$(gconflocaledir)"\"  \
         -DGCONF_SRCDIR=\""$(absolute_top_srcdir)"\" \
 	-DGCONF_CONFDIR=\""$(sysconfdir)/gconf/$(MAJOR_VERSION)"\" \
+	-DGCONF_ETCDIR=\""$(sysconfdir)/gconf"\" \
 	-DGCONF_BUILDDIR=\""$(top_builddir)"\" 			\
 	-DGCONF_BACKEND_DIR=\""$(pkglibdir)/$(MAJOR_VERSION)"\" \
 	-DVERSION=\""$(VERSION)"\" \
Index: gconf/gconftool.c
===================================================================
RCS file: /cvs/gnome/gconf/gconf/gconftool.c,v
retrieving revision 1.51.2.7
diff -u -r1.51.2.7 gconftool.c
--- gconf/gconftool.c	2001/07/28 06:17:39	1.51.2.7
+++ gconf/gconftool.c	2001/08/01 20:15:51
@@ -56,6 +56,7 @@
 static int long_docs_mode = FALSE;
 static int schema_name_mode = FALSE;
 static int associate_schema_mode = FALSE;
+static int default_source_mode = FALSE;
 
 struct poptOption options[] = {
   { 
@@ -321,6 +322,15 @@
     NULL
   },
   {
+    "get-default-source",
+    '\0',
+    POPT_ARG_NONE,
+    &default_source_mode,
+    0,
+    N_("Get the name of the default source"),
+    NULL
+  },
+  {
     NULL,
     '\0',
     0,
@@ -350,6 +360,7 @@
 static int do_long_docs (GConfEngine *conf, const gchar **args);
 static int do_get_schema_name (GConfEngine *conf, const gchar **args);
 static int do_associate_schema (GConfEngine *conf, const gchar **args);
+static int do_get_default_source (GConfEngine *conf, const gchar **args);
 
 int 
 main (int argc, char** argv)
@@ -717,6 +728,16 @@
           return 1;
         }
     }
+
+  if (default_source_mode)
+    {
+      const gchar** args = poptGetArgs(ctx);
+      if (do_get_default_source(conf, args)  == 1)
+        {
+          gconf_engine_unref(conf);
+          return 1;
+        }
+    }
   
   if (all_entries_mode)
     {
@@ -2493,6 +2514,39 @@
       
       ++args;
     }
+
+  return 0;
+}
+
+static int
+do_get_default_source(GConfEngine* conf, const gchar** args)
+{
+  gchar *source;
+  gchar buf[512];
+  FILE *f;
+
+  /* Try with $sysconfdir/gconf/schema-install-source */
+  f = fopen(GCONF_ETCDIR"/schema-install-source", "r");
+
+  if (f != NULL)
+    {
+      source = fgets(buf, 512, f);
+      fclose(f);  
+      if (source)
+	{
+	  g_strchomp(source);
+	  if (*source != '\0')
+	    {
+	      printf("%s\n", source);
+	      return 0;
+	    }
+	}
+    }
+
+  /* Use default database */
+  source = g_strconcat("xml::", GCONF_ETCDIR, "/gconf.xml.defaults", NULL);
+  printf("%s\n", source);
+  g_free(source);
 
   return 0;
 }


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