[monkey-bubble: 379/753] Use bonobo-config instead of gnome-config.
- From: Sven Herzberg <herzi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [monkey-bubble: 379/753] Use bonobo-config instead of gnome-config.
- Date: Wed, 14 Jul 2010 22:27:31 +0000 (UTC)
commit dc5b67e0982cd44dc53a083e4f73396f55bf253e
Author: Martin Baulig <baulig suse de>
Date: Mon Jun 4 22:02:25 2001 +0000
Use bonobo-config instead of gnome-config.
2001-06-05 Martin Baulig <baulig suse de>
* gnome-url.c: Use bonobo-config instead of gnome-config.
* libgnome-init.h (gnome_get_config_database): New function.
* Makefile.am (libgnome_headers): Don't install gnome-config.h.
(libgnome_src): Removed gnome-triggers.c.
* libgnome.h: Don't #include <libgnome/gnome-config.h>.
libgnome/ChangeLog | 11 +++++++++
libgnome/Makefile.am | 5 ++-
libgnome/gnome-init.c | 23 ++++++++++++++++++-
libgnome/gnome-init.h | 6 +++++
libgnome/gnome-url.c | 52 ++++++++++++++++++++++++++++++----------------
libgnome/libgnome.h | 1 -
libgnome/libgnomeP.h | 1 +
libgnome/test-libgnome.c | 10 ++++++++
8 files changed, 86 insertions(+), 23 deletions(-)
---
diff --git a/libgnome/ChangeLog b/libgnome/ChangeLog
index 6d08ae0..108222b 100644
--- a/libgnome/ChangeLog
+++ b/libgnome/ChangeLog
@@ -1,3 +1,14 @@
+2001-06-05 Martin Baulig <baulig suse de>
+
+ * gnome-url.c: Use bonobo-config instead of gnome-config.
+
+ * libgnome-init.h (gnome_get_config_database): New function.
+
+ * Makefile.am (libgnome_headers): Don't install gnome-config.h.
+ (libgnome_src): Removed gnome-triggers.c.
+
+ * libgnome.h: Don't #include <libgnome/gnome-config.h>.
+
2001-06-04 Martin Baulig <baulig suse de>
* gnome-selector.c (gnome_selector_add_event_supplier): New function.
diff --git a/libgnome/Makefile.am b/libgnome/Makefile.am
index 61b8d33..d86bc39 100644
--- a/libgnome/Makefile.am
+++ b/libgnome/Makefile.am
@@ -60,6 +60,7 @@ libgnome_src = \
gnome-selector.c \
gnome-selector-factory.c\
gnome-config.c \
+ gnome-config.h \
gnome-ditem.c \
gnome-exec.c \
gnome-fileconvert.c \
@@ -67,7 +68,6 @@ libgnome_src = \
gnome-regex.c \
gnome-remote.c \
gnome-score.c \
- gnome-triggers.c \
gnome-url.c \
gnome-util.c \
gnome-paper.c \
@@ -86,7 +86,6 @@ libgnome_headers = \
gnome-async-context.h \
gnome-program.h \
gnome-i18n.h \
- gnome-config.h \
gnome-fileconvert.h \
gnome-ditem.h \
gnome-exec.h \
@@ -215,3 +214,5 @@ test_libgnome_LDADD = \
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = libgnome-2.0.pc
+gnomesysconfdir = $(sysconfdir)/gnome-2.0
+gnomesysconf_DATA = gnome-desktop.xmldb
diff --git a/libgnome/gnome-init.c b/libgnome/gnome-init.c
index d6e3456..e5f0a82 100644
--- a/libgnome/gnome-init.c
+++ b/libgnome/gnome-init.c
@@ -137,6 +137,12 @@ gnome_program_get_desktop_config_database (GnomeProgram *program)
return get_db (program, GNOME_PARAM_DESKTOP_CONFIG_DATABASE, NULL);
}
+Bonobo_ConfigDatabase
+gnome_get_config_database (void)
+{
+ return gnome_program_get_config_database (gnome_program_get ());
+}
+
static void
libbonobo_get_property (GObject *object, guint param_id, GValue *value,
GParamSpec *pspec)
@@ -243,7 +249,7 @@ libbonobo_class_init (GnomeProgramClass *klass, const GnomeModuleInfo *mod_info)
cdata->desktop_config_moniker_id = gnome_program_install_property
(klass, libbonobo_get_property, libbonobo_set_property,
g_param_spec_string (GNOME_PARAM_DESKTOP_CONFIG_MONIKER, NULL, NULL,
- NULL,
+ "xmldb:" LIBGNOME_SYSCONFDIR "/gnome-2.0/gnome-desktop.xmldb",
(G_PARAM_READABLE | G_PARAM_WRITABLE |
G_PARAM_CONSTRUCT_ONLY)));
@@ -289,7 +295,20 @@ libbonobo_post_args_parse (GnomeProgram *program, GnomeModuleInfo *mod_info)
priv->config_database = bonobo_get_object (priv->config_moniker, "Bonobo/ConfigDatabase", &ev);
CORBA_exception_free (&ev);
+ CORBA_exception_init (&ev);
+ priv->desktop_config_database = bonobo_get_object (priv->desktop_config_moniker,
+ "Bonobo/ConfigDatabase", &ev);
+ CORBA_exception_free (&ev);
+
+ if (priv->config_database != CORBA_OBJECT_NIL) {
+ CORBA_exception_init (&ev);
+ Bonobo_ConfigDatabase_addDatabase (priv->config_database, priv->desktop_config_database,
+ "", "/Gnome/", &ev);
+ CORBA_exception_free (&ev);
+ }
+
g_message (G_STRLOC ": %p - `%s'", priv->config_database, priv->config_moniker);
+ g_message (G_STRLOC ": %p - `%s'", priv->desktop_config_database, priv->desktop_config_moniker);
}
static GnomeModuleRequirement libbonobo_requirements [] = {
@@ -404,7 +423,7 @@ libgnome_post_args_parse (GnomeProgram *program,
create_dirs_val = g_value_get_boolean (&value);
g_value_unset (&value);
- gnome_triggers_init ();
+ // gnome_triggers_init ();
libgnome_userdir_setup (create_dirs_val);
diff --git a/libgnome/gnome-init.h b/libgnome/gnome-init.h
index 5e62b07..35fe165 100644
--- a/libgnome/gnome-init.h
+++ b/libgnome/gnome-init.h
@@ -47,6 +47,12 @@ gnome_program_get_desktop_config_database (GnomeProgram *program);
Bonobo_ConfigDatabase
gnome_program_get_config_database (GnomeProgram *program);
+/*
+ * Shortcut for gnome_program_get_config_database (gnome_program_get ()).
+ */
+Bonobo_ConfigDatabase
+gnome_get_config_database (void);
+
#define GNOME_PARAM_CONFIG_DATABASE "config-database"
#define GNOME_PARAM_CONFIG_MONIKER "config-moniker"
diff --git a/libgnome/gnome-url.c b/libgnome/gnome-url.c
index 7961709..c4bf869 100644
--- a/libgnome/gnome-url.c
+++ b/libgnome/gnome-url.c
@@ -1,3 +1,4 @@
+/* -*- Mode: C; c-set-style: gnu indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
/* gnome-url.c
* Copyright (C) 1998, James Henstridge <james daa com au>
* Copyright (C) 1999, 2000 Red Hat, Inc.
@@ -31,9 +32,10 @@
#include <unistd.h>
#include <errno.h>
-#include <libgnome/gnome-config.h>
+#include <bonobo/bonobo-property-bag-client.h>
#include <libgnome/gnome-exec.h>
#include <libgnome/gnome-util.h>
+#include <libgnome/libgnome-init.h>
#include "gnome-url.h"
#include "gnome-i18nP.h"
#include <popt.h>
@@ -59,8 +61,13 @@ gnome_url_default_handler (void)
if (!default_handler) {
gchar *str, *app;
gboolean def;
- str = gnome_config_get_string_with_default ("/Gnome/URL Handlers/default-show",
- &def);
+ Bonobo_ConfigDatabase cdb;
+
+ cdb = gnome_get_config_database ();
+
+ str = bonobo_pbclient_get_string_with_default (cdb, "/Gnome/URL Handlers/default-show",
+ NULL, &def);
+ g_message (G_STRLOC ": %d - `%s'", def, str);
if (def) {
app = gnome_is_program_in_path ("nautilus");
if (app) {
@@ -71,22 +78,24 @@ gnome_url_default_handler (void)
/* first time gnome_url_show is run -- set up some useful defaults */
default_handler = DEFAULT_HANDLER;
- gnome_config_set_string ("/Gnome/URL Handlers/default-show", default_handler);
+ bonobo_pbclient_set_string (cdb, "/Gnome/URL Handlers/default-show",
+ default_handler, NULL);
- g_free (gnome_config_get_string_with_default(
- "/Gnome/URL Handlers/info-show", &def));
+ g_free (bonobo_pbclient_get_string_with_default(
+ cdb, "/Gnome/URL Handlers/info-show", NULL, &def));
if (def)
- gnome_config_set_string ("/Gnome/URL Handlers/info-show", app);
- g_free (gnome_config_get_string_with_default(
- "/Gnome/URL Handlers/man-show", &def));
+ bonobo_pbclient_set_string (cdb, "/Gnome/URL Handlers/info-show",
+ app, NULL);
+ g_free (bonobo_pbclient_get_string_with_default(
+ cdb, "/Gnome/URL Handlers/man-show", NULL, &def));
if (def)
- gnome_config_set_string ("/Gnome/URL Handlers/man-show", app);
- g_free (gnome_config_get_string_with_default(
- "/Gnome/URL Handlers/ghelp-show", &def));
+ bonobo_pbclient_set_string (cdb, "/Gnome/URL Handlers/man-show",
+ app, NULL);
+ g_free (bonobo_pbclient_get_string_with_default(
+ cdb, "/Gnome/URL Handlers/ghelp-show", NULL, &def));
if (def)
- gnome_config_set_string ("/Gnome/URL Handlers/ghelp-show", app);
-
- gnome_config_sync_file ("/Gnome/");
+ bonobo_pbclient_set_string (cdb, "/Gnome/URL Handlers/ghelp-show",
+ app, NULL);
} else
default_handler = str;
}
@@ -127,7 +136,11 @@ create_cmd(GnomeURLDisplayContext *rdc, const char *template,
/* sort of a hack, if the command is gnome-moz-remote, first look
* if mozilla is in path */
if(strcmp(temp_argv[0], "gnome-moz-remote") == 0) {
- char *moz = gnome_config_get_string("/gnome-moz-remote/Mozilla/filename=netscape");
+ Bonobo_ConfigDatabase cdb = gnome_get_config_database ();
+ char *moz = bonobo_pbclient_get_string_with_default(cdb,
+ "/gnome-moz-remote/Mozilla/filename",
+ "netscape",
+ NULL);
char *foo;
foo = gnome_is_program_in_path(moz);
@@ -227,9 +240,12 @@ gnome_url_show_full(GnomeURLDisplayContext *display_context, const char *url,
char path[PATH_MAX];
gboolean def, free_template = FALSE;
GnomeURLDisplayContext *rdc = display_context;
+ Bonobo_ConfigDatabase cdb;
g_return_val_if_fail (!(flags & GNOME_URL_DISPLAY_CLOSE) || display_context, display_context);
+ cdb = gnome_get_config_database();
+
if(flags & GNOME_URL_DISPLAY_CLOSE)
url = url_type = ""; /* Stick in a dummy URL to make code happy */
@@ -246,7 +262,7 @@ gnome_url_show_full(GnomeURLDisplayContext *display_context, const char *url,
if (url_type)
{
g_snprintf(path, sizeof(path), "/Gnome/URL Handlers/%s-show", url_type);
- template = gnome_config_get_string_with_default (path, &def);
+ template = bonobo_pbclient_get_string_with_default (cdb, path, NULL, &def);
if(def)
{
g_free(template);
@@ -265,7 +281,7 @@ gnome_url_show_full(GnomeURLDisplayContext *display_context, const char *url,
g_snprintf (path, sizeof(path), "/Gnome/URL Handlers/%.*s-show", (int)(pos - url - 3), url);
- template = gnome_config_get_string_with_default (path, &def);
+ template = bonobo_pbclient_get_string_with_default (cdb, path, NULL, &def);
if (def) {
g_free(template);
diff --git a/libgnome/libgnome.h b/libgnome/libgnome.h
index 000da7b..6e9b08b 100644
--- a/libgnome/libgnome.h
+++ b/libgnome/libgnome.h
@@ -29,7 +29,6 @@
#include <libgnome/gnome-program.h>
#include <libgnome/gnome-i18n.h>
-#include <libgnome/gnome-config.h>
#include <libgnome/gnome-exec.h>
/* Should this be in gnome-print? */
diff --git a/libgnome/libgnomeP.h b/libgnome/libgnomeP.h
index b471102..fbae137 100644
--- a/libgnome/libgnomeP.h
+++ b/libgnome/libgnomeP.h
@@ -29,6 +29,7 @@
#include <glib.h>
#include <libgnome/libgnome.h>
+#include "gnome-config.h"
#include "gnome-i18nP.h"
#define PATH_SEP '/'
diff --git a/libgnome/test-libgnome.c b/libgnome/test-libgnome.c
index 1ca438e..4f3bbc1 100644
--- a/libgnome/test-libgnome.c
+++ b/libgnome/test-libgnome.c
@@ -9,6 +9,8 @@
#include "libgnome.h"
+#include <libgnome/gnome-url.h>
+
#include <gobject/gvaluetypes.h>
#include <gobject/gparamspecs.h>
@@ -137,6 +139,12 @@ test_bonobo (GnomeProgram *program)
g_message (G_STRLOC ": %p", db);
}
+static void
+test_url (void)
+{
+ gnome_url_show ("http://www.gnu.org/");
+}
+
int
main (int argc, char **argv)
{
@@ -189,5 +197,7 @@ main (int argc, char **argv)
test_bonobo (program);
+ test_url ();
+
return 0;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]