diff options
author | Hans Petter Jansson <hpj@ximian.com> | 2003-12-17 00:46:23 +0000 |
---|---|---|
committer | Hans Petter <hansp@src.gnome.org> | 2003-12-17 00:46:23 +0000 |
commit | 5ea27bc7a765be43b528661a314f85a8763289dd (patch) | |
tree | fdf6c80cc0c9b773d5689b209f312ff80a8b97fc | |
parent | 8c76cacf3a622a9366c5ea825728e8576b465ed8 (diff) | |
download | evolution-data-server-5ea27bc7a765be43b528661a314f85a8763289dd.tar.gz |
Ref and keep the loaded ESource around. Unref old source if present.
2003-12-16 Hans Petter Jansson <hpj@ximian.com>
* libebook/e-book.c (fetch_corba_book): Ref and keep the loaded
ESource around. Unref old source if present.
(e_book_get_source): Implement.
(e_book_init): Init source pointer.
(e_book_dispose): Unref source, if any.
-rw-r--r-- | addressbook/ChangeLog | 8 | ||||
-rw-r--r-- | addressbook/libebook/e-book.c | 17 | ||||
-rw-r--r-- | addressbook/libebook/e-book.h | 1 |
3 files changed, 26 insertions, 0 deletions
diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog index 316f2195e..2126fe406 100644 --- a/addressbook/ChangeLog +++ b/addressbook/ChangeLog @@ -1,3 +1,11 @@ +2003-12-16 Hans Petter Jansson <hpj@ximian.com> + + * libebook/e-book.c (fetch_corba_book): Ref and keep the loaded + ESource around. Unref old source if present. + (e_book_get_source): Implement. + (e_book_init): Init source pointer. + (e_book_dispose): Unref source, if any. + 2003-12-15 Hans Petter Jansson <hpj@ximian.com> * libebook/e-contact.c (adr_getter): Initialize the address_format diff --git a/addressbook/libebook/e-book.c b/addressbook/libebook/e-book.c index 0ea7cf0d3..9eabd37ea 100644 --- a/addressbook/libebook/e-book.c +++ b/addressbook/libebook/e-book.c @@ -102,7 +102,9 @@ struct _EBookPrivate { GMutex *mutex; + /* Need to keep URI around, since the getter returns const */ gchar *uri; + ESource *source; gulong listener_signal; gulong died_signal; @@ -1663,6 +1665,11 @@ fetch_corba_book (EBook *book, g_free (book->priv->uri); book->priv->uri = uri; + g_object_ref (source); + if (book->priv->source) + g_object_unref (book->priv->source); + book->priv->source = source; + source_xml = e_source_to_standalone_xml (source); for (l = factories; l; l = l->next) { @@ -1817,6 +1824,12 @@ e_book_get_uri (EBook *book) return book->priv->uri; } +ESource * +e_book_get_source (EBook *book) +{ + return book->priv->source; +} + const char * e_book_get_static_capabilities (EBook *book, GError **error) @@ -2022,6 +2035,7 @@ e_book_init (EBook *book) book->priv = g_new0 (EBookPrivate, 1); book->priv->load_state = E_BOOK_URI_NOT_LOADED; book->priv->uri = NULL; + book->priv->source = NULL; book->priv->mutex = g_mutex_new (); } @@ -2067,6 +2081,9 @@ e_book_dispose (GObject *object) g_free (book->priv->uri); + if (book->priv->source) + g_object_unref (book->priv->source); + g_free (book->priv); book->priv = NULL; } diff --git a/addressbook/libebook/e-book.h b/addressbook/libebook/e-book.h index dc6972863..5a43ca719 100644 --- a/addressbook/libebook/e-book.h +++ b/addressbook/libebook/e-book.h @@ -143,6 +143,7 @@ gboolean e_book_get_changes (EBook *book, void e_book_free_change_list (GList *change_list); const char *e_book_get_uri (EBook *book); +ESource *e_book_get_source (EBook *book); const char *e_book_get_static_capabilities (EBook *book, GError **error); |