aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/gui
diff options
context:
space:
mode:
authorChris Toshok <toshok@ximian.com>2001-10-28 11:04:53 +0800
committerChris Toshok <toshok@src.gnome.org>2001-10-28 11:04:53 +0800
commita9491dff65271a8c6b643450938df0af74bad52c (patch)
treeb483ba56b5650f3d51fdc869f21eeba3d689f9a6 /addressbook/gui
parent14557ba81ad6630a1012430e8965c0f08edcc0f0 (diff)
downloadgsoc2013-evolution-a9491dff65271a8c6b643450938df0af74bad52c.tar.gz
gsoc2013-evolution-a9491dff65271a8c6b643450938df0af74bad52c.tar.zst
gsoc2013-evolution-a9491dff65271a8c6b643450938df0af74bad52c.zip
change to EBookCallback signature, and unref the book. (add_card_idle_cb):
2001-10-27 Chris Toshok <toshok@ximian.com> * gui/component/e-address-popup.c (email_table_save_card_cb): change to EBookCallback signature, and unref the book. (add_card_idle_cb): use addressbook_load_default_book, and call the cb if it fails. (e_address_popup_cleanup): fix type -- should be "pop->card = NULL", not "pop = NULL". (contact_editor_cb): change to EBookCallback signature. (edit_contact_info_cb): use addressbook_load_default_book. (start_query): change to EBookCallback signature. (e_address_popup_query): use addressbook_load_default_book. * gui/widgets/e-minicard-control.c (book_open_cb): change to EBookCallback signature, and unref the book. (save_in_addressbook): use addressbook_load_default_book instead of e_book_use_local_address_book. * gui/widgets/Makefile.am (INCLUDES): change includes since we're including addressbook.h which has it's own set of funky include path requirements. svn path=/trunk/; revision=14268
Diffstat (limited to 'addressbook/gui')
-rw-r--r--addressbook/gui/component/e-address-popup.c36
-rw-r--r--addressbook/gui/widgets/Makefile.am3
-rw-r--r--addressbook/gui/widgets/e-minicard-control.c13
3 files changed, 42 insertions, 10 deletions
diff --git a/addressbook/gui/component/e-address-popup.c b/addressbook/gui/component/e-address-popup.c
index c554fd8d9b..7c04cc0130 100644
--- a/addressbook/gui/component/e-address-popup.c
+++ b/addressbook/gui/component/e-address-popup.c
@@ -29,6 +29,7 @@
*/
#include <config.h>
+#include "addressbook.h"
#include "e-address-popup.h"
#include <bonobo/bonobo-control.h>
#include <bonobo/bonobo-property-bag.h>
@@ -384,12 +385,13 @@ email_table_to_card (EMailTable *et)
}
static void
-email_table_save_card_cb (EBook *book, gpointer closure)
+email_table_save_card_cb (EBook *book, EBookStatus status, gpointer closure)
{
ECard *card = E_CARD (closure);
if (book) {
e_book_commit_card (book, card, NULL, NULL);
+ gtk_object_unref (GTK_OBJECT (book));
}
gtk_object_unref (GTK_OBJECT (card));
}
@@ -401,7 +403,14 @@ email_table_save_card_cb (EBook *book, gpointer closure)
static gint
add_card_idle_cb (gpointer closure)
{
- e_book_use_local_address_book (email_table_save_card_cb, closure);
+ EBook *book;
+
+ book = e_book_new ();
+ if (!addressbook_load_default_book (book, email_table_save_card_cb, closure)) {
+ gtk_object_unref (GTK_OBJECT (book));
+ email_table_save_card_cb (NULL, E_BOOK_STATUS_OTHER_ERROR, closure);
+ }
+
return 0;
}
@@ -680,7 +689,7 @@ e_address_popup_cleanup (EAddressPopup *pop)
{
if (pop->card) {
gtk_object_unref (GTK_OBJECT (pop->card));
- pop = NULL;
+ pop->card = NULL;
}
if (pop->scheduled_refresh) {
@@ -923,7 +932,7 @@ emit_event (EAddressPopup *pop, const char *event)
}
static void
-contact_editor_cb (EBook *book, gpointer closure)
+contact_editor_cb (EBook *book, EBookStatus status, gpointer closure)
{
EAddressPopup *pop = E_ADDRESS_POPUP (closure);
EContactEditor *ce = e_addressbook_show_contact_editor (book, pop->card, FALSE, TRUE);
@@ -935,8 +944,14 @@ contact_editor_cb (EBook *book, gpointer closure)
static void
edit_contact_info_cb (EAddressPopup *pop)
{
+ EBook *book;
emit_event (pop, "Hide");
- e_book_use_local_address_book (contact_editor_cb, pop);
+
+ book = e_book_new ();
+ if (!addressbook_load_default_book (book, contact_editor_cb, pop)) {
+ gtk_object_unref (GTK_OBJECT (book));
+ contact_editor_cb (NULL, E_BOOK_STATUS_OTHER_ERROR, pop);
+ }
}
static void
@@ -1113,7 +1128,7 @@ query_cb (EBook *book, EBookSimpleQueryStatus status, const GList *cards, gpoint
}
static void
-start_query (EBook *book, gpointer closure)
+start_query (EBook *book, EBookStatus status, gpointer closure)
{
EAddressPopup *pop = E_ADDRESS_POPUP (closure);
@@ -1135,10 +1150,17 @@ start_query (EBook *book, gpointer closure)
static void
e_address_popup_query (EAddressPopup *pop)
{
+ EBook *book;
+
g_return_if_fail (pop && E_IS_ADDRESS_POPUP (pop));
+ book = e_book_new ();
gtk_object_ref (GTK_OBJECT (pop));
- e_book_use_local_address_book (start_query, pop);
+
+ if (!addressbook_load_default_book (book, start_query, pop)) {
+ gtk_object_unref (GTK_OBJECT (book));
+ start_query (NULL, E_BOOK_STATUS_OTHER_ERROR, pop);
+ }
}
/** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** **/
diff --git a/addressbook/gui/widgets/Makefile.am b/addressbook/gui/widgets/Makefile.am
index 39da68797c..7e1a72e56e 100644
--- a/addressbook/gui/widgets/Makefile.am
+++ b/addressbook/gui/widgets/Makefile.am
@@ -4,9 +4,10 @@ INCLUDES = \
-DEVOLUTION_DATADIR=\""$(datadir)"\" \
-DEVOLUTION_IMAGESDIR=\""$(datadir)"/images/evolution\" \
-I$(top_srcdir) \
- -I$(top_srcdir)/addressbook/backend/ebook \
+ -I$(top_srcdir)/addressbook/backend \
-I$(top_srcdir)/addressbook/gui/contact-editor \
-I$(top_srcdir)/addressbook/gui/merging \
+ -I$(top_srcdir)/addressbook/gui/component \
-I$(top_srcdir)/widgets/misc \
-I$(top_builddir)/shell \
$(BONOBO_GNOME_CFLAGS) \
diff --git a/addressbook/gui/widgets/e-minicard-control.c b/addressbook/gui/widgets/e-minicard-control.c
index 32a8a7cdc9..73417af78c 100644
--- a/addressbook/gui/widgets/e-minicard-control.c
+++ b/addressbook/gui/widgets/e-minicard-control.c
@@ -19,6 +19,8 @@
#include <addressbook/backend/ebook/e-card.h>
#include <gal/util/e-util.h>
+#include <addressbook/gui/component/addressbook.h>
+
#include "e-minicard-control.h"
#include "e-minicard-widget.h"
#include "e-card-merging.h"
@@ -240,7 +242,7 @@ pstream_get_content_types (BonoboPersistStream *ps, void *closure,
}
static void
-book_open_cb (EBook *book, gpointer closure)
+book_open_cb (EBook *book, EBookStatus status, gpointer closure)
{
GList *list = closure;
if (book) {
@@ -248,6 +250,7 @@ book_open_cb (EBook *book, gpointer closure)
for (p = list; p; p = p->next) {
e_card_merging_book_add_card(book, p->data, NULL, NULL);
}
+ gtk_object_unref (GTK_OBJECT (book));
}
e_free_object_list (list);
}
@@ -257,13 +260,19 @@ save_in_addressbook(GtkWidget *button, gpointer data)
{
EMinicardControl *minicard_control = data;
GList *list, *p;
+ EBook *book;
+
+ book = e_book_new ();
list = g_list_copy (minicard_control->card_list);
for (p = list; p; p = p->next)
gtk_object_ref (GTK_OBJECT (p->data));
- e_book_use_local_address_book (book_open_cb, list);
+ if (!addressbook_load_default_book (book, book_open_cb, list)) {
+ gtk_object_unref (GTK_OBJECT (book));
+ book_open_cb (NULL, E_BOOK_STATUS_OTHER_ERROR, list);
+ }
}
static void