[monkey-bubble: 674/753] Add gconf support here. This is the init stuff, none of the gui stuff.



commit cf89e09ec6e0299ad2bdfc9765c40ac75d43d585
Author: George Lebl <jirka 5z com>
Date:   Mon Aug 27 05:49:21 2001 +0000

    Add gconf support here. This is the init stuff, none of the gui stuff.
    
    Sun Aug 26 22:48:54 2001  George Lebl <jirka 5z com>
    
    	* gnome-init.c, gnome-gconf.[ch], Makefile.am:  Add gconf support
    	  here.  This is the init stuff, none of the gui stuff.

 libgnome/ChangeLog     |    5 ++
 libgnome/gnome-gconf.c |  126 ++++++++++++++++++++++++++++++++++++++++++++++++
 libgnome/gnome-gconf.h |   52 ++++++++++++++++++++
 libgnome/gnome-init.c  |    2 +
 libgnome/libgnome.h    |    2 +
 5 files changed, 187 insertions(+), 0 deletions(-)
---
diff --git a/libgnome/ChangeLog b/libgnome/ChangeLog
index e9d6fc0..4f824fb 100644
--- a/libgnome/ChangeLog
+++ b/libgnome/ChangeLog
@@ -1,3 +1,8 @@
+Sun Aug 26 22:48:54 2001  George Lebl <jirka 5z com>
+
+	* gnome-init.c, gnome-gconf.[ch], Makefile.am:  Add gconf support
+	  here.  This is the init stuff, none of the gui stuff.
+
 Sun Aug 26 07:29:59 2001  George Lebl <jirka 5z com>
 
 	* Makefile.am, gnome-config.[ch], parse-path.cP, gnome-sound.[ch],
