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

« back to all changes in this revision

Viewing changes to camel/providers/local/camel-local-store.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:
74
74
        new = g_build_filename (prefix, basename, NULL);
75
75
        g_free (basename);
76
76
 
77
 
        d(printf("renaming %s%s to %s%s\n", oldp, suffix, newp, suffix));
 
77
        d (printf ("renaming %s%s to %s%s\n", oldp, suffix, newp, suffix));
78
78
 
79
79
        if (g_stat (old, &st) == -1) {
80
80
                if (missingok && errno == ENOENT) {
167
167
        gchar *path;
168
168
        gchar *name;
169
169
 
170
 
        settings = camel_service_get_settings (service);
 
170
        settings = camel_service_ref_settings (service);
171
171
 
172
172
        local_settings = CAMEL_LOCAL_SETTINGS (settings);
173
173
        path = camel_local_settings_dup_path (local_settings);
174
174
 
 
175
        g_object_unref (settings);
 
176
 
175
177
        if (brief)
176
178
                name = g_strdup (path);
177
179
        else
206
208
        gchar *path;
207
209
 
208
210
        service = CAMEL_SERVICE (store);
209
 
        settings= camel_service_get_settings (service);
 
211
 
 
212
        settings= camel_service_ref_settings (service);
210
213
 
211
214
        local_settings = CAMEL_LOCAL_SETTINGS (settings);
212
215
        path = camel_local_settings_dup_path (local_settings);
213
216
 
 
217
        g_object_unref (settings);
 
218
 
214
219
        if (!g_path_is_absolute (path)) {
215
220
                g_set_error (
216
221
                        error, CAMEL_STORE_ERROR,
270
275
         * there before.
271
276
         */
272
277
 
273
 
        d(printf("-- LOCAL STORE -- get folder info: %s\n", top));
 
278
        d (printf ("-- LOCAL STORE -- get folder info: %s\n", top));
274
279
 
275
280
        return NULL;
276
281
}
361
366
        struct stat st;
362
367
 
363
368
        service = CAMEL_SERVICE (store);
364
 
        settings = camel_service_get_settings (service);
 
369
 
 
370
        settings = camel_service_ref_settings (service);
365
371
 
366
372
        local_settings = CAMEL_LOCAL_SETTINGS (settings);
367
373
        path = camel_local_settings_dup_path (local_settings);
368
374
 
 
375
        g_object_unref (settings);
 
376
 
369
377
        /* This is a pretty hacky version of create folder, but should basically work */
370
378
 
371
379
        if (!g_path_is_absolute (path)) {
377
385
        }
378
386
 
379
387
        if (parent_name && *parent_name)
380
 
                name = g_strdup_printf("%s/%s/%s", path, parent_name, folder_name);
 
388
                name = g_strdup_printf ("%s/%s/%s", path, parent_name, folder_name);
381
389
        else
382
 
                name = g_strdup_printf("%s/%s", path, folder_name);
 
390
                name = g_strdup_printf ("%s/%s", path, folder_name);
383
391
 
384
392
        if (g_stat (name, &st) == 0 || errno != ENOENT) {
385
393
                g_set_error (
393
401
        g_free (name);
394
402
 
395
403
        if (parent_name && *parent_name)
396
 
                name = g_strdup_printf("%s/%s", parent_name, folder_name);
 
404
                name = g_strdup_printf ("%s/%s", parent_name, folder_name);
397
405
        else
398
 
                name = g_strdup_printf("%s", folder_name);
 
406
                name = g_strdup_printf ("%s", folder_name);
399
407
 
400
408
        folder = CAMEL_STORE_GET_CLASS (store)->get_folder_sync (
401
409
                store, name, CAMEL_STORE_FOLDER_CREATE, cancellable, error);
430
438
        gboolean success = TRUE;
431
439
 
432
440
        service = CAMEL_SERVICE (store);
433
 
        settings = camel_service_get_settings (service);
 
441
 
 
442
        settings = camel_service_ref_settings (service);
434
443
 
435
444
        local_settings = CAMEL_LOCAL_SETTINGS (settings);
436
445
        path = camel_local_settings_dup_path (local_settings);
437
446
 
 
447
        g_object_unref (settings);
 
448
 
438
449
        /* remove metadata only */
439
450
        name = g_build_filename (path, folder_name, NULL);
440
451
        str = g_strdup_printf ("%s.ibex", name);
512
523
        gboolean success = TRUE;
513
524
 
514
525
        service = CAMEL_SERVICE (store);
515
 
        settings = camel_service_get_settings (service);
 
526
 
 
527
        settings = camel_service_ref_settings (service);
516
528
 
517
529
        local_settings = CAMEL_LOCAL_SETTINGS (settings);
518
530
        path = camel_local_settings_dup_path (local_settings);
519
531
 
 
532
        g_object_unref (settings);
 
533
 
520
534
        old_basename = g_strdup_printf ("%s.ibex", old);
521
535
        new_basename = g_strdup_printf ("%s.ibex", new);
522
536
 
528
542
 
529
543
        /* try to rollback failures, has obvious races */
530
544
 
531
 
        d(printf("local rename folder '%s' '%s'\n", old, new));
 
545
        d (printf ("local rename folder '%s' '%s'\n", old, new));
532
546
 
533
547
        folder = camel_object_bag_get (store->folders, old);
534
548
        if (folder && folder->index) {
535
549
                if (camel_index_rename (folder->index, newibex) == -1)
536
550
                        goto ibex_failed;
537
551
        } else {
538
 
                /* TODO: camel_text_index_rename should find out if we have an active index itself? */
 
552
                /* TODO camel_text_index_rename() should find
 
553
                 *      out if we have an active index itself? */
539
554
                if (camel_text_index_rename (oldibex, newibex) == -1)
540
555
                        goto ibex_failed;
541
556
        }
542
557
 
543
 
        if (xrename(old, new, path, ".ev-summary", TRUE, error))
544
 
                goto summary_failed;
545
 
 
546
 
        if (xrename(old, new, path, ".ev-summary-meta", TRUE, error))
547
 
                goto summary_failed;
548
 
 
549
 
        if (xrename(old, new, path, ".cmeta", TRUE, error))
 
558
        if (xrename (old, new, path, ".ev-summary", TRUE, error))
 
559
                goto summary_failed;
 
560
 
 
561
        if (xrename (old, new, path, ".ev-summary-meta", TRUE, error))
 
562
                goto summary_failed;
 
563
 
 
564
        if (xrename (old, new, path, ".cmeta", TRUE, error))
550
565
                goto cmeta_failed;
551
566
 
552
 
        if (xrename(old, new, path, "", FALSE, error))
 
567
        if (xrename (old, new, path, "", FALSE, error))
553
568
                goto base_failed;
554
569
 
555
570
        g_free (newibex);
563
578
        /* The (f)utility of this recovery effort is quesitonable */
564
579
 
565
580
base_failed:
566
 
        xrename(new, old, path, ".cmeta", TRUE, NULL);
 
581
        xrename (new, old, path, ".cmeta", TRUE, NULL);
567
582
 
568
583
cmeta_failed:
569
 
        xrename(new, old, path, ".ev-summary", TRUE, NULL);
570
 
        xrename(new, old, path, ".ev-summary-meta", TRUE, NULL);
 
584
        xrename (new, old, path, ".ev-summary", TRUE, NULL);
 
585
        xrename (new, old, path, ".ev-summary-meta", TRUE, NULL);
571
586
summary_failed:
572
587
        if (folder) {
573
588
                if (folder->index)
606
621
        gchar *path;
607
622
 
608
623
        service = CAMEL_SERVICE (ls);
609
 
        settings = camel_service_get_settings (service);
 
624
 
 
625
        settings = camel_service_ref_settings (service);
610
626
 
611
627
        local_settings = CAMEL_LOCAL_SETTINGS (settings);
612
628
        path = camel_local_settings_dup_path (local_settings);
613
629
 
 
630
        g_object_unref (settings);
 
631
 
614
632
        filename = g_build_filename (path, full_name, NULL);
615
633
 
616
634
        g_free (path);
631
649
        gchar *path;
632
650
 
633
651
        service = CAMEL_SERVICE (ls);
634
 
        settings = camel_service_get_settings (service);
 
652
 
 
653
        settings = camel_service_ref_settings (service);
635
654
 
636
655
        local_settings = CAMEL_LOCAL_SETTINGS (settings);
637
656
        path = camel_local_settings_dup_path (local_settings);
638
657
 
 
658
        g_object_unref (settings);
 
659
 
639
660
        basename = g_strconcat (full_name, ext, NULL);
640
661
        filename = g_build_filename (path, basename, NULL);
641
662
        g_free (basename);
797
818
{
798
819
        g_return_if_fail (CAMEL_IS_LOCAL_STORE (store));
799
820
 
800
 
        if ((store->priv->need_summary_check ? 1 : 0) == (need_summary_check ? 1 : 0))
 
821
        if (store->priv->need_summary_check == need_summary_check)
801
822
                return;
802
823
 
803
824
        store->priv->need_summary_check = need_summary_check;