diff options
Diffstat (limited to 'capplet/settings/mail-account-view.c')
-rw-r--r-- | capplet/settings/mail-account-view.c | 86 |
1 files changed, 42 insertions, 44 deletions
diff --git a/capplet/settings/mail-account-view.c b/capplet/settings/mail-account-view.c index a6751b9a1b..cd47ae5223 100644 --- a/capplet/settings/mail-account-view.c +++ b/capplet/settings/mail-account-view.c @@ -48,7 +48,7 @@ struct _MailAccountViewPrivate { gboolean do_gcontacts; gboolean do_calendar; - char *username; + gchar *username; GtkWidget *yahoo_cal_entry; }; @@ -246,10 +246,10 @@ setup_yahoo_account (MailAccountView *mav) ESourceList *slist; ESourceGroup *sgrp; ESource *calendar; - char *sanitize_uname, *abs_uri, *rel_uri; + gchar *sanitize_uname, *abs_uri, *rel_uri; GSList *ids, *temp; - const char *email = e_account_get_string(em_account_editor_get_modified_account(mav->edit), E_ACCOUNT_ID_ADDRESS); - + const gchar *email = e_account_get_string(em_account_editor_get_modified_account(mav->edit), E_ACCOUNT_ID_ADDRESS); + slist = e_source_list_new_for_gconf (gconf, "/apps/evolution/calendar/sources"); sgrp = e_source_list_peek_group_by_base_uri (slist, "caldav://"); if (!sgrp) { @@ -259,20 +259,20 @@ setup_yahoo_account (MailAccountView *mav) printf("Setting up Yahoo Calendar: list:%p CalDAVGrp: %p\n", slist, sgrp); /* FIXME: Not sure if we should localize 'Calendar' */ - calendar = e_source_new ("Yahoo", ""); + calendar = e_source_new ("Yahoo", ""); e_source_set_property (calendar, "ssl", "1"); e_source_set_property (calendar, "refresh", "30"); - e_source_set_property (calendar, "refresh-type", "0"); + e_source_set_property (calendar, "refresh-type", "0"); e_source_set_property (calendar, "auth", "1"); e_source_set_property (calendar, "offline_sync", "1"); e_source_set_property (calendar, "username", email); e_source_set_property (calendar, "default", "true"); e_source_set_property (calendar, "alarm", "true"); - + e_source_set_readonly (calendar, FALSE); - + sanitize_uname = sanitize_user_mail (email); - + abs_uri = g_strdup_printf ("caldav://%s@caldav.calendar.yahoo.com/dav/%s/Calendar/%s/", sanitize_uname, email, gtk_entry_get_text((GtkEntry *)mav->priv->yahoo_cal_entry)); e_passwords_add_password (abs_uri, gtk_entry_get_text((GtkEntry *)mav->password)); e_passwords_remember_password ("Calendar", abs_uri); @@ -290,7 +290,7 @@ setup_yahoo_account (MailAccountView *mav) for (; temp != NULL; temp = g_slist_next (temp)) g_free (temp->data); - g_slist_free (ids); + g_slist_free (ids); g_free(abs_uri); g_free(rel_uri); @@ -305,14 +305,14 @@ setup_yahoo_account (MailAccountView *mav) ESourceList *slist; ESourceGroup *sgrp; ESource *abook; - char *rel_uri;; + gchar *rel_uri;; slist = e_source_list_new_for_gconf (gconf, "/apps/evolution/addressbook/sources" ); - + sgrp = e_source_list_peek_group_by_base_uri (slist, "google://"); - + /* FIXME: Not sure if we should localize 'Contacts' */ - abook = e_source_new ("Contacts", ""); + abook = e_source_new ("Contacts", ""); e_source_set_property (abook, "default", "true"); e_source_set_property (abook, "offline_sync", "1"); e_source_set_property (abook, "auth", "plain/password"); @@ -322,7 +322,7 @@ setup_yahoo_account (MailAccountView *mav) e_source_set_property (abook, "completion", "true"); e_source_set_property (abook, "username", mav->priv->username); e_source_set_relative_uri (abook, mav->priv->username); - + rel_uri = g_strdup_printf("google://%s/", mav->priv->username); e_passwords_add_password (rel_uri, gtk_entry_get_text((GtkEntry *)mav->password)); e_passwords_remember_password ("Addressbook", rel_uri); @@ -334,7 +334,6 @@ setup_yahoo_account (MailAccountView *mav) g_object_unref(sgrp); g_object_unref(abook); - } g_object_unref (gconf); @@ -352,9 +351,9 @@ setup_google_accounts (MailAccountView *mav) ESourceList *slist; ESourceGroup *sgrp; ESource *calendar; - char *sanitize_uname, *abs_uri, *rel_uri; + gchar *sanitize_uname, *abs_uri, *rel_uri; GSList *ids, *temp; - + slist = e_source_list_new_for_gconf (gconf, "/apps/evolution/calendar/sources"); sgrp = e_source_list_peek_group_by_base_uri (slist, "google://"); if (!sgrp) { @@ -364,13 +363,13 @@ setup_google_accounts (MailAccountView *mav) printf("Setting up Google Calendar: list:%p GoogleGrp: %p\n", slist, sgrp); /* FIXME: Not sure if we should localize 'Calendar' */ - calendar = e_source_new ("Calendar", ""); + calendar = e_source_new ("Calendar", ""); e_source_set_property (calendar, "ssl", "1"); e_source_set_property (calendar, "refresh", "30"); e_source_set_property (calendar, "auth", "1"); e_source_set_property (calendar, "offline_sync", "1"); e_source_set_property (calendar, "username", mav->priv->username); - e_source_set_property (calendar, "setup-username", mav->priv->username); + e_source_set_property (calendar, "setup-username", mav->priv->username); e_source_set_property (calendar, "default", "true"); e_source_set_readonly (calendar, FALSE); @@ -378,7 +377,7 @@ setup_google_accounts (MailAccountView *mav) abs_uri = g_strdup_printf (CALENDAR_CALDAV_URI, sanitize_uname, mav->priv->username); e_source_set_absolute_uri (calendar, abs_uri); - + e_passwords_add_password (abs_uri, gtk_entry_get_text((GtkEntry *)mav->password)); e_passwords_remember_password ("Calendar", abs_uri); rel_uri = g_strconcat ("https", GMAIL_CALENDAR_LOCATION, sanitize_uname, CALENDAR_DEFAULT_PATH, NULL); @@ -394,7 +393,7 @@ setup_google_accounts (MailAccountView *mav) for (; temp != NULL; temp = g_slist_next (temp)) g_free (temp->data); - g_slist_free (ids); + g_slist_free (ids); g_free(abs_uri); g_free(rel_uri); @@ -409,14 +408,14 @@ setup_google_accounts (MailAccountView *mav) ESourceList *slist; ESourceGroup *sgrp; ESource *abook; - char *rel_uri;; + gchar *rel_uri;; slist = e_source_list_new_for_gconf (gconf, "/apps/evolution/addressbook/sources" ); - + sgrp = e_source_list_peek_group_by_base_uri (slist, "google://"); - + /* FIXME: Not sure if we should localize 'Contacts' */ - abook = e_source_new ("Contacts", ""); + abook = e_source_new ("Contacts", ""); e_source_set_property (abook, "default", "true"); e_source_set_property (abook, "offline_sync", "1"); e_source_set_property (abook, "auth", "plain/password"); @@ -426,7 +425,7 @@ setup_google_accounts (MailAccountView *mav) e_source_set_property (abook, "completion", "true"); e_source_set_property (abook, "username", mav->priv->username); e_source_set_relative_uri (abook, mav->priv->username); - + rel_uri = g_strdup_printf("google://%s/", mav->priv->username); e_passwords_add_password (rel_uri, gtk_entry_get_text((GtkEntry *)mav->password)); e_passwords_remember_password ("Addressbook", rel_uri); @@ -438,7 +437,6 @@ setup_google_accounts (MailAccountView *mav) g_object_unref(sgrp); g_object_unref(abook); - } g_object_unref (gconf); @@ -657,7 +655,7 @@ mav_next_pressed (GtkButton *button, MailAccountView *mav) if (!mav->original) { EAccount *account = em_account_editor_get_modified_account(mav->edit); CamelURL *aurl; - char *surl; + gchar *surl; /* Save the password ahead of time */ aurl = camel_url_new (account->source->url, NULL); surl = camel_url_to_string(aurl, CAMEL_URL_HIDE_ALL); @@ -667,7 +665,7 @@ mav_next_pressed (GtkButton *button, MailAccountView *mav) g_free(surl); } - if (mav->priv->is_gmail && !mav->original) + if (mav->priv->is_gmail && !mav->original) setup_google_accounts (mav); else if (mav->priv->is_yahoo && !mav->original) setup_yahoo_account (mav); @@ -688,7 +686,7 @@ mav_next_pressed (GtkButton *button, MailAccountView *mav) MAVPage *page = mav->pages[mav->current_page]; GtkWidget *tmp; EAccount *account = em_account_editor_get_modified_account(mav->edit); - + if (page->main) gtk_widget_destroy (page->main); @@ -698,7 +696,7 @@ mav_next_pressed (GtkButton *button, MailAccountView *mav) gtk_box_pack_start((GtkBox *)page->main, tmp, FALSE, FALSE, 0); gtk_widget_show(tmp); gtk_box_pack_start((GtkBox *)page->box, page->main, FALSE, FALSE, 3); - + if (mav->priv->is_gmail) { gtk_widget_destroy (mav->priv->gcontacts); gtk_widget_destroy (mav->priv->calendar); @@ -717,19 +715,19 @@ mav_next_pressed (GtkButton *button, MailAccountView *mav) mav->priv->gcontacts = gtk_check_button_new_with_label (_("Setup Google contacts with Evolution")); mav->priv->calendar = gtk_check_button_new_with_label (_("Setup Google calendar with Evolution")); - + gtk_toggle_button_set_active ((GtkToggleButton *)mav->priv->gcontacts, TRUE); gtk_toggle_button_set_active ((GtkToggleButton *)mav->priv->calendar, TRUE); mav->priv->gmail_info_label = gtk_label_new (_("You may need to enable IMAP access.")); gtk_label_set_selectable ((GtkLabel *)mav->priv->gmail_info_label, TRUE); - + gtk_widget_show (mav->priv->gcontacts); gtk_widget_show (mav->priv->calendar); gtk_widget_show (mav->priv->gmail_info_label); - + tmp = gtk_label_new (NULL); - gtk_label_set_markup ((GtkLabel *)tmp, _("<span size=\"large\" weight=\"bold\">Google account settings:</span>")); + gtk_label_set_markup ((GtkLabel *)tmp, _("<span size=\"large\" weight=\"bold\">Google account settings:</span>")); gtk_widget_show(tmp); #define PACK_IN_BOX(wid,child,num) { GtkWidget *tbox; tbox = gtk_hbox_new (FALSE, 0); gtk_box_pack_start ((GtkBox *)tbox, child, FALSE, FALSE, num); gtk_widget_show (tbox); gtk_box_pack_start ((GtkBox *)wid, tbox, FALSE, FALSE, 0); } @@ -742,29 +740,29 @@ mav_next_pressed (GtkButton *button, MailAccountView *mav) PACK_IN_BOX(page->box,mav->priv->gmail_info_label,gtk_link_button_new("https://mail.google.com/mail/?ui=2&shva=1#settings/fwdandpop"), 24, 0); #undef PACK_IN_BOX - } else if (mav->original == NULL && + } else if (mav->original == NULL && (g_strrstr(account->source->url, "yahoo.") || g_strrstr(account->source->url, "ymail.") || g_strrstr(account->source->url, "rocketmail."))) { /* Yahoo accounts*/ GtkWidget *tmp; - char *cal_name; + gchar *cal_name; GtkWidget *tmpbox; mav->priv->is_yahoo = TRUE; printf("Google account: %s\n", account->source->url); mav->priv->calendar = gtk_check_button_new_with_label (_("Setup Yahoo calendar with Evolution")); - + gtk_toggle_button_set_active ((GtkToggleButton *)mav->priv->calendar, TRUE); mav->priv->gmail_info_label = gtk_label_new (_("Yahoo calendars are named as firstname_lastname. We have tried to form the calendar name. So please confirm and re-enter the calendar name if it is not correct.")); gtk_label_set_selectable ((GtkLabel *)mav->priv->gmail_info_label, TRUE); - + gtk_widget_show (mav->priv->calendar); gtk_widget_show (mav->priv->gmail_info_label); - + tmp = gtk_label_new (NULL); - gtk_label_set_markup ((GtkLabel *)tmp, _("<span size=\"large\" weight=\"bold\">Yahoo account settings:</span>")); + gtk_label_set_markup ((GtkLabel *)tmp, _("<span size=\"large\" weight=\"bold\">Yahoo account settings:</span>")); gtk_widget_show(tmp); #define PACK_IN_BOX(wid,child,num) { GtkWidget *tbox; tbox = gtk_hbox_new (FALSE, 0); gtk_box_pack_start ((GtkBox *)tbox, child, FALSE, FALSE, num); gtk_widget_show (tbox); gtk_box_pack_start ((GtkBox *)wid, tbox, FALSE, FALSE, 0); } @@ -1013,7 +1011,7 @@ mail_account_view_construct (MailAccountView *view) shell = e_shell_get_default (); if (!shell || e_shell_get_express_mode (shell)) { - GtkWidget *table = em_account_editor_get_widget (view->edit, "identity_required_table"); + GtkWidget *table = em_account_editor_get_widget (view->edit, "identity_required_table"); GtkWidget *label, *pwd; gtk_widget_hide (em_account_editor_get_widget (view->edit, "identity_optional_frame")); @@ -1027,7 +1025,7 @@ mail_account_view_construct (MailAccountView *view) gtk_widget_show(pwd); gtk_table_attach ((GtkTable *)table, label, 0, 1, 2, 3, GTK_FILL, 0, 0, 0); gtk_table_attach ((GtkTable *)table, pwd, 1, 2, 2, 3, GTK_FILL|GTK_EXPAND, 0, 0, 0); - + view->password = pwd; } } |