diff --git a/libgnome/gnome-gconf.c b/libgnome/gnome-gconf.c
new file mode 100644
index 0000000..2f1027b
--- /dev/null
+++ b/libgnome/gnome-gconf.c
@@ -0,0 +1,126 @@
+/*  -*- Mode: C; c-set-style: linux; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
+/* GNOME Library - gnome-gconf.c
+ * Copyright (C) 2000  Red Hat Inc.,
+ * All rights reserved.
+ *
+ * Author: Jonathan Blandford  <jrb redhat com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Cambridge, MA 02139, USA.
+ */
+/*
+  @NOTATION@
+*/
+
+
+#include <config.h>
+#include <stdlib.h>
+
+#define GCONF_ENABLE_INTERNALS 1
+#include <gconf/gconf.h>
+#include <gconf/gconf-client.h>
+extern struct poptOption gconf_options[];
+
+#include <libgnome/libgnome.h>
+#include "gnome-gconf.h"
+
+gchar*
+gnome_gconf_get_gnome_libs_settings_relative (const gchar *subkey)
+{
+        gchar *dir;
+        gchar *key;
+
+        dir = g_strconcat("/apps/gnome-settings/",
+                          gnome_program_get_name(gnome_program_get()),
+                          NULL);
+
+        if (subkey && *subkey) {
+                key = gconf_concat_dir_and_key(dir, subkey);
+                g_free(dir);
+        } else {
+                /* subkey == "" */
+                key = dir;
+        }
+
+        return key;
+}
+
+gchar*
+gnome_gconf_get_app_settings_relative (const gchar *subkey)
+{
+        gchar *dir;
+        gchar *key;
+
+        dir = g_strconcat("/apps/",
+                          gnome_program_get_name(gnome_program_get()),
+                          NULL);
+
+        if (subkey && *subkey) {
+                key = gconf_concat_dir_and_key(dir, subkey);
+                g_free(dir);
+        } else {
+                /* subkey == "" */
+                key = dir;
+        }
+
+        return key;
+}
+
+/*
+ * Our global GConfClient, and module stuff
+ */
+
+static GConfClient* global_client = NULL;
+
+static void
+gnome_gconf_pre_args_parse(GnomeProgram *app, GnomeModuleInfo *mod_info)
+{
+        gconf_preinit(app, (GnomeModuleInfo*)mod_info);
+}
+
+static void
+gnome_gconf_post_args_parse(GnomeProgram *app, GnomeModuleInfo *mod_info)
+{
+        gchar *settings_dir;
+        
+        gconf_postinit(app, (GnomeModuleInfo*)mod_info);
+
+        global_client = gconf_client_get_default();
+
+        gconf_client_add_dir(global_client,
+                             "/desktop/gnome",
+                             GCONF_CLIENT_PRELOAD_NONE, NULL);
+
+        settings_dir = gnome_gconf_get_gnome_libs_settings_relative("");
+
+        gconf_client_add_dir(global_client,
+                             settings_dir,
+                             /* Possibly we should turn preload on for this */
+                             GCONF_CLIENT_PRELOAD_NONE,
+                             NULL);
+        g_free(settings_dir);
+}
+
+static GnomeModuleRequirement gnome_gconf_requirements[] = {
+        /* VERSION is also our version note - it's all libgnomeui */
+	{ VERSION, &gnome_bonobo_activation_module_info },
+        { NULL, NULL }
+};
+
+GnomeModuleInfo gnome_gconf_module_info = {
+        "gnome-gconf", VERSION, N_("GNOME GConf Support"),
+        gnome_gconf_requirements,
+        gnome_gconf_pre_args_parse, gnome_gconf_post_args_parse,
+        gconf_options
+};
diff --git a/libgnome/gnome-gconf.h b/libgnome/gnome-gconf.h
new file mode 100644
index 0000000..35dd3d4
--- /dev/null
+++ b/libgnome/gnome-gconf.h
@@ -0,0 +1,52 @@
+/*  -*- Mode: C; c-set-style: linux; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
+/* GNOME Library - gnome-gconf.h
+ * Copyright (C) 2000  Red Hat Inc.,
+ * All rights reserved.
+ *
+ * Author: Jonathan Blandford  <jrb redhat com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Cambridge, MA 02139, USA.
+ */
+/*
+  @NOTATION@
+*/
+
+#ifndef GNOME_GCONF_H
+#define GNOME_GCONF_H
+
+#include <gconf/gconf-client.h>
+
+#include <libgnome/gnome-program.h>
+#include <libgnome/gnome-init.h>
+
+/* Get keys relative to the gnome-libs internal per-app directory and the
+   application author per-app directory */
+gchar      *gnome_gconf_get_gnome_libs_settings_relative (const gchar *subkey);
+gchar      *gnome_gconf_get_app_settings_relative        (const gchar *subkey);
+
+/* GNOME GConf module; basically what this does is
+   create a global GConfClient for a GNOME application; it's used
+   by libgnome*, and applications can either use it or create
+   their own. However note that signals will be emitted for
+   libgnomeui settings and errors! Also the module inits
+   GConf
+*/
+
+extern GnomeModuleInfo gnome_gconf_module_info;
+
+#endif
+
+
+
diff --git a/libgnome/gnome-init.c b/libgnome/gnome-init.c
index ba556d2..639599d 100644
--- a/libgnome/gnome-init.c
+++ b/libgnome/gnome-init.c
@@ -40,6 +40,7 @@
 #include "gnome-i18nP.h"
 
 #include <libgnome/gnome-init.h>
+#include <libgnome/gnome-gconf.h>
 #include <libgnome/gnome-util.h>
 
 #include <errno.h>
@@ -520,6 +521,7 @@ GnomeModuleInfo gnome_vfs_module_info = {
 static GnomeModuleRequirement libgnome_requirements [] = {
 	{ VERSION, &libbonobo_module_info },
 	{ "0.3.0", &gnome_vfs_module_info },
+	{ VERSION, &gnome_gconf_module_info },
 	{ NULL }
 };
 
diff --git a/libgnome/libgnome.h b/libgnome/libgnome.h
index 8115bb1..8251766 100644
--- a/libgnome/libgnome.h
+++ b/libgnome/libgnome.h
@@ -31,6 +31,8 @@
 
 #include <libgnome/gnome-config.h>
 
+#include <libgnome/gnome-gconf.h>
+
 #include <libgnome/gnome-triggers.h>
 #include <libgnome/gnome-sound.h>
 



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