diff options
author | Federico Mena Quintero <federico@ximian.com> | 2001-02-21 06:35:19 +0800 |
---|---|---|
committer | Federico Mena Quintero <federico@src.gnome.org> | 2001-02-21 06:35:19 +0800 |
commit | f9a92db9a9b72e9e65f59f20469cc72e6c84186f (patch) | |
tree | 0202266b7bd093a40eb9aed7f334907f3ea45a6e | |
parent | 3be64e5b653331f72e2431d81336b740acbe2d97 (diff) | |
download | gsoc2013-evolution-f9a92db9a9b72e9e65f59f20469cc72e6c84186f.tar.gz gsoc2013-evolution-f9a92db9a9b72e9e65f59f20469cc72e6c84186f.tar.zst gsoc2013-evolution-f9a92db9a9b72e9e65f59f20469cc72e6c84186f.zip |
Moved the register_factory() code to here, since it was the only thing
2001-02-20 Federico Mena Quintero <federico@ximian.com>
* backend/pas/pas-book-factory.c (pas_book_factory_activate):
Moved the register_factory() code to here, since it was the only
thing being called anyways.
(PasBookFactoryPrivate): Added a "registered" flag.
(pas_book_factory_activate): Set the registered flag.
(pas_book_factory_destroy): Deactivate the factory when we go away.
svn path=/trunk/; revision=8307
-rw-r--r-- | addressbook/ChangeLog | 9 | ||||
-rw-r--r-- | addressbook/backend/pas/pas-book-factory.c | 43 |
2 files changed, 38 insertions, 14 deletions
diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog index 4d13b3f592..6e875fc5b4 100644 --- a/addressbook/ChangeLog +++ b/addressbook/ChangeLog @@ -1,3 +1,12 @@ +2001-02-20 Federico Mena Quintero <federico@ximian.com> + + * backend/pas/pas-book-factory.c (pas_book_factory_activate): + Moved the register_factory() code to here, since it was the only + thing being called anyways. + (PasBookFactoryPrivate): Added a "registered" flag. + (pas_book_factory_activate): Set the registered flag. + (pas_book_factory_destroy): Deactivate the factory when we go away. + 2001-02-20 Chris Toshok <toshok@ximian.com> * backend/ebook/e-book.c (e_book_get_supported_fields): new function. diff --git a/addressbook/backend/pas/pas-book-factory.c b/addressbook/backend/pas/pas-book-factory.c index e1470c1fad..54fbd2de84 100644 --- a/addressbook/backend/pas/pas-book-factory.c +++ b/addressbook/backend/pas/pas-book-factory.c @@ -30,6 +30,9 @@ struct _PASBookFactoryPrivate { GHashTable *backends; GHashTable *active_server_map; GList *queued_requests; + + /* Whether the factory has been registered with OAF yet */ + guint registered : 1; }; /* Signal IDs */ @@ -419,17 +422,32 @@ pas_book_factory_new (void) return factory; } -static gboolean -register_factory (CORBA_Object obj) +/** + * pas_book_factory_activate: + */ +gboolean +pas_book_factory_activate (PASBookFactory *factory) { + PASBookFactoryPrivate *priv; + CORBA_Object obj; OAF_RegistrationResult result; + g_return_val_if_fail (factory != NULL, FALSE); + g_return_val_if_fail (PAS_IS_BOOK_FACTORY (factory), FALSE); + + priv = factory->priv; + + g_return_val_if_fail (!priv->registered, FALSE); + puts ("about to register addressbook"); + obj = bonobo_object_corba_objref (BONOBO_OBJECT (factory)); + result = oaf_active_server_register (PAS_BOOK_FACTORY_OAF_ID, obj); switch (result) { case OAF_REG_SUCCESS: + priv->registered = TRUE; return TRUE; case OAF_REG_NOT_LISTED: g_message ("Error registering the PAS factory: not listed"); @@ -444,18 +462,6 @@ register_factory (CORBA_Object obj) } } -/** - * pas_book_factory_activate: - */ -gboolean -pas_book_factory_activate (PASBookFactory *factory) -{ - g_return_val_if_fail (factory != NULL, FALSE); - g_return_val_if_fail (PAS_IS_BOOK_FACTORY (factory), FALSE); - - return register_factory (bonobo_object_corba_objref (BONOBO_OBJECT (factory))); -} - static void pas_book_factory_init (PASBookFactory *factory) { @@ -464,6 +470,7 @@ pas_book_factory_init (PASBookFactory *factory) factory->priv->active_server_map = g_hash_table_new (g_str_hash, g_str_equal); factory->priv->backends = g_hash_table_new (g_str_hash, g_str_equal); factory->priv->queued_requests = NULL; + factory->priv->registered = FALSE; } static void @@ -520,6 +527,14 @@ pas_book_factory_destroy (GtkObject *object) NULL); g_hash_table_destroy (factory->priv->backends); factory->priv->backends = NULL; + + if (factory->priv->registered) { + CORBA_Object obj; + + obj = bonobo_object_corba_objref (BONOBO_OBJECT (factory)); + oaf_active_server_unregister (PAS_BOOK_FACTORY_OAF_ID, obj); + factory->priv->registered = FALSE; + } g_free (factory->priv); |