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

« back to all changes in this revision

Viewing changes to calendar/backends/contacts/e-cal-backend-contacts.c

  • Committer: Package Import Robot
  • Author(s): Chris Coulson
  • Date: 2012-10-08 12:58:16 UTC
  • mfrom: (181.1.7 quantal)
  • Revision ID: package-import@ubuntu.com-20121008125816-i3n76e8c0m64e7xp
Tags: 3.6.0-0ubuntu2
* Fix LP: #1038047 part 1 - Don't abort in e_source_registry_new* when a
  problem occurs connecting to the Dbus service
  - add debian/patches/dont-abort-in-e_source_registry_new.patch
  - update debian/patches/series
* Fix LP: #1038047 part 2 - libedataserver depends on
  evolution-data-server-common to ensure that the GSettings schemas are
  present
  - update debian/control

Show diffs side-by-side

added added

removed removed

Lines of Context:
58
58
/* Private part of the ECalBackendContacts structure */
59
59
struct _ECalBackendContactsPrivate {
60
60
 
61
 
        GMutex *mutex;                  /* guards 'addressbooks' */
 
61
        GRecMutex rec_mutex;                    /* guards 'addressbooks' */
62
62
        GHashTable   *addressbooks;     /* UID -> BookRecord */
63
63
        gboolean      addressbook_loaded;
64
64
 
210
210
                                         ESource *source,
211
211
                                         BookRecord *br)
212
212
{
213
 
        g_mutex_lock (cbc->priv->mutex);
 
213
        g_rec_mutex_lock (&cbc->priv->rec_mutex);
214
214
 
215
215
        g_hash_table_insert (
216
216
                cbc->priv->addressbooks,
217
217
                g_object_ref (source),
218
218
                book_record_ref (br));
219
219
 
220
 
        g_mutex_unlock (cbc->priv->mutex);
 
220
        g_rec_mutex_unlock (&cbc->priv->rec_mutex);
221
221
}
222
222
 
223
223
static gboolean
226
226
{
227
227
        gboolean removed;
228
228
 
229
 
        g_mutex_lock (cbc->priv->mutex);
 
229
        g_rec_mutex_lock (&cbc->priv->rec_mutex);
230
230
 
231
231
        removed = g_hash_table_remove (cbc->priv->addressbooks, source);
232
232
 
233
 
        g_mutex_unlock (cbc->priv->mutex);
 
233
        g_rec_mutex_unlock (&cbc->priv->rec_mutex);
234
234
 
235
235
        return removed;
236
236
}
885
885
        e_cal_component_set_icalcomponent (cal_comp, ical_comp);
886
886
 
887
887
        /* Set uid */
888
 
        d(g_message ("Creating UID: %s", uid));
 
888
        d (g_message ("Creating UID: %s", uid));
889
889
        e_cal_component_set_uid (cal_comp, uid);
890
890
 
891
891
        /* Set all-day event's date from contact data */
1032
1032
}
1033
1033
 
1034
1034
static void
1035
 
e_cal_backend_contacts_remove (ECalBackendSync *backend,
1036
 
                               EDataCal *cal,
1037
 
                               GCancellable *cancellable,
1038
 
                               GError **perror)
1039
 
{
1040
 
        /* WRITE ME */
1041
 
        g_propagate_error (perror, EDC_ERROR (PermissionDenied));
1042
 
}
1043
 
 
1044
 
static void
1045
1035
e_cal_backend_contacts_get_object (ECalBackendSync *backend,
1046
1036
                                   EDataCal *cal,
1047
1037
                                   GCancellable *cancellable,
1078
1068
        if (record->comp_birthday && g_str_has_suffix (uid, BIRTHDAY_UID_EXT)) {
1079
1069
                *object = e_cal_component_get_as_string (record->comp_birthday);
1080
1070
 
1081
 
                d(g_message ("Return birthday: %s", *object));
 
1071
                d (g_message ("Return birthday: %s", *object));
1082
1072
                return;
1083
1073
        }
1084
1074
 
1085
1075
        if (record->comp_anniversary && g_str_has_suffix (uid, ANNIVERSARY_UID_EXT)) {
1086
1076
                *object = e_cal_component_get_as_string (record->comp_anniversary);
1087
1077
 
1088
 
                d(g_message ("Return anniversary: %s", *object));
 
1078
                d (g_message ("Return anniversary: %s", *object));
1089
1079
                return;
1090
1080
        }
1091
1081
 
1092
 
        d(g_message ("Returning nothing for uid: %s", uid));
 
1082
        d (g_message ("Returning nothing for uid: %s", uid));
1093
1083
 
1094
1084
        g_propagate_error (perror, EDC_ERROR (ObjectNotFound));
1095
1085
}
1326
1316
                g_signal_handler_disconnect (priv->settings, priv->notifyid);
1327
1317
 
1328
1318
        g_object_unref (priv->settings);
1329
 
        g_mutex_free (priv->mutex);
 
1319
        g_rec_mutex_clear (&priv->rec_mutex);
1330
1320
 
1331
1321
        /* Chain up to parent's finalize() method. */
1332
1322
        G_OBJECT_CLASS (e_cal_backend_contacts_parent_class)->finalize (object);
1354
1344
{
1355
1345
        cbc->priv = E_CAL_BACKEND_CONTACTS_GET_PRIVATE (cbc);
1356
1346
 
1357
 
        cbc->priv->mutex = g_mutex_new ();
 
1347
        g_rec_mutex_init (&cbc->priv->rec_mutex);
1358
1348
 
1359
1349
        cbc->priv->addressbooks = g_hash_table_new_full (
1360
1350
                (GHashFunc) e_source_hash,
1419
1409
 
1420
1410
        sync_class->get_backend_property_sync   = e_cal_backend_contacts_get_backend_property;
1421
1411
        sync_class->open_sync                   = e_cal_backend_contacts_open;
1422
 
        sync_class->remove_sync                 = e_cal_backend_contacts_remove;
1423
1412
        sync_class->create_objects_sync         = e_cal_backend_contacts_create_objects;
1424
1413
        sync_class->receive_objects_sync        = e_cal_backend_contacts_receive_objects;
1425
1414
        sync_class->send_objects_sync           = e_cal_backend_contacts_send_objects;