diff options
author | Rodrigo Moya <rodrigo@ximian.com> | 2001-09-19 20:47:16 +0800 |
---|---|---|
committer | Rodrigo Moya <rodrigo@src.gnome.org> | 2001-09-19 20:47:16 +0800 |
commit | 85390babb97dabc9e9ad5e878ad0a9d1d49fdc83 (patch) | |
tree | 2a3310262808e76f634ac5a1d92531b7ad0513a3 /calendar/pcs | |
parent | 9ab4b45c155a49e2109a6dee3a315cce54d3bf16 (diff) | |
download | gsoc2013-evolution-85390babb97dabc9e9ad5e878ad0a9d1d49fdc83.tar.gz gsoc2013-evolution-85390babb97dabc9e9ad5e878ad0a9d1d49fdc83.tar.zst gsoc2013-evolution-85390babb97dabc9e9ad5e878ad0a9d1d49fdc83.zip |
add a new parameter (const char *iid) to specify the OAFIID of the factory
2001-09-19 Rodrigo Moya <rodrigo@ximian.com>
* pcs/cal-factory.c (cal_factory_oaf_register): add a new parameter
(const char *iid) to specify the OAFIID of the factory being
registered
svn path=/trunk/; revision=12977
Diffstat (limited to 'calendar/pcs')
-rw-r--r-- | calendar/pcs/cal-factory.c | 25 | ||||
-rw-r--r-- | calendar/pcs/cal-factory.h | 2 |
2 files changed, 21 insertions, 6 deletions
diff --git a/calendar/pcs/cal-factory.c b/calendar/pcs/cal-factory.c index 86090fc2bb..00f6d8b6da 100644 --- a/calendar/pcs/cal-factory.c +++ b/calendar/pcs/cal-factory.c @@ -30,8 +30,8 @@ #include "cal-factory.h" #include "job.h" -#define PARENT_TYPE BONOBO_X_OBJECT_TYPE -#define CAL_FACTORY_OAF_ID "OAFIID:GNOME_Evolution_Wombat_CalendarFactory" +#define PARENT_TYPE BONOBO_X_OBJECT_TYPE +#define DEFAULT_CAL_FACTORY_OAF_ID "OAFIID:GNOME_Evolution_Wombat_CalendarFactory" static BonoboXObjectClass *parent_class; @@ -43,6 +43,9 @@ struct _CalFactoryPrivate { /* Hash table from GnomeVFSURI structures to CalBackend objects */ GHashTable *backends; + /* OAFIID of the factory */ + char *iid; + /* Whether we have been registered with OAF yet */ guint registered : 1; }; @@ -469,9 +472,10 @@ cal_factory_destroy (GtkObject *object) priv->backends = NULL; if (priv->registered) { - oaf_active_server_unregister (CAL_FACTORY_OAF_ID, BONOBO_OBJREF (factory)); + oaf_active_server_unregister (priv->iid, BONOBO_OBJREF (factory)); priv->registered = FALSE; } + g_free (priv->iid); g_free (priv); factory->priv = NULL; @@ -543,6 +547,7 @@ str_tolower (const char *s) /** * cal_factory_oaf_register: * @factory: A calendar factory. + * @iid: OAFIID for the factory to be registered. * * Registers a calendar factory with the OAF object activation daemon. This * function must be called before any clients can activate the factory. @@ -550,10 +555,11 @@ str_tolower (const char *s) * Return value: TRUE on success, FALSE otherwise. **/ gboolean -cal_factory_oaf_register (CalFactory *factory) +cal_factory_oaf_register (CalFactory *factory, const char *iid) { CalFactoryPrivate *priv; OAF_RegistrationResult result; + char *tmp_iid; g_return_val_if_fail (factory != NULL, FALSE); g_return_val_if_fail (IS_CAL_FACTORY (factory), FALSE); @@ -562,11 +568,18 @@ cal_factory_oaf_register (CalFactory *factory) g_return_val_if_fail (!priv->registered, FALSE); - result = oaf_active_server_register (CAL_FACTORY_OAF_ID, BONOBO_OBJREF (factory)); + /* if iid is NULL, use the default factory OAFIID */ + if (iid) + tmp_iid = g_strdup (iid); + else + tmp_iid = g_strdup (DEFAULT_CAL_FACTORY_OAF_ID); + + result = oaf_active_server_register (tmp_iid, BONOBO_OBJREF (factory)); switch (result) { case OAF_REG_SUCCESS: priv->registered = TRUE; + priv->iid = tmp_iid; return TRUE; case OAF_REG_NOT_LISTED: @@ -586,6 +599,8 @@ cal_factory_oaf_register (CalFactory *factory) break; } + g_free (tmp_iid); + return FALSE; } diff --git a/calendar/pcs/cal-factory.h b/calendar/pcs/cal-factory.h index 008fc2c36d..434cb56f81 100644 --- a/calendar/pcs/cal-factory.h +++ b/calendar/pcs/cal-factory.h @@ -62,7 +62,7 @@ struct _CalFactoryClass { GtkType cal_factory_get_type (void); CalFactory *cal_factory_new (void); -gboolean cal_factory_oaf_register (CalFactory *factory); +gboolean cal_factory_oaf_register (CalFactory *factory, const char *iid); void cal_factory_register_method (CalFactory *factory, const char *method, GtkType backend_type); |