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

« back to all changes in this revision

Viewing changes to camel/camel-vee-summary.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:
41
41
 
42
42
#define d(x)
43
43
 
44
 
struct _CamelVeeSummaryPrivate
45
 
{
46
 
        GHashTable *vuids_by_subfolder; /* CamelFolder * => GHashTable * of gchar *vuid */
 
44
#define CAMEL_VEE_SUMMARY_GET_PRIVATE(obj) \
 
45
        (G_TYPE_INSTANCE_GET_PRIVATE \
 
46
        ((obj), CAMEL_TYPE_VEE_SUMMARY, CamelVeeSummaryPrivate))
 
47
 
 
48
struct _CamelVeeSummaryPrivate {
 
49
        /* CamelFolder * => GHashTable * of gchar *vuid */
 
50
        GHashTable *vuids_by_subfolder;
47
51
};
48
52
 
49
53
G_DEFINE_TYPE (CamelVeeSummary, camel_vee_summary, CAMEL_TYPE_FOLDER_SUMMARY)
143
147
        CamelMessageInfo *rmi = camel_folder_summary_get (((CamelVeeMessageInfo *) mi)->orig_summary, mi->uid + 8);
144
148
        const gchar *ret;
145
149
 
146
 
        HANDLE_NULL_INFO("");
 
150
        HANDLE_NULL_INFO ("");
147
151
        ret = camel_message_info_user_tag (rmi, id);
148
152
        camel_message_info_free (rmi);
149
153
 
289
293
                 * Otherwise, the first byte itself would return in strcmp, saving the CPU.
290
294
                 */
291
295
                if (!camel_folder_summary_check_uid (s, uid)) {
292
 
                        d(g_message ("Unable to find %s in the summary of %s", uid,
 
296
                        d (
 
297
                                g_message ("Unable to find %s in the summary of %s", uid,
293
298
                                camel_folder_get_full_name (camel_folder_summary_get_folder (s->folder))));
294
299
                        return NULL;
295
300
                }
318
323
static void
319
324
vee_summary_finalize (GObject *object)
320
325
{
321
 
        CamelVeeSummary *vsummary = CAMEL_VEE_SUMMARY (object);
322
 
 
323
 
        g_hash_table_destroy (vsummary->priv->vuids_by_subfolder);
 
326
        CamelVeeSummaryPrivate *priv;
 
327
 
 
328
        priv = CAMEL_VEE_SUMMARY_GET_PRIVATE (object);
 
329
 
 
330
        g_hash_table_destroy (priv->vuids_by_subfolder);
324
331
 
325
332
        /* Chain up to parent's finalize() method. */
326
333
        G_OBJECT_CLASS (camel_vee_summary_parent_class)->finalize (object);
356
363
static void
357
364
camel_vee_summary_init (CamelVeeSummary *vee_summary)
358
365
{
359
 
        vee_summary->priv = G_TYPE_INSTANCE_GET_PRIVATE (vee_summary,
360
 
                CAMEL_TYPE_VEE_SUMMARY, CamelVeeSummaryPrivate);
 
366
        vee_summary->priv = CAMEL_VEE_SUMMARY_GET_PRIVATE (vee_summary);
361
367
 
362
 
        vee_summary->priv->vuids_by_subfolder =
363
 
                g_hash_table_new_full (g_direct_hash, g_direct_equal, NULL, (GDestroyNotify) g_hash_table_destroy);
 
368
        vee_summary->priv->vuids_by_subfolder = g_hash_table_new_full (
 
369
                (GHashFunc) g_direct_hash,
 
370
                (GEqualFunc) g_direct_equal,
 
371
                (GDestroyNotify) NULL,
 
372
                (GDestroyNotify) g_hash_table_destroy);
364
373
}
365
374
 
366
375
/**
398
407
        g_hash_table_insert (user_data, (gpointer) camel_pstring_strdup (key), GINT_TO_POINTER (1));
399
408
}
400
409
 
 
410
/**
 
411
 * camel_vee_summary_get_uids_for_subfolder:
 
412
 *
 
413
 * FIXME Document me!
 
414
 *
 
415
 * Since: 3.6
 
416
 **/
401
417
GHashTable *
402
418
camel_vee_summary_get_uids_for_subfolder (CamelVeeSummary *summary,
403
419
                                          CamelFolder *subfolder)
447
463
        vmi = (CamelVeeMessageInfo *) camel_folder_summary_peek_loaded (&s->summary, vuid);
448
464
        if (vmi) {
449
465
                /* Possible that the entry is loaded, see if it has the summary */
450
 
                d(g_message ("%s - already there\n", vuid));
 
466
                d (g_message ("%s - already there\n", vuid));
451
467
                if (!vmi->orig_summary)
452
468
                        vmi->orig_summary = g_object_ref (orig_folder->summary);
453
469
 
484
500
        return vmi;
485
501
}
486
502
 
 
503
/**
 
504
 * camel_vee_summary_remove:
 
505
 *
 
506
 * FIXME Document me!
 
507
 *
 
508
 * Since: 3.6
 
509
 **/
487
510
void
488
511
camel_vee_summary_remove (CamelVeeSummary *summary,
489
512
                          const gchar *vuid,
490
513
                          CamelFolder *subfolder)
491
514
{
 
515
        CamelMessageInfo *mi;
492
516
        GHashTable *vuids;
493
517
 
494
518
        g_return_if_fail (CAMEL_IS_VEE_SUMMARY (summary));
503
527
                if (!g_hash_table_size (vuids))
504
528
                        g_hash_table_remove (summary->priv->vuids_by_subfolder, subfolder);
505
529
        }
 
530
 
 
531
        mi = camel_folder_summary_peek_loaded (&summary->summary, vuid);
 
532
 
506
533
        camel_folder_summary_remove_uid (&summary->summary, vuid);
507
534
 
 
535
        if (mi) {
 
536
                /* under twice, the first for camel_folder_summary_peek_loaded(),
 
537
                 * the second to actually free the mi */
 
538
                camel_message_info_free (mi);
 
539
                camel_message_info_free (mi);
 
540
        }
 
541
 
508
542
        camel_folder_summary_unlock (&summary->summary, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
509
543
}
510
544
 
516
550
 * Makes sure @summary flags on @uid corresponds to those 
517
551
 * in the subfolder of vee-folder, and updates internal counts
518
552
 * on @summary as well.
 
553
 *
 
554
 * Since: 3.6
519
555
 **/
520
556
void
521
557
camel_vee_summary_replace_flags (CamelVeeSummary *summary,