~ubuntu-branches/ubuntu/precise/evolution/precise

« back to all changes in this revision

Viewing changes to mail/e-mail-migrate.c

  • Committer: Bazaar Package Importer
  • Author(s): Mathieu Trudel-Lapierre
  • Date: 2011-05-30 14:08:05 UTC
  • mfrom: (1.1.79 upstream)
  • Revision ID: james.westby@ubuntu.com-20110530140805-nhlx5os5z2ru31vy
Tags: 3.0.2-0ubuntu1
New upstream release 3.0.2.

Show diffs side-by-side

added added

removed removed

Lines of Context:
65
65
 
66
66
#define d(x) x
67
67
 
68
 
struct _migrate_state_info {
 
68
typedef struct _MigrateStateInfo MigrateStateInfo;
 
69
 
 
70
struct _MigrateStateInfo {
69
71
        gchar *label_name;
70
72
        gdouble progress;
71
73
};
72
74
 
73
75
static gboolean
74
 
update_states_in_main_thread (const struct _migrate_state_info *info);
 
76
update_states_in_main_thread (MigrateStateInfo *info);
75
77
 
76
78
/* 1.4 upgrade functions */
77
79
 
519
521
#ifndef G_OS_WIN32
520
522
 
521
523
static gboolean
522
 
update_states_in_main_thread (const struct _migrate_state_info * info)
 
524
update_states_in_main_thread (MigrateStateInfo *info)
523
525
{
524
526
        g_return_val_if_fail (info != NULL, FALSE);
525
527
        g_return_val_if_fail (info->label_name != NULL, FALSE);
 
528
 
526
529
        em_migrate_set_progress (info->progress);
527
530
        em_migrate_set_folder_name (info->label_name);
 
531
 
 
532
        /* XXX Why is this necessary? */
 
533
        while (gtk_events_pending ())
 
534
                gtk_main_iteration ();
 
535
 
 
536
        return FALSE;
 
537
}
 
538
 
 
539
static void
 
540
migrate_state_info_free (MigrateStateInfo *info)
 
541
{
528
542
        g_free (info->label_name);
529
 
        g_free ( (gpointer)info);
530
 
        while (gtk_events_pending ())
531
 
                gtk_main_iteration ();
532
 
        return FALSE;
 
543
        g_slice_free (MigrateStateInfo, info);
533
544
}
534
545
 
535
546
static void
544
555
        CamelFolder *folder;
545
556
 
546
557
        while (fi) {
547
 
 
548
 
                struct _migrate_state_info *info = g_malloc (sizeof (struct
549
 
                                        _migrate_state_info));
550
 
                info->label_name = g_strdup_printf ("%s/%s", acc,
551
 
                                fi->full_name);
 
558
                MigrateStateInfo *info;
552
559
 
553
560
                *nth_folder = *nth_folder + 1;
554
561
 
 
562
                info = g_slice_new0 (MigrateStateInfo);
 
563
                info->label_name = g_strdup_printf (
 
564
                        "%s/%s", acc, fi->full_name);
555
565
                info->progress = (double) (*nth_folder) / total_folders;
556
 
                g_idle_add ((GSourceFunc) update_states_in_main_thread, info);
 
566
 
 
567
                g_idle_add_full (
 
568
                        G_PRIORITY_LOW, (GSourceFunc)
 
569
                        update_states_in_main_thread, info,
 
570
                        (GDestroyNotify) migrate_state_info_free);
557
571
 
558
572
                if (is_local)
559
573
                        folder = camel_store_get_folder_sync (