[evolution/account-mgmt: 44/50] Adapt pst-importer plugin to the new ESource API.
- From: Matthew Barnes <mbarnes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution/account-mgmt: 44/50] Adapt pst-importer plugin to the new ESource API.
- Date: Sat, 1 Oct 2011 15:51:09 +0000 (UTC)
commit 2b36bdbccb11db385043b18a71de238ad23d1184
Author: Matthew Barnes <mbarnes redhat com>
Date: Mon Mar 28 11:39:16 2011 -0400
Adapt pst-importer plugin to the new ESource API.
plugins/pst-import/pst-importer.c | 62 +++++++++++++++++++++++++------------
1 files changed, 42 insertions(+), 20 deletions(-)
---
diff --git a/plugins/pst-import/pst-importer.c b/plugins/pst-import/pst-importer.c
index fc19d7a..469c8ac 100644
--- a/plugins/pst-import/pst-importer.c
+++ b/plugins/pst-import/pst-importer.c
@@ -45,13 +45,17 @@
#include <libebook/e-contact.h>
#include <libebook/e-book-client.h>
+#include <libebook/e-source-address-book.h>
#include <libecal/e-cal-client.h>
#include <libecal/e-cal-component.h>
+#include <libecal/e-source-calendar.h>
#include <libedataserver/e-data-server-util.h>
-#include <libedataserverui/e-source-combo-box.h>
+#include <libedataserver/e-source-registry.h>
#include <libedataserverui/e-client-utils.h>
+#include <libedataserverui/e-source-combo-box.h>
+#include <libedataserverui/e-source-selector-dialog.h>
#include <mail/e-mail-backend.h>
#include <mail/e-mail-local.h>
@@ -382,18 +386,41 @@ get_source_combo_key (EClientSourceType source_type)
static void
add_source_list_with_check (GtkWidget *frame,
const gchar *caption,
+ ESourceRegistry *registry,
EClientSourceType source_type,
GCallback toggle_callback,
EImportTarget *target)
{
+ ESource *source;
GtkWidget *check, *hbox;
- ESourceList *source_list = NULL;
GtkWidget *combo = NULL;
+ const gchar *extension_name;
g_return_if_fail (frame != NULL);
g_return_if_fail (caption != NULL);
g_return_if_fail (toggle_callback != NULL);
+ switch (source_type) {
+ case E_CLIENT_SOURCE_TYPE_CONTACTS:
+ extension_name = E_SOURCE_EXTENSION_ADDRESS_BOOK;
+ source = e_source_registry_get_default_address_book (registry);
+ break;
+ case E_CLIENT_SOURCE_TYPE_EVENTS:
+ extension_name = E_SOURCE_EXTENSION_CALENDAR;
+ source = e_source_registry_get_default_calendar (registry);
+ break;
+ case E_CLIENT_SOURCE_TYPE_TASKS:
+ extension_name = E_SOURCE_EXTENSION_TASK_LIST;
+ source = e_source_registry_get_default_task_list (registry);
+ break;
+ case E_CLIENT_SOURCE_TYPE_MEMOS:
+ extension_name = E_SOURCE_EXTENSION_MEMO_LIST;
+ source = e_source_registry_get_default_memo_list (registry);
+ break;
+ default:
+ g_return_if_reached ();
+ }
+
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2);
check = gtk_check_button_new_with_mnemonic (caption);
@@ -401,22 +428,15 @@ add_source_list_with_check (GtkWidget *frame,
g_signal_connect (check, "toggled", toggle_callback, target);
gtk_box_pack_start ((GtkBox *) hbox, check, FALSE, FALSE, 0);
- if (e_client_utils_get_sources (&source_list, source_type, NULL)) {
- ESource *source;
+ combo = e_source_combo_box_new (registry, extension_name);
+ e_source_combo_box_set_active (E_SOURCE_COMBO_BOX (combo), source);
- combo = e_source_combo_box_new (source_list);
- source = e_source_list_peek_default_source (source_list);
- if (!source)
- source = e_source_list_peek_source_any (source_list);
- e_source_combo_box_set_active (E_SOURCE_COMBO_BOX (combo), source);
+ gtk_box_pack_end ((GtkBox *) hbox, combo, FALSE, FALSE, 0);
- gtk_box_pack_end ((GtkBox *) hbox, combo, FALSE, FALSE, 0);
-
- g_signal_connect (
- check, "toggled",
- G_CALLBACK (widget_sanitizer_cb), combo);
- widget_sanitizer_cb (GTK_TOGGLE_BUTTON (check), combo);
- }
+ g_signal_connect (
+ check, "toggled",
+ G_CALLBACK (widget_sanitizer_cb), combo);
+ widget_sanitizer_cb (GTK_TOGGLE_BUTTON (check), combo);
gtk_box_pack_start ((GtkBox *) frame, hbox, FALSE, FALSE, 0);
@@ -435,6 +455,7 @@ org_credativ_evolution_readpst_getwidget (EImport *ei,
EImportImporter *im)
{
EShell *shell;
+ ESourceRegistry *registry;
EShellBackend *shell_backend;
GtkWidget *hbox, *framebox, *w, *check;
gchar *foldername;
@@ -455,6 +476,7 @@ org_credativ_evolution_readpst_getwidget (EImport *ei,
gtk_box_pack_start ((GtkBox *) hbox, check, FALSE, FALSE, 0);
shell = e_shell_get_default ();
+ registry = e_shell_get_registry (shell);
shell_backend = e_shell_get_backend_by_name (shell, "mail");
w = em_folder_selection_button_new (
@@ -476,19 +498,19 @@ org_credativ_evolution_readpst_getwidget (EImport *ei,
add_source_list_with_check (
framebox, _("_Address Book"),
- E_CLIENT_SOURCE_TYPE_CONTACTS,
+ registry, E_CLIENT_SOURCE_TYPE_CONTACTS,
G_CALLBACK (checkbox_addr_toggle_cb), target);
add_source_list_with_check (
framebox, _("A_ppointments"),
- E_CLIENT_SOURCE_TYPE_EVENTS,
+ registry, E_CLIENT_SOURCE_TYPE_EVENTS,
G_CALLBACK (checkbox_appt_toggle_cb), target);
add_source_list_with_check (
framebox, _("_Tasks"),
- E_CLIENT_SOURCE_TYPE_TASKS,
+ registry, E_CLIENT_SOURCE_TYPE_TASKS,
G_CALLBACK (checkbox_task_toggle_cb), target);
add_source_list_with_check (
framebox, _("_Journal entries"),
- E_CLIENT_SOURCE_TYPE_MEMOS,
+ registry, E_CLIENT_SOURCE_TYPE_MEMOS,
G_CALLBACK (checkbox_journal_toggle_cb), target);
gtk_widget_show_all (framebox);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]