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

« back to all changes in this revision

Viewing changes to libedataserver/e-client.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:
313
313
}
314
314
 
315
315
static void
 
316
client_remove_thread (GSimpleAsyncResult *simple,
 
317
                      GObject *object,
 
318
                      GCancellable *cancellable)
 
319
{
 
320
        GError *error = NULL;
 
321
 
 
322
        e_client_remove_sync (E_CLIENT (object), cancellable, &error);
 
323
 
 
324
        if (error != NULL)
 
325
                g_simple_async_result_take_error (simple, error);
 
326
}
 
327
 
 
328
static void
 
329
client_remove (EClient *client,
 
330
               GCancellable *cancellable,
 
331
               GAsyncReadyCallback callback,
 
332
               gpointer user_data)
 
333
{
 
334
        GSimpleAsyncResult *simple;
 
335
 
 
336
        simple = g_simple_async_result_new (
 
337
                G_OBJECT (client), callback, user_data, client_remove);
 
338
 
 
339
        g_simple_async_result_set_check_cancellable (simple, cancellable);
 
340
 
 
341
        g_simple_async_result_run_in_thread (
 
342
                simple, client_remove_thread,
 
343
                G_PRIORITY_DEFAULT, cancellable);
 
344
 
 
345
        g_object_unref (simple);
 
346
}
 
347
 
 
348
static gboolean
 
349
client_remove_finish (EClient *client,
 
350
                      GAsyncResult *result,
 
351
                      GError **error)
 
352
{
 
353
        GSimpleAsyncResult *simple;
 
354
 
 
355
        g_return_val_if_fail (
 
356
                g_simple_async_result_is_valid (
 
357
                result, G_OBJECT (client), client_remove), FALSE);
 
358
 
 
359
        simple = G_SIMPLE_ASYNC_RESULT (result);
 
360
 
 
361
        /* Assume success unless a GError is set. */
 
362
        return !g_simple_async_result_propagate_error (simple, error);
 
363
}
 
364
 
 
365
static gboolean
 
366
client_remove_sync (EClient *client,
 
367
                    GCancellable *cancellable,
 
368
                    GError **error)
 
369
{
 
370
        ESource *source;
 
371
 
 
372
        source = e_client_get_source (client);
 
373
 
 
374
        return e_source_remove_sync (source, cancellable, error);
 
375
}
 
376
 
 
377
static void
316
378
e_client_class_init (EClientClass *class)
317
379
{
318
380
        GObjectClass *object_class;
325
387
        object_class->dispose = client_dispose;
326
388
        object_class->finalize = client_finalize;
327
389
 
 
390
        class->remove = client_remove;
 
391
        class->remove_finish = client_remove_finish;
 
392
        class->remove_sync = client_remove_sync;
 
393
 
328
394
        g_object_class_install_property (
329
395
                object_class,
330
396
                PROP_SOURCE,
947
1013
 
948
1014
        e_client_set_capabilities (client, res ? *capabilities : NULL);
949
1015
 
 
1016
        if (error && *error)
 
1017
                e_client_unwrap_dbus_error (client, *error, error);
 
1018
 
950
1019
        return res;
951
1020
}
952
1021
 
988
1057
 
989
1058
        e_client_set_capabilities (client, res ? *capabilities : NULL);
990
1059
 
 
1060
        if (error && *error)
 
1061
                e_client_unwrap_dbus_error (client, *error, error);
 
1062
 
991
1063
        return res;
992
1064
}
993
1065
 
1045
1117
                                      GError **error)
1046
1118
{
1047
1119
        EClientClass *class;
 
1120
        gboolean res;
1048
1121
 
1049
1122
        g_return_val_if_fail (E_IS_CLIENT (client), FALSE);
1050
1123
        g_return_val_if_fail (prop_value != NULL, FALSE);
1053
1126
        g_return_val_if_fail (class != NULL, FALSE);
1054
1127
        g_return_val_if_fail (class->get_backend_property_finish != NULL, FALSE);
1055
1128
 
1056
 
        return class->get_backend_property_finish (client, result, prop_value, error);
 
1129
        res = class->get_backend_property_finish (client, result, prop_value, error);
 
1130
 
 
1131
        if (error && *error)
 
1132
                e_client_unwrap_dbus_error (client, *error, error);
 
1133
 
 
1134
        return res;
1057
1135
}
1058
1136
 
