+2007-06-22 Armin Burgmeier <armin@openismus.com>
+
+ * src/maemo/modest-maemo-utils.h:
+ * src/maemo/modest-maemo-utils.c: Added a GError parameter to
+ modest_maemo_utils_get_supported_secure_authentication_methods.
+
+ * src/maemo/easysetup/modest-easysetup-wizard.c:
+ * src/maemo/modest-account-settings-dialog.c: Show correct error if
+ one occured, not just "Server does not support secure authentication".
+
2007-06-22 Murray Cumming <murrayc@murrayc.com>
* src/modest-tny-account-store.c: (get_password):
Added modest_ui_actions_on_new_account() as a signal handler for the
New Account menu item. It shows the easysetup wizard.
* po/en_GB.po: Added additional needed logical IDs and translations.
-
static GList* check_for_supported_auth_methods(ModestEasysetupWizardDialog* account_wizard)
{
- const ModestTransportStoreProtocol protocol =
+ GError *error = NULL;
+ const ModestTransportStoreProtocol protocol =
easysetup_servertype_combo_box_get_active_servertype (
EASYSETUP_SERVERTYPE_COMBO_BOX (account_wizard->combo_incoming_servertype));
const gchar* hostname = gtk_entry_get_text(GTK_ENTRY(account_wizard->entry_incomingserver));
MODEST_SERVERSECURITY_COMBO_BOX (
account_wizard->combo_incoming_security));
int port_num = get_serverport_incoming(protocol, protocol_security_incoming);
- GList *list_auth_methods =
+ GList *list_auth_methods =
modest_maemo_utils_get_supported_secure_authentication_methods (
protocol,
- hostname, port_num, username, GTK_WINDOW (account_wizard));
- if (list_auth_methods) {
+ hostname, port_num, username, GTK_WINDOW (account_wizard), &error);
+ if (list_auth_methods) {
/* TODO: Select the correct method */
GList* list = NULL;
GList* method;
/* no secure methods supported */
GtkWidget* error_dialog = gtk_message_dialog_new(GTK_WINDOW(account_wizard),
GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR,
- GTK_BUTTONS_OK, _("Server does not support secure authentication!"));
+ GTK_BUTTONS_OK, error != NULL ? error->message : _("Server does not support secure authentication!"));
+ if(error != NULL) g_error_free(error);
+
gtk_dialog_run(GTK_DIALOG(error_dialog));
gtk_widget_destroy(error_dialog);
return NULL;
{
if (gtk_toggle_button_get_active (
GTK_TOGGLE_BUTTON (dialog->checkbox_incoming_auth))) {
+ GError *error = NULL;
GList *list_auth_methods =
modest_maemo_utils_get_supported_secure_authentication_methods (dialog->incoming_protocol,
- hostname, port_num, username, GTK_WINDOW (dialog));
+ hostname, port_num, username, GTK_WINDOW (dialog), &error);
if (list_auth_methods) {
/* Use the first supported method.
* TODO: Should we prioritize them, to prefer a particular one? */
{
GtkWidget* error_dialog = gtk_message_dialog_new(GTK_WINDOW(dialog),
GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR,
- GTK_BUTTONS_OK, _("Server does not support secure authentication!"));
+ GTK_BUTTONS_OK, (error != NULL) ? error->message : _("Server does not support secure authentication!"));
+ if(error != NULL) g_error_free(error);
gtk_dialog_run(GTK_DIALOG(error_dialog));
gtk_widget_destroy(error_dialog);
/* This is a nasty hack. jschmid. */
gboolean cancel;
GList *result;
GtkWidget* dialog;
- GtkWidget* progress;
+ GtkWidget* progress;
+ GError* error;
} ModestGetSupportedAuthInfo;
static void on_camel_account_get_supported_secure_authentication_status (
ModestGetSupportedAuthInfo *info = (ModestGetSupportedAuthInfo*)user_data;
g_return_if_fail (info);
-
+
/* Free everything if the actual action was canceled */
if (info->cancel)
{
return;
}
+ /* Why is this a pointer to a pointer? We are not supposed to set it,
+ * are we? */
+ if(err != NULL && *err != NULL)
+ {
+ printf("Err: %s\n", (*err)->message);
+ info->error = g_error_copy(*err);
+ }
+
if (!auth_types) {
printf ("DEBUG: %s: auth_types is NULL.\n", __FUNCTION__);
info->finished = TRUE; /* We are blocking, waiting for this. */
}
GList* modest_maemo_utils_get_supported_secure_authentication_methods (ModestTransportStoreProtocol proto,
- const gchar* hostname, gint port, const gchar* username, GtkWindow *parent_window)
+ const gchar* hostname, gint port, const gchar* username, GtkWindow *parent_window, GError** error)
{
g_return_val_if_fail (proto != MODEST_PROTOCOL_TRANSPORT_STORE_UNKNOWN, NULL);
tny_account_set_proto (tny_account,
modest_protocol_info_get_transport_store_protocol_name(proto));
+ tny_account_set_hostname (tny_account, hostname);
/* Required for POP, at least */
tny_account_set_user (tny_account, username);
g_return_val_if_fail (session, NULL);
tny_camel_account_set_session (TNY_CAMEL_ACCOUNT(tny_account), session);
- tny_account_set_hostname (tny_account, hostname);
-
if(port > 0)
tny_account_set_port (tny_account, port);
info->finished = FALSE;
info->result = NULL;
info->cancel = FALSE;
+ info->error = NULL;
info->progress = gtk_progress_bar_new();
info->dialog = gtk_dialog_new_with_buttons(_("Authentication"),
parent_window, GTK_DIALOG_MODAL,
GList *result = info->result;
if (!info->cancel)
{
+ if(info->error != NULL)
+ g_propagate_error(error, info->error);
+
g_slice_free (ModestGetSupportedAuthInfo, info);
info = NULL;
}
*/
GList* modest_maemo_utils_get_supported_secure_authentication_methods (ModestTransportStoreProtocol proto,
- const gchar* hostname, gint port, const gchar* username, GtkWindow *parent_window);
+ const gchar* hostname, gint port, const gchar* username, GtkWindow *parent_window, GError** error);
/**
* modest_maemo_utils_setup_images_filechooser: