X-Git-Url: http://git.maemo.org/git/?a=blobdiff_plain;f=src%2Fmaemo%2Fmodest-connection-specific-smtp-edit-window.c;h=f4047d18775b2040985fcd9b9ac088ebd0cc2f73;hb=30ec701bc2d1c270022e3543994f0221f6fb8b8c;hp=520a27e367f5034b571e912cf557179097d5d8c5;hpb=7eff5ee43be3f5cefc0d4e810069c8d348d3bba7;p=modest diff --git a/src/maemo/modest-connection-specific-smtp-edit-window.c b/src/maemo/modest-connection-specific-smtp-edit-window.c index 520a27e..f4047d1 100644 --- a/src/maemo/modest-connection-specific-smtp-edit-window.c +++ b/src/maemo/modest-connection-specific-smtp-edit-window.c @@ -41,6 +41,7 @@ #include #include #include "modest-text-utils.h" +#include "modest-maemo-utils.h" #include @@ -174,7 +175,8 @@ on_response (GtkDialog *dialog, int response_id, gpointer user_data) /* Don't close the dialog if a range error occured */ if(response_id == GTK_RESPONSE_OK) { - if (!modest_text_utils_validate_domain_name (hostname)) { + if (hostname && (hostname[0] != '\0') && + (!modest_text_utils_validate_domain_name (hostname))) { g_signal_stop_emission_by_name (dialog, "response"); hildon_banner_show_information (NULL, NULL, _("mcen_ib_invalid_servername")); gtk_widget_grab_focus (priv->entry_outgoingserver); @@ -333,7 +335,11 @@ modest_connection_specific_smtp_edit_window_init (ModestConnectionSpecificSmtpEd /* When this window is shown, hibernation should not be possible, * because there is no sensible way to save the state: */ modest_window_mgr_prevent_hibernation_while_window_is_shown ( - modest_runtime_get_window_mgr (), GTK_WINDOW (self)); + modest_runtime_get_window_mgr (), GTK_WINDOW (self)); + + hildon_help_dialog_help_enable (GTK_DIALOG(self), + "applications_email_connectionspecificsmtpconf", + modest_maemo_utils_get_osso_context()); } ModestConnectionSpecificSmtpEditWindow* @@ -384,12 +390,22 @@ modest_connection_specific_smtp_edit_window_get_settings ( ModestConnectionSpecificSmtpEditWindow *window, ModestAccountMgr *account_manager) { - ModestConnectionSpecificSmtpEditWindowPrivate *priv = - CONNECTION_SPECIFIC_SMTP_EDIT_WINDOW_GET_PRIVATE (window); + ModestConnectionSpecificSmtpEditWindowPrivate *priv = NULL; + ModestServerAccountData *result = NULL; + const gchar *outgoing_server = NULL; + + priv = CONNECTION_SPECIFIC_SMTP_EDIT_WINDOW_GET_PRIVATE (window); + outgoing_server = gtk_entry_get_text (GTK_ENTRY (priv->entry_outgoingserver)); + + /* If the outgoing server is NULL, we are removing the connection specific + * settings */ + if ((outgoing_server == NULL) || (outgoing_server[0] == '\0')) { + return NULL; + } /* Use g_slice_new0(), because that's what modest_account_mgr_free_server_account_data() * expects us to use. */ - ModestServerAccountData *result = g_slice_new0 (ModestServerAccountData); + result = g_slice_new0 (ModestServerAccountData); result->hostname = g_strdup (gtk_entry_get_text (GTK_ENTRY (priv->entry_outgoingserver))); result->username = g_strdup (gtk_entry_get_text (GTK_ENTRY (priv->entry_user_username)));