1059
1137
/**
1078
1156
                                    GError **error)
1079
1157
{
1080
1158
        EClientClass *class;
 
1159
        gboolean res;
1081
1160
 
1082
1161
        g_return_val_if_fail (E_IS_CLIENT (client), FALSE);
1083
1162
        g_return_val_if_fail (prop_name != NULL, FALSE);
1087
1166
        g_return_val_if_fail (class != NULL, FALSE);
1088
1167
        g_return_val_if_fail (class->get_backend_property_sync != NULL, FALSE);
1089
1168
 
1090
 
        return class->get_backend_property_sync (client, prop_name, prop_value, cancellable, error);
 
1169
        res = class->get_backend_property_sync (client, prop_name, prop_value, cancellable, error);
 
1170
 
 
1171
        if (error && *error)
 
1172
                e_client_unwrap_dbus_error (client, *error, error);
 
1173
 
 
1174
        return res;
1091
1175
}
1092
1176
 
1093
1177
/**
1145
1229
                                      GError **error)
1146
1230
{
1147
1231
        EClientClass *class;
 
1232
        gboolean res;
1148
1233
 
1149
1234
        g_return_val_if_fail (E_IS_CLIENT (client), FALSE);
1150
1235
 
1152
1237
        g_return_val_if_fail (class != NULL, FALSE);
1153
1238
        g_return_val_if_fail (class->set_backend_property_finish != NULL, FALSE);
1154
1239
 
1155
 
        return class->set_backend_property_finish (client, result, error);
 
1240
        res = class->set_backend_property_finish (client, result, error);
 
1241
 
 
1242
        if (error && *error)
 
1243
                e_client_unwrap_dbus_error (client, *error, error);
 
1244
 
 
1245
        return res;
1156
1246
}
1157
1247
 
1158
1248
/**
1178
1268
                                    GError **error)
1179
1269
{
1180
1270
        EClientClass *class;
 
1271
        gboolean res;
1181
1272
 
1182
1273
        g_return_val_if_fail (E_IS_CLIENT (client), FALSE);
1183
1274
        g_return_val_if_fail (prop_name != NULL, FALSE);
1187
1278
        g_return_val_if_fail (class != NULL, FALSE);
1188
1279
        g_return_val_if_fail (class->set_backend_property_sync != NULL, FALSE);
1189
1280
 
1190
 
        return class->set_backend_property_sync (client, prop_name, prop_value, cancellable, error);
 
1281
        res = class->set_backend_property_sync (client, prop_name, prop_value, cancellable, error);
 
1282
 
 
1283
        if (error && *error)
 
1284
                e_client_unwrap_dbus_error (client, *error, error);
 
1285
 
 
1286
        return res;
1191
1287
}
1192
1288
 
1193
1289
/**
1240
1336
                      GError **error)
1241
1337
{
1242
1338
        EClientClass *class;
 
1339
        gboolean res;
1243
1340
 
1244
1341
        g_return_val_if_fail (E_IS_CLIENT (client), FALSE);
1245
1342
 
1247
1344
        g_return_val_if_fail (class != NULL, FALSE);
1248
1345
        g_return_val_if_fail (class->open_finish != NULL, FALSE);
1249
1346
 
1250
 
        return class->open_finish (client, result, error);
 
1347
        res = class->open_finish (client, result, error);
 
1348
 
 
1349
        if (error && *error)
 
1350
                e_client_unwrap_dbus_error (client, *error, error);
 
1351
 
 
1352
        return res;
1251
1353
}
1252
1354
 
1253
1355
/**
1270
1372
                    GError **error)
1271
1373
{
1272
1374
        EClientClass *class;
 
1375
        gboolean res;
1273
1376
 
1274
1377
        class = E_CLIENT_GET_CLASS (client);
1275
1378
        g_return_val_if_fail (class != NULL, FALSE);
1276
1379
        g_return_val_if_fail (class->open_sync != NULL, FALSE);
1277
1380
 
1278
 
        return class->open_sync (client, only_if_exists, cancellable, error);
 
1381
        res = class->open_sync (client, only_if_exists, cancellable, error);
 
1382
 
 
1383
        if (error && *error)
 
1384
                e_client_unwrap_dbus_error (client, *error, error);
 
1385
 
 
1386
        return res;
1279
1387
}
1280
1388
 
1281
1389
/**
1290
1398
 * The call is finished by e_client_remove_finish() from the @callback.
1291
1399
 *
1292
1400
 * Since: 3.2
 
1401
 *
 
1402
 * Deprecated: 3.6: Use e_source_remove() instead.
1293
1403
 **/
