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

« back to all changes in this revision

Viewing changes to modules/ubuntu-online-accounts/module-ubuntu-online-accounts.c

  • Committer: Package Import Robot
  • Author(s): Iain Lane
  • Date: 2015-07-20 13:34:59 UTC
  • mfrom: (1.1.126) (1.2.48 sid)
  • Revision ID: package-import@ubuntu.com-20150720133459-g6y46hnu5ewtoz08
Tags: 3.16.4-0ubuntu2
debian/patches/0001-Bug-752373-Monthly-events-do-not-recur-correctly.patch:
Cherry-pick patch from upstream to fix events not recurring correctly.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
2
 * module-ubuntu-online-accounts.c
3
3
 *
4
 
 * This library is free software you can redistribute it and/or modify it
 
4
 * This library is free software: you can redistribute it and/or modify it
5
5
 * under the terms of the GNU Lesser General Public License as published by
6
6
 * the Free Software Foundation.
7
7
 *
8
8
 * This library is distributed in the hope that it will be useful, but
9
9
 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
10
 
 * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 
10
 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
11
11
 * for more details.
12
12
 *
13
13
 * You should have received a copy of the GNU Lesser General Public License
14
 
 * along with this library; if not, see <http://www.gnu.org/licenses/>.
 
14
 * along with this library. If not, see <http://www.gnu.org/licenses/>.
15
15
 *
16
16
 */
17
17
 
21
21
#include <libaccounts-glib/accounts-glib.h>
22
22
 
23
23
#include "uoa-utils.h"
24
 
#include "e-signon-session-password.h"
25
24
 
26
25
/* Standard GObject macros */
27
26
#define E_TYPE_UBUNTU_ONLINE_ACCOUNTS \
292
291
        gboolean supports_oauth2 = FALSE;
293
292
        const gchar *extension_name;
294
293
 
295
 
        g_object_bind_property (
 
294
        e_binding_bind_property (
296
295
                ag_account, "display-name",
297
296
                source, "display-name",
298
297
                G_BINDING_SYNC_CREATE);
299
298
 
300
 
        g_object_bind_property (
 
299
        e_binding_bind_property (
301
300
                ag_account, "enabled",
302
301
                source, "enabled",
303
302
                G_BINDING_SYNC_CREATE);
305
304
        extension_name = E_SOURCE_EXTENSION_UOA;
306
305
        source_extension = e_source_get_extension (source, extension_name);
307
306
 
308
 
        g_object_bind_property (
 
307
        e_binding_bind_property (
309
308
                ag_account, "id",
310
309
                source_extension, "account-id",
311
310
                G_BINDING_SYNC_CREATE);
313
312
        extension_name = E_SOURCE_EXTENSION_COLLECTION;
314
313
        source_extension = e_source_get_extension (source, extension_name);
315
314
 
316
 
        g_object_bind_property_full (
 
315
        e_binding_bind_property_full (
317
316
                ag_account, "provider",
318
317
                source_extension, "backend-name",
319
318
                G_BINDING_SYNC_CREATE,
329
328
        ag_account_service = g_hash_table_lookup (
330
329
                account_services, E_AG_SERVICE_TYPE_MAIL);
331
330
        if (ag_account_service != NULL) {
332
 
                g_object_bind_property (
 
331
                e_binding_bind_property (
333
332
                        ag_account_service , "enabled",
334
333
                        source_extension, "mail-enabled",
335
334
                        G_BINDING_SYNC_CREATE);
341
340
        ag_account_service = g_hash_table_lookup (
342
341
                account_services, E_AG_SERVICE_TYPE_CALENDAR);
343
342
        if (ag_account_service != NULL) {
344
 
                g_object_bind_property (
 
343
                e_binding_bind_property (
345
344
                        ag_account_service, "enabled",
346
345
                        source_extension, "calendar-enabled",
347
346
                        G_BINDING_SYNC_CREATE);
353
352
        ag_account_service = g_hash_table_lookup (
354
353
                account_services, E_AG_SERVICE_TYPE_CONTACTS);
355
354
        if (ag_account_service != NULL) {
356
 
                g_object_bind_property (
 
355
                e_binding_bind_property (
357
356
                        ag_account_service, "enabled",
358
357
                        source_extension, "contacts-enabled",
359
358
                        G_BINDING_SYNC_CREATE);
371
370
                g_hash_table_ref (account_services),
372
371
                (GDestroyNotify) g_hash_table_unref);
373
372
 
 
373
        e_server_side_source_set_writable (E_SERVER_SIDE_SOURCE (source), TRUE);
 
374
 
374
375
        /* The data source should not be removable by clients. */
375
 
        e_server_side_source_set_removable (
376
 
                E_SERVER_SIDE_SOURCE (source), FALSE);
377
 
 
378
 
        /* Obtain passwords from the signond service. */
379
 
        e_server_side_source_set_auth_session_type (
380
 
                E_SERVER_SIDE_SOURCE (source),
381
 
                E_TYPE_SIGNON_SESSION_PASSWORD);
 
376
        e_server_side_source_set_removable (E_SERVER_SIDE_SOURCE (source), FALSE);
382
377
 
383
378
        if (supports_oauth2) {
384
379
                /* This module provides OAuth 2.0 support to the collection.
424
419
                                             const gchar *email_address)
425
420
{
426
421
        EServerSideSource *server_side_source;
 
422
        ESourceMailSubmission *mail_submission;
 
423
        ESourceMailComposition *mail_composition;
 
424
        gchar *tmp;
427
425
 
428
426
        if (email_address != NULL) {
429
427
                ESourceMailIdentity *source_extension;
434
432
                        source_extension, email_address);
435
433
        }
436
434
 
 
435
        /* Set default Sent folder to the On This Computer/Sent */
 
436
        mail_submission = e_source_get_extension (source, E_SOURCE_EXTENSION_MAIL_SUBMISSION);
 
437
        tmp = e_source_mail_submission_dup_sent_folder (mail_submission);
 
438
        if (!tmp || !*tmp)
 
439
                e_source_mail_submission_set_sent_folder (mail_submission, "folder://local/Sent");
 
440
        g_free (tmp);
 
441
 
 
442
        /* Set default Drafts folder to the On This Computer/Drafts */
 
443
        mail_composition = e_source_get_extension (source, E_SOURCE_EXTENSION_MAIL_COMPOSITION);
 
444
        tmp = e_source_mail_composition_dup_drafts_folder (mail_composition);
 
445
        if (!tmp || !*tmp)
 
446
                e_source_mail_composition_set_drafts_folder (mail_composition, "folder://local/Drafts");
 
447
        g_free (tmp);
 
448
 
437
449
        /* Clients may change the source but may not remove it. */
438
450
        server_side_source = E_SERVER_SIDE_SOURCE (source);
439
451
        e_server_side_source_set_writable (server_side_source, TRUE);
707
719
 
708
720
        if (source_uid == NULL && backend_name != NULL)
709
721
                backend_factory = e_data_factory_ref_backend_factory (
710
 
                        E_DATA_FACTORY (server), backend_name);
 
722
                        E_DATA_FACTORY (server), backend_name, E_SOURCE_EXTENSION_COLLECTION);
711
723
 
712
724
        if (backend_factory != NULL) {
713
725
                ubuntu_online_accounts_collect_userinfo (
1139
1151
e_module_load (GTypeModule *type_module)
1140
1152
{
1141
1153
        e_ubuntu_online_accounts_register_type (type_module);
1142
 
        e_signon_session_password_type_register (type_module);
1143
1154
}
1144
1155
 
1145
1156
G_MODULE_EXPORT void