aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook
diff options
context:
space:
mode:
authorJP Rosevear <jpr@ximian.com>2003-05-15 02:44:27 +0800
committerJP Rosevear <jpr@src.gnome.org>2003-05-15 02:44:27 +0800
commit0203f5de7608f34c6510948b36f522c4c3a87fef (patch)
treead2cb3601cc04bff1993794236b3410b4d3d2040 /addressbook
parentd49d8a2f15034c24cc67ac3922570d95643c39a5 (diff)
downloadgsoc2013-evolution-0203f5de7608f34c6510948b36f522c4c3a87fef.tar
gsoc2013-evolution-0203f5de7608f34c6510948b36f522c4c3a87fef.tar.gz
gsoc2013-evolution-0203f5de7608f34c6510948b36f522c4c3a87fef.tar.bz2
gsoc2013-evolution-0203f5de7608f34c6510948b36f522c4c3a87fef.tar.lz
gsoc2013-evolution-0203f5de7608f34c6510948b36f522c4c3a87fef.tar.xz
gsoc2013-evolution-0203f5de7608f34c6510948b36f522c4c3a87fef.tar.zst
gsoc2013-evolution-0203f5de7608f34c6510948b36f522c4c3a87fef.zip
clear the view (book_open_cb): track the book in the view, don't unref the
2003-05-14 JP Rosevear <jpr@ximian.com> * gui/component/addressbook.c (addressbook_view_unref): clear the view (book_open_cb): track the book in the view, don't unref the book (set_prop): set the book (retrieve_shell_view_interface_from_control): get the shell view every time (set_folder_bar_label): release and unref the shell view * gui/component/addressbook-storage.h: add proto * gui/component/addressbook-storage.c (addressbook_storage_cleanup): unref the storage * gui/component/addressbook-component.c (owner_unset_cb): clean up storage * backend/ebook/e-book.c (e_book_load_uri): track the listener signal (e_book_dispose): unref the listener and disconnect the signal svn path=/trunk/; revision=21179
Diffstat (limited to 'addressbook')
-rw-r--r--addressbook/ChangeLog22
-rw-r--r--addressbook/backend/ebook/e-book.c13
-rw-r--r--addressbook/gui/component/addressbook-component.c2
-rw-r--r--addressbook/gui/component/addressbook-storage.c9
-rw-r--r--addressbook/gui/component/addressbook-storage.h1
-rw-r--r--addressbook/gui/component/addressbook.c89
6 files changed, 72 insertions, 64 deletions
diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog
index f21d687ee7..9df678ecb8 100644
--- a/addressbook/ChangeLog
+++ b/addressbook/ChangeLog
@@ -1,3 +1,25 @@
+2003-05-14 JP Rosevear <jpr@ximian.com>
+
+ * gui/component/addressbook.c (addressbook_view_unref): clear the
+ view
+ (book_open_cb): track the book in the view, don't unref the book
+ (set_prop): set the book
+ (retrieve_shell_view_interface_from_control): get the shell view
+ every time
+ (set_folder_bar_label): release and unref the shell view
+
+ * gui/component/addressbook-storage.h: add proto
+
+ * gui/component/addressbook-storage.c
+ (addressbook_storage_cleanup): unref the storage
+
+ * gui/component/addressbook-component.c (owner_unset_cb): clean up
+ storage
+
+ * backend/ebook/e-book.c (e_book_load_uri): track the listener
+ signal
+ (e_book_dispose): unref the listener and disconnect the signal
+
2003-05-13 Chris Toshok <toshok@ximian.com>
* gui/component/select-names/e-select-names-text-model.c
diff --git a/addressbook/backend/ebook/e-book.c b/addressbook/backend/ebook/e-book.c
index c20f0e7c5c..7cf33d09c0 100644
--- a/addressbook/backend/ebook/e-book.c
+++ b/addressbook/backend/ebook/e-book.c
@@ -57,6 +57,7 @@ struct _EBookPrivate {
gchar *uri;
+ gulong listener_signal;
gulong died_signal;
};
@@ -773,8 +774,8 @@ e_book_load_uri (EBook *book,
return;
}
- g_signal_connect (book->priv->listener, "responses_queued",
- G_CALLBACK (e_book_check_listener_queue), book);
+ book->priv->listener_signal = g_signal_connect (book->priv->listener, "responses_queued",
+ G_CALLBACK (e_book_check_listener_queue), book);
load_uri_data = g_new (EBookLoadURIData, 1);
load_uri_data->open_response = open_response;
@@ -1605,9 +1606,15 @@ e_book_dispose (GObject *object)
CORBA_exception_init (&ev);
}
}
-
+
CORBA_exception_free (&ev);
+ if (book->priv->listener) {
+ g_signal_handler_disconnect (book->priv->comp_listener, book->priv->listener_signal);
+ bonobo_object_unref (book->priv->listener);
+ book->priv->listener = NULL;
+ }
+
if (book->priv->comp_listener) {
g_signal_handler_disconnect (book->priv->comp_listener, book->priv->died_signal);
g_object_unref (book->priv->comp_listener);
diff --git a/addressbook/gui/component/addressbook-component.c b/addressbook/gui/component/addressbook-component.c
index b1db690d2a..04a1e3ebe7 100644
--- a/addressbook/gui/component/addressbook-component.c
+++ b/addressbook/gui/component/addressbook-component.c
@@ -390,6 +390,8 @@ owner_unset_cb (EvolutionShellComponent *shell_component,
if (owner_count == 0)
global_shell_client = NULL;
+
+ addressbook_storage_cleanup ();
}
/* FIXME We should perhaps take the time to figure out if the book is editable. */
diff --git a/addressbook/gui/component/addressbook-storage.c b/addressbook/gui/component/addressbook-storage.c
index 9b73b93b54..6f087b6c7e 100644
--- a/addressbook/gui/component/addressbook-storage.c
+++ b/addressbook/gui/component/addressbook-storage.c
@@ -107,6 +107,15 @@ addressbook_storage_setup (EvolutionShellComponent *shell_component,
#endif
}
+void
+addressbook_storage_cleanup (void)
+{
+ if (storage != NULL) {
+ bonobo_object_unref (storage);
+ storage = NULL;
+ }
+}
+
#ifdef HAVE_LDAP
static void
notify_listener (const Bonobo_Listener listener,
diff --git a/addressbook/gui/component/addressbook-storage.h b/addressbook/gui/component/addressbook-storage.h
index 1d0fc24b73..9a26abebd6 100644
--- a/addressbook/gui/component/addressbook-storage.h
+++ b/addressbook/gui/component/addressbook-storage.h
@@ -64,6 +64,7 @@ typedef struct {
void addressbook_storage_setup (EvolutionShellComponent *shell_component,
const char *evolution_homedir);
+void addressbook_storage_cleanup (void);
EvolutionStorage *addressbook_get_other_contact_storage (void);
GList *addressbook_storage_get_sources (void);
diff --git a/addressbook/gui/component/addressbook.c b/addressbook/gui/component/addressbook.c
index 39c4f2fcce..1d7586f886 100644
--- a/addressbook/gui/component/addressbook.c
+++ b/addressbook/gui/component/addressbook.c
@@ -77,6 +77,7 @@ typedef struct {
ESearchBar *search;
gint ecml_changed_id;
GtkWidget *vbox;
+ EBook *book;
EvolutionActivityClient *activity;
BonoboControl *control;
BonoboPropertyBag *properties;
@@ -422,23 +423,6 @@ control_activate_cb (BonoboControl *control,
}
}
-static void
-addressbook_view_ref (AddressbookView *view)
-{
- g_assert (view->refs > 0);
- ++view->refs;
-}
-
-static void
-addressbook_view_unref (AddressbookView *view)
-{
- g_assert (view->refs > 0);
- --view->refs;
- if (view->refs == 0) {
- g_free (view);
- }
-}
-
static ECategoriesMasterList *
get_master_list (void)
{
@@ -452,24 +436,15 @@ get_master_list (void)
static void
addressbook_view_clear (AddressbookView *view)
{
- EBook *book;
-
- if (view->uri && view->view) {
- g_object_get(view->view,
- "book", &book,
- NULL);
- g_object_unref (book);
+ if (view->book) {
+ g_object_unref (view->book);
+ view->book = NULL;
}
if (view->properties) {
bonobo_object_unref (BONOBO_OBJECT(view->properties));
view->properties = NULL;
}
-
- if (view->view) {
- gtk_widget_destroy (GTK_WIDGET (view->view));
- view->view = NULL;
- }
g_free(view->passwd);
view->passwd = NULL;
@@ -477,9 +452,6 @@ addressbook_view_clear (AddressbookView *view)
g_free(view->uri);
view->uri = NULL;
- if (view->refs == 0)
- g_free(view);
-
if (view->ecml_changed_id != 0) {
g_signal_handler_disconnect (get_master_list(),
view->ecml_changed_id);
@@ -488,16 +460,31 @@ addressbook_view_clear (AddressbookView *view)
}
static void
+addressbook_view_ref (AddressbookView *view)
+{
+ g_assert (view->refs > 0);
+ ++view->refs;
+}
+
+static void
+addressbook_view_unref (AddressbookView *view)
+{
+ g_assert (view->refs > 0);
+ --view->refs;
+ if (view->refs == 0) {
+ addressbook_view_clear (view);
+ g_free (view);
+ }
+}
+
+static void
book_open_cb (EBook *book, EBookStatus status, gpointer closure)
{
AddressbookView *view = closure;
if (status == E_BOOK_STATUS_SUCCESS) {
view->failed_to_load = FALSE;
-
- g_object_set(view->view,
- "book", book,
- NULL);
+ view->book = book;
}
else {
char *label_string;
@@ -562,17 +549,12 @@ book_open_cb (EBook *book, EBookStatus status, gpointer closure)
gtk_widget_show_all (warning_dialog);
}
-
- g_object_unref (book);
}
static void
destroy_callback(gpointer data, GObject *where_object_was)
{
AddressbookView *view = data;
- if (view->view && view->view->model && view->view->model->book_view)
- e_book_view_stop (view->view->model->book_view);
- addressbook_view_clear (view);
addressbook_view_unref (view);
}
@@ -767,20 +749,16 @@ set_prop (BonoboPropertyBag *bag,
AddressbookView *view = user_data;
char *uri_data;
- EBook *book;
switch (arg_id) {
case PROPERTY_FOLDER_URI_IDX:
- g_object_get(view->view,
- "book", &book,
- NULL);
if (view->uri) {
/* we've already had a uri set on this view, so unload it */
- e_book_unload_uri (book);
+ e_book_unload_uri (view->book);
g_free (view->uri);
} else {
- book = e_book_new ();
+ view->book = e_book_new ();
}
view->failed_to_load = FALSE;
@@ -789,7 +767,7 @@ set_prop (BonoboPropertyBag *bag,
uri_data = e_book_expand_uri (view->uri);
- addressbook_load_uri (book, uri_data, book_open_cb, view);
+ addressbook_load_uri (view->book, uri_data, book_open_cb, view);
g_free(uri_data);
@@ -920,12 +898,6 @@ retrieve_shell_view_interface_from_control (BonoboControl *control)
GNOME_Evolution_ShellView shell_view_interface;
CORBA_Environment ev;
- shell_view_interface = g_object_get_data (G_OBJECT (control),
- "shell_view_interface");
-
- if (shell_view_interface)
- return shell_view_interface;
-
control_frame = bonobo_control_get_control_frame (control, NULL);
if (control_frame == NULL)
@@ -937,13 +909,6 @@ retrieve_shell_view_interface_from_control (BonoboControl *control)
&ev);
CORBA_exception_free (&ev);
- if (shell_view_interface != CORBA_OBJECT_NIL)
- g_object_set_data (G_OBJECT (control),
- "shell_view_interface",
- shell_view_interface);
- else
- g_warning ("Control frame doesn't have Evolution/ShellView.");
-
return shell_view_interface;
}
@@ -1051,6 +1016,8 @@ set_folder_bar_label (EAddressbookView *eav, const char *message, AddressbookVie
bonobo_exception_get_text (&ev));
CORBA_exception_free (&ev);
+
+ bonobo_object_release_unref (shell_view_interface, NULL);
}
/* Our global singleton config database */