aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/gui
diff options
context:
space:
mode:
Diffstat (limited to 'addressbook/gui')
-rw-r--r--addressbook/gui/component/addressbook-migrate.c20
-rw-r--r--addressbook/gui/component/addressbook-view.c31
-rw-r--r--addressbook/gui/component/addressbook.c17
-rw-r--r--addressbook/gui/component/addressbook.h4
-rw-r--r--addressbook/gui/component/select-names/e-select-names-manager.c4
-rw-r--r--addressbook/gui/component/select-names/e-select-names.c4
-rw-r--r--addressbook/gui/contact-editor/e-contact-editor.c8
-rw-r--r--addressbook/gui/widgets/eab-gui-util.c4
8 files changed, 53 insertions, 39 deletions
diff --git a/addressbook/gui/component/addressbook-migrate.c b/addressbook/gui/component/addressbook-migrate.c
index 32fbf1ca3e..7b3bf2b38e 100644
--- a/addressbook/gui/component/addressbook-migrate.c
+++ b/addressbook/gui/component/addressbook-migrate.c
@@ -341,14 +341,16 @@ migrate_contact_folder_to_source (MigrationContext *context, char *old_path, ESo
dialog_set_folder_name (context, e_source_peek_name (new_source));
- old_book = e_book_new ();
- if (!e_book_load_source (old_book, old_source, TRUE, &e)) {
+ old_book = e_book_new (old_source, &e);
+ if (!old_book
+ || !e_book_open (old_book, TRUE, &e)) {
g_warning ("failed to load source book for migration: `%s'", e->message);
goto finish;
}
- new_book = e_book_new ();
- if (!e_book_load_source (new_book, new_source, FALSE, &e)) {
+ new_book = e_book_new (new_source, &e);
+ if (!new_book
+ || e_book_open (new_book, FALSE, &e)) {
g_warning ("failed to load destination book for migration: `%s'", e->message);
goto finish;
}
@@ -779,8 +781,9 @@ migrate_contact_lists_for_local_folders (MigrationContext *context, ESourceGroup
dialog_set_folder_name (context, e_source_peek_name (source));
- book = e_book_new ();
- if (!e_book_load_source (book, source, TRUE, NULL)) {
+ book = e_book_new (source, NULL);
+ if (!book
+ || !e_book_open (book, TRUE, NULL)) {
char *uri = e_source_get_uri (source);
g_warning ("failed to migrate contact lists for source %s", uri);
g_free (uri);
@@ -853,8 +856,9 @@ migrate_company_phone_for_local_folders (MigrationContext *context, ESourceGroup
dialog_set_folder_name (context, e_source_peek_name (source));
- book = e_book_new ();
- if (!e_book_load_source (book, source, TRUE, NULL)) {
+ book = e_book_new (source, NULL);
+ if (!book
+ || !e_book_open (book, TRUE, NULL)) {
char *uri = e_source_get_uri (source);
g_warning ("failed to migrate company phone numbers for source %s", uri);
g_free (uri);
diff --git a/addressbook/gui/component/addressbook-view.c b/addressbook/gui/component/addressbook-view.c
index a87520703d..3b8c86cfef 100644
--- a/addressbook/gui/component/addressbook-view.c
+++ b/addressbook/gui/component/addressbook-view.c
@@ -681,8 +681,8 @@ delete_addressbook_cb (GtkWidget *widget, AddressbookView *view)
}
/* Remove local data */
- book = e_book_new ();
- if (e_book_load_source (book, selected_source, TRUE, &error))
+ book = e_book_new (selected_source, &error);
+ if (book)
removed = e_book_remove (book, &error);
if (removed) {
@@ -876,12 +876,12 @@ selector_tree_drag_data_received (GtkWidget *widget,
if (E_IS_SOURCE_GROUP (source) || e_source_get_readonly (source))
goto finish;
- book = e_book_new ();
+ book = e_book_new (source, NULL);
if (!book) {
g_message (G_STRLOC ":Couldn't create EBook.");
return FALSE;
}
- e_book_load_source (book, source, TRUE, NULL);
+ e_book_open (book, TRUE, NULL);
contactlist = eab_contact_list_from_string (data->data);
for (l = contactlist; l; l = l->next) {
@@ -1128,8 +1128,6 @@ activate_source (AddressbookView *view,
g_object_unref (book);
}
else {
- book = e_book_new ();
-
g_object_get (uid_view,
"source", &source,
NULL);
@@ -1139,11 +1137,18 @@ activate_source (AddressbookView *view,
actually made it to
book_open_cb yet. */
if (source) {
- data = g_new (BookOpenData, 1);
- data->view = g_object_ref (uid_view);
- data->source = source; /* transfer the ref we get back from g_object_get */
-
- addressbook_load_source (book, source, book_open_cb, data);
+ book = e_book_new (source, NULL);
+
+ if (!book) {
+ g_object_unref (source);
+ }
+ else {
+ data = g_new (BookOpenData, 1);
+ data->view = g_object_ref (uid_view);
+ data->source = source; /* transfer the ref we get back from g_object_get */
+
+ addressbook_load (book, book_open_cb, data);
+ }
}
}
}
@@ -1177,13 +1182,13 @@ activate_source (AddressbookView *view,
g_signal_connect (uid_view, "command_state_change",
G_CALLBACK(update_command_state), view);
- book = e_book_new ();
+ book = e_book_new (source, NULL);
data = g_new (BookOpenData, 1);
data->view = g_object_ref (uid_view);
data->source = g_object_ref (source);
- addressbook_load_source (book, source, book_open_cb, data);
+ addressbook_load (book, book_open_cb, data);
}
gtk_notebook_set_current_page (GTK_NOTEBOOK (priv->notebook),
diff --git a/addressbook/gui/component/addressbook.c b/addressbook/gui/component/addressbook.c
index d9628eeb50..83c56e4b6d 100644
--- a/addressbook/gui/component/addressbook.c
+++ b/addressbook/gui/component/addressbook.c
@@ -225,23 +225,23 @@ load_source_cb (EBook *book, EBookStatus status, gpointer closure)
}
guint
-addressbook_load_source (EBook *book, ESource *source,
- EBookCallback cb, gpointer closure)
+addressbook_load (EBook *book,
+ EBookCallback cb, gpointer closure)
{
LoadSourceData *load_source_data = g_new0 (LoadSourceData, 1);
load_source_data->cb = cb;
load_source_data->closure = closure;
- load_source_data->source = g_object_ref (source);
+ load_source_data->source = g_object_ref (g_object_ref (e_book_get_source (book)));
load_source_data->cancelled = FALSE;
- e_book_async_load_source (book, source, load_source_cb, load_source_data);
+ e_book_async_open (book, FALSE, load_source_cb, load_source_data);
return GPOINTER_TO_UINT (load_source_data);
}
void
-addressbook_load_source_cancel (guint id)
+addressbook_load_cancel (guint id)
{
LoadSourceData *load_source_data = GUINT_TO_POINTER (id);
@@ -263,11 +263,16 @@ void
addressbook_load_default_book (EBookCallback cb, gpointer closure)
{
LoadSourceData *load_source_data = g_new (LoadSourceData, 1);
+ EBook *book;
load_source_data->cb = cb;
load_source_data->source = NULL;
load_source_data->closure = closure;
load_source_data->cancelled = FALSE;
- e_book_async_get_default_addressbook (default_book_cb, load_source_data);
+ book = e_book_new_default_addressbook (NULL);
+ if (!book)
+ load_source_cb (NULL, E_BOOK_ERROR_OTHER_ERROR, closure); /* XXX we should just use a GError and it's error code here */
+
+ e_book_async_open (book, FALSE, default_book_cb, load_source_data);
}
diff --git a/addressbook/gui/component/addressbook.h b/addressbook/gui/component/addressbook.h
index d44f1f2e36..d0ab99b62e 100644
--- a/addressbook/gui/component/addressbook.h
+++ b/addressbook/gui/component/addressbook.h
@@ -7,8 +7,8 @@
#include <bonobo/bonobo-moniker-util.h>
#include <libebook/e-book-async.h>
-guint addressbook_load_source (EBook *book, ESource *source, EBookCallback cb, gpointer closure);
-void addressbook_load_source_cancel (guint id);
+guint addressbook_load (EBook *book, EBookCallback cb, gpointer closure);
+void addressbook_load_cancel (guint id);
void addressbook_load_default_book (EBookCallback open_response, gpointer closure);
#endif /* __ADDRESSBOOK_H__ */
diff --git a/addressbook/gui/component/select-names/e-select-names-manager.c b/addressbook/gui/component/select-names/e-select-names-manager.c
index d78ac0aef6..43b69d9149 100644
--- a/addressbook/gui/component/select-names/e-select-names-manager.c
+++ b/addressbook/gui/component/select-names/e-select-names-manager.c
@@ -335,9 +335,9 @@ update_completion_books (ESelectNamesManager *manager)
ESource *source = E_SOURCE (sources->data);
const char *completion = e_source_get_property (source, "completion");
if (completion && !g_ascii_strcasecmp (completion, "true")) {
- EBook *book = e_book_new ();
+ EBook *book = e_book_new (source, NULL);
g_object_ref (manager);
- addressbook_load_source (book, source, open_book_cb, manager);
+ addressbook_load (book, open_book_cb, manager);
}
}
}
diff --git a/addressbook/gui/component/select-names/e-select-names.c b/addressbook/gui/component/select-names/e-select-names.c
index 25c79790f9..894d5e9847 100644
--- a/addressbook/gui/component/select-names/e-select-names.c
+++ b/addressbook/gui/component/select-names/e-select-names.c
@@ -154,12 +154,12 @@ addressbook_model_set_source (ESelectNames *e_select_names, EABModel *model, ESo
{
EBook *book;
- book = e_book_new();
+ book = e_book_new(source, NULL);
g_object_ref(e_select_names);
g_object_ref(model);
- addressbook_load_source (book, source, (EBookCallback) set_book, e_select_names);
+ addressbook_load (book, (EBookCallback) set_book, e_select_names);
}
static void *
diff --git a/addressbook/gui/contact-editor/e-contact-editor.c b/addressbook/gui/contact-editor/e-contact-editor.c
index 1e9b3adb99..85b2f2f5dc 100644
--- a/addressbook/gui/contact-editor/e-contact-editor.c
+++ b/addressbook/gui/contact-editor/e-contact-editor.c
@@ -2204,7 +2204,7 @@ static void
cancel_load (EContactEditor *editor)
{
if (editor->load_source_id) {
- addressbook_load_source_cancel (editor->load_source_id);
+ addressbook_load_cancel (editor->load_source_id);
editor->load_source_id = 0;
g_object_unref (editor->load_book);
@@ -2225,9 +2225,9 @@ source_selected (GtkWidget *source_option_menu, ESource *source, EContactEditor
return;
}
- editor->load_book = e_book_new ();
- editor->load_source_id = addressbook_load_source (editor->load_book, source,
- (EBookCallback) new_target_cb, editor);
+ editor->load_book = e_book_new (source, NULL);
+ editor->load_source_id = addressbook_load (editor->load_book,
+ (EBookCallback) new_target_cb, editor);
}
static void
diff --git a/addressbook/gui/widgets/eab-gui-util.c b/addressbook/gui/widgets/eab-gui-util.c
index c8fcb1cde5..60640f62f7 100644
--- a/addressbook/gui/widgets/eab-gui-util.c
+++ b/addressbook/gui/widgets/eab-gui-util.c
@@ -736,8 +736,8 @@ eab_transfer_contacts (EBook *source, GList *contacts /* adopted */, gboolean de
else
process->done_cb = NULL;
- dest = e_book_new ();
- e_book_async_load_source (dest, destination_source, got_book_cb, process);
+ dest = e_book_new (destination_source, NULL);
+ e_book_async_open (dest, TRUE, got_book_cb, process);
}
#include <Evolution-Composer.h>