aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--wombat/ChangeLog5
-rw-r--r--wombat/wombat-moniker.c71
2 files changed, 73 insertions, 3 deletions
diff --git a/wombat/ChangeLog b/wombat/ChangeLog
index d1045a0f45..b31353b24e 100644
--- a/wombat/ChangeLog
+++ b/wombat/ChangeLog
@@ -1,3 +1,8 @@
+2001-03-27 Dietmar Maurer <dietmar@ximian.com>
+
+ * wombat-moniker.c (wombat_moniker_resolve): we can now resolve to
+ storages and streams.
+
2001-03-26 Kjartan Maraas <kmaraas@gnome.org>
* wombat.c: Replace <gnome.h> <and <bonobo.h> includes
diff --git a/wombat/wombat-moniker.c b/wombat/wombat-moniker.c
index ffd3262d78..4083820977 100644
--- a/wombat/wombat-moniker.c
+++ b/wombat/wombat-moniker.c
@@ -3,6 +3,7 @@
#include <bonobo/bonobo-moniker-simple.h>
#include <bonobo/bonobo-moniker-util.h>
#include <bonobo/bonobo-exception.h>
+#include <bonobo/bonobo-storage.h>
#include "wombat-moniker.h"
#define DEFAULT_DB_URL "xmldb:/tmp/wombat-default-config.xmldb"
@@ -10,6 +11,64 @@
#define DB_URL (DEFAULT_DB_URL "#" USER_DB_URL)
+Bonobo_Storage
+wombat_root_storage (CORBA_Environment *ev)
+{
+ static BonoboStorage *root = NULL;
+ char *path;
+
+ if (!root) {
+ path = g_strconcat (g_get_home_dir (), "/evolution/config",
+ NULL);
+
+ root = bonobo_storage_open_full (BONOBO_IO_DRIVER_FS, path,
+ Bonobo_Storage_CREATE, 0664,
+ ev);
+
+ g_free (path);
+
+ if (BONOBO_EX (ev) || !root)
+ return CORBA_OBJECT_NIL;
+ }
+
+ return BONOBO_OBJREF (root);
+}
+
+static Bonobo_Storage
+wombat_lookup_storage (const char *name,
+ CORBA_Environment *ev)
+{
+ Bonobo_Storage root;
+
+ if ((root = wombat_root_storage (ev)) == CORBA_OBJECT_NIL)
+ return CORBA_OBJECT_NIL;
+
+ if (!strcmp (name, ""))
+ return bonobo_object_dup_ref (root, ev);
+
+ return Bonobo_Storage_openStorage (root, name, Bonobo_Storage_CREATE,
+ ev);
+}
+
+static Bonobo_Storage
+wombat_lookup_stream (const char *name,
+ CORBA_Environment *ev)
+{
+ Bonobo_Storage root;
+
+ if (!strcmp (name, "")) {
+ bonobo_exception_set (ev, ex_Bonobo_Storage_NotFound);
+ return CORBA_OBJECT_NIL;
+ }
+
+ if ((root = wombat_root_storage (ev)) == CORBA_OBJECT_NIL)
+ return CORBA_OBJECT_NIL;
+
+
+ return Bonobo_Storage_openStream (root, name, Bonobo_Storage_CREATE,
+ ev);
+}
+
static CORBA_Object
wombat_lookup_db (CORBA_Environment *ev)
{
@@ -31,6 +90,8 @@ wombat_moniker_resolve (BonoboMoniker *moniker,
CORBA_Object db;
Bonobo_Moniker parent;
const gchar *name;
+ Bonobo_Storage storage;
+ Bonobo_Stream stream;
parent = bonobo_moniker_get_parent (moniker, ev);
if (BONOBO_EX (ev))
@@ -51,12 +112,16 @@ wombat_moniker_resolve (BonoboMoniker *moniker,
if (!strcmp (interface, "IDL:Bonobo/Storage:1.0")) {
- /* fixme: */
+ storage = wombat_lookup_storage (name, ev);
+
+ return storage;
}
if (!strcmp (interface, "IDL:Bonobo/Stream:1.0")) {
-
- /* fixme: */
+
+ stream = wombat_lookup_stream (name, ev);
+
+ return stream;
}
if (!strcmp (interface, "IDL:Bonobo/ConfigDatabase:1.0")) {