From 3c45eb1bdd9f07a5ab80a54c00da40255ba7c2ae Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Mon, 10 Oct 2011 20:27:45 +0200 Subject: Bug #660782 - [pst-import] Missing tasks after import --- plugins/pst-import/pst-importer.c | 121 +++++++++++++++++++++++++++++++++----- 1 file changed, 105 insertions(+), 16 deletions(-) (limited to 'plugins') diff --git a/plugins/pst-import/pst-importer.c b/plugins/pst-import/pst-importer.c index fc19d7a4fd..89e45e6785 100644 --- a/plugins/pst-import/pst-importer.c +++ b/plugins/pst-import/pst-importer.c @@ -384,7 +384,8 @@ add_source_list_with_check (GtkWidget *frame, const gchar *caption, EClientSourceType source_type, GCallback toggle_callback, - EImportTarget *target) + EImportTarget *target, + gboolean active) { GtkWidget *check, *hbox; ESourceList *source_list = NULL; @@ -397,7 +398,7 @@ add_source_list_with_check (GtkWidget *frame, hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2); check = gtk_check_button_new_with_mnemonic (caption); - gtk_toggle_button_set_active ((GtkToggleButton *) check, FALSE); + gtk_toggle_button_set_active ((GtkToggleButton *) check, active); g_signal_connect (check, "toggled", toggle_callback, target); gtk_box_pack_start ((GtkBox *) hbox, check, FALSE, FALSE, 0); @@ -429,6 +430,93 @@ add_source_list_with_check (GtkWidget *frame, } } +static void +pst_import_check_items (EImportTarget *target) +{ + gboolean has_mail = FALSE, has_addr = FALSE, has_appt = FALSE, has_task = FALSE, has_journal = FALSE; + gchar *filename; + pst_file pst; + pst_item *item = NULL, *subitem; + pst_desc_tree *d_ptr, *topitem; + + filename = g_filename_from_uri (((EImportTargetURI *) target)->uri_src, NULL, NULL); + + if (pst_init (&pst, filename) < 0) { + goto end; + } + + if ((item = pst_parse_item (&pst, pst.d_head, NULL)) == NULL) { + goto end; + } + + if ((topitem = pst_getTopOfFolders (&pst, item)) == NULL) { + goto end; + } + + d_ptr = topitem->child; + + /* Walk through folder tree */ + while (d_ptr != NULL && (!has_mail || !has_addr || !has_appt || !has_task || !has_journal)) { + subitem = pst_parse_item (&pst, d_ptr, NULL); + + if (subitem != NULL && + subitem->message_store == NULL && + subitem->folder == NULL) { + switch (subitem->type) { + case PST_TYPE_CONTACT: + if (subitem->contact) + has_addr = TRUE; + break; + case PST_TYPE_APPOINTMENT: + if (subitem->appointment) + has_appt = TRUE; + break; + case PST_TYPE_TASK: + if (subitem->appointment) + has_task = TRUE; + break; + case PST_TYPE_JOURNAL: + if (subitem->appointment) + has_journal = TRUE; + break; + case PST_TYPE_NOTE: + case PST_TYPE_SCHEDULE: + case PST_TYPE_REPORT: + if (subitem->email) + has_mail = TRUE; + break; + } + } + + pst_freeItem (subitem); + + if (d_ptr->child != NULL) { + d_ptr = d_ptr->child; + } else if (d_ptr->next != NULL) { + d_ptr = d_ptr->next; + } else { + while (d_ptr != topitem && d_ptr->next == NULL) { + d_ptr = d_ptr->parent; + } + + if (d_ptr == topitem) + break; + + d_ptr = d_ptr->next; + } + } + + pst_freeItem (item); + + end: + g_free (filename); + g_datalist_set_data (&target->data, "pst-do-mail", GINT_TO_POINTER (has_mail)); + g_datalist_set_data (&target->data, "pst-do-addr", GINT_TO_POINTER (has_addr)); + g_datalist_set_data (&target->data, "pst-do-appt", GINT_TO_POINTER (has_appt)); + g_datalist_set_data (&target->data, "pst-do-task", GINT_TO_POINTER (has_task)); + g_datalist_set_data (&target->data, "pst-do-journal", GINT_TO_POINTER (has_journal)); +} + GtkWidget * org_credativ_evolution_readpst_getwidget (EImport *ei, EImportTarget *target, @@ -439,18 +527,14 @@ org_credativ_evolution_readpst_getwidget (EImport *ei, GtkWidget *hbox, *framebox, *w, *check; gchar *foldername; - g_datalist_set_data (&target->data, "pst-do-mail", GINT_TO_POINTER (TRUE)); - g_datalist_set_data (&target->data, "pst-do-addr", GINT_TO_POINTER (FALSE)); - g_datalist_set_data (&target->data, "pst-do-appt", GINT_TO_POINTER (FALSE)); - g_datalist_set_data (&target->data, "pst-do-task", GINT_TO_POINTER (FALSE)); - g_datalist_set_data (&target->data, "pst-do-journal", GINT_TO_POINTER (FALSE)); + pst_import_check_items (target); framebox = gtk_vbox_new (FALSE, 2); /* Mail */ hbox = gtk_hbox_new (FALSE, 0); check = gtk_check_button_new_with_mnemonic (_("_Mail")); - gtk_toggle_button_set_active ((GtkToggleButton *) check, TRUE); + gtk_toggle_button_set_active ((GtkToggleButton *) check, GPOINTER_TO_INT (g_datalist_get_data (&target->data, "pst-do-mail"))); g_signal_connect (check, "toggled", G_CALLBACK (checkbox_mail_toggle_cb), target); gtk_box_pack_start ((GtkBox *) hbox, check, FALSE, FALSE, 0); @@ -477,19 +561,23 @@ org_credativ_evolution_readpst_getwidget (EImport *ei, add_source_list_with_check ( framebox, _("_Address Book"), E_CLIENT_SOURCE_TYPE_CONTACTS, - G_CALLBACK (checkbox_addr_toggle_cb), target); + G_CALLBACK (checkbox_addr_toggle_cb), target, + GPOINTER_TO_INT (g_datalist_get_data (&target->data, "pst-do-addr"))); add_source_list_with_check ( framebox, _("A_ppointments"), E_CLIENT_SOURCE_TYPE_EVENTS, - G_CALLBACK (checkbox_appt_toggle_cb), target); + G_CALLBACK (checkbox_appt_toggle_cb), target, + GPOINTER_TO_INT (g_datalist_get_data (&target->data, "pst-do-appt"))); add_source_list_with_check ( framebox, _("_Tasks"), E_CLIENT_SOURCE_TYPE_TASKS, - G_CALLBACK (checkbox_task_toggle_cb), target); + G_CALLBACK (checkbox_task_toggle_cb), target, + GPOINTER_TO_INT (g_datalist_get_data (&target->data, "pst-do-task"))); add_source_list_with_check ( framebox, _("_Journal entries"), E_CLIENT_SOURCE_TYPE_MEMOS, - G_CALLBACK (checkbox_journal_toggle_cb), target); + G_CALLBACK (checkbox_journal_toggle_cb), target, + GPOINTER_TO_INT (g_datalist_get_data (&target->data, "pst-do-journal"))); gtk_widget_show_all (framebox); @@ -1839,6 +1927,7 @@ static void pst_process_component (PstImporter *m, pst_item *item, const gchar *comp_type, + ECalComponentVType vtype, ECalClient *cal) { ECalComponent *ec; @@ -1848,7 +1937,7 @@ pst_process_component (PstImporter *m, g_return_if_fail (item->appointment != NULL); ec = e_cal_component_new (); - e_cal_component_set_new_vtype (ec, E_CAL_COMPONENT_EVENT); + e_cal_component_set_new_vtype (ec, vtype); fill_calcomponent (m, item, ec, comp_type); set_cal_attachments (cal, ec, m, item->attach); @@ -1868,21 +1957,21 @@ static void pst_process_appointment (PstImporter *m, pst_item *item) { - pst_process_component (m, item, "appointment", m->calendar); + pst_process_component (m, item, "appointment", E_CAL_COMPONENT_EVENT, m->calendar); } static void pst_process_task (PstImporter *m, pst_item *item) { - pst_process_component (m, item, "task", m->tasks); + pst_process_component (m, item, "task", E_CAL_COMPONENT_TODO, m->tasks); } static void pst_process_journal (PstImporter *m, pst_item *item) { - pst_process_component (m, item, "journal", m->journal); + pst_process_component (m, item, "journal", E_CAL_COMPONENT_JOURNAL, m->journal); } /* Print an error message - maybe later bring up an error dialog? */ -- cgit v1.2.3 From 7225739d7d2a26f98c6835cf83e345894201a575 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Mon, 10 Oct 2011 22:30:48 +0200 Subject: Bug #660861 - Avoid mark-all-read on a non-folder selection --- plugins/mark-all-read/mark-all-read.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'plugins') diff --git a/plugins/mark-all-read/mark-all-read.c b/plugins/mark-all-read/mark-all-read.c index 4fe19cf71b..a05515b54c 100644 --- a/plugins/mark-all-read/mark-all-read.c +++ b/plugins/mark-all-read/mark-all-read.c @@ -602,7 +602,8 @@ update_actions_cb (EShellView *shell_view, g_object_get (shell_sidebar, "folder-tree", &folder_tree, NULL); folder_uri = em_folder_tree_get_selected_uri (folder_tree); - visible = (scan_folder_tree_for_unread (folder_uri) > 0); + visible = em_folder_tree_get_selected (folder_tree, NULL, NULL) + && scan_folder_tree_for_unread (folder_uri) > 0; gtk_action_set_visible (action, visible); g_object_unref (folder_tree); -- cgit v1.2.3 From 23f7fa75705e667f85568341d1184616443bc029 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Tue, 11 Oct 2011 10:03:17 +0200 Subject: Bug #660829 - Allow 'Mark as read' in right click menu on spam folder --- plugins/mark-all-read/mark-all-read.c | 30 ++++++++++++------------------ 1 file changed, 12 insertions(+), 18 deletions(-) (limited to 'plugins') diff --git a/plugins/mark-all-read/mark-all-read.c b/plugins/mark-all-read/mark-all-read.c index a05515b54c..5e48a59920 100644 --- a/plugins/mark-all-read/mark-all-read.c +++ b/plugins/mark-all-read/mark-all-read.c @@ -277,10 +277,8 @@ scan_folder_tree_for_unread_helper (GtkTreeModel *model, folder_has_unread = !is_store && !is_draft && - (folder_flags & CAMEL_FOLDER_VTRASH) == 0 && ((folder_flags & CAMEL_FOLDER_VIRTUAL) == 0 || - ((folder_flags & CAMEL_FOLDER_TYPE_MASK) != CAMEL_FOLDER_TYPE_TRASH && - (folder_flags & CAMEL_FOLDER_TYPE_MASK) != CAMEL_FOLDER_TYPE_JUNK)) && + (folder_flags & CAMEL_FOLDER_TYPE_MASK) != CAMEL_FOLDER_TYPE_TRASH) && unread > 0 && unread != ~((guint) 0); if (folder_has_unread) { @@ -384,6 +382,8 @@ mar_got_folder (CamelStore *store, CamelFolder *folder; gchar *folder_name; GError *error = NULL; + GPtrArray *uids; + gint ii; alert_sink = e_activity_get_alert_sink (context->activity); cancellable = e_activity_get_cancellable (context->activity); @@ -408,26 +408,20 @@ mar_got_folder (CamelStore *store, g_return_if_fail (CAMEL_IS_FOLDER (folder)); - /* Skip virtual trash/junk folders. */ - if (!CAMEL_IS_VTRASH_FOLDER (folder)) { - GPtrArray *uids; - gint ii; - camel_folder_freeze (folder); + camel_folder_freeze (folder); - uids = camel_folder_get_uids (folder); + uids = camel_folder_get_uids (folder); - for (ii = 0; ii < uids->len; ii++) - camel_folder_set_message_flags ( - folder, uids->pdata[ii], - CAMEL_MESSAGE_SEEN, - CAMEL_MESSAGE_SEEN); + for (ii = 0; ii < uids->len; ii++) + camel_folder_set_message_flags ( + folder, uids->pdata[ii], + CAMEL_MESSAGE_SEEN, + CAMEL_MESSAGE_SEEN); - camel_folder_free_uids (folder, uids); - - camel_folder_thaw (folder); - } + camel_folder_free_uids (folder, uids); + camel_folder_thaw (folder); g_object_unref (folder); /* If the folder name queue is empty, we're done. */ -- cgit v1.2.3 From 1c7c5557bfc87ec7e77720736494fa722ea764f8 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Wed, 12 Oct 2011 20:40:39 -0400 Subject: Require libgdata >= 0.10. Drop all the backward-compatibility cruft. --- plugins/google-account-setup/google-source.c | 9 --------- 1 file changed, 9 deletions(-) (limited to 'plugins') diff --git a/plugins/google-account-setup/google-source.c b/plugins/google-account-setup/google-source.c index e8d3f5a410..a9785ad844 100644 --- a/plugins/google-account-setup/google-source.c +++ b/plugins/google-account-setup/google-source.c @@ -434,9 +434,7 @@ retrieve_list_clicked (GtkButton *button, GtkComboBox *combo) { ESource *source; - #ifdef HAVE_LIBGDATA_0_9 GDataClientLoginAuthorizer *authorizer; - #endif GDataCalendarService *service; GDataFeed *feed; gchar *user, *password, *tmp; @@ -467,14 +465,9 @@ retrieve_list_clicked (GtkButton *button, return; } - #ifdef HAVE_LIBGDATA_0_9 authorizer = gdata_client_login_authorizer_new ("evolution-client-0.1.0", GDATA_TYPE_CALENDAR_SERVICE); service = gdata_calendar_service_new (GDATA_AUTHORIZER (authorizer)); if (!gdata_client_login_authorizer_authenticate (authorizer, user, password, NULL, &error)) { - #else - service = gdata_calendar_service_new ("evolution-client-0.1.0"); - if (!gdata_service_authenticate (GDATA_SERVICE (service), user, password, NULL, &error)) { - #endif /* Error! */ claim_error (parent, error->message); g_error_free (error); @@ -584,9 +577,7 @@ retrieve_list_clicked (GtkButton *button, } g_object_unref (service); - #ifdef HAVE_LIBGDATA_0_9 g_object_unref (authorizer); - #endif g_free (user); } -- cgit v1.2.3 From 3b26bfc864956e32696a74c565261de18743df9d Mon Sep 17 00:00:00 2001 From: Andre Klapper Date: Thu, 13 Oct 2011 08:29:50 +0200 Subject: Fix typos in user visible strings --- plugins/backup-restore/org-gnome-backup-restore.error.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'plugins') diff --git a/plugins/backup-restore/org-gnome-backup-restore.error.xml b/plugins/backup-restore/org-gnome-backup-restore.error.xml index 398715eb91..6034d89d12 100644 --- a/plugins/backup-restore/org-gnome-backup-restore.error.xml +++ b/plugins/backup-restore/org-gnome-backup-restore.error.xml @@ -2,8 +2,8 @@ - <_primary>Invalid Evolution back up file - <_secondary>Please select a valid back up file to restore. + <_primary>Invalid Evolution backup file + <_secondary>Please select a valid backup file to restore. <_primary>Are you sure you want to close Evolution? @@ -12,8 +12,8 @@