diff options
author | Rodrigo Moya <rodrigo@gnome-db.org> | 2011-10-13 18:55:34 +0800 |
---|---|---|
committer | Rodrigo Moya <rodrigo@gnome-db.org> | 2011-10-13 18:55:34 +0800 |
commit | cb3e037f8f55f95892104326807d9988be87fbe4 (patch) | |
tree | acac7b63e7a8b1ea4f37273363cb423dbff491ed /plugins | |
parent | b77871e4fd7a4464e3a2e4e458f0d10e71805a02 (diff) | |
parent | ee5ca188d56abc91ca9fce034322466d5b0f4b9f (diff) | |
download | gsoc2013-evolution-cb3e037f8f55f95892104326807d9988be87fbe4.tar gsoc2013-evolution-cb3e037f8f55f95892104326807d9988be87fbe4.tar.gz gsoc2013-evolution-cb3e037f8f55f95892104326807d9988be87fbe4.tar.bz2 gsoc2013-evolution-cb3e037f8f55f95892104326807d9988be87fbe4.tar.lz gsoc2013-evolution-cb3e037f8f55f95892104326807d9988be87fbe4.tar.xz gsoc2013-evolution-cb3e037f8f55f95892104326807d9988be87fbe4.tar.zst gsoc2013-evolution-cb3e037f8f55f95892104326807d9988be87fbe4.zip |
Merge branch 'master' into wip/gsettings
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/backup-restore/org-gnome-backup-restore.error.xml | 8 | ||||
-rw-r--r-- | plugins/google-account-setup/google-source.c | 9 | ||||
-rw-r--r-- | plugins/mark-all-read/mark-all-read.c | 33 | ||||
-rw-r--r-- | plugins/pst-import/pst-importer.c | 121 |
4 files changed, 123 insertions, 48 deletions
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 @@ <error-list domain="org.gnome.backup-restore"> <error id="invalid-backup" type="warning"> - <_primary>Invalid Evolution back up file</_primary> - <_secondary>Please select a valid back up file to restore.</_secondary> + <_primary>Invalid Evolution backup file</_primary> + <_secondary>Please select a valid backup file to restore.</_secondary> </error> <error id="backup-confirm" type="warning" default="GTK_RESPONSE_CANCEL"> <_primary>Are you sure you want to close Evolution?</_primary> @@ -12,8 +12,8 @@ <button stock="gtk-cancel" response="GTK_RESPONSE_CANCEL"/> </error> <error id="restore-confirm" type="warning" default="GTK_RESPONSE_CANCEL"> - <_primary>Are you sure you want to restore Evolution from the selected back up file?</_primary> - <_secondary xml:space="preserve">To restore your data and settings, you must first close Evolution. Please make sure that you save any unsaved data before proceeding. This will delete all your current Evolution data and settings and restore them from your back up.</_secondary> + <_primary>Are you sure you want to restore Evolution from the selected backup file?</_primary> + <_secondary xml:space="preserve">To restore your data and settings, you must first close Evolution. Please make sure that you save any unsaved data before proceeding. This will delete all your current Evolution data and settings and restore them from your backup.</_secondary> <button _label="Close and Restore Evolution" response="GTK_RESPONSE_YES"/> <button stock="gtk-cancel" response="GTK_RESPONSE_CANCEL"/> </error> 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); } diff --git a/plugins/mark-all-read/mark-all-read.c b/plugins/mark-all-read/mark-all-read.c index 4fe19cf71b..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. */ @@ -602,7 +596,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); 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? */ |