diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2011-03-28 20:28:51 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2012-06-03 11:00:40 +0800 |
commit | b16443a316a0881b4996f4ec5efdf78aeca273fd (patch) | |
tree | 73139369a2232fcb2cd0d5aabd82c5dd0ffe0f6c /capplet/settings | |
parent | 3449e5fcc7f9c797fcde7f2a444b1eb7a934cd81 (diff) | |
download | gsoc2013-evolution-b16443a316a0881b4996f4ec5efdf78aeca273fd.tar gsoc2013-evolution-b16443a316a0881b4996f4ec5efdf78aeca273fd.tar.gz gsoc2013-evolution-b16443a316a0881b4996f4ec5efdf78aeca273fd.tar.bz2 gsoc2013-evolution-b16443a316a0881b4996f4ec5efdf78aeca273fd.tar.lz gsoc2013-evolution-b16443a316a0881b4996f4ec5efdf78aeca273fd.tar.xz gsoc2013-evolution-b16443a316a0881b4996f4ec5efdf78aeca273fd.tar.zst gsoc2013-evolution-b16443a316a0881b4996f4ec5efdf78aeca273fd.zip |
Adapt evolution-settings capplet to the new ESource API.
Diffstat (limited to 'capplet/settings')
-rw-r--r-- | capplet/settings/mail-account-view.c | 71 | ||||
-rw-r--r-- | capplet/settings/mail-account-view.h | 4 | ||||
-rw-r--r-- | capplet/settings/mail-capplet-shell.c | 98 | ||||
-rw-r--r-- | capplet/settings/mail-settings-view.c | 18 | ||||
-rw-r--r-- | capplet/settings/mail-view.c | 8 |
5 files changed, 45 insertions, 154 deletions
diff --git a/capplet/settings/mail-account-view.c b/capplet/settings/mail-account-view.c index 677db7e68e..65b220c190 100644 --- a/capplet/settings/mail-account-view.c +++ b/capplet/settings/mail-account-view.c @@ -27,9 +27,6 @@ #include <glib/gi18n.h> #include "mail-account-view.h" #include <libedataserverui/e-passwords.h> -#include <libedataserver/e-source-group.h> -#include <libedataserver/e-source-list.h> -#include <libedataserver/e-account-list.h> #include "mail-view.h" #include "e-util/e-config.h" #include "mail/e-mail-backend.h" @@ -161,6 +158,7 @@ save_identity (MailAccountView *view) static gint validate_identity (MailAccountView *view) { +#if 0 /* ACCOUNT_MGMT */ gchar *user = (gchar *) e_account_get_string (em_account_editor_get_modified_account (view->edit), E_ACCOUNT_ID_NAME); gchar *email = (gchar *) e_account_get_string (em_account_editor_get_modified_account (view->edit), E_ACCOUNT_ID_ADDRESS); gchar *tmp; @@ -178,20 +176,10 @@ validate_identity (MailAccountView *view) tmp = strchr (email, '@'); if (!tmp || tmp[1] == 0) return ERROR_INVALID_EMAIL; +#endif /* ACCOUNT_MGMT */ return 0; } -#ifdef NOT_USED -static void -save_send (MailAccountView *view) -{ -} - -static void -save_account (MailAccountView *view) -{ -} -#endif #define PACK_BOX(w) box = gtk_hbox_new(FALSE, 0); gtk_box_pack_start((GtkBox *)box, w, FALSE, FALSE, 12); gtk_widget_show(box); #define PACK_BOXF(w) box = gtk_hbox_new(FALSE, 0); gtk_box_pack_start((GtkBox *)box, w, FALSE, FALSE, 0); gtk_widget_show(box); @@ -239,36 +227,12 @@ sanitize_user_mail (const gchar *user) } static void -add_selected_calendar (const gchar *uid) -{ - gchar **ids; - gint i; - GPtrArray *array; - GSettings *settings; - - settings = g_settings_new ("org.gnome.evolution.calendar"); - ids = g_settings_get_strv (settings, "selected-calendars"); - - array = g_ptr_array_new (); - for (i = 0; ids[i] != NULL; i++) - g_ptr_array_add (array, ids[i]); - g_ptr_array_add (array, (gpointer) uid); - g_ptr_array_add (array, NULL); - - g_settings_set_strv (settings, "selected-calendars", (const gchar* const *) array->pdata); - - g_ptr_array_free (array, TRUE); - g_object_unref (settings); -} - -static void setup_yahoo_account (MailAccountView *mav) { - GConfClient *gconf = gconf_client_get_default (); - mav->priv->do_gcontacts = gtk_toggle_button_get_active ((GtkToggleButton *) mav->priv->gcontacts); mav->priv->do_calendar = gtk_toggle_button_get_active ((GtkToggleButton *) mav->priv->calendar); +#if 0 /* ACCOUNT_MGMT */ if (mav->priv->do_calendar) { ESourceList *slist; ESourceGroup *sgrp; @@ -309,8 +273,6 @@ setup_yahoo_account (MailAccountView *mav) e_source_group_add_source (sgrp, calendar, -1); e_source_list_sync (slist, NULL); - add_selected_calendar (e_source_get_uid (calendar)); - g_free (abs_uri); g_free (rel_uri); g_free (sanitize_uname); @@ -354,18 +316,16 @@ setup_yahoo_account (MailAccountView *mav) g_object_unref (abook); } - - g_object_unref (gconf); +#endif /* ACCOUNT_MGMT */ } static void setup_google_accounts (MailAccountView *mav) { - GConfClient *gconf = gconf_client_get_default (); - mav->priv->do_gcontacts = gtk_toggle_button_get_active ((GtkToggleButton *) mav->priv->gcontacts); mav->priv->do_calendar = gtk_toggle_button_get_active ((GtkToggleButton *) mav->priv->calendar); +#if 0 /* ACCOUNT_MGMT */ if (mav->priv->do_calendar) { ESourceList *slist; ESourceGroup *sgrp; @@ -400,8 +360,6 @@ setup_google_accounts (MailAccountView *mav) e_source_list_sync (slist, NULL); - add_selected_calendar (e_source_get_uid (calendar)); - g_free (abs_uri); g_free (rel_uri); g_free (sanitize_uname); @@ -462,8 +420,7 @@ setup_google_accounts (MailAccountView *mav) g_object_unref (slist); g_object_unref (sgrp); } - - g_object_unref (gconf); +#endif /* ACCOUNT_MGMT */ } #define INDENTATION 10 @@ -471,6 +428,7 @@ setup_google_accounts (MailAccountView *mav) static GtkWidget * create_review (MailAccountView *view) { +#if 0 /* ACCOUNT_MGMT */ GtkWidget *table, *box, *label, *entry; gchar *buff; CamelNetworkSettings *source_settings = NULL; @@ -650,6 +608,9 @@ create_review (MailAccountView *view) g_free (user); return table; +#endif /* ACCOUNT_MGMT */ + + return NULL; } #define IDENTITY_DETAIL N_("To use the email application you'll need to setup an account. Put your email address and password in below and we'll try and work out all the settings. If we can't do it automatically you'll need your server details as well.") @@ -688,6 +649,7 @@ struct _page_text { static gboolean mav_check_same_source_transport (MailAccountView *mav) { +#if 0 /* ACCOUNT_MGMT */ EAccount *account = em_account_editor_get_modified_account (mav->edit); const gchar *uri; gchar *current = NULL; @@ -721,12 +683,16 @@ mav_check_same_source_transport (MailAccountView *mav) } return ret; +#endif /* ACCOUNT_MGMT */ + + return FALSE; /* ACCOUNT_MGMT */ } static void mav_next_pressed (GtkButton *button, MailAccountView *mav) { +#if 0 /* ACCOUNT_MGMT */ if (mail_account_pages[mav->current_page].validate_page) { gint ret = (*mail_account_pages[mav->current_page].validate_page) (mav); MAVPage *page = mav->pages[mav->current_page]; @@ -771,8 +737,10 @@ mav_next_pressed (GtkButton *button, /* Save the password ahead of time */ aurl = camel_url_new (account->source->url, NULL); surl = camel_url_to_string (aurl, CAMEL_URL_HIDE_ALL); +#if 0 /* ACCOUNT_MGMT */ e_passwords_add_password (surl, gtk_entry_get_text ((GtkEntry *) mav->password)); e_passwords_remember_password (NULL, surl); +#endif /* ACCOUNT_MGMT */ camel_url_free (aurl); g_free (surl); } @@ -942,6 +910,7 @@ mav_next_pressed (GtkButton *button, mav_next_pressed (NULL, mav); } } +#endif /* ACCOUNT_MGMT */ } static void @@ -1072,6 +1041,7 @@ next_page (GtkWidget *entry, mav_next_pressed (NULL, mav); } +#if 0 /* ACCOUNT_MGMT */ static void mail_account_view_construct (MailAccountView *view, EMailBackend *backend) @@ -1097,7 +1067,7 @@ mail_account_view_construct (MailAccountView *view, view->current_page = 0; gtk_box_pack_start ((GtkBox *) view, view->scroll, TRUE, TRUE, 0); view->edit = em_account_editor_new_for_pages ( - view->original, EMAE_PAGES, backend, + view->original, EMAE_PAGES, session, "org.gnome.evolution.mail.config.accountWizard", view->wpages); gtk_widget_hide (e_config_create_widget (E_CONFIG (view->edit->config))); if (!view->original) { @@ -1148,6 +1118,7 @@ mail_account_view_new (EAccount *account, return view; } +#endif /* ACCOUNT_MGMT */ static void mav_close (GtkButton *w, diff --git a/capplet/settings/mail-account-view.h b/capplet/settings/mail-account-view.h index 0a582c4a13..f69f5b86a8 100644 --- a/capplet/settings/mail-account-view.h +++ b/capplet/settings/mail-account-view.h @@ -24,8 +24,6 @@ #define _MAIL_ACCOUNT_VIEW_H_ #include <gtk/gtk.h> -#include "mail/em-account-editor.h" -#include <libedataserver/e-account-list.h> #include "mail-view.h" #define MAIL_ACCOUNT_VIEW_TYPE (mail_account_view_get_type ()) @@ -87,7 +85,9 @@ typedef struct _MailAccountViewClass { } MailAccountViewClass; GType mail_account_view_get_type (void); +#if 0 /* ACCOUNT_MGMT */ MailAccountView *mail_account_view_new (EAccount *account, EMailBackend *backend); +#endif /* ACCOUNT_MGMT */ GtkWidget * mail_account_view_get_tab_widget (MailAccountView *mcv); void mail_account_view_activate (MailAccountView *mcv, GtkWidget *tree, GtkWidget *folder_tree, GtkWidget *check_mail, GtkWidget *sort_by, gboolean act); #endif diff --git a/capplet/settings/mail-capplet-shell.c b/capplet/settings/mail-capplet-shell.c index 6369baff85..acb577b378 100644 --- a/capplet/settings/mail-capplet-shell.c +++ b/capplet/settings/mail-capplet-shell.c @@ -86,8 +86,6 @@ static void mail_capplet_shell_quit (MailCappletShell *shell); G_DEFINE_TYPE (MailCappletShell, mail_capplet_shell, GTK_TYPE_WINDOW) -static void setup_abooks (void); - static void mail_capplet_shell_init (MailCappletShell *shell) { @@ -288,7 +286,6 @@ mail_capplet_shell_construct (MailCappletShell *shell, g_signal_connect ( mc, "view-close", G_CALLBACK (ms_show_post_druid), shell); - setup_abooks (); } else shell->priv->settings_view = mail_view_add_page ((MailView *) shell->view, MAIL_VIEW_SETTINGS, NULL); @@ -304,98 +301,3 @@ mail_capplet_shell_new (gint socket_id, return GTK_WIDGET (shell); } - -#define LOCAL_BASE_URI "local:" -#define PERSONAL_RELATIVE_URI "system" - -static void -setup_abooks (void) -{ - GSList *groups; - ESourceGroup *group; - ESourceList *list = NULL; - ESourceGroup *on_this_computer = NULL; - ESource *personal_source = NULL; - GError *error = NULL; - - e_book_client_get_sources (&list, &error); - - if (error != NULL) { - g_warning ( - "%s: Unable to get books: %s", - G_STRFUNC, error->message); - g_error_free (error); - return; - } - - groups = e_source_list_peek_groups (list); - if (groups) { - /* groups are already there, we need to search for things... */ - GSList *g; - gchar *base_dir, *base_uri; - - base_dir = g_build_filename ( - e_get_user_data_dir (), "addressbook", "local", NULL); - base_uri = g_filename_to_uri (base_dir, NULL, NULL); - - for (g = groups; g; g = g->next) { - group = E_SOURCE_GROUP (g->data); - - if (strcmp (base_uri, e_source_group_peek_base_uri (group)) == 0) - e_source_group_set_base_uri (group, LOCAL_BASE_URI); - - if (!on_this_computer && !strcmp (LOCAL_BASE_URI, e_source_group_peek_base_uri (group))) { - on_this_computer = g_object_ref (group); - break; - } - } - - g_free (base_dir); - g_free (base_uri); - } - - if (on_this_computer) { - /* make sure "Personal" shows up as a source under - * this group */ - GSList *sources = e_source_group_peek_sources (on_this_computer); - GSList *s; - for (s = sources; s; s = s->next) { - ESource *source = E_SOURCE (s->data); - const gchar *relative_uri; - - relative_uri = e_source_peek_relative_uri (source); - if (relative_uri == NULL) - continue; - if (!strcmp (PERSONAL_RELATIVE_URI, relative_uri)) { - personal_source = g_object_ref (source); - break; - } - } - } - else { - /* create the local source group */ - group = e_source_group_new (_("On This Computer"), LOCAL_BASE_URI); - e_source_list_add_group (list, group, -1); - - on_this_computer = group; - } - - if (!personal_source) { - /* Create the default Person addressbook */ - ESource *source = e_source_new (_("Personal"), PERSONAL_RELATIVE_URI); - e_source_group_add_source (on_this_computer, source, -1); - - e_source_set_property (source, "completion", "true"); - - personal_source = source; - } - - if (on_this_computer) - g_object_unref (on_this_computer); - if (personal_source) - g_object_unref (personal_source); - - e_source_list_sync (list, NULL); - g_object_unref (list); -} - diff --git a/capplet/settings/mail-settings-view.c b/capplet/settings/mail-settings-view.c index 2f284c685d..125fc357cb 100644 --- a/capplet/settings/mail-settings-view.c +++ b/capplet/settings/mail-settings-view.c @@ -25,9 +25,6 @@ #endif #include <glib/gi18n.h> -#include <libedataserver/e-account-list.h> - -#include <libemail-utils/e-account-utils.h> #include "mail-settings-view.h" #include "mail-view.h" @@ -38,7 +35,9 @@ struct _MailSettingsViewPrivate { GtkWidget *scroll; GtkWidget *box; +#if 0 /* ACCOUNT_MGMT */ EAccountList *accounts; +#endif /* ACCOUNT_MGMT */ }; G_DEFINE_TYPE (MailSettingsView, mail_settings_view, GTK_TYPE_VBOX) @@ -99,15 +98,18 @@ static void msv_edit_account (GtkButton *button, MailSettingsView *msv) { +#if 0 /* ACCOUNT_MGMT */ EAccount *acc = g_object_get_data((GObject *)button, "account"); g_signal_emit (msv, signals[SHOW_ACCOUNT], 0, acc); +#endif /* ACCOUNT_MGMT */ } static void msv_delete_account (GtkButton *button, MailSettingsView *msv) { +#if 0 /* ACCOUNT_MGMT */ EAccount *account = g_object_get_data((GObject *)button, "account"); EAccountList *account_list = e_get_account_list (); @@ -116,9 +118,10 @@ msv_delete_account (GtkButton *button, e_account_list_save (account_list); msv_regen_view (msv); - +#endif /* ACCOUNT_MGMT */ } +#if 0 /* ACCOUNT_MGMT */ static void msv_account_added (EAccountList *al, EAccount *account, @@ -126,9 +129,11 @@ msv_account_added (EAccountList *al, { msv_regen_view (msv); } +#endif /* ACCOUNT_MGMT */ #define PACK_BOX(w,s) box = gtk_hbox_new(FALSE, 0); gtk_box_pack_start((GtkBox *)box, w, FALSE, FALSE, s); gtk_widget_show(box); gtk_widget_show(w); gtk_box_pack_start((GtkBox *)acview->priv->box, box, FALSE, FALSE, 3); +#if 0 /* ACCOUNT_MGMT */ static void build_account_button (MailSettingsView *acview, EAccount *account) @@ -178,10 +183,12 @@ build_account_button (MailSettingsView *acview, PACK_BOX (box1,24); } +#endif /* ACCOUNT_MGMT */ static void msv_regen_view (MailSettingsView *acview) { +#if 0 /* ACCOUNT_MGMT */ EAccount *account; EAccountList *accounts = acview->priv->accounts; EIterator *node; @@ -204,6 +211,7 @@ msv_regen_view (MailSettingsView *acview) } g_object_unref (node); build_account_button (acview, NULL); +#endif /* ACCOUNT_MGMT */ } static void @@ -217,10 +225,12 @@ mail_settings_view_construct (MailSettingsView *acview) gtk_widget_show (acview->priv->box); gtk_scrolled_window_add_with_viewport ((GtkScrolledWindow *) acview->priv->scroll, acview->priv->box); +#if 0 /* ACCOUNT_MGMT */ acview->priv->accounts = e_get_account_list (); g_signal_connect ( acview->priv->accounts, "account-added", G_CALLBACK (msv_account_added), acview); +#endif /* ACCOUNT_MGMT */ msv_regen_view (acview); gtk_widget_show ((GtkWidget *) acview); diff --git a/capplet/settings/mail-view.c b/capplet/settings/mail-view.c index db4002b87b..dfc50f50da 100644 --- a/capplet/settings/mail-view.c +++ b/capplet/settings/mail-view.c @@ -441,6 +441,7 @@ mail_view_add_message (MailView *mv, #endif +#if 0 /* ACCOUNT_MGMT */ static void mv_show_acc_mcv (MailViewChild *mfv, EAccount *account, @@ -448,6 +449,7 @@ mv_show_acc_mcv (MailViewChild *mfv, { mail_view_add_page (mv, MAIL_VIEW_ACCOUNT, account); } +#endif /* ACCOUNT_MGMT */ static MailViewChild * mail_view_add_settings (MailView *mv, @@ -466,9 +468,11 @@ mail_view_add_settings (MailView *mv, g_signal_connect ( msv, "view-close", G_CALLBACK (mv_close_mcv), mv); +#if 0 /* ACCOUNT_MGMT */ g_signal_connect ( msv, "show-account", G_CALLBACK (mv_show_acc_mcv), mv); +#endif /* ACCOUNT_MGMT */ gtk_notebook_set_tab_reorderable (GTK_NOTEBOOK (mv), (GtkWidget *) msv, TRUE); gtk_notebook_set_tab_detachable (GTK_NOTEBOOK (mv), (GtkWidget *) msv, FALSE); if (!block) @@ -484,6 +488,7 @@ mail_view_add_account (MailView *mv, gpointer data, gboolean block) { +#if 0 /* ACCOUNT_MGMT */ MailAccountView *msv; gint position = 0; @@ -504,6 +509,9 @@ mail_view_add_account (MailView *mv, mail_account_view_activate (msv, mv->tree, mv->folder_tree, mv->check_mail, mv->sort_by, FALSE); return (MailViewChild *) msv; +#endif /* ACCOUNT_MGMT */ + + return NULL; } MailViewChild * |