1294
1404
void
1295
1405
e_client_remove (EClient *client,
1320
1430
 * Returns: %TRUE if successful, %FALSE otherwise.
1321
1431
 *
1322
1432
 * Since: 3.2
 
1433
 *
 
1434
 * Deprecated: 3.6: Use e_source_remove_finish() instead.
1323
1435
 **/
1324
1436
gboolean
1325
1437
e_client_remove_finish (EClient *client,
1327
1439
                        GError **error)
1328
1440
{
1329
1441
        EClientClass *class;
 
1442
        gboolean res;
1330
1443
 
1331
1444
        g_return_val_if_fail (E_IS_CLIENT (client), FALSE);
1332
1445
 
1334
1447
        g_return_val_if_fail (class != NULL, FALSE);
1335
1448
        g_return_val_if_fail (class->remove_finish != NULL, FALSE);
1336
1449
 
1337
 
        return class->remove_finish (client, result, error);
 
1450
        res = class->remove_finish (client, result, error);
 
1451
 
 
1452
        if (error && *error)
 
1453
                e_client_unwrap_dbus_error (client, *error, error);
 
1454
 
 
1455
        return res;
1338
1456
}
1339
1457
 
1340
1458
/**
1349
1467
 * Returns: %TRUE if successful, %FALSE otherwise.
1350
1468
 *
1351
1469
 * Since: 3.2
 
1470
 *
 
1471
 * Deprecated: 3.6: Use e_source_remove_sync() instead.
1352
1472
 **/
1353
1473
gboolean
1354
1474
e_client_remove_sync (EClient *client,
1356
1476
                      GError **error)
1357
1477
{
1358
1478
        EClientClass *class;
 
1479
        gboolean res;
1359
1480
 
1360
1481
        class = E_CLIENT_GET_CLASS (client);
1361
1482
        g_return_val_if_fail (class != NULL, FALSE);
1362
1483
        g_return_val_if_fail (class->remove_sync != NULL, FALSE);
1363
1484
 
1364
 
        return class->remove_sync (client, cancellable, error);
 
1485
        res = class->remove_sync (client, cancellable, error);
 
1486
 
 
1487
        if (error && *error)
 
1488
                e_client_unwrap_dbus_error (client, *error, error);
 
1489
 
 
1490
        return res;
1365
1491
}
1366
1492
 
1367
1493
/**
1415
1541
                         GError **error)
1416
1542
{
1417
1543
        EClientClass *class;
 
1544
        gboolean res;
1418
1545
 
1419
1546
        g_return_val_if_fail (E_IS_CLIENT (client), FALSE);
1420
1547
 
1422
1549
        g_return_val_if_fail (class != NULL, FALSE);
1423
1550
        g_return_val_if_fail (class->refresh_finish != NULL, FALSE);
1424
1551
 
1425
 
        return class->refresh_finish (client, result, error);
 
1552
        res = class->refresh_finish (client, result, error);
 
1553
 
 
1554
        if (error && *error)
 
1555
                e_client_unwrap_dbus_error (client, *error, error);
 
1556
 
 
1557
        return res;
1426
1558
}
1427
1559
 
1428
1560
/**
1446
1578
                       GError **error)
1447
1579
{
1448
1580
        EClientClass *class;
 
1581
        gboolean res;
1449
1582
 
1450
1583
        class = E_CLIENT_GET_CLASS (client);
1451
1584
        g_return_val_if_fail (class != NULL, FALSE);
1452
1585
        g_return_val_if_fail (class->refresh_sync != NULL, FALSE);
1453
1586
 
1454
 
        return class->refresh_sync (client, cancellable, error);
 
1587
        res = class->refresh_sync (client, cancellable, error);
 
1588
 
 
1589
        if (error && *error)
 
1590
                e_client_unwrap_dbus_error (client, *error, error);
 
1591
 
 
1592
        return res;
1455
1593
}
1456
1594
 
1457
1595
/**
1763
1901
                *client_error = g_error_new_literal (E_CLIENT_ERROR, E_CLIENT_ERROR_OTHER_ERROR, dbus_error->message);
1764
1902
                g_error_free (dbus_error);
1765
1903
        } else {
1766
 
                if (dbus_error->domain == G_DBUS_ERROR)
1767
 
                        g_dbus_error_strip_remote_error (dbus_error);
 
1904
                g_dbus_error_strip_remote_error (dbus_error);
1768
1905
                *client_error = dbus_error;
1769
1906
        }
1770
1907