#include "modest-hildon-includes.h"
#include "modest-platform.h"
+#include "modest-maemo-utils.h"
#include <glib/gi18n.h>
+#include <string.h>
-G_DEFINE_TYPE (ModestConnectionSpecificSmtpWindow, modest_connection_specific_smtp_window, GTK_TYPE_WINDOW);
+G_DEFINE_TYPE (ModestConnectionSpecificSmtpWindow, modest_connection_specific_smtp_window,
+ GTK_TYPE_DIALOG);
#define CONNECTION_SPECIFIC_SMTP_WINDOW_GET_PRIVATE(o) \
(G_TYPE_INSTANCE_GET_PRIVATE ((o), MODEST_TYPE_CONNECTION_SPECIFIC_SMTP_WINDOW, ModestConnectionSpecificSmtpWindowPrivate))
MODEST_CONNECTION_SPECIFIC_SMTP_EDIT_WINDOW (window),
priv->account_manager);
- const gchar* server_name = data ? data->hostname : NULL;
- gtk_list_store_set (GTK_LIST_STORE (priv->model), &iter,
- MODEL_COL_SERVER_ACCOUNT_DATA, data,
- MODEL_COL_SERVER_NAME, server_name,
- -1);
+ if (data) {
+ gtk_list_store_set (GTK_LIST_STORE (priv->model), &iter,
+ MODEL_COL_SERVER_ACCOUNT_DATA, data,
+ MODEL_COL_SERVER_NAME, data->hostname,
+ -1);
+ } else {
+ gtk_list_store_set (GTK_LIST_STORE (priv->model), &iter,
+ MODEL_COL_SERVER_ACCOUNT_DATA, NULL,
+ MODEL_COL_SERVER_NAME, NULL,
+ MODEL_COL_SERVER_ACCOUNT_NAME, NULL,
+ -1);
+ }
}
else
{
g_free (connection_name);
g_free (id);
g_free (server_account_name);
+ update_model_server_names (self);
}
static void
/* The application must call modest_connection_specific_smtp_window_fill_with_connections(). */
- GtkWidget *vbox = gtk_vbox_new (FALSE, MODEST_MARGIN_DEFAULT);
+ GtkWidget *vbox = GTK_DIALOG(self)->vbox;
+ //gtk_vbox_new (FALSE, MODEST_MARGIN_DEFAULT);
/* Introductory note: */
/* TODO: For some reason this label does not wrap. It is truncated. */
g_signal_connect (G_OBJECT (button_cancel), "clicked",
G_CALLBACK (on_button_cancel), self);
- gtk_container_add (GTK_CONTAINER (self), GTK_WIDGET (vbox));
+ //gtk_container_add (GTK_CONTAINER (self), GTK_WIDGET (vbox));
gtk_widget_show (vbox);
/* Disable the Edit button when nothing is selected: */
g_signal_connect (G_OBJECT (self),
"key-press-event",
G_CALLBACK (on_key_pressed), NULL);
+
+ hildon_help_dialog_help_enable (GTK_DIALOG(self),
+ "applications_email_connectionsspecificsmtpconf",
+ modest_maemo_utils_get_osso_context());
}
ModestConnectionSpecificSmtpWindow*
/* Walk through the list, reading each row */
while (valid) {
- gchar *id = NULL;
+ gchar *id = NULL;
gchar *connection_name = NULL;
gchar *server_account_name = NULL;
+ gchar *server_name = NULL;
ModestServerAccountData *data = NULL;
gtk_tree_model_get (priv->model, &iter,
MODEL_COL_ID, &id,
MODEL_COL_NAME, &connection_name,
+ MODEL_COL_SERVER_NAME, &server_name,
MODEL_COL_SERVER_ACCOUNT_NAME, &server_account_name,
MODEL_COL_SERVER_ACCOUNT_DATA, &data,
-1);
MODEST_PROTOCOL_TRANSPORT_SMTP,
data->security,
data->secure_auth);
+ if (success) {
+ TnyAccount *account = TNY_ACCOUNT (modest_tny_account_store_new_connection_specific_transport_account
+ (modest_runtime_get_account_store (),
+ server_account_name));
+ if (account)
+ g_object_unref (account);
+ }
/* associate the specific server account with this connection for this account: */
success = success && modest_account_mgr_set_connection_specific_smtp (
} else {
/* Change an existing server account: */
- success = modest_account_mgr_set_string (priv->account_manager, server_account_name,
- MODEST_ACCOUNT_HOSTNAME, data->hostname, TRUE /* server account */);
+ modest_account_mgr_set_server_account_hostname (priv->account_manager, server_account_name,
+ data->hostname);
- modest_server_account_set_username (priv->account_manager, server_account_name,
+ modest_account_mgr_set_server_account_username (priv->account_manager, server_account_name,
data->username);
- modest_server_account_set_password (priv->account_manager, server_account_name,
+ modest_account_mgr_set_server_account_password (priv->account_manager, server_account_name,
data->password);
- modest_server_account_set_secure_auth (priv->account_manager, server_account_name,
+ modest_account_mgr_set_server_account_secure_auth (priv->account_manager, server_account_name,
data->secure_auth);
- modest_server_account_set_security (priv->account_manager, server_account_name,
+ modest_account_mgr_set_server_account_security (priv->account_manager, server_account_name,
data->security);
-
- modest_account_mgr_set_int (priv->account_manager, server_account_name,
- MODEST_ACCOUNT_PORT, data->port, TRUE /* server account */);
+
+ modest_account_mgr_set_server_account_port (priv->account_manager, server_account_name, data->port);
}
+ } else if (connection_name && server_name &&
+ !strcmp (server_name, _("mcen_ia_optionalsmtp_notdefined"))) {
+ modest_account_mgr_remove_connection_specific_smtp (priv->account_manager,
+ connection_name);
+ gtk_list_store_set (GTK_LIST_STORE (priv->model), &iter,
+ MODEL_COL_SERVER_ACCOUNT_NAME, NULL, -1);
}
g_free (connection_name);
g_free (id);
g_free (server_account_name);
+ g_free (server_name);
if (!success)
return FALSE;
while (valid) {
gchar *server_account_name = NULL;
+ ModestServerAccountData *data = NULL;
gtk_tree_model_get (priv->model, &iter,
MODEL_COL_SERVER_ACCOUNT_NAME, &server_account_name,
+ MODEL_COL_SERVER_ACCOUNT_DATA, &data,
-1);
-
if (server_account_name) {
+
/* Get the server hostname and show it in the treemodel: */
- gchar *hostname = modest_account_mgr_get_string (priv->account_manager,
- server_account_name, MODEST_ACCOUNT_HOSTNAME, TRUE /* server account */);
+ gchar *hostname = modest_account_mgr_get_server_account_hostname (priv->account_manager,
+ server_account_name);
gtk_list_store_set (GTK_LIST_STORE (priv->model), &iter,
MODEL_COL_SERVER_NAME, hostname,
-1);
g_free (hostname);
+ } else if (data && data->hostname && (data->hostname[0] != '\0')) {
+ gtk_list_store_set (GTK_LIST_STORE (priv->model), &iter,
+ MODEL_COL_SERVER_NAME, data->hostname,
+ -1);
} else {
gtk_list_store_set (GTK_LIST_STORE (priv->model), &iter,
MODEL_COL_SERVER_NAME, _("mcen_ia_optionalsmtp_notdefined"),