1
1
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
5
3
* Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
4
* Copyright (C) 2006 OpenedHand Ltd
5
* Copyright (C) 2009 Intel Corporation
7
* This library is free software; you can redistribute it and/or modify it under
8
* the terms of version 2.1 of the GNU Lesser General Public License as
9
* published by the Free Software Foundation.
11
* This library is distributed in the hope that it will be useful, but WITHOUT
12
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
16
* You should have received a copy of the GNU Lesser General Public License
17
* along with this library; if not, write to the Free Software Foundation, Inc.,
18
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20
* Author: Ross Burton <ross@linux.intel.com>
12
#include <bonobo/bonobo-main.h>
13
#include <bonobo/bonobo-arg.h>
14
#include "libedataserver/e-list.h"
15
#include <libebook/e-contact.h>
25
#include <dbus/dbus.h>
26
#include <dbus/dbus-glib.h>
27
#include <dbus/dbus-glib-lowlevel.h>
28
#include <glib/gi18n.h>
29
#include <glib-object.h>
30
#include "e-data-book-enumtypes.h"
31
#include "e-data-book-factory.h"
32
#include "e-data-book.h"
16
33
#include "e-data-book-view.h"
17
#include "e-book-backend.h"
18
34
#include "e-book-backend-sexp.h"
19
#include "e-data-book.h"
21
static BonoboObjectClass *e_data_book_parent_class;
22
POA_GNOME_Evolution_Addressbook_Book__vepv e_data_book_vepv;
24
struct _EDataBookPrivate {
25
EBookBackend *backend;
26
GNOME_Evolution_Addressbook_BookListener listener;
37
DBusGConnection *connection;
40
static void impl_AddressBook_Book_open(EDataBook *book, gboolean only_if_exists, DBusGMethodInvocation *context);
41
static void impl_AddressBook_Book_remove(EDataBook *book, DBusGMethodInvocation *context);
42
static void impl_AddressBook_Book_getContact(EDataBook *book, const gchar *IN_uid, DBusGMethodInvocation *context);
43
static void impl_AddressBook_Book_getContactList(EDataBook *book, const gchar *query, DBusGMethodInvocation *context);
44
static void impl_AddressBook_Book_authenticateUser(EDataBook *book, const gchar *IN_user, const gchar *IN_passwd, const gchar *IN_auth_method, DBusGMethodInvocation *context);
45
static void impl_AddressBook_Book_addContact(EDataBook *book, const gchar *IN_vcard, DBusGMethodInvocation *context);
46
static void impl_AddressBook_Book_modifyContact(EDataBook *book, const gchar *IN_vcard, DBusGMethodInvocation *context);
47
static void impl_AddressBook_Book_removeContacts(EDataBook *book, const gchar **IN_uids, DBusGMethodInvocation *context);
48
static gboolean impl_AddressBook_Book_getStaticCapabilities(EDataBook *book, gchar **OUT_capabilities, GError **error);
49
static void impl_AddressBook_Book_getSupportedFields(EDataBook *book, DBusGMethodInvocation *context);
50
static void impl_AddressBook_Book_getRequiredFields(EDataBook *book, DBusGMethodInvocation *context);
51
static void impl_AddressBook_Book_getSupportedAuthMethods(EDataBook *book, DBusGMethodInvocation *context);
52
static void impl_AddressBook_Book_getBookView (EDataBook *book, const gchar *search, const guint max_results, DBusGMethodInvocation *context);
53
static void impl_AddressBook_Book_getChanges(EDataBook *book, const gchar *IN_change_id, DBusGMethodInvocation *context);
54
static gboolean impl_AddressBook_Book_cancelOperation(EDataBook *book, GError **error);
55
static void impl_AddressBook_Book_close(EDataBook *book, DBusGMethodInvocation *context);
56
#include "e-data-book-glue.h"
58
static void return_status_and_list (guint32 opid, EDataBookStatus status, GList *list, gboolean free_data);
59
static void data_book_return_error (DBusGMethodInvocation *context, gint code, const gchar *error_str);
31
impl_GNOME_Evolution_Addressbook_Book_open (PortableServer_Servant servant,
32
const CORBA_long opid,
33
const CORBA_boolean only_if_exists,
34
CORBA_Environment *ev)
36
EDataBook *book = E_DATA_BOOK (bonobo_object (servant));
38
printf ("impl_GNOME_Evolution_Addressbook_Book_open (%p)\n", (gpointer) book);
40
e_book_backend_open (e_data_book_get_backend (book), book, opid, only_if_exists);
44
impl_GNOME_Evolution_Addressbook_Book_remove (PortableServer_Servant servant,
45
const CORBA_long opid,
46
CORBA_Environment *ev)
48
EDataBook *book = E_DATA_BOOK (bonobo_object (servant));
50
printf ("impl_GNOME_Evolution_Addressbook_Book_remove\n");
52
e_book_backend_remove (e_data_book_get_backend (book), book, opid);
56
impl_GNOME_Evolution_Addressbook_Book_getContact (PortableServer_Servant servant,
57
const CORBA_long opid,
59
CORBA_Environment *ev)
61
EDataBook *book = E_DATA_BOOK (bonobo_object (servant));
63
printf ("impl_GNOME_Evolution_Addressbook_Book_getContact\n");
65
e_book_backend_get_contact (e_data_book_get_backend (book), book, opid, id);
69
impl_GNOME_Evolution_Addressbook_Book_getContactList (PortableServer_Servant servant,
70
const CORBA_long opid,
71
const CORBA_char *query,
72
CORBA_Environment *ev)
74
EDataBook *book = E_DATA_BOOK (bonobo_object (servant));
76
printf ("impl_GNOME_Evolution_Addressbook_Book_getContactList\n");
78
e_book_backend_get_contact_list (e_data_book_get_backend (book), book, opid, query);
82
impl_GNOME_Evolution_Addressbook_Book_authenticateUser (PortableServer_Servant servant,
83
const CORBA_long opid,
86
const gchar * auth_method,
87
CORBA_Environment *ev)
89
EDataBook *book = E_DATA_BOOK (bonobo_object (servant));
91
e_book_backend_authenticate_user (e_data_book_get_backend (book), book,
92
opid, user, passwd, auth_method);
96
impl_GNOME_Evolution_Addressbook_Book_addContact (PortableServer_Servant servant,
97
const CORBA_long opid,
98
const CORBA_char *vcard,
99
CORBA_Environment *ev)
101
EDataBook *book = E_DATA_BOOK (bonobo_object (servant));
103
e_book_backend_create_contact (e_data_book_get_backend (book), book, opid, vcard);
107
impl_GNOME_Evolution_Addressbook_Book_removeContacts (PortableServer_Servant servant,
108
const CORBA_long opid,
109
const GNOME_Evolution_Addressbook_ContactIdList *ids,
110
CORBA_Environment *ev)
112
EDataBook *book = E_DATA_BOOK (bonobo_object (servant));
114
GList *id_list = NULL;
116
for (i = 0; i < ids->_length; i ++)
117
id_list = g_list_append (id_list, ids->_buffer[i]);
119
e_book_backend_remove_contacts (e_data_book_get_backend (book), book, opid, id_list);
121
g_list_free (id_list);
125
impl_GNOME_Evolution_Addressbook_Book_modifyContact (PortableServer_Servant servant,
126
const CORBA_long opid,
127
const CORBA_char *vcard,
128
CORBA_Environment *ev)
130
EDataBook *book = E_DATA_BOOK (bonobo_object (servant));
132
e_book_backend_modify_contact (e_data_book_get_backend (book), book, opid, vcard);
136
impl_GNOME_Evolution_Addressbook_Book_getBookView (PortableServer_Servant servant,
137
const CORBA_long opid,
138
const GNOME_Evolution_Addressbook_BookViewListener listener,
139
const CORBA_char *search,
140
const GNOME_Evolution_Addressbook_stringlist* requested_fields,
141
const CORBA_long max_results,
142
CORBA_Environment *ev)
144
EDataBook *book = E_DATA_BOOK (bonobo_object (servant));
68
static guint signals[LAST_SIGNAL] = { 0 };
70
static GThreadPool *op_pool;
85
guint32 id; /* operation id */
86
EDataBook *book; /* book */
89
gboolean only_if_exists;
97
/* OP_MODIFY_CONTACT */
101
/* OP_GET_CONTACTS */
103
/* OP_MODIFY_CONTACT */
105
/* OP_REMOVE_CONTACTS */
113
operation_thread (gpointer data, gpointer user_data)
115
OperationData *op = data;
116
EBookBackend *backend;
118
backend = e_data_book_get_backend (op->book);
122
e_book_backend_open (backend, op->book, op->id, op->d.only_if_exists);
124
case OP_AUTHENTICATE:
125
e_book_backend_authenticate_user (backend, op->book, op->id,
129
g_free (op->d.auth.username);
130
g_free (op->d.auth.password);
131
g_free (op->d.auth.method);
134
e_book_backend_create_contact (backend, op->book, op->id, op->d.vcard);
135
g_free (op->d.vcard);
138
e_book_backend_get_contact (backend, op->book, op->id, op->d.uid);
141
case OP_GET_CONTACTS:
142
e_book_backend_get_contact_list (backend, op->book, op->id, op->d.query);
143
g_free (op->d.query);
145
case OP_MODIFY_CONTACT:
146
e_book_backend_modify_contact (backend, op->book, op->id, op->d.vcard);
147
g_free (op->d.vcard);
149
case OP_REMOVE_CONTACTS:
150
e_book_backend_remove_contacts (backend, op->book, op->id, op->d.ids);
151
g_list_foreach (op->d.ids, (GFunc)g_free, NULL);
152
g_list_free (op->d.ids);
155
e_book_backend_get_changes (backend, op->book, op->id, op->d.change_id);
156
g_free (op->d.change_id);
160
g_object_unref (op->book);
161
g_slice_free (OperationData, op);
164
static OperationData *
165
op_new (OperationID op, EDataBook *book, DBusGMethodInvocation *context)
169
data = g_slice_new0 (OperationData);
171
data->book = g_object_ref (book);
172
data->id = opid_store (context);
177
/* Create the EDataBook error quark */
179
e_data_book_error_quark (void)
181
static GQuark quark = 0;
182
if (G_UNLIKELY (quark == 0))
183
quark = g_quark_from_static_string ("e-data-book-error");
187
/* Generate the GObject boilerplate */
188
G_DEFINE_TYPE(EDataBook, e_data_book, G_TYPE_OBJECT)
191
e_data_book_dispose (GObject *object)
193
EDataBook *book = E_DATA_BOOK (object);
196
g_object_unref (book->backend);
197
book->backend = NULL;
201
g_object_unref (book->source);
205
G_OBJECT_CLASS (e_data_book_parent_class)->dispose (object);
209
e_data_book_class_init (EDataBookClass *e_data_book_class)
211
GObjectClass *object_class = G_OBJECT_CLASS (e_data_book_class);
213
object_class->dispose = e_data_book_dispose;
216
g_signal_new ("writable",
217
G_OBJECT_CLASS_TYPE (e_data_book_class),
218
G_SIGNAL_RUN_LAST | G_SIGNAL_DETAILED,
221
g_cclosure_marshal_VOID__BOOLEAN,
222
G_TYPE_NONE, 1, G_TYPE_BOOLEAN);
224
signals[CONNECTION] =
225
g_signal_new ("connection",
226
G_OBJECT_CLASS_TYPE (e_data_book_class),
227
G_SIGNAL_RUN_LAST | G_SIGNAL_DETAILED,
230
g_cclosure_marshal_VOID__BOOLEAN,
231
G_TYPE_NONE, 1, G_TYPE_BOOLEAN);
233
signals[AUTH_REQUIRED] =
234
g_signal_new ("auth-required",
235
G_OBJECT_CLASS_TYPE (e_data_book_class),
236
G_SIGNAL_RUN_LAST | G_SIGNAL_DETAILED,
239
g_cclosure_marshal_VOID__VOID,
242
dbus_g_object_type_install_info (G_TYPE_FROM_CLASS (e_data_book_class), &dbus_glib_e_data_book_object_info);
244
dbus_g_error_domain_register (E_DATA_BOOK_ERROR, NULL, E_TYPE_DATA_BOOK_STATUS);
246
op_pool = g_thread_pool_new (operation_thread, NULL, 10, FALSE, NULL);
247
/* Kill threads which don't do anything for 10 seconds */
248
g_thread_pool_set_max_idle_time (10 * 1000);
253
e_data_book_init (EDataBook *ebook)
258
e_data_book_new (EBookBackend *backend, ESource *source)
262
book = g_object_new (E_TYPE_DATA_BOOK, NULL);
263
book->backend = g_object_ref (backend);
264
book->source = g_object_ref (source);
270
e_data_book_get_source (EDataBook *book)
272
g_return_val_if_fail (book != NULL, NULL);
278
e_data_book_get_backend (EDataBook *book)
280
g_return_val_if_fail (book != NULL, NULL);
282
return book->backend;
286
impl_AddressBook_Book_open(EDataBook *book, gboolean only_if_exists, DBusGMethodInvocation *context)
290
op = op_new (OP_OPEN, book, context);
291
op->d.only_if_exists = only_if_exists;
292
g_thread_pool_push (op_pool, op, NULL);
296
e_data_book_respond_open (EDataBook *book, guint opid, EDataBookStatus status)
298
DBusGMethodInvocation *context = opid_fetch (opid);
300
if (status != E_DATA_BOOK_STATUS_SUCCESS) {
301
data_book_return_error (context, status, _("Cannot open book"));
303
dbus_g_method_return (context);
308
impl_AddressBook_Book_remove(EDataBook *book, DBusGMethodInvocation *context)
310
e_book_backend_remove (book->backend, book, opid_store (context));
314
e_data_book_respond_remove (EDataBook *book, guint opid, EDataBookStatus status)
316
DBusGMethodInvocation *context = opid_fetch (opid);
318
if (status != E_DATA_BOOK_STATUS_SUCCESS) {
319
data_book_return_error (context, status, _("Cannot remove book"));
321
dbus_g_method_return (context);
326
impl_AddressBook_Book_getContact (EDataBook *book, const gchar *IN_uid, DBusGMethodInvocation *context)
330
if (IN_uid == NULL) {
331
data_book_return_error (context, E_DATA_BOOK_STATUS_CONTACT_NOT_FOUND, _("Cannot get contact"));
335
op = op_new (OP_GET_CONTACT, book, context);
336
op->d.uid = g_strdup (IN_uid);
337
g_thread_pool_push (op_pool, op, NULL);
341
e_data_book_respond_get_contact (EDataBook *book, guint32 opid, EDataBookStatus status, const gchar *vcard)
343
DBusGMethodInvocation *context = opid_fetch (opid);
345
if (status != E_DATA_BOOK_STATUS_SUCCESS) {
346
data_book_return_error (context, status, _("Cannot get contact"));
348
dbus_g_method_return (context, vcard);
353
impl_AddressBook_Book_getContactList (EDataBook *book, const gchar *query, DBusGMethodInvocation *context)
357
if (query == NULL || query[0] == '\0') {
358
data_book_return_error (context, E_DATA_BOOK_STATUS_INVALID_QUERY, _("Empty query"));
362
op = op_new (OP_GET_CONTACTS, book, context);
363
op->d.query = g_strdup (query);
364
g_thread_pool_push (op_pool, op, NULL);
368
e_data_book_respond_get_contact_list (EDataBook *book, guint32 opid, EDataBookStatus status, GList *cards)
370
return_status_and_list (opid, status, cards, TRUE);
374
impl_AddressBook_Book_authenticateUser(EDataBook *book, const gchar *IN_user, const gchar *IN_passwd, const gchar *IN_auth_method, DBusGMethodInvocation *context)
378
op = op_new (OP_AUTHENTICATE, book, context);
379
op->d.auth.username = g_strdup (IN_user);
380
op->d.auth.password = g_strdup (IN_passwd);
381
op->d.auth.method = g_strdup (IN_auth_method);
382
g_thread_pool_push (op_pool, op, NULL);
386
data_book_return_error (DBusGMethodInvocation *context, gint code, const gchar *error_str)
390
error = g_error_new (E_DATA_BOOK_ERROR, code, "%s", error_str);
391
dbus_g_method_return_error (context, error);
393
g_error_free (error);
397
e_data_book_respond_authenticate_user (EDataBook *book, guint32 opid, EDataBookStatus status)
399
DBusGMethodInvocation *context = opid_fetch (opid);
401
if (status != E_DATA_BOOK_STATUS_SUCCESS) {
402
data_book_return_error (context, status, _("Cannot authenticate user"));
404
dbus_g_method_return (context);
409
impl_AddressBook_Book_addContact (EDataBook *book, const gchar *IN_vcard, DBusGMethodInvocation *context)
413
if (IN_vcard == NULL || IN_vcard[0] == '\0') {
414
data_book_return_error (context, E_DATA_BOOK_STATUS_INVALID_QUERY, _("Cannot add contact"));
418
op = op_new (OP_ADD_CONTACT, book, context);
419
op->d.vcard = g_strdup (IN_vcard);
420
g_thread_pool_push (op_pool, op, NULL);
424
e_data_book_respond_create (EDataBook *book, guint32 opid, EDataBookStatus status, EContact *contact)
426
DBusGMethodInvocation *context = opid_fetch (opid);
428
if (status != E_DATA_BOOK_STATUS_SUCCESS) {
429
data_book_return_error (context, status, _("Cannot add contact"));
431
e_book_backend_notify_update (e_data_book_get_backend (book), contact);
432
e_book_backend_notify_complete (e_data_book_get_backend (book));
434
dbus_g_method_return (context, e_contact_get_const (contact, E_CONTACT_UID));
439
impl_AddressBook_Book_modifyContact (EDataBook *book, const gchar *IN_vcard, DBusGMethodInvocation *context)
443
if (IN_vcard == NULL) {
444
data_book_return_error (context, E_DATA_BOOK_STATUS_INVALID_QUERY, _("Cannot modify contact"));
448
op = op_new (OP_MODIFY_CONTACT, book, context);
449
op->d.vcard = g_strdup (IN_vcard);
450
g_thread_pool_push (op_pool, op, NULL);
454
e_data_book_respond_modify (EDataBook *book, guint32 opid, EDataBookStatus status, EContact *contact)
456
DBusGMethodInvocation *context = opid_fetch (opid);
458
if (status != E_DATA_BOOK_STATUS_SUCCESS) {
459
data_book_return_error (context, status, _("Cannot modify contact"));
461
e_book_backend_notify_update (e_data_book_get_backend (book), contact);
462
e_book_backend_notify_complete (e_data_book_get_backend (book));
464
dbus_g_method_return (context);
469
impl_AddressBook_Book_removeContacts(EDataBook *book, const gchar **IN_uids, DBusGMethodInvocation *context)
473
/* Allow an empty array to be removed */
474
if (IN_uids == NULL) {
475
dbus_g_method_return (context);
479
op = op_new (OP_REMOVE_CONTACTS, book, context);
481
for (; *IN_uids; IN_uids++) {
482
op->d.ids = g_list_prepend (op->d.ids, g_strdup (*IN_uids));
485
g_thread_pool_push (op_pool, op, NULL);
489
e_data_book_respond_remove_contacts (EDataBook *book, guint32 opid, EDataBookStatus status, GList *ids)
491
DBusGMethodInvocation *context = opid_fetch (opid);
493
if (status != E_DATA_BOOK_STATUS_SUCCESS) {
494
data_book_return_error (context, status, _("Cannot remove contacts"));
498
for (i = ids; i; i = i->next)
499
e_book_backend_notify_remove (e_data_book_get_backend (book), i->data);
500
e_book_backend_notify_complete (e_data_book_get_backend (book));
502
dbus_g_method_return (context);
507
impl_AddressBook_Book_getStaticCapabilities(EDataBook *book, gchar **OUT_capabilities, GError **error)
509
*OUT_capabilities = e_book_backend_get_static_capabilities (e_data_book_get_backend (book));
514
impl_AddressBook_Book_getSupportedFields(EDataBook *book, DBusGMethodInvocation *context)
516
e_book_backend_get_supported_fields (e_data_book_get_backend (book), book, opid_store (context));
520
e_data_book_respond_get_supported_fields (EDataBook *book, guint32 opid, EDataBookStatus status, GList *fields)
522
return_status_and_list (opid, status, fields, FALSE);
526
impl_AddressBook_Book_getRequiredFields(EDataBook *book, DBusGMethodInvocation *context)
528
e_book_backend_get_required_fields (e_data_book_get_backend (book), book, opid_store (context));
532
e_data_book_respond_get_required_fields (EDataBook *book, guint32 opid, EDataBookStatus status, GList *fields)
534
return_status_and_list (opid, status, fields, FALSE);
538
impl_AddressBook_Book_getSupportedAuthMethods(EDataBook *book, DBusGMethodInvocation *context)
540
e_book_backend_get_supported_auth_methods (e_data_book_get_backend (book), book, opid_store (context));
544
e_data_book_respond_get_supported_auth_methods (EDataBook *book, guint32 opid, EDataBookStatus status, GList *auth_methods)
546
return_status_and_list (opid, status, auth_methods, FALSE);
550
construct_bookview_path (void)
552
static volatile guint counter = 1;
554
return g_strdup_printf ("/org/gnome/evolution/dataserver/addressbook/BookView/%d/%d",
556
g_atomic_int_exchange_and_add ((int*)&counter, 1));
560
impl_AddressBook_Book_getBookView (EDataBook *book, const gchar *search, const guint max_results, DBusGMethodInvocation *context)
145
562
EBookBackend *backend = e_data_book_get_backend (book);
146
563
EBookBackendSExp *card_sexp;
149
g_warning ("impl_GNOME_Evolution_Addressbook_Book_getBookView (%s)\n", search);
151
/* we handle this entirely here, since it doesn't require any
152
backend involvement now that we have e_data_book_view_start to
153
actually kick off the search. */
564
EDataBookView *book_view;
155
567
card_sexp = e_book_backend_sexp_new (search);
156
568
if (!card_sexp) {
157
e_data_book_respond_get_book_view (book, opid, GNOME_Evolution_Addressbook_InvalidQuery, NULL);
161
/* XXX still need to add requested_fields here */
162
view = e_data_book_view_new (backend, listener, search, card_sexp, max_results);
165
g_object_unref (card_sexp);
166
e_data_book_respond_get_book_view (book, opid, GNOME_Evolution_Addressbook_OtherError, NULL);
170
e_book_backend_add_book_view (backend, view);
172
e_data_book_respond_get_book_view (book, opid, GNOME_Evolution_Addressbook_Success, view);
176
impl_GNOME_Evolution_Addressbook_Book_getChanges (PortableServer_Servant servant,
177
const CORBA_long opid,
178
const CORBA_char *change_id,
179
CORBA_Environment *ev)
181
EDataBook *book = E_DATA_BOOK (bonobo_object (servant));
183
e_book_backend_get_changes (e_data_book_get_backend (book), book, opid, change_id);
187
impl_GNOME_Evolution_Addressbook_Book_getStaticCapabilities (PortableServer_Servant servant,
188
CORBA_Environment *ev)
190
EDataBook *book = E_DATA_BOOK (bonobo_object (servant));
194
temp = e_book_backend_get_static_capabilities (book->priv->backend);
195
ret_val = CORBA_string_dup(temp);
201
impl_GNOME_Evolution_Addressbook_Book_getRequiredFields (PortableServer_Servant servant,
202
const CORBA_long opid,
203
CORBA_Environment *ev)
207
EDataBook *book = E_DATA_BOOK (bonobo_object (servant));
209
e_book_backend_get_required_fields (e_data_book_get_backend (book), book, opid);
214
impl_GNOME_Evolution_Addressbook_Book_getSupportedFields (PortableServer_Servant servant,
215
const CORBA_long opid,
216
CORBA_Environment *ev)
218
EDataBook *book = E_DATA_BOOK (bonobo_object (servant));
220
e_book_backend_get_supported_fields (e_data_book_get_backend (book), book, opid);
224
impl_GNOME_Evolution_Addressbook_Book_getSupportedAuthMethods (PortableServer_Servant servant,
225
const CORBA_long opid,
226
CORBA_Environment *ev)
228
EDataBook *book = E_DATA_BOOK (bonobo_object (servant));
230
e_book_backend_get_supported_auth_methods (e_data_book_get_backend (book), book, opid);
233
static GNOME_Evolution_Addressbook_CallStatus
234
impl_GNOME_Evolution_Addressbook_Book_cancelOperation (PortableServer_Servant servant,
235
CORBA_Environment *ev)
237
EDataBook *book = E_DATA_BOOK (bonobo_object (servant));
239
return e_book_backend_cancel_operation (e_data_book_get_backend (book), book);
243
* e_data_book_get_backend:
244
* @book: an #EDataBook
246
* Gets the #EBookBackend being used to store data for @book.
248
* Return value: The #EBookBackend being used.
251
e_data_book_get_backend (EDataBook *book)
253
g_return_val_if_fail (book && E_IS_DATA_BOOK (book), NULL);
255
return book->priv->backend;
259
* e_data_book_get_listener:
260
* @book: an #EDataBook
262
* Gets the CORBA listener associated with @book.
264
* Return value: A #GNOME_Evolution_Addressbook_BookListener.
266
GNOME_Evolution_Addressbook_BookListener
267
e_data_book_get_listener (EDataBook *book)
269
g_return_val_if_fail (book && E_IS_DATA_BOOK (book), CORBA_OBJECT_NIL);
271
return book->priv->listener;
275
* e_data_book_get_source:
276
* @book: an #EDataBook
278
* Gets the #ESource associated with @book.
280
* Return value: An #ESource.
283
e_data_book_get_source (EDataBook *book)
285
return book->priv->source;
289
* e_data_book_respond_open:
290
* @book: an #EDataBook
291
* @opid: the operation ID that generated the response
292
* @status: the outcome of the operation
294
* Respond to an 'open' request specified by @opid on @book,
295
* indicating @status as the outcome.
298
e_data_book_respond_open (EDataBook *book,
300
GNOME_Evolution_Addressbook_CallStatus status)
302
CORBA_Environment ev;
304
CORBA_exception_init (&ev);
305
GNOME_Evolution_Addressbook_BookListener_notifyBookOpened (book->priv->listener, opid, status, &ev);
307
if (ev._major != CORBA_NO_EXCEPTION) {
308
g_warning ("e_data_book_respond_open: Exception "
309
"responding to BookListener!\n");
312
CORBA_exception_free (&ev);
316
* e_data_book_respond_remove:
317
* @book: an #EDataBook
318
* @opid: the operation ID that generated the response
319
* @status: the outcome of the operation
321
* Respond to a 'remove' request to remove all of @book's data,
322
* specified by @opid, indicating @status as the outcome.
325
e_data_book_respond_remove (EDataBook *book,
327
GNOME_Evolution_Addressbook_CallStatus status)
329
CORBA_Environment ev;
331
CORBA_exception_init (&ev);
332
GNOME_Evolution_Addressbook_BookListener_notifyBookRemoved (book->priv->listener, opid, status, &ev);
334
if (ev._major != CORBA_NO_EXCEPTION) {
335
g_warning ("e_data_book_respond_remove: Exception "
336
"responding to BookListener!\n");
339
CORBA_exception_free (&ev);
343
* e_data_book_respond_create:
344
* @book: an #EDataBook
345
* @opid: the operation ID that generated the response
346
* @status: the outcome of the operation
347
* @contact: the contact created, or %NULL
349
* Respond to a 'create' request specified by @opid on @book,
350
* indicating @status as the outcome.
353
e_data_book_respond_create (EDataBook *book,
355
GNOME_Evolution_Addressbook_CallStatus status,
358
CORBA_Environment ev;
360
if (status == GNOME_Evolution_Addressbook_Success) {
361
e_book_backend_notify_update (book->priv->backend, contact);
362
e_book_backend_notify_complete (book->priv->backend);
365
CORBA_exception_init (&ev);
367
GNOME_Evolution_Addressbook_BookListener_notifyContactCreated (
368
book->priv->listener, opid, status,
369
status == GNOME_Evolution_Addressbook_Success ? e_contact_get_const (contact, E_CONTACT_UID) : "",
372
if (ev._major != CORBA_NO_EXCEPTION) {
373
g_warning ("e_data_book_respond_create: Exception "
374
"responding to BookListener!\n");
377
CORBA_exception_free (&ev);
381
* e_data_book_respond_remove_contacts:
382
* @book: an #EDataBook
383
* @opid: the operation ID that generated the response
384
* @status: the outcome of the operation
385
* @ids: a list of contact IDs removed
387
* Respond to a 'remove contacts' request specified by @opid on @book,
388
* indicating @status as the outcome.
391
e_data_book_respond_remove_contacts (EDataBook *book,
393
GNOME_Evolution_Addressbook_CallStatus status,
396
CORBA_Environment ev;
399
CORBA_exception_init (&ev);
402
for (i = ids; i; i = i->next)
403
e_book_backend_notify_remove (book->priv->backend, i->data);
404
e_book_backend_notify_complete (book->priv->backend);
407
GNOME_Evolution_Addressbook_BookListener_notifyContactsRemoved (
408
book->priv->listener, opid, status, &ev);
410
if (ev._major != CORBA_NO_EXCEPTION) {
411
g_warning ("e_data_book_respond_remove: Exception "
412
"responding to BookListener!\n");
415
CORBA_exception_free (&ev);
419
* e_data_book_respond_modify:
420
* @book: an #EDataBook
421
* @opid: the operation ID that generated the response
422
* @status: the outcome of the operation
423
* @contact: the modified #EContact
425
* Respond to a 'modify' request specified by @opid on @book,
426
* indicating @status as the outcome.
429
e_data_book_respond_modify (EDataBook *book,
431
GNOME_Evolution_Addressbook_CallStatus status,
434
CORBA_Environment ev;
436
if (status == GNOME_Evolution_Addressbook_Success) {
437
e_book_backend_notify_update (book->priv->backend, contact);
438
e_book_backend_notify_complete (book->priv->backend);
441
CORBA_exception_init (&ev);
443
GNOME_Evolution_Addressbook_BookListener_notifyContactModified (
444
book->priv->listener, opid, status, &ev);
446
if (ev._major != CORBA_NO_EXCEPTION) {
447
g_warning ("e_data_book_respond_modify: Exception "
448
"responding to BookListener!\n");
451
CORBA_exception_free (&ev);
455
* e_data_book_respond_authenticate_user:
456
* @book: an #EDataBook
457
* @opid: the operation ID that generated the response
458
* @status: the outcome of the operation
460
* Respond to an 'authenticate' request specified by @opid on @book,
461
* indicating @status as the outcome.
464
e_data_book_respond_authenticate_user (EDataBook *book,
466
GNOME_Evolution_Addressbook_CallStatus status)
468
CORBA_Environment ev;
470
CORBA_exception_init (&ev);
472
GNOME_Evolution_Addressbook_BookListener_notifyAuthenticationResult (
473
book->priv->listener, opid, status, &ev);
475
if (ev._major != CORBA_NO_EXCEPTION) {
476
g_warning ("e_data_book_respond_authenticate_user: Exception "
477
"responding to BookListener!\n");
480
CORBA_exception_free (&ev);
484
* e_data_book_respond_get_required_fields:
485
* @book: an #EDataBook
486
* @opid: the operation ID that generated the response
487
* @status: the outcome of the operation
488
* @fields: a list of required field names
490
* Respond to a 'get required fields' request specified by @opid on @book,
491
* indicating @status as the outcome.
494
e_data_book_respond_get_required_fields (EDataBook *book,
496
GNOME_Evolution_Addressbook_CallStatus status,
500
CORBA_Environment ev;
501
GNOME_Evolution_Addressbook_stringlist stringlist;
506
CORBA_exception_init (&ev);
508
num_fields = g_list_length (fields);
510
stringlist._buffer = CORBA_sequence_CORBA_string_allocbuf (num_fields);
511
stringlist._maximum = num_fields;
512
stringlist._length = num_fields;
514
for (i = 0, iter = fields; iter; iter = iter->next, i ++) {
515
stringlist._buffer[i] = CORBA_string_dup ((gchar *)iter->data);
518
printf ("calling GNOME_Evolution_Addressbook_BookListener_notifyRequiredFields\n");
520
GNOME_Evolution_Addressbook_BookListener_notifyRequiredFields (
521
book->priv->listener, opid, status,
525
CORBA_exception_free (&ev);
527
CORBA_free(stringlist._buffer);
531
* e_data_book_respond_get_supported_fields:
532
* @book: an #EDataBook
533
* @opid: the operation ID that generated the response
534
* @status: the outcome of the operation
535
* @fields: a list of supported field names
537
* Respond to a 'get supported fields' request specified by @opid on @book,
538
* indicating @status as the outcome.
541
e_data_book_respond_get_supported_fields (EDataBook *book,
543
GNOME_Evolution_Addressbook_CallStatus status,
546
CORBA_Environment ev;
547
GNOME_Evolution_Addressbook_stringlist stringlist;
552
CORBA_exception_init (&ev);
554
num_fields = g_list_length (fields);
556
stringlist._buffer = CORBA_sequence_CORBA_string_allocbuf (num_fields);
557
stringlist._maximum = num_fields;
558
stringlist._length = num_fields;
560
for (i = 0, iter = fields; iter; iter = iter->next, i ++) {
561
stringlist._buffer[i] = CORBA_string_dup ((gchar *)iter->data);
564
printf ("calling GNOME_Evolution_Addressbook_BookListener_notifySupportedFields\n");
566
GNOME_Evolution_Addressbook_BookListener_notifySupportedFields (
567
book->priv->listener, opid, status,
571
CORBA_exception_free (&ev);
573
CORBA_free(stringlist._buffer);
577
* e_data_book_respond_get_supported_auth_methods:
578
* @book: an #EDataBook
579
* @opid: the operation ID that generated the response
580
* @status: the outcome of the operation
581
* @auth_methods: a list of names for supported auth methods
583
* Respond to a 'get supported auth methods' request specified by @opid on @book,
584
* indicating @status as the outcome.
587
e_data_book_respond_get_supported_auth_methods (EDataBook *book,
589
GNOME_Evolution_Addressbook_CallStatus status,
592
CORBA_Environment ev;
593
GNOME_Evolution_Addressbook_stringlist stringlist;
594
gint num_auth_methods;
598
CORBA_exception_init (&ev);
600
num_auth_methods = g_list_length (auth_methods);
602
stringlist._buffer = CORBA_sequence_CORBA_string_allocbuf (num_auth_methods);
603
stringlist._maximum = num_auth_methods;
604
stringlist._length = num_auth_methods;
606
for (i = 0, iter = auth_methods; iter; iter = iter->next, i ++) {
607
stringlist._buffer[i] = CORBA_string_dup ((gchar *)iter->data);
610
GNOME_Evolution_Addressbook_BookListener_notifySupportedAuthMethods (
611
book->priv->listener, opid, status,
615
CORBA_exception_free (&ev);
617
CORBA_free(stringlist._buffer);
621
view_destroy(gpointer data, GObject *where_object_was)
623
EDataBook *book = (EDataBook *)data;
624
e_book_backend_remove_book_view (book->priv->backend, (EDataBookView*)where_object_was);
628
* e_data_book_respond_get_book_view:
629
* @book: an #EDataBook
630
* @opid: the operation ID that generated the response
631
* @status: the outcome of the operation
632
* @book_view: the #EDataBookView created
634
* Respond to a 'get book view' request specified by @opid on @book,
635
* indicating @status as the outcome.
638
e_data_book_respond_get_book_view (EDataBook *book,
640
GNOME_Evolution_Addressbook_CallStatus status,
641
EDataBookView *book_view)
643
CORBA_Environment ev;
644
CORBA_Object object = CORBA_OBJECT_NIL;
646
printf ("e_data_book_respond_get_book_view\n");
648
CORBA_exception_init (&ev);
651
object = bonobo_object_corba_objref(BONOBO_OBJECT(book_view));
653
g_object_weak_ref (G_OBJECT (book_view), view_destroy, book);
656
GNOME_Evolution_Addressbook_BookListener_notifyViewRequested (
657
book->priv->listener, opid, status, object, &ev);
659
if (ev._major != CORBA_NO_EXCEPTION) {
660
g_warning ("e_data_book_respond_get_book_view: Exception "
661
"responding to BookListener!\n");
664
CORBA_exception_free (&ev);
668
* e_data_book_respond_get_contact:
669
* @book: an #EDataBook
670
* @opid: the operation ID that generated the response
671
* @status: the outcome of the operation
672
* @vcard: the found VCard, or %NULL
674
* Respond to a 'get contact' request specified by @opid on @book,
675
* indicating @status as the outcome.
678
e_data_book_respond_get_contact (EDataBook *book,
680
GNOME_Evolution_Addressbook_CallStatus status,
683
CORBA_Environment ev;
685
CORBA_exception_init (&ev);
687
GNOME_Evolution_Addressbook_BookListener_notifyContactRequested (book->priv->listener,
693
if (ev._major != CORBA_NO_EXCEPTION)
694
g_message ("could not notify listener of get-contact response");
696
CORBA_exception_free (&ev);
700
* e_data_book_respond_get_contact_list:
701
* @book: an #EDataBook
702
* @opid: the operation ID that generated the response
703
* @status: the outcome of the operation
704
* @card_list: a list of VCard strings
706
* Respond to a 'get contact list' request specified by @opid on @book,
707
* indicating @status as the outcome.
710
e_data_book_respond_get_contact_list (EDataBook *book,
712
GNOME_Evolution_Addressbook_CallStatus status,
715
CORBA_Environment ev;
716
GNOME_Evolution_Addressbook_stringlist stringlist;
721
CORBA_exception_init (&ev);
723
num_cards = g_list_length (card_list);
725
stringlist._buffer = CORBA_sequence_CORBA_string_allocbuf (num_cards);
726
stringlist._maximum = num_cards;
727
stringlist._length = num_cards;
729
for (i = 0, l = card_list; l; l = l->next, i ++)
730
stringlist._buffer[i] = CORBA_string_dup (l->data);
732
g_list_foreach (card_list, (GFunc)g_free, NULL);
733
g_list_free (card_list);
735
GNOME_Evolution_Addressbook_BookListener_notifyContactListRequested (book->priv->listener,
741
if (ev._major != CORBA_NO_EXCEPTION)
742
g_message ("could not notify listener of get-contact-list response");
744
CORBA_exception_free (&ev);
746
CORBA_free(stringlist._buffer);
750
* e_data_book_respond_get_changes:
751
* @book: an #EDataBook
752
* @opid: the operation ID that generated the response
753
* @status: the outcome of the operation
754
* @changes: a list of GNOME_Evolution_Addressbook_BookChangeItem items
756
* Respond to a 'get changes' request specified by @opid on @book,
757
* indicating @status as the outcome.
760
e_data_book_respond_get_changes (EDataBook *book,
762
GNOME_Evolution_Addressbook_CallStatus status,
765
CORBA_Environment ev;
766
GNOME_Evolution_Addressbook_BookChangeList changelist;
771
CORBA_exception_init (&ev);
773
num_changes = g_list_length (changes);
775
changelist._buffer = CORBA_sequence_GNOME_Evolution_Addressbook_BookChangeItem_allocbuf (num_changes);
776
changelist._maximum = num_changes;
777
changelist._length = num_changes;
779
for (i = 0, l = changes; l; l = l->next, i ++) {
780
GNOME_Evolution_Addressbook_BookChangeItem *change = (GNOME_Evolution_Addressbook_BookChangeItem*)l->data;
781
changelist._buffer[i] = *change;
782
changelist._buffer[i].vcard = CORBA_string_dup (change->vcard);
785
g_list_foreach (changes, (GFunc)CORBA_free, NULL);
786
g_list_free (changes);
788
GNOME_Evolution_Addressbook_BookListener_notifyChangesRequested (book->priv->listener,
794
if (ev._major != CORBA_NO_EXCEPTION)
795
g_message ("could not notify listener of get-changes response");
797
CORBA_exception_free (&ev);
799
CORBA_free(changelist._buffer);
803
* e_data_book_report_writable:
804
* @book: an #EDataBook
805
* @writable: %TRUE if @book is writeable, %FALSE otherwise
807
* Notify listeners that @book's writeable status has changed
811
e_data_book_report_writable (EDataBook *book,
814
CORBA_Environment ev;
816
CORBA_exception_init (&ev);
818
GNOME_Evolution_Addressbook_BookListener_notifyWritable (
819
book->priv->listener, (CORBA_boolean) writable, &ev);
821
if (ev._major != CORBA_NO_EXCEPTION) {
822
g_warning ("e_data_book_report_writable: Exception "
823
"responding to BookListener!\n");
826
CORBA_exception_free (&ev);
830
* e_data_book_report_connection_status:
831
* @book: an #EDataBook
832
* @is_online: %TRUE if the book is connected, %FALSE otherwise
834
* Notify listeners that @book's online status has changed
838
e_data_book_report_connection_status (EDataBook *book,
841
CORBA_Environment ev;
843
CORBA_exception_init (&ev);
845
GNOME_Evolution_Addressbook_BookListener_notifyConnectionStatus (
846
book->priv->listener, (CORBA_boolean) is_online, &ev);
848
if (ev._major != CORBA_NO_EXCEPTION) {
849
g_warning ("e_data_book_report_connection_status: Exception "
850
"responding to BookListener!\n");
853
CORBA_exception_free (&ev);
858
* e_data_book_report_connection_status:
859
* @book: an #EDataBook
861
* Notify listeners that @book requires authentication.
569
data_book_return_error (context, E_DATA_BOOK_STATUS_INVALID_QUERY, _("Invalid query"));
573
path = construct_bookview_path ();
574
book_view = e_data_book_view_new (book, path, search, card_sexp, max_results);
576
e_book_backend_add_book_view (backend, book_view);
578
dbus_g_method_return (context, path);
583
impl_AddressBook_Book_getChanges(EDataBook *book, const gchar *IN_change_id, DBusGMethodInvocation *context)
587
op = op_new (OP_GET_CHANGES, book, context);
588
op->d.change_id = g_strdup (IN_change_id);
589
g_thread_pool_push (op_pool, op, NULL);
593
e_data_book_respond_get_changes (EDataBook *book, guint32 opid, EDataBookStatus status, GList *changes)
595
DBusGMethodInvocation *context = opid_fetch (opid);
597
if (status != E_DATA_BOOK_STATUS_SUCCESS) {
598
data_book_return_error (context, status, _("Cannot get changes"));
600
/* The DBus interface to this is a(us), an array of structs of unsigned ints
601
and strings. In dbus-glib this is a GPtrArray of GValueArray of unsigned
605
array = g_ptr_array_new ();
607
while (changes != NULL) {
608
EDataBookChange *change = (EDataBookChange *) changes->data;
611
vals = g_value_array_new (2);
613
g_value_array_append (vals, NULL);
614
g_value_init (g_value_array_get_nth (vals, 0), G_TYPE_UINT);
615
g_value_set_uint (g_value_array_get_nth (vals, 0), change->change_type);
617
g_value_array_append (vals, NULL);
618
g_value_init (g_value_array_get_nth (vals, 1), G_TYPE_STRING);
619
g_value_take_string (g_value_array_get_nth (vals, 1), change->vcard);
620
/* Now change->vcard is owned by the GValue */
623
changes = g_list_remove (changes, change);
626
dbus_g_method_return (context, array);
627
g_ptr_array_foreach (array, (GFunc)g_value_array_free, NULL);
628
g_ptr_array_free (array, TRUE);
633
impl_AddressBook_Book_cancelOperation(EDataBook *book, GError **error)
635
if (e_book_backend_cancel_operation (e_data_book_get_backend (book), book) != GNOME_Evolution_Addressbook_Success) {
636
g_set_error (error, E_DATA_BOOK_ERROR, E_DATA_BOOK_STATUS_COULD_NOT_CANCEL, "Failed to cancel operation");
644
impl_AddressBook_Book_close(EDataBook *book, DBusGMethodInvocation *context)
646
e_book_backend_remove_client (e_data_book_get_backend (book), book);
647
g_object_unref (book);
649
dbus_g_method_return (context);
653
e_data_book_report_writable (EDataBook *book, gboolean writable)
655
g_return_if_fail (book != NULL);
657
g_signal_emit (book, signals[WRITABLE], 0, writable);
661
e_data_book_report_connection_status (EDataBook *book, gboolean connected)
663
g_return_if_fail (book != NULL);
665
g_signal_emit (book, signals[CONNECTION], 0, connected);
864
669
e_data_book_report_auth_required (EDataBook *book)
867
CORBA_Environment ev;
869
CORBA_exception_init (&ev);
871
GNOME_Evolution_Addressbook_BookListener_notifyAuthRequired (
872
book->priv->listener, &ev);
874
if (ev._major != CORBA_NO_EXCEPTION) {
875
g_warning ("e_data_book_report_auth_required: Exception "
876
"responding to BookListener!\n");
879
CORBA_exception_free (&ev);
884
e_data_book_construct (EDataBook *book,
885
EBookBackend *backend,
887
GNOME_Evolution_Addressbook_BookListener listener)
889
EDataBookPrivate *priv;
890
CORBA_Environment ev;
892
671
g_return_if_fail (book != NULL);
893
g_return_if_fail (source != NULL);
897
CORBA_exception_init (&ev);
898
book->priv->listener = CORBA_Object_duplicate (listener, &ev);
900
if (ev._major != CORBA_NO_EXCEPTION) {
901
g_message ("e_data_book_construct(): could not duplicate the listener");
902
CORBA_exception_free (&ev);
906
CORBA_exception_free (&ev);
908
g_object_ref (source);
910
priv->backend = g_object_ref(backend);
911
priv->source = source;
916
* @backend: an #EBookBackend
917
* @source: an #ESource
918
* @listener: a #GNOME_Evolution_Addressbook_BookListener CORBA object
920
* Create a new #EDataBook using @backend for storage, @source as the
921
* storage location and @listener for reporting status.
923
* Return value: A new #EDataBook.
926
e_data_book_new (EBookBackend *backend,
928
GNOME_Evolution_Addressbook_BookListener listener)
930
static GStaticMutex mutex = G_STATIC_MUTEX_INIT;
931
static PortableServer_POA poa = NULL;
934
g_static_mutex_lock (&mutex);
936
poa = bonobo_poa_get_threaded (ORBIT_THREAD_HINT_PER_REQUEST, NULL);
937
g_static_mutex_unlock (&mutex);
939
book = g_object_new (E_TYPE_DATA_BOOK, "poa", poa, NULL);
941
e_data_book_construct (book, backend, source, listener);
947
e_data_book_dispose (GObject *object)
949
EDataBook *book = E_DATA_BOOK (object);
952
CORBA_Environment ev;
954
CORBA_exception_init (&ev);
955
CORBA_Object_release (book->priv->listener, &ev);
957
if (ev._major != CORBA_NO_EXCEPTION)
958
g_message ("e_data_book_construct(): could not release the listener");
960
CORBA_exception_free (&ev);
962
g_object_unref (book->priv->source);
963
g_object_unref (book->priv->backend);
968
if (G_OBJECT_CLASS (e_data_book_parent_class)->dispose)
969
G_OBJECT_CLASS (e_data_book_parent_class)->dispose (object);
973
e_data_book_class_init (EDataBookClass *klass)
975
GObjectClass *object_class = G_OBJECT_CLASS (klass);
976
POA_GNOME_Evolution_Addressbook_Book__epv *epv;
978
e_data_book_parent_class = g_type_class_peek_parent (klass);
980
object_class->dispose = e_data_book_dispose;
984
epv->open = impl_GNOME_Evolution_Addressbook_Book_open;
985
epv->remove = impl_GNOME_Evolution_Addressbook_Book_remove;
986
epv->getContact = impl_GNOME_Evolution_Addressbook_Book_getContact;
987
epv->getContactList = impl_GNOME_Evolution_Addressbook_Book_getContactList;
988
epv->authenticateUser = impl_GNOME_Evolution_Addressbook_Book_authenticateUser;
989
epv->addContact = impl_GNOME_Evolution_Addressbook_Book_addContact;
990
epv->removeContacts = impl_GNOME_Evolution_Addressbook_Book_removeContacts;
991
epv->modifyContact = impl_GNOME_Evolution_Addressbook_Book_modifyContact;
992
epv->getStaticCapabilities = impl_GNOME_Evolution_Addressbook_Book_getStaticCapabilities;
993
epv->getSupportedFields = impl_GNOME_Evolution_Addressbook_Book_getSupportedFields;
994
epv->getRequiredFields = impl_GNOME_Evolution_Addressbook_Book_getRequiredFields;
995
epv->getSupportedAuthMethods = impl_GNOME_Evolution_Addressbook_Book_getSupportedAuthMethods;
996
epv->getBookView = impl_GNOME_Evolution_Addressbook_Book_getBookView;
997
epv->getChanges = impl_GNOME_Evolution_Addressbook_Book_getChanges;
998
epv->cancelOperation = impl_GNOME_Evolution_Addressbook_Book_cancelOperation;
1003
e_data_book_init (EDataBook *book)
1005
book->priv = g_new0 (EDataBookPrivate, 1);
1008
BONOBO_TYPE_FUNC_FULL (
1010
GNOME_Evolution_Addressbook_Book,
673
g_signal_emit (book, signals[AUTH_REQUIRED], 0);
677
return_status_and_list (guint32 opid, EDataBookStatus status, GList *list, gboolean free_data)
679
DBusGMethodInvocation *context = opid_fetch (opid);
681
if (status == E_DATA_BOOK_STATUS_SUCCESS) {
686
array = g_new0 (gchar *, g_list_length (list) + 1);
687
for (l = list; l != NULL; l = l->next) {
688
array[i++] = l->data;
691
dbus_g_method_return (context, array);
699
data_book_return_error (context, status, _("Cannot complete operation"));