~ubuntu-branches/ubuntu/quantal/evolution-data-server/quantal

« back to all changes in this revision

Viewing changes to addressbook/libedata-book/e-data-book.c

  • Committer: Package Import Robot
  • Author(s): Mathieu Trudel-Lapierre
  • Date: 2012-07-03 22:41:23 UTC
  • mfrom: (1.1.100)
  • Revision ID: package-import@ubuntu.com-20120703224123-90dydkyfyvff8s0s
Tags: 3.5.3.1-0ubuntu1
* New upstream release 3.5.3.1.
* debian/control:
  - Drop libgconf2-dev from Build-Depends.
  - Bump versions for glib, goa, and libsoup in Build-Depends.
  - Add a Build-Depends on libgcr-3-dev (>= 3.4)
  - Rename packages following upstream SONAME changes.
  - Add Depends on libgnome-keyring-dev to libedataserver1.2-dev.
* debian/rules:
  - Update mkshlibs arguments for libcamel-1.2-38 instead of -33; as it was
    renamed in control due to the soname change.
  - Strip out -Bsymbolic-functions from LDFLAGS.
* Renamed install files in debian/:
  - libcamel-1.2-33.install => libcamel-1.2-38.install
  - libebackend-1.2-2.install => libebackend-1.2-4.install
  - libebook-1.2-13.install => libebook-1.2-17.install
  - libecal-1.2-11.install => libecal-1.2-15.install
  - libedata-book-1.2-13.install => libedata-book-1.2-15.install
  - libedata-cal-1.2-15.install => libedata-cal-1.2-18.install
  - libedataserver-1.2-16.install => libedataserver-1.2-17.install
  - libedataserverui-3.0-1.install => libedataserverui-3.0-4.install
* debian/patches/google_tests_fpic.patch: build tests with -fPIC; otherwise
  build fails.

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
#include <glib/gi18n.h>
26
26
#include <gio/gio.h>
27
27
 
28
 
#include <libedataserver/e-credentials.h>
29
 
#include <libedataserver/e-data-server-util.h>
30
 
#include <libedataserver/e-operation-pool.h>
 
28
#include <libebook/libebook.h>
31
29
 
32
 
#include "e-data-book-enumtypes.h"
33
30
#include "e-data-book-factory.h"
34
31
#include "e-data-book.h"
35
32
#include "e-data-book-view.h"
 
33
#include "e-book-backend.h"
36
34
#include "e-book-backend-sexp.h"
37
35
 
38
36
#include "e-gdbus-book.h"
65
63
        OP_GET_CONTACT,
66
64
        OP_GET_CONTACTS,
67
65
        OP_GET_CONTACTS_UIDS,
68
 
        OP_AUTHENTICATE,
69
66
        OP_ADD_CONTACTS,
70
67
        OP_REMOVE_CONTACTS,
71
68
        OP_MODIFY_CONTACTS,
88
85
                gboolean only_if_exists;
89
86
                /* OP_GET_CONTACT */
90
87
                gchar *uid;
91
 
                /* OP_AUTHENTICATE */
92
 
                ECredentials *credentials;
93
88
                /* OP_REMOVE_CONTACTS */
94
89
                GSList *ids;
95
90
                /* OP_ADD_CONTACT */
233
228
                }
234
229
                g_free (op->d.query);
235
230
                break;
236
 
        case OP_AUTHENTICATE:
237
 
                e_book_backend_authenticate_user (backend, op->cancellable, op->d.credentials);
238
 
                e_credentials_free (op->d.credentials);
239
 
                break;
240
231
        case OP_CANCEL_OPERATION:
241
232
                g_static_rec_mutex_lock (&op->book->priv->pending_ops_lock);
242
233
 
746
737
}
747
738
 
748
739
static gboolean
749
 
impl_Book_authenticate_user (EGdbusBook *object,
750
 
                             GDBusMethodInvocation *invocation,
751
 
                             const gchar * const *in_credentials,
752
 
                             EDataBook *book)
753
 
{
754
 
        OperationData *op;
755
 
 
756
 
        if (in_credentials == NULL) {
757
 
                GError *error = e_data_book_create_error (E_DATA_BOOK_STATUS_INVALID_ARG, NULL);
758
 
                /* Translators: This is prefix to a detailed error message */
759
 
                data_book_return_error (invocation, error, _("Cannot authenticate user: "));
760
 
                g_error_free (error);
761
 
                return TRUE;
762
 
        }
763
 
 
764
 
        op = op_new (OP_AUTHENTICATE, book);
765
 
        op->d.credentials = e_credentials_new_strv (in_credentials);
766
 
 
767
 
        e_gdbus_book_complete_authenticate_user (book->priv->gdbus_object, invocation, NULL);
768
 
        e_operation_pool_push (ops_pool, op);
769
 
 
770
 
        return TRUE;
771
 
}
772
 
 
773
 
static gboolean
774
740
impl_Book_cancel_operation (EGdbusBook *object,
775
741
                            GDBusMethodInvocation *invocation,
776
742
                            guint in_opid,
1163
1129
        e_gdbus_book_emit_online (book->priv->gdbus_object, is_online);
1164
1130
}
1165
1131
 
1166
 
/* credentilas contains extra information for a source for which authentication is requested.
1167
 
 * This parameter can be NULL to indicate "for this book".
1168
 
*/
1169
 
void
1170
 
e_data_book_report_auth_required (EDataBook *book,
1171
 
                                  const ECredentials *credentials)
1172
 
{
1173
 
        gchar *empty_strv[2];
1174
 
        gchar **strv = NULL;
1175
 
 
1176
 
        g_return_if_fail (book != NULL);
1177
 
 
1178
 
        empty_strv[0] = NULL;
1179
 
        empty_strv[1] = NULL;
1180
 
 
1181
 
        if (credentials)
1182
 
                strv = e_credentials_to_strv (credentials);
1183
 
 
1184
 
        e_gdbus_book_emit_auth_required (book->priv->gdbus_object, (const gchar * const *) (strv ? strv : empty_strv));
1185
 
 
1186
 
        g_strfreev (strv);
1187
 
}
1188
 
 
1189
1132
/**
1190
1133
 * e_data_book_report_opened:
1191
1134
 *
1404
1347
                gdbus_object, "handle-get-contact-list-uids",
1405
1348
                G_CALLBACK (impl_Book_get_contact_list_uids), ebook);
1406
1349
        g_signal_connect (
1407
 
                gdbus_object, "handle-authenticate-user",
1408
 
                G_CALLBACK (impl_Book_authenticate_user), ebook);
1409
 
        g_signal_connect (
1410
1350
                gdbus_object, "handle-add-contacts",
1411
1351
                G_CALLBACK (impl_Book_add_contacts), ebook);
1412
1352
        g_signal_connect (