diff options
author | Dietmar Maurer <dietmar@ximian.com> | 2001-03-21 22:55:09 +0800 |
---|---|---|
committer | Dietmar Maurer <dietmar@src.gnome.org> | 2001-03-21 22:55:09 +0800 |
commit | 0cf839a464d506c810806b77eccb56d63ea51086 (patch) | |
tree | 5107c987adf52d5ec97c039f8e6f5da63c32dd17 /wombat | |
parent | 33688c3aece916519259f177b3fa0d2af76ca725 (diff) | |
download | gsoc2013-evolution-0cf839a464d506c810806b77eccb56d63ea51086.tar gsoc2013-evolution-0cf839a464d506c810806b77eccb56d63ea51086.tar.gz gsoc2013-evolution-0cf839a464d506c810806b77eccb56d63ea51086.tar.bz2 gsoc2013-evolution-0cf839a464d506c810806b77eccb56d63ea51086.tar.lz gsoc2013-evolution-0cf839a464d506c810806b77eccb56d63ea51086.tar.xz gsoc2013-evolution-0cf839a464d506c810806b77eccb56d63ea51086.tar.zst gsoc2013-evolution-0cf839a464d506c810806b77eccb56d63ea51086.zip |
initialise the moniker factory
2001-03-21 Dietmar Maurer <dietmar@ximian.com>
* wombat.c (setup_config): initialise the moniker factory
* GNOME_Evolution_Wombat.oaf.in: added the necessary entries for
the wombat moniker.
* wombat-moniker.[ch]: wombat is now a moniker
svn path=/trunk/; revision=8866
Diffstat (limited to 'wombat')
-rw-r--r-- | wombat/ChangeLog | 9 | ||||
-rw-r--r-- | wombat/GNOME_Evolution_Wombat.oaf.in | 20 | ||||
-rw-r--r-- | wombat/Makefile.am | 3 | ||||
-rw-r--r-- | wombat/wombat-moniker.c | 92 | ||||
-rw-r--r-- | wombat/wombat-moniker.h | 11 | ||||
-rw-r--r-- | wombat/wombat.c | 12 |
6 files changed, 146 insertions, 1 deletions
diff --git a/wombat/ChangeLog b/wombat/ChangeLog index bf205db52a..0a42871fab 100644 --- a/wombat/ChangeLog +++ b/wombat/ChangeLog @@ -1,3 +1,12 @@ +2001-03-21 Dietmar Maurer <dietmar@ximian.com> + + * wombat.c (setup_config): initialise the moniker factory + + * GNOME_Evolution_Wombat.oaf.in: added the necessary entries for + the wombat moniker. + + * wombat-moniker.[ch]: wombat is now a moniker + 2001-03-15 Jon Trowbridge <trow@ximian.com> * wombat.c (main): If we can't initialize a service on startup, diff --git a/wombat/GNOME_Evolution_Wombat.oaf.in b/wombat/GNOME_Evolution_Wombat.oaf.in index 4c1b2875fd..d863204a35 100644 --- a/wombat/GNOME_Evolution_Wombat.oaf.in +++ b/wombat/GNOME_Evolution_Wombat.oaf.in @@ -27,4 +27,24 @@ </oaf_server> +<oaf_server iid="OAFIID:Bonobo_Moniker_wombat_Factory" type="exe" location="wombat"> + <oaf_attribute name="repo_ids" type="stringv"> + <item value="IDL:GNOME/GenericFactory:1.0"/> + </oaf_attribute> + + <oaf_attribute name="name" type="string" value="XML Database Moniker factory"/> +</oaf_server> + +<oaf_server iid="OAFIID:Bonobo_Moniker_wombat" type="factory" + location="OAFIID:Bonobo_Moniker_wombat_Factory"> + <oaf_attribute name="repo_ids" type="stringv"> + <item value="IDL:Bonobo/Moniker:1.0"/> + <item value="IDL:Bonobo/Unknown:1.0"/> + </oaf_attribute> + <oaf_attribute name="name" type="string" value="wombat Moniker"/> + <oaf_attribute name="bonobo:moniker" type="stringv"> + <item value="wombat:"/> + </oaf_attribute> +</oaf_server> + </oaf_info> diff --git a/wombat/Makefile.am b/wombat/Makefile.am index c36a7d4741..1ba59269bf 100644 --- a/wombat/Makefile.am +++ b/wombat/Makefile.am @@ -17,7 +17,8 @@ INCLUDES = \ bin_PROGRAMS = \ wombat -wombat_SOURCES = \ +wombat_SOURCES = \ + wombat-moniker.c \ wombat.c wombat_LDADD = \ diff --git a/wombat/wombat-moniker.c b/wombat/wombat-moniker.c new file mode 100644 index 0000000000..ffd3262d78 --- /dev/null +++ b/wombat/wombat-moniker.c @@ -0,0 +1,92 @@ +#include <config.h> + +#include <bonobo/bonobo-moniker-simple.h> +#include <bonobo/bonobo-moniker-util.h> +#include <bonobo/bonobo-exception.h> +#include "wombat-moniker.h" + +#define DEFAULT_DB_URL "xmldb:/tmp/wombat-default-config.xmldb" +#define USER_DB_URL "xmldb:~/evolution/config.xmldb" + +#define DB_URL (DEFAULT_DB_URL "#" USER_DB_URL) + +static CORBA_Object +wombat_lookup_db (CORBA_Environment *ev) +{ + static CORBA_Object db = CORBA_OBJECT_NIL; + + if (db == CORBA_OBJECT_NIL) + db = bonobo_get_object (DB_URL, + "IDL:Bonobo/ConfigDatabase:1.0", ev); + + return db; +} + +Bonobo_Unknown +wombat_moniker_resolve (BonoboMoniker *moniker, + const Bonobo_ResolveOptions *options, + const CORBA_char *interface, + CORBA_Environment *ev) +{ + CORBA_Object db; + Bonobo_Moniker parent; + const gchar *name; + + parent = bonobo_moniker_get_parent (moniker, ev); + if (BONOBO_EX (ev)) + return CORBA_OBJECT_NIL; + + name = bonobo_moniker_get_name (moniker); + + if (parent != CORBA_OBJECT_NIL) { + + g_warning ("wombat: parent moniker are not supproted"); + + bonobo_object_release_unref (parent, ev); + + bonobo_exception_set (ev, ex_Bonobo_Moniker_InterfaceNotFound); + + return CORBA_OBJECT_NIL; + } + + if (!strcmp (interface, "IDL:Bonobo/Storage:1.0")) { + + /* fixme: */ + } + + if (!strcmp (interface, "IDL:Bonobo/Stream:1.0")) { + + /* fixme: */ + } + + if (!strcmp (interface, "IDL:Bonobo/ConfigDatabase:1.0")) { + + if (strcmp (name, "")) + g_warning ("wombat: unused moniker name"); + + if ((db = wombat_lookup_db (ev)) != CORBA_OBJECT_NIL) + return db; + } + + bonobo_exception_set (ev, ex_Bonobo_Moniker_InterfaceNotFound); + return CORBA_OBJECT_NIL; +} + +BonoboObject * +wombat_moniker_factory (BonoboGenericFactory *this, + const char *object_id, + void *data) +{ + g_return_val_if_fail (object_id != NULL, NULL); + + if (!strcmp (object_id, "OAFIID:Bonobo_Moniker_wombat")) + + return BONOBO_OBJECT (bonobo_moniker_simple_new ( + "wombat:", wombat_moniker_resolve)); + + else + g_warning ("Failing to manufacture a '%s'", object_id); + + return NULL; +} + diff --git a/wombat/wombat-moniker.h b/wombat/wombat-moniker.h new file mode 100644 index 0000000000..46ebcf79c8 --- /dev/null +++ b/wombat/wombat-moniker.h @@ -0,0 +1,11 @@ +#ifndef _MONIKER_WOMBAT_H_ +#define _MONIKER_WOMBAT_H_ + +#include <bonobo/bonobo-generic-factory.h> + +BonoboObject * +wombat_moniker_factory (BonoboGenericFactory *this, + const char *object_id, + void *data); + +#endif diff --git a/wombat/wombat.c b/wombat/wombat.c index 29bd87b217..f5baae4610 100644 --- a/wombat/wombat.c +++ b/wombat/wombat.c @@ -20,6 +20,8 @@ #include "calendar/pcs/cal-factory.h" #include "calendar/pcs/cal-backend-file.h" +#include "wombat-moniker.h" + /* The and addressbook calendar factories */ static CalFactory *cal_factory; @@ -143,6 +145,16 @@ setup_pcs (int argc, char **argv) static gboolean setup_config (int argc, char **argv) { + BonoboGenericFactory *factory; + char *oafiid = "OAFIID:Bonobo_Moniker_wombat_Factory"; + + factory = bonobo_generic_factory_new_multi (oafiid, + wombat_moniker_factory, + NULL); + + // bonobo_running_context_auto_exit_unref (BONOBO_OBJECT (factory)); + + return TRUE; } |