1 /* Copyright (c) 2006, Nokia Corporation
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * * Neither the name of the Nokia Corporation nor the names of its
14 * contributors may be used to endorse or promote products derived from
15 * this software without specific prior written permission.
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
18 * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
19 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
20 * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
21 * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
22 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
23 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
24 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
25 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
26 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 #include "modest-connection-specific-smtp-edit-window.h"
31 #include "widgets/modest-ui-constants.h"
32 #include "modest-hildon-includes.h"
33 #include "modest-runtime.h"
35 #include "modest-serversecurity-picker.h"
36 #include "modest-secureauth-picker.h"
37 #include "widgets/modest-validating-entry.h"
38 #include <hildon/hildon-pannable-area.h>
39 #include <gtk/gtkbutton.h>
40 #include <gtk/gtkhbox.h>
41 #include <gtk/gtkvbox.h>
42 #include <gtk/gtkstock.h>
43 #include "modest-text-utils.h"
44 #include "modest-maemo-utils.h"
46 #include <glib/gi18n.h>
48 #define PORT_RANGE_MIN 1
49 #define PORT_RANGE_MAX 65535
51 G_DEFINE_TYPE (ModestConnectionSpecificSmtpEditWindow, modest_connection_specific_smtp_edit_window, GTK_TYPE_DIALOG);
53 #define CONNECTION_SPECIFIC_SMTP_EDIT_WINDOW_GET_PRIVATE(o) \
54 (G_TYPE_INSTANCE_GET_PRIVATE ((o), MODEST_TYPE_CONNECTION_SPECIFIC_SMTP_EDIT_WINDOW, ModestConnectionSpecificSmtpEditWindowPrivate))
56 static void on_response (GtkDialog *dialog,
60 typedef struct _ModestConnectionSpecificSmtpEditWindowPrivate ModestConnectionSpecificSmtpEditWindowPrivate;
62 struct _ModestConnectionSpecificSmtpEditWindowPrivate
64 GtkWidget *entry_outgoingserver;
65 GtkWidget *outgoing_auth_picker;
66 GtkWidget *entry_user_username;
67 GtkWidget *entry_user_password;
68 GtkWidget *outgoing_security_picker;
69 GtkWidget *entry_port;
72 GtkWidget *button_cancel;
77 gboolean range_error_occured;
81 modest_connection_specific_smtp_edit_window_get_property (GObject *object, guint property_id,
82 GValue *value, GParamSpec *pspec)
84 switch (property_id) {
86 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
91 modest_connection_specific_smtp_edit_window_set_property (GObject *object, guint property_id,
92 const GValue *value, GParamSpec *pspec)
94 switch (property_id) {
96 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
101 modest_connection_specific_smtp_edit_window_dispose (GObject *object)
105 if (G_OBJECT_CLASS (modest_connection_specific_smtp_edit_window_parent_class)->dispose)
106 G_OBJECT_CLASS (modest_connection_specific_smtp_edit_window_parent_class)->dispose (object);
110 modest_connection_specific_smtp_edit_window_finalize (GObject *object)
112 ModestConnectionSpecificSmtpEditWindow *self = (ModestConnectionSpecificSmtpEditWindow *) object;
113 ModestConnectionSpecificSmtpEditWindowPrivate *priv =
114 CONNECTION_SPECIFIC_SMTP_EDIT_WINDOW_GET_PRIVATE (self);
116 if (priv->account_name) {
117 g_free (priv->account_name);
118 priv->account_name = NULL;
120 G_OBJECT_CLASS (modest_connection_specific_smtp_edit_window_parent_class)->finalize (object);
124 modest_connection_specific_smtp_edit_window_class_init (ModestConnectionSpecificSmtpEditWindowClass *klass)
126 GObjectClass *object_class = G_OBJECT_CLASS (klass);
128 g_type_class_add_private (klass, sizeof (ModestConnectionSpecificSmtpEditWindowPrivate));
130 object_class->get_property = modest_connection_specific_smtp_edit_window_get_property;
131 object_class->set_property = modest_connection_specific_smtp_edit_window_set_property;
132 object_class->dispose = modest_connection_specific_smtp_edit_window_dispose;
133 object_class->finalize = modest_connection_specific_smtp_edit_window_finalize;
138 MODEL_COL_SERVER_NAME = 1,
143 on_change(GtkWidget* widget, ModestConnectionSpecificSmtpEditWindow *self)
145 ModestConnectionSpecificSmtpEditWindowPrivate *priv =
146 CONNECTION_SPECIFIC_SMTP_EDIT_WINDOW_GET_PRIVATE (self);
147 priv->is_dirty = TRUE;
151 on_value_changed(GtkWidget* widget, GValue* value, ModestConnectionSpecificSmtpEditWindow *self)
153 ModestConnectionSpecificSmtpEditWindowPrivate *priv =
154 CONNECTION_SPECIFIC_SMTP_EDIT_WINDOW_GET_PRIVATE (self);
156 priv->range_error_occured = FALSE;
157 on_change(widget, self);
161 on_range_error (GtkWidget *widget, HildonNumberEditorErrorType type, gpointer user_data)
164 ModestConnectionSpecificSmtpEditWindow *self = user_data;
165 ModestConnectionSpecificSmtpEditWindowPrivate *priv =
166 CONNECTION_SPECIFIC_SMTP_EDIT_WINDOW_GET_PRIVATE (self);
168 /* We want to prevent the closure of the dialog when a range error occured. The problem is that
169 * the hildon number editor already resets the value to the default value, so we have to
170 * remember that such an error occured. */
171 priv->range_error_occured = TRUE;
173 if (type == HILDON_NUMBER_EDITOR_ERROR_MAXIMUM_VALUE_EXCEED) {
174 msg = g_strdup (_HL("ckct_ib_maximum_value"));
175 } else if (type == HILDON_NUMBER_EDITOR_ERROR_MINIMUM_VALUE_EXCEED) {
176 msg = g_strdup (_HL("ckct_ib_minimum_value"));
178 msg = g_strdup_printf (_HL("ckct_ib_set_a_value_within_range"), PORT_RANGE_MIN, PORT_RANGE_MAX);
180 modest_platform_information_banner (widget, NULL, msg);
183 /* Show error message by not returning TRUE */
188 on_response (GtkDialog *dialog, int response_id, gpointer user_data)
190 const gchar *hostname;
191 ModestConnectionSpecificSmtpEditWindow *self = user_data;
192 ModestConnectionSpecificSmtpEditWindowPrivate *priv =
193 CONNECTION_SPECIFIC_SMTP_EDIT_WINDOW_GET_PRIVATE (self);
195 hostname = gtk_entry_get_text (GTK_ENTRY (priv->entry_outgoingserver));
197 /* Don't close the dialog if a range error occured */
198 if(response_id == GTK_RESPONSE_OK && priv->range_error_occured)
200 priv->range_error_occured = FALSE;
201 g_signal_stop_emission_by_name (dialog, "response");
202 gtk_widget_grab_focus (priv->entry_port);
206 /* Don't close the dialog if a range error occured */
207 if(response_id == GTK_RESPONSE_OK) {
208 if (hostname && (hostname[0] != '\0') &&
209 (!modest_text_utils_validate_domain_name (hostname))) {
210 g_signal_stop_emission_by_name (dialog, "response");
211 hildon_banner_show_information (NULL, NULL, _("mcen_ib_invalid_servername"));
212 gtk_widget_grab_focus (priv->entry_outgoingserver);
213 gtk_editable_select_region (GTK_EDITABLE (priv->entry_outgoingserver), 0, -1);
217 /* Ask user if they want to discard changes */
218 if (priv->is_dirty) {
220 response = modest_platform_run_confirmation_dialog (GTK_WINDOW (user_data),
221 _("imum_nc_wizard_confirm_lose_changes"));
222 if (response != GTK_RESPONSE_OK)
223 g_signal_stop_emission_by_name (dialog, "response");
228 static void on_set_focus_child (GtkContainer *container, GtkWidget *widget, gpointer user_data)
230 ModestConnectionSpecificSmtpEditWindow *self = user_data;
231 ModestConnectionSpecificSmtpEditWindowPrivate *priv =
232 CONNECTION_SPECIFIC_SMTP_EDIT_WINDOW_GET_PRIVATE (self);
234 /* Another child gained focus. Since the number editor already reset a
235 * possible range error to the default value, we allow closure of the
237 priv->range_error_occured = FALSE;
241 on_security_picker_changed (HildonPickerButton *widget, gpointer user_data)
243 ModestConnectionSpecificSmtpEditWindow *self =
244 MODEST_CONNECTION_SPECIFIC_SMTP_EDIT_WINDOW (user_data);
245 ModestConnectionSpecificSmtpEditWindowPrivate *priv =
246 CONNECTION_SPECIFIC_SMTP_EDIT_WINDOW_GET_PRIVATE (self);
248 on_change(GTK_WIDGET(widget), self);
250 const gint port_number =
251 modest_serversecurity_picker_get_active_serversecurity_port (
252 MODEST_SERVERSECURITY_PICKER (priv->outgoing_security_picker));
254 if(port_number != 0) {
255 hildon_number_editor_set_value (
256 HILDON_NUMBER_EDITOR (priv->entry_port), port_number);
261 on_auth_picker_changed (HildonPickerButton *widget, gpointer user_data)
263 ModestConnectionSpecificSmtpEditWindow *self =
264 MODEST_CONNECTION_SPECIFIC_SMTP_EDIT_WINDOW (user_data);
265 ModestConnectionSpecificSmtpEditWindowPrivate *priv =
266 CONNECTION_SPECIFIC_SMTP_EDIT_WINDOW_GET_PRIVATE (self);
267 ModestProtocolType auth_proto;
269 on_change (GTK_WIDGET(widget), self);
271 /* Enable/disable username and password fields */
273 modest_secureauth_picker_get_active_secureauth (MODEST_SECUREAUTH_PICKER (priv->outgoing_auth_picker));
275 if (auth_proto == modest_protocol_registry_get_none_auth_type_id ()) {
276 gtk_widget_set_sensitive (priv->entry_user_username, FALSE);
277 gtk_widget_set_sensitive (priv->entry_user_password, FALSE);
279 gtk_widget_set_sensitive (priv->entry_user_username, TRUE);
280 gtk_widget_set_sensitive (priv->entry_user_password, TRUE);
286 modest_connection_specific_smtp_edit_window_init (ModestConnectionSpecificSmtpEditWindow *self)
288 ModestConnectionSpecificSmtpEditWindowPrivate *priv;
289 GtkWidget *dialog_box;
290 GtkWidget *pannable, *vbox;
292 /* The title of this dialog is quite long, so make the window wide enough */
293 gtk_widget_set_size_request (GTK_WIDGET (self), 600, 320);
295 priv = CONNECTION_SPECIFIC_SMTP_EDIT_WINDOW_GET_PRIVATE (self);
296 dialog_box = GTK_DIALOG(self)->vbox; /* gtk_vbox_new (FALSE, MODEST_MARGIN_HALF); */
297 gtk_box_set_spacing (GTK_BOX (dialog_box), MODEST_MARGIN_NONE);
298 gtk_container_set_border_width (GTK_CONTAINER (dialog_box), MODEST_MARGIN_HALF);
300 vbox = gtk_vbox_new (FALSE, 0);
302 /* Create a size group to be used by all captions.
303 * Note that HildonCaption does not create a default size group if we do not specify one.
304 * We use GTK_SIZE_GROUP_HORIZONTAL, so that the widths are the same. */
305 GtkSizeGroup *title_sizegroup = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
306 GtkSizeGroup *value_sizegroup = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
308 /* The outgoing server widgets: */
309 if (!priv->entry_outgoingserver)
310 priv->entry_outgoingserver = gtk_entry_new ();
311 /* Auto-capitalization is the default, so let's turn it off: */
312 hildon_gtk_entry_set_input_mode (GTK_ENTRY (priv->entry_outgoingserver), HILDON_GTK_INPUT_MODE_FULL);
313 g_signal_connect(G_OBJECT(priv->entry_outgoingserver), "changed", G_CALLBACK(on_change), self);
315 GtkWidget *captioned =
316 modest_maemo_utils_create_captioned (title_sizegroup, value_sizegroup,
317 _("mcen_li_emailsetup_smtp"),
318 priv->entry_outgoingserver);
319 gtk_widget_show (priv->entry_outgoingserver);
320 gtk_box_pack_start (GTK_BOX (vbox), captioned, FALSE, FALSE, MODEST_MARGIN_HALF);
321 gtk_widget_show (captioned);
323 /* The secure authentication widgets: */
324 if (!priv->outgoing_auth_picker) {
325 priv->outgoing_auth_picker =
326 GTK_WIDGET (modest_secureauth_picker_new (MODEST_EDITABLE_SIZE,
327 HILDON_BUTTON_ARRANGEMENT_HORIZONTAL));
329 modest_maemo_utils_set_hbutton_layout (title_sizegroup, value_sizegroup,
330 _("mcen_li_emailsetup_secure_authentication"),
331 priv->outgoing_auth_picker);
332 g_signal_connect (G_OBJECT (priv->outgoing_auth_picker), "value-changed", (GCallback)on_auth_picker_changed, self);
333 gtk_widget_show (priv->outgoing_auth_picker);
334 gtk_box_pack_start (GTK_BOX (vbox), priv->outgoing_auth_picker, FALSE, FALSE, MODEST_MARGIN_HALF);
336 /* The username widgets: */
337 priv->entry_user_username = GTK_WIDGET (modest_validating_entry_new ());
338 /* Auto-capitalization is the default, so let's turn it off: */
339 hildon_gtk_entry_set_input_mode (GTK_ENTRY (priv->entry_user_username), HILDON_GTK_INPUT_MODE_FULL);
340 captioned = modest_maemo_utils_create_captioned (title_sizegroup, value_sizegroup,
341 _("mail_fi_username"),
342 priv->entry_user_username);
343 g_signal_connect(G_OBJECT(priv->entry_user_username), "changed", G_CALLBACK(on_change), self);
344 gtk_widget_show (priv->entry_user_username);
345 gtk_box_pack_start (GTK_BOX (vbox), captioned, FALSE, FALSE, MODEST_MARGIN_HALF);
346 gtk_widget_show (captioned);
348 /* Prevent the use of some characters in the username,
349 * as required by our UI specification: */
350 modest_validating_entry_set_unallowed_characters_whitespace (
351 MODEST_VALIDATING_ENTRY (priv->entry_user_username));
353 /* Set max length as in the UI spec:
354 * TODO: The UI spec seems to want us to show a dialog if we hit the maximum. */
355 gtk_entry_set_max_length (GTK_ENTRY (priv->entry_user_username), 64);
357 /* The password widgets: */
358 priv->entry_user_password = gtk_entry_new ();
359 /* Auto-capitalization is the default, so let's turn it off: */
360 hildon_gtk_entry_set_input_mode (GTK_ENTRY (priv->entry_user_password),
361 HILDON_GTK_INPUT_MODE_FULL | HILDON_GTK_INPUT_MODE_INVISIBLE);
362 gtk_entry_set_visibility (GTK_ENTRY (priv->entry_user_password), FALSE);
363 /* gtk_entry_set_invisible_char (GTK_ENTRY (priv->entry_user_password), '*'); */
364 captioned = modest_maemo_utils_create_captioned (title_sizegroup, value_sizegroup,
365 _("mail_fi_password"), priv->entry_user_password);
366 g_signal_connect(G_OBJECT(priv->entry_user_password), "changed", G_CALLBACK(on_change), self);
367 gtk_widget_show (priv->entry_user_password);
368 gtk_box_pack_start (GTK_BOX (vbox), captioned, FALSE, FALSE, MODEST_MARGIN_HALF);
369 gtk_widget_show (captioned);
371 /* The secure connection widgets: */
372 if (!priv->outgoing_security_picker)
373 priv->outgoing_security_picker =
374 GTK_WIDGET (modest_serversecurity_picker_new (MODEST_EDITABLE_SIZE,
375 HILDON_BUTTON_ARRANGEMENT_HORIZONTAL));
376 modest_serversecurity_picker_fill (
377 MODEST_SERVERSECURITY_PICKER (priv->outgoing_security_picker), MODEST_PROTOCOLS_TRANSPORT_SMTP);
378 modest_serversecurity_picker_set_active_serversecurity (
379 MODEST_SERVERSECURITY_PICKER (priv->outgoing_security_picker), MODEST_PROTOCOLS_CONNECTION_NONE);
380 modest_maemo_utils_set_hbutton_layout (title_sizegroup, value_sizegroup,
381 _("mcen_li_emailsetup_secure_connection"),
382 priv->outgoing_security_picker);
383 gtk_widget_show (priv->outgoing_security_picker);
384 gtk_box_pack_start (GTK_BOX (vbox), priv->outgoing_security_picker, FALSE, FALSE, MODEST_MARGIN_HALF);
386 /* The port number widgets: */
387 if (!priv->entry_port)
388 priv->entry_port = GTK_WIDGET (hildon_number_editor_new (PORT_RANGE_MIN, PORT_RANGE_MAX));
389 captioned = modest_maemo_utils_create_captioned (title_sizegroup, value_sizegroup,
390 _("mcen_fi_emailsetup_port"), priv->entry_port);
391 gtk_widget_add_events(GTK_WIDGET(priv->entry_port), GDK_FOCUS_CHANGE_MASK);
392 g_signal_connect(G_OBJECT(priv->entry_port), "range-error", G_CALLBACK(on_range_error), self);
393 g_signal_connect(G_OBJECT(priv->entry_port), "notify::value", G_CALLBACK(on_value_changed), self);
394 gtk_widget_show (priv->entry_port);
395 gtk_box_pack_start (GTK_BOX (vbox), captioned, FALSE, FALSE, MODEST_MARGIN_HALF);
396 gtk_widget_show (captioned);
398 /* Show a default port number when the security method changes, as per the UI spec: */
399 g_signal_connect (G_OBJECT (priv->outgoing_security_picker), "value-changed", (GCallback)on_security_picker_changed, self);
401 /* Add the buttons: */
402 gtk_dialog_add_button (GTK_DIALOG (self), _HL("wdgt_bd_save"), GTK_RESPONSE_OK);
404 priv->is_dirty = FALSE;
405 priv->range_error_occured = FALSE;
406 g_signal_connect(G_OBJECT(self), "response", G_CALLBACK(on_response), self);
407 g_signal_connect(G_OBJECT(vbox), "set-focus-child", G_CALLBACK(on_set_focus_child), self);
409 priv->account_name = NULL;
411 pannable = hildon_pannable_area_new ();
412 g_object_set (G_OBJECT (pannable), "initial-hint", TRUE, NULL);
413 hildon_pannable_area_add_with_viewport (HILDON_PANNABLE_AREA (pannable), vbox);
414 gtk_box_pack_start (GTK_BOX (dialog_box), pannable, TRUE, TRUE, 0);
416 gtk_widget_show_all (dialog_box);
417 gtk_window_set_default_size (GTK_WINDOW (self), -1, 220);
419 g_object_unref (title_sizegroup);
420 g_object_unref (value_sizegroup);
422 /* When this window is shown, hibernation should not be possible,
423 * because there is no sensible way to save the state: */
424 modest_window_mgr_prevent_hibernation_while_window_is_shown (
425 modest_runtime_get_window_mgr (), GTK_WINDOW (self));
427 hildon_help_dialog_help_enable (GTK_DIALOG(self),
428 "applications_email_connectionspecificsmtpconf",
429 modest_maemo_utils_get_osso_context());
431 /* Refresh view with current settings */
432 on_auth_picker_changed (HILDON_PICKER_BUTTON (priv->outgoing_auth_picker), self);
433 on_security_picker_changed (HILDON_PICKER_BUTTON (priv->outgoing_security_picker), self);
436 ModestConnectionSpecificSmtpEditWindow*
437 modest_connection_specific_smtp_edit_window_new (void)
439 return g_object_new (MODEST_TYPE_CONNECTION_SPECIFIC_SMTP_EDIT_WINDOW, NULL);
443 modest_connection_specific_smtp_edit_window_set_connection (
444 ModestConnectionSpecificSmtpEditWindow *window, const gchar* iap_id, const gchar* iap_name,
445 ModestServerAccountSettings *server_settings)
447 ModestConnectionSpecificSmtpEditWindowPrivate *priv =
448 CONNECTION_SPECIFIC_SMTP_EDIT_WINDOW_GET_PRIVATE (window);
450 /* This causes a warning because of the %s in the translation, but not in the original string: */
451 gchar* title = g_strdup_printf (_("mcen_ti_connection_connection_name"), iap_name);
452 gtk_window_set_title (GTK_WINDOW (window), title);
457 /* Setting known values */
458 if (priv->account_name)
459 g_free (priv->account_name);
460 priv->account_name = g_strdup (modest_server_account_settings_get_account_name (server_settings));
461 gtk_entry_set_text (GTK_ENTRY (priv->entry_outgoingserver),
462 modest_server_account_settings_get_hostname (server_settings));
463 gtk_entry_set_text (GTK_ENTRY (priv->entry_user_username),
464 modest_server_account_settings_get_username (server_settings));
465 gtk_entry_set_text (GTK_ENTRY (priv->entry_user_password),
466 modest_server_account_settings_get_password (server_settings));
468 modest_serversecurity_picker_set_active_serversecurity (
469 MODEST_SERVERSECURITY_PICKER (priv->outgoing_security_picker),
470 modest_server_account_settings_get_security_protocol (server_settings));
472 modest_secureauth_picker_set_active_secureauth (
473 MODEST_SECUREAUTH_PICKER (priv->outgoing_auth_picker),
474 modest_server_account_settings_get_auth_protocol (server_settings));
477 hildon_number_editor_set_value (
478 HILDON_NUMBER_EDITOR (priv->entry_port),
479 modest_server_account_settings_get_port (server_settings));
482 /* This will cause changed signals so we set dirty back to FALSE */
483 priv->is_dirty = FALSE;
487 ModestServerAccountSettings*
488 modest_connection_specific_smtp_edit_window_get_settings (ModestConnectionSpecificSmtpEditWindow *window)
490 ModestConnectionSpecificSmtpEditWindowPrivate *priv = NULL;
491 ModestServerAccountSettings *server_settings = NULL;
492 const gchar *outgoing_server = NULL;
494 priv = CONNECTION_SPECIFIC_SMTP_EDIT_WINDOW_GET_PRIVATE (window);
495 outgoing_server = gtk_entry_get_text (GTK_ENTRY (priv->entry_outgoingserver));
497 /* If the outgoing server is NULL, we are removing the connection specific
499 if ((outgoing_server == NULL) || (outgoing_server[0] == '\0')) {
503 server_settings = modest_server_account_settings_new ();
505 modest_server_account_settings_set_hostname (server_settings,
506 gtk_entry_get_text (GTK_ENTRY (priv->entry_outgoingserver)));
507 modest_server_account_settings_set_protocol (server_settings,
508 MODEST_PROTOCOLS_TRANSPORT_SMTP);
509 modest_server_account_settings_set_username (server_settings,
510 gtk_entry_get_text (GTK_ENTRY (priv->entry_user_username)));
511 modest_server_account_settings_set_password (server_settings,
512 gtk_entry_get_text (GTK_ENTRY (priv->entry_user_password)));
514 modest_server_account_settings_set_security_protocol (server_settings,
515 modest_serversecurity_picker_get_active_serversecurity (
516 MODEST_SERVERSECURITY_PICKER (priv->outgoing_security_picker)));
517 modest_server_account_settings_set_auth_protocol (server_settings,
518 modest_secureauth_picker_get_active_secureauth (
519 MODEST_SECUREAUTH_PICKER (priv->outgoing_auth_picker)));
520 modest_server_account_settings_set_account_name (server_settings,
524 modest_server_account_settings_set_port (server_settings,
525 hildon_number_editor_get_value (HILDON_NUMBER_EDITOR (priv->entry_port)));
527 return server_settings;
531 modest_connection_specific_smtp_edit_window_is_dirty(ModestConnectionSpecificSmtpEditWindow *window)
533 ModestConnectionSpecificSmtpEditWindowPrivate *priv =
534 CONNECTION_SPECIFIC_SMTP_EDIT_WINDOW_GET_PRIVATE (window);
536 return priv->is_dirty;