diff options
author | Chris Toshok <toshok@ximian.com> | 2004-05-20 09:16:30 +0800 |
---|---|---|
committer | Chris Toshok <toshok@src.gnome.org> | 2004-05-20 09:16:30 +0800 |
commit | 47c3838fee257737f17aae3696a8dda177af7a35 (patch) | |
tree | 700f2c3e3cd6fe3b13eeff901c7ea3c49daf76a6 /addressbook | |
parent | 5bc91a74fecf9f6eecff4281408743ab694e26df (diff) | |
download | gsoc2013-evolution-47c3838fee257737f17aae3696a8dda177af7a35.tar.gz gsoc2013-evolution-47c3838fee257737f17aae3696a8dda177af7a35.tar.zst gsoc2013-evolution-47c3838fee257737f17aae3696a8dda177af7a35.zip |
use the new e_book_new and e_book_open apis.
2004-05-19 Chris Toshok <toshok@ximian.com>
* importers/evolution-vcard-importer.c (load_file_fn): use the new
e_book_new and e_book_open apis.
* importers/evolution-ldif-importer.c (load_file_fn): use the new
e_book_new and e_book_open apis.
* gui/widgets/eab-gui-util.c (eab_transfer_contacts): use the new
e_book_new and e_book_async_open apis.
* gui/contact-editor/e-contact-editor.c (cancel_load):
addressbook_load_source_cancel -> addressbook_load_cancel.
(source_selected): use the new e_book_new and addressbook_load.
* gui/component/select-names/e-select-names.c
(addressbook_model_set_source): use the new e_book_new and
addressbook_load.
* gui/component/select-names/e-select-names-manager.c
(update_completion_books): use the new e_book_new and
addressbook_load.
* gui/component/addressbook.h: rename
addressbook_load_source{_cancel} to addressbook_load{_cancel}, and
remove the source arg.
* gui/component/addressbook.c (addressbook_load): rename since we
aren't passing a source anymore.
(addressbook_load_cancel): same.
(addressbook_load_default_book): use the new e_book_new_* apis.
* gui/component/addressbook-view.c (delete_addressbook_cb): just
use e_book_new, not e_book_load_source.
(selector_tree_drag_data_received): switch to new
e_book_new_*/e_book_open apis.
(activate_source): same, and addressbook_load_source ->
addressbook_load.
* gui/component/addressbook-migrate.c
(migrate_contact_folder_to_source): switch to new
e_book_new_*/e_book_open apis.
(migrate_contact_lists_for_local_folders): same.
(migrate_company_phone_for_local_folders): same.
* conduit/address-conduit.c (pre_sync): switch to new
e_book_new_*/e_book_open apis.
svn path=/trunk/; revision=25999
Diffstat (limited to 'addressbook')
-rw-r--r-- | addressbook/ChangeLog | 48 | ||||
-rw-r--r-- | addressbook/conduit/address-conduit.c | 5 | ||||
-rw-r--r-- | addressbook/gui/component/addressbook-migrate.c | 20 | ||||
-rw-r--r-- | addressbook/gui/component/addressbook-view.c | 31 | ||||
-rw-r--r-- | addressbook/gui/component/addressbook.c | 17 | ||||
-rw-r--r-- | addressbook/gui/component/addressbook.h | 4 | ||||
-rw-r--r-- | addressbook/gui/component/select-names/e-select-names-manager.c | 4 | ||||
-rw-r--r-- | addressbook/gui/component/select-names/e-select-names.c | 4 | ||||
-rw-r--r-- | addressbook/gui/contact-editor/e-contact-editor.c | 8 | ||||
-rw-r--r-- | addressbook/gui/widgets/eab-gui-util.c | 4 | ||||
-rw-r--r-- | addressbook/importers/evolution-ldif-importer.c | 4 | ||||
-rw-r--r-- | addressbook/importers/evolution-vcard-importer.c | 4 |
12 files changed, 108 insertions, 45 deletions
diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog index 63b9ef4885..24749363c4 100644 --- a/addressbook/ChangeLog +++ b/addressbook/ChangeLog @@ -1,3 +1,51 @@ +2004-05-19 Chris Toshok <toshok@ximian.com> + + * importers/evolution-vcard-importer.c (load_file_fn): use the new + e_book_new and e_book_open apis. + + * importers/evolution-ldif-importer.c (load_file_fn): use the new + e_book_new and e_book_open apis. + + * gui/widgets/eab-gui-util.c (eab_transfer_contacts): use the new + e_book_new and e_book_async_open apis. + + * gui/contact-editor/e-contact-editor.c (cancel_load): + addressbook_load_source_cancel -> addressbook_load_cancel. + (source_selected): use the new e_book_new and addressbook_load. + + * gui/component/select-names/e-select-names.c + (addressbook_model_set_source): use the new e_book_new and + addressbook_load. + + * gui/component/select-names/e-select-names-manager.c + (update_completion_books): use the new e_book_new and + addressbook_load. + + * gui/component/addressbook.h: rename + addressbook_load_source{_cancel} to addressbook_load{_cancel}, and + remove the source arg. + + * gui/component/addressbook.c (addressbook_load): rename since we + aren't passing a source anymore. + (addressbook_load_cancel): same. + (addressbook_load_default_book): use the new e_book_new_* apis. + + * gui/component/addressbook-view.c (delete_addressbook_cb): just + use e_book_new, not e_book_load_source. + (selector_tree_drag_data_received): switch to new + e_book_new_*/e_book_open apis. + (activate_source): same, and addressbook_load_source -> + addressbook_load. + + * gui/component/addressbook-migrate.c + (migrate_contact_folder_to_source): switch to new + e_book_new_*/e_book_open apis. + (migrate_contact_lists_for_local_folders): same. + (migrate_company_phone_for_local_folders): same. + + * conduit/address-conduit.c (pre_sync): switch to new + e_book_new_*/e_book_open apis. + 2004-05-19 Hans Petter Jansson <hpj@ximian.com> * gui/contact-editor/e-contact-editor.c (sensitize_email): Check diff --git a/addressbook/conduit/address-conduit.c b/addressbook/conduit/address-conduit.c index 5fcf55762e..555e470fda 100644 --- a/addressbook/conduit/address-conduit.c +++ b/addressbook/conduit/address-conduit.c @@ -1145,8 +1145,9 @@ pre_sync (GnomePilotConduit *conduit, ctxt->dbi = dbi; /* FIXME Need to allow our own concept of "local" */ - ctxt->ebook = e_book_new (); - if (!e_book_load_local_addressbook (ctxt->ebook, NULL)) { + ctxt->ebook = e_book_new_system_addressbook (NULL); + if (!ctxt->ebook + || !e_book_open (ctxt->ebook, FALSE, NULL)) { WARN(_("Could not load addressbook")); gnome_pilot_conduit_error (conduit, _("Could not load addressbook")); 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> diff --git a/addressbook/importers/evolution-ldif-importer.c b/addressbook/importers/evolution-ldif-importer.c index e82fd02074..e756f6adff 100644 --- a/addressbook/importers/evolution-ldif-importer.c +++ b/addressbook/importers/evolution-ldif-importer.c @@ -574,12 +574,12 @@ load_file_fn (EvolutionImporter *importer, gci->ready = FALSE; /* Load the book and the cards */ - gci->book = e_book_new (); + gci->book = e_book_new (gci->primary, NULL); if (!gci->book) { g_message (G_STRLOC ":Couldn't create EBook."); return FALSE; } - e_book_load_source (gci->book, gci->primary, TRUE, NULL); + e_book_open (gci->book, TRUE, NULL); gci->contactlist = create_contacts_from_ldif (filename); gci->ready = TRUE; diff --git a/addressbook/importers/evolution-vcard-importer.c b/addressbook/importers/evolution-vcard-importer.c index f457cefafc..5719dce51c 100644 --- a/addressbook/importers/evolution-vcard-importer.c +++ b/addressbook/importers/evolution-vcard-importer.c @@ -277,12 +277,12 @@ load_file_fn (EvolutionImporter *importer, gci->ready = FALSE; /* Load the book */ - gci->book = e_book_new (); + gci->book = e_book_new (gci->primary, NULL); if (!gci->book) { g_message (G_STRLOC ":Couldn't create EBook."); return FALSE; } - e_book_load_source (gci->book, gci->primary, TRUE, NULL); + e_book_open (gci->book, TRUE, NULL); /* Load the file and the contacts */ if (!g_file_get_contents (filename, &contents, NULL, NULL)) { |