1 /* Copyright (c) 2007, Nokia Corporation
7 #include "modest-account-settings-dialog.h"
8 #include <glib/gi18n.h>
9 #include <gtk/gtknotebook.h>
10 #include <gtk/gtkvbox.h>
11 #include <gtk/gtklabel.h>
12 #include <gtk/gtkcombobox.h>
13 #include <gtk/gtkentry.h>
14 #include <gtk/gtkbutton.h>
15 #include <gtk/gtkcheckbutton.h>
16 #include <gtk/gtkmessagedialog.h>
17 #include <gtk/gtkstock.h>
18 #include <hildon-widgets/hildon-caption.h>
19 #include "maemo/easysetup/modest-easysetup-country-combo-box.h"
20 #include "maemo/easysetup/modest-easysetup-provider-combo-box.h"
21 #include "maemo/easysetup/modest-easysetup-servertype-combo-box.h"
22 #include "maemo/easysetup/modest-easysetup-serversecurity-combo-box.h"
23 #include "maemo/easysetup/modest-easysetup-secureauth-combo-box.h"
24 #include "maemo/easysetup/modest-validating-entry.h"
25 #include "widgets/modest-retrieve-combo-box.h"
26 #include "widgets/modest-limit-retrieve-combo-box.h"
27 #include "modest-text-utils.h"
28 #include "modest-account-mgr.h"
29 #include "modest-account-mgr-helpers.h" /* For modest_account_mgr_get_account_data(). */
30 #include "modest-runtime.h" /* For modest_runtime_get_account_mgr(). */
31 #include "maemo/modest-connection-specific-smtp-window.h"
32 #include <gconf/gconf-client.h>
33 #include <string.h> /* For strlen(). */
35 /* Include config.h so that _() works: */
40 #define EXAMPLE_EMAIL_ADDRESS "first.last@provider.com"
42 G_DEFINE_TYPE (ModestAccountSettingsDialog, modest_account_settings_dialog, GTK_TYPE_DIALOG);
44 #define ACCOUNT_SETTINGS_DIALOG_GET_PRIVATE(o) \
45 (G_TYPE_INSTANCE_GET_PRIVATE ((o), MODEST_TYPE_ACCOUNT_SETTINGS_DIALOG, ModestAccountSettingsDialogPrivate))
47 typedef struct _ModestAccountSettingsDialogPrivate ModestAccountSettingsDialogPrivate;
49 struct _ModestAccountSettingsDialogPrivate
54 enable_buttons (ModestAccountSettingsDialog *self);
57 save_configuration (ModestAccountSettingsDialog *dialog);
60 modest_account_settings_dialog_get_property (GObject *object, guint property_id,
61 GValue *value, GParamSpec *pspec)
63 switch (property_id) {
65 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
70 modest_account_settings_dialog_set_property (GObject *object, guint property_id,
71 const GValue *value, GParamSpec *pspec)
73 switch (property_id) {
75 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
80 modest_account_settings_dialog_dispose (GObject *object)
82 if (G_OBJECT_CLASS (modest_account_settings_dialog_parent_class)->dispose)
83 G_OBJECT_CLASS (modest_account_settings_dialog_parent_class)->dispose (object);
87 modest_account_settings_dialog_finalize (GObject *object)
89 ModestAccountSettingsDialog *self = MODEST_ACCOUNT_SETTINGS_DIALOG (object);
91 if (self->account_name)
92 g_free (self->account_name);
94 if (self->original_account_title)
95 g_free (self->original_account_title);
97 if (self->account_manager)
98 g_object_unref (G_OBJECT (self->account_manager));
100 G_OBJECT_CLASS (modest_account_settings_dialog_parent_class)->finalize (object);
104 show_error (GtkWindow *parent_window, const gchar* text);
107 show_ok (GtkWindow *parent_window, const gchar* text);
110 on_combo_incoming_security_changed (GtkComboBox *widget, gpointer user_data);
113 on_combo_outgoing_security_changed (GtkComboBox *widget, gpointer user_data);
117 on_caption_entry_changed (GtkEditable *editable, gpointer user_data)
119 ModestAccountSettingsDialog *self = MODEST_ACCOUNT_SETTINGS_DIALOG (user_data);
121 enable_buttons(self);
125 on_caption_combobox_changed (GtkComboBox *widget, gpointer user_data)
127 ModestAccountSettingsDialog *self = MODEST_ACCOUNT_SETTINGS_DIALOG (user_data);
129 enable_buttons(self);
132 /** This is a convenience function to create a caption containing a mandatory widget.
133 * When the widget is edited, the enable_buttons() vfunc will be called.
135 static GtkWidget* create_caption_new_with_asterix(ModestAccountSettingsDialog *self,
140 HildonCaptionStatus flag)
142 GtkWidget *caption = hildon_caption_new (group, value, control, icon, flag);
144 /* The translated strings seem to already contain the *,
145 * but this code can be used if that is not true in future.
148 /* Add a * character to indicate mandatory fields,
149 * as specified in our "Email UI Specification": */
150 if (flag == HILDON_CAPTION_MANDATORY) {
151 gchar* title = g_strdup_printf("%s*", value);
152 caption = hildon_caption_new (group, title, control, icon, flag);
156 caption = hildon_caption_new (group, value, control, icon, flag);
159 /* Connect to the appropriate changed signal for the widget,
160 * so we can ask for the prev/next buttons to be enabled/disabled appropriately:
162 if (GTK_IS_ENTRY (control)) {
163 g_signal_connect (G_OBJECT (control), "changed",
164 G_CALLBACK (on_caption_entry_changed), self);
167 else if (GTK_IS_COMBO_BOX (control)) {
168 g_signal_connect (G_OBJECT (control), "changed",
169 G_CALLBACK (on_caption_combobox_changed), self);
176 create_page_account_details (ModestAccountSettingsDialog *self)
178 GtkWidget *box = gtk_vbox_new (FALSE, 2);
179 GtkWidget *label = gtk_label_new(_("mcen_ia_accountdetails"));
180 gtk_box_pack_start (GTK_BOX (box), label, FALSE, FALSE, 2);
181 gtk_widget_show (label);
183 /* Create a size group to be used by all captions.
184 * Note that HildonCaption does not create a default size group if we do not specify one.
185 * We use GTK_SIZE_GROUP_HORIZONTAL, so that the widths are the same. */
186 GtkSizeGroup* sizegroup = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
188 /* The description widgets: */
189 self->entry_account_title = GTK_WIDGET (easysetup_validating_entry_new ());
190 GtkWidget *caption = create_caption_new_with_asterix (self, sizegroup, _("mcen_fi_account_title"),
191 self->entry_account_title, NULL, HILDON_CAPTION_MANDATORY);
192 gtk_widget_show (self->entry_account_title);
193 gtk_box_pack_start (GTK_BOX (box), caption, FALSE, FALSE, 2);
194 gtk_widget_show (caption);
196 /* Prevent the use of some characters in the account title,
197 * as required by our UI specification: */
198 GList *list_prevent = NULL;
199 list_prevent = g_list_append (list_prevent, "\\");
200 list_prevent = g_list_append (list_prevent, "/");
201 list_prevent = g_list_append (list_prevent, ":");
202 list_prevent = g_list_append (list_prevent, "*");
203 list_prevent = g_list_append (list_prevent, "?");
204 list_prevent = g_list_append (list_prevent, "\""); /* The UI spec mentions “, but maybe means ", maybe both. */
205 list_prevent = g_list_append (list_prevent, "“");
206 list_prevent = g_list_append (list_prevent, "<");
207 list_prevent = g_list_append (list_prevent, ">");
208 list_prevent = g_list_append (list_prevent, "|");
209 list_prevent = g_list_append (list_prevent, "^");
210 easysetup_validating_entry_set_unallowed_characters (
211 EASYSETUP_VALIDATING_ENTRY (self->entry_account_title), list_prevent);
212 g_list_free (list_prevent);
214 /* Set max length as in the UI spec:
215 * TODO: The UI spec seems to want us to show a dialog if we hit the maximum. */
216 gtk_entry_set_max_length (GTK_ENTRY (self->entry_account_title), 64);
218 /* The retrieve combobox: */
219 self->combo_retrieve = GTK_WIDGET (modest_retrieve_combo_box_new ());
220 caption = create_caption_new_with_asterix (self, sizegroup, _("mcen_fi_advsetup_retrievetype"),
221 self->combo_retrieve, NULL, HILDON_CAPTION_MANDATORY);
222 gtk_widget_show (self->combo_retrieve);
223 gtk_box_pack_start (GTK_BOX (box), caption, FALSE, FALSE, 2);
224 gtk_widget_show (caption);
226 /* The limit-retrieve combobox: */
227 self->combo_limit_retrieve = GTK_WIDGET (modest_limit_retrieve_combo_box_new ());
228 caption = create_caption_new_with_asterix (self, sizegroup, _("mcen_fi_advsetup_limit_retrieve"),
229 self->combo_limit_retrieve, NULL, HILDON_CAPTION_MANDATORY);
230 gtk_widget_show (self->combo_limit_retrieve);
231 gtk_box_pack_start (GTK_BOX (box), caption, FALSE, FALSE, 2);
232 gtk_widget_show (caption);
234 /* The leave-messages widgets: */
235 if(!self->checkbox_leave_messages)
236 self->checkbox_leave_messages =
237 gtk_check_button_new_with_label (_("mcen_fi_advsetup_leave_on_server"));
238 gtk_box_pack_start (GTK_BOX (box), self->checkbox_leave_messages, FALSE, FALSE, 2);
239 gtk_widget_show (self->checkbox_leave_messages);
242 gtk_widget_show (GTK_WIDGET (box));
244 return GTK_WIDGET (box);
248 on_button_signature (GtkButton *button, gpointer user_data)
254 create_page_user_details (ModestAccountSettingsDialog *self)
256 GtkWidget *box = gtk_vbox_new (FALSE, 2);
258 /* Create a size group to be used by all captions.
259 * Note that HildonCaption does not create a default size group if we do not specify one.
260 * We use GTK_SIZE_GROUP_HORIZONTAL, so that the widths are the same. */
261 GtkSizeGroup* sizegroup = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
263 /* The name widgets: */
264 self->entry_user_name = GTK_WIDGET (easysetup_validating_entry_new ());
265 /* Set max length as in the UI spec:
266 * TODO: The UI spec seems to want us to show a dialog if we hit the maximum. */
267 gtk_entry_set_max_length (GTK_ENTRY (self->entry_user_name), 64);
268 GtkWidget *caption = create_caption_new_with_asterix (self, sizegroup,
269 _("mcen_li_emailsetup_name"), self->entry_user_name, NULL, HILDON_CAPTION_OPTIONAL);
270 gtk_widget_show (self->entry_user_name);
271 gtk_box_pack_start (GTK_BOX (box), caption, FALSE, FALSE, 2);
272 gtk_widget_show (caption);
274 /* Prevent the use of some characters in the name,
275 * as required by our UI specification: */
276 GList *list_prevent = NULL;
277 list_prevent = g_list_append (list_prevent, "<");
278 list_prevent = g_list_append (list_prevent, ">");
279 easysetup_validating_entry_set_unallowed_characters (
280 EASYSETUP_VALIDATING_ENTRY (self->entry_user_name), list_prevent);
281 g_list_free (list_prevent);
283 /* The username widgets: */
284 self->entry_user_username = GTK_WIDGET (easysetup_validating_entry_new ());
285 caption = create_caption_new_with_asterix (self, sizegroup, _("mail_fi_username"),
286 self->entry_user_username, NULL, HILDON_CAPTION_MANDATORY);
287 gtk_widget_show (self->entry_user_username);
288 gtk_box_pack_start (GTK_BOX (box), caption, FALSE, FALSE, 2);
289 gtk_widget_show (caption);
291 /* Prevent the use of some characters in the username,
292 * as required by our UI specification: */
293 easysetup_validating_entry_set_unallowed_characters_whitespace (
294 EASYSETUP_VALIDATING_ENTRY (self->entry_user_username));
296 /* Set max length as in the UI spec:
297 * TODO: The UI spec seems to want us to show a dialog if we hit the maximum. */
298 gtk_entry_set_max_length (GTK_ENTRY (self->entry_user_username), 64);
300 /* The password widgets: */
301 self->entry_user_password = gtk_entry_new ();
302 gtk_entry_set_visibility (GTK_ENTRY (self->entry_user_password), FALSE);
303 /* gtk_entry_set_invisible_char (GTK_ENTRY (self->entry_user_password), '*'); */
304 caption = create_caption_new_with_asterix (self, sizegroup,
305 _("mail_fi_password"), self->entry_user_password, NULL, HILDON_CAPTION_OPTIONAL);
306 gtk_widget_show (self->entry_user_password);
307 gtk_box_pack_start (GTK_BOX (box), caption, FALSE, FALSE, 2);
308 gtk_widget_show (caption);
310 /* The email address widgets: */
311 self->entry_user_email = GTK_WIDGET (easysetup_validating_entry_new ());
312 caption = create_caption_new_with_asterix (self, sizegroup,
313 _("mcen_li_emailsetup_email_address"), self->entry_user_email, NULL, HILDON_CAPTION_MANDATORY);
314 gtk_entry_set_text (GTK_ENTRY (self->entry_user_email), EXAMPLE_EMAIL_ADDRESS); /* Default text. */
315 gtk_widget_show (self->entry_user_email);
316 gtk_box_pack_start (GTK_BOX (box), caption, FALSE, FALSE, 2);
317 gtk_widget_show (caption);
319 /* Set max length as in the UI spec:
320 * TODO: The UI spec seems to want us to show a dialog if we hit the maximum. */
321 gtk_entry_set_max_length (GTK_ENTRY (self->entry_user_email), 64);
324 /* Signature button: */
325 if (!self->button_signature)
326 self->button_signature = gtk_button_new_with_label (_("mcen_bd_emailsetup_edit"));
327 caption = hildon_caption_new (sizegroup, _("mcen_fi_email_signature"),
328 self->button_signature, NULL, HILDON_CAPTION_OPTIONAL);
329 gtk_widget_show (self->button_signature);
330 gtk_box_pack_start (GTK_BOX (box), caption, FALSE, FALSE, 2);
331 gtk_widget_show (caption);
333 g_signal_connect (G_OBJECT (self->button_signature), "clicked",
334 G_CALLBACK (on_button_signature), self);
336 gtk_widget_show (GTK_WIDGET (box));
338 return GTK_WIDGET (box);
341 /** Change the caption title for the incoming server,
342 * as specified in the UI spec:
344 static void update_incoming_server_title (ModestAccountSettingsDialog *self, ModestProtocol protocol)
347 (protocol == MODEST_PROTOCOL_STORE_POP ?
348 _("mail_fi_emailtype_pop3") :
349 _("mail_fi_emailtype_imap") );
352 /* Note that this produces a compiler warning,
353 * because the compiler does not know that the translated string will have a %s in it.
354 * I do not see a way to avoid the warning while still using these Logical IDs. murrayc. */
355 gchar* incomingserver_title = g_strdup_printf(_("mcen_li_emailsetup_servertype"), type);
356 g_object_set (G_OBJECT (self->caption_incoming), "label", incomingserver_title, NULL);
357 g_free(incomingserver_title);
360 /** Change the caption title for the incoming server,
361 * as specified in the UI spec:
363 static void update_incoming_server_security_choices (ModestAccountSettingsDialog *self, ModestProtocol protocol)
365 /* Fill the combo with appropriately titled choices for POP or IMAP. */
366 /* The choices are the same, but the titles are different, as in the UI spec. */
367 easysetup_serversecurity_combo_box_fill (
368 EASYSETUP_SERVERSECURITY_COMBO_BOX (self->combo_incoming_security), protocol);
371 static GtkWidget* create_page_incoming (ModestAccountSettingsDialog *self)
373 GtkWidget *box = gtk_vbox_new (FALSE, 2);
375 /* Create a size group to be used by all captions.
376 * Note that HildonCaption does not create a default size group if we do not specify one.
377 * We use GTK_SIZE_GROUP_HORIZONTAL, so that the widths are the same. */
378 GtkSizeGroup *sizegroup = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
380 /* The incoming server widgets: */
381 if(!self->entry_incomingserver)
382 self->entry_incomingserver = gtk_entry_new ();
384 if (self->caption_incoming)
385 gtk_widget_destroy (self->caption_incoming);
387 /* The caption title will be updated in update_incoming_server_title().
388 * so this default text will never be seen: */
389 /* (Note: Changing the title seems pointless. murrayc) */
390 self->caption_incoming = create_caption_new_with_asterix (self, sizegroup,
391 "Incoming Server", self->entry_incomingserver, NULL, HILDON_CAPTION_MANDATORY);
392 gtk_widget_show (self->entry_incomingserver);
393 gtk_box_pack_start (GTK_BOX (box), self->caption_incoming, FALSE, FALSE, 2);
394 gtk_widget_show (self->caption_incoming);
396 /* The secure connection widgets: */
397 /* This will be filled by update_incoming_server_security_choices(). */
398 if (!self->combo_incoming_security)
399 self->combo_incoming_security = GTK_WIDGET (easysetup_serversecurity_combo_box_new ());
400 GtkWidget *caption = hildon_caption_new (sizegroup, _("mcen_li_emailsetup_secure_connection"),
401 self->combo_incoming_security, NULL, HILDON_CAPTION_OPTIONAL);
402 gtk_widget_show (self->combo_incoming_security);
403 gtk_box_pack_start (GTK_BOX (box), caption, FALSE, FALSE, 2);
404 gtk_widget_show (caption);
406 /* Show a default port number when the security method changes, as per the UI spec: */
407 g_signal_connect (G_OBJECT (self->combo_incoming_security), "changed", (GCallback)on_combo_incoming_security_changed, self);
410 /* The port widgets: */
411 /* TODO: There are various rules about this in the UI spec. */
412 if (!self->entry_incoming_port)
413 self->entry_incoming_port = GTK_WIDGET (gtk_entry_new ());
414 caption = hildon_caption_new (sizegroup, _("mcen_fi_emailsetup_port"),
415 self->entry_incoming_port, NULL, HILDON_CAPTION_OPTIONAL);
416 gtk_widget_show (self->entry_incoming_port);
417 gtk_box_pack_start (GTK_BOX (box), caption, FALSE, FALSE, 2);
418 gtk_widget_show (caption);
420 /* The secure authentication widgets: */
421 if(!self->checkbox_incoming_auth)
422 self->checkbox_incoming_auth =
423 gtk_check_button_new_with_label (_("mcen_li_emailsetup_secure_authentication"));
424 gtk_box_pack_start (GTK_BOX (box), self->checkbox_incoming_auth, FALSE, FALSE, 2);
425 gtk_widget_show (self->checkbox_incoming_auth);
427 gtk_widget_show (GTK_WIDGET (box));
429 return GTK_WIDGET (box);
433 on_toggle_button_changed (GtkToggleButton *togglebutton, gpointer user_data)
435 GtkWidget *widget = GTK_WIDGET (user_data);
437 /* Enable the widget only if the toggle button is active: */
438 const gboolean enable = gtk_toggle_button_get_active (togglebutton);
439 gtk_widget_set_sensitive (widget, enable);
442 /* Make the sensitivity of a widget depend on a toggle button.
445 enable_widget_for_togglebutton (GtkWidget *widget, GtkToggleButton* button)
447 g_signal_connect (G_OBJECT (button), "toggled",
448 G_CALLBACK (on_toggle_button_changed), widget);
450 /* Set the starting sensitivity: */
451 on_toggle_button_changed (button, widget);
455 on_smtp_servers_window_hide (GtkWindow *window, gpointer user_data)
457 /* Destroy the window when it is closed: */
458 gtk_widget_destroy (GTK_WIDGET (window));
462 on_button_outgoing_smtp_servers (GtkButton *button, gpointer user_data)
465 ModestAccountSettingsDialog * self = MODEST_ACCOUNT_SETTINGS_DIALOG (user_data);
467 /* Show the window: */
468 /* TODO: Retrieve the chosen settings,
469 * so we can supply them when creating the connection somehow.
471 GtkWidget *window = GTK_WIDGET (modest_connection_specific_smtp_window_new ());
472 gtk_window_set_transient_for (GTK_WINDOW (self), GTK_WINDOW (window));
473 g_signal_connect (G_OBJECT (window), "hide",
474 G_CALLBACK (on_smtp_servers_window_hide), self);
475 gtk_widget_show (window);
479 on_combo_outgoing_auth_changed (GtkComboBox *widget, gpointer user_data)
481 ModestAccountSettingsDialog *self = MODEST_ACCOUNT_SETTINGS_DIALOG (user_data);
483 ModestProtocol protocol_security =
484 easysetup_secureauth_combo_box_get_active_secureauth (
485 EASYSETUP_SECUREAUTH_COMBO_BOX (self->combo_outgoing_auth));
486 const gboolean secureauth_used = protocol_security != MODEST_PROTOCOL_AUTH_NONE;
488 gtk_widget_set_sensitive (self->caption_outgoing_username, secureauth_used);
489 gtk_widget_set_sensitive (self->caption_outgoing_password, secureauth_used);
493 on_combo_outgoing_security_changed (GtkComboBox *widget, gpointer user_data)
495 ModestAccountSettingsDialog *self = MODEST_ACCOUNT_SETTINGS_DIALOG (user_data);
497 const gint port_number =
498 easysetup_serversecurity_combo_box_get_active_serversecurity_port (
499 EASYSETUP_SERVERSECURITY_COMBO_BOX (self->combo_outgoing_security));
501 if(port_number != 0) {
502 gchar* str = g_strdup_printf ("%d", port_number);
503 gtk_entry_set_text (GTK_ENTRY (self->entry_outgoing_port), str);
509 on_combo_incoming_security_changed (GtkComboBox *widget, gpointer user_data)
511 ModestAccountSettingsDialog *self = MODEST_ACCOUNT_SETTINGS_DIALOG (user_data);
513 const gint port_number =
514 easysetup_serversecurity_combo_box_get_active_serversecurity_port (
515 EASYSETUP_SERVERSECURITY_COMBO_BOX (self->combo_incoming_security));
517 if(port_number != 0) {
518 gchar* str = g_strdup_printf ("%d", port_number);
519 gtk_entry_set_text (GTK_ENTRY (self->entry_incoming_port), str);
525 static GtkWidget* create_page_outgoing (ModestAccountSettingsDialog *self)
527 GtkWidget *box = gtk_vbox_new (FALSE, 2);
529 /* Create a size group to be used by all captions.
530 * Note that HildonCaption does not create a default size group if we do not specify one.
531 * We use GTK_SIZE_GROUP_HORIZONTAL, so that the widths are the same. */
532 GtkSizeGroup *sizegroup = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
534 /* The outgoing server widgets: */
535 if (!self->entry_outgoingserver)
536 self->entry_outgoingserver = gtk_entry_new ();
537 GtkWidget *caption = create_caption_new_with_asterix (self, sizegroup,
538 _("mcen_li_emailsetup_smtp"), self->entry_outgoingserver, NULL, HILDON_CAPTION_OPTIONAL);
539 gtk_widget_show (self->entry_outgoingserver);
540 gtk_box_pack_start (GTK_BOX (box), caption, FALSE, FALSE, 2);
541 gtk_widget_show (caption);
543 /* The secure authentication widgets: */
544 if (!self->combo_outgoing_auth)
545 self->combo_outgoing_auth = GTK_WIDGET (easysetup_secureauth_combo_box_new ());
546 caption = hildon_caption_new (sizegroup, _("mcen_li_emailsetup_secure_authentication"),
547 self->combo_outgoing_auth, NULL, HILDON_CAPTION_OPTIONAL);
548 gtk_widget_show (self->combo_outgoing_auth);
549 gtk_box_pack_start (GTK_BOX (box), caption, FALSE, FALSE, 2);
550 gtk_widget_show (caption);
552 /* Dim the outgoing username and password when no secure authentication is used, as per the UI spec: */
553 g_signal_connect (G_OBJECT (self->combo_outgoing_auth), "changed", (GCallback)on_combo_outgoing_auth_changed, self);
555 /* The username widgets: */
556 self->entry_outgoing_username = GTK_WIDGET (easysetup_validating_entry_new ());
557 self->caption_outgoing_username = create_caption_new_with_asterix (self, sizegroup, _("mail_fi_username"),
558 self->entry_outgoing_username, NULL, HILDON_CAPTION_MANDATORY);
559 gtk_widget_show (self->entry_outgoing_username);
560 gtk_box_pack_start (GTK_BOX (box), self->caption_outgoing_username, FALSE, FALSE, 2);
561 gtk_widget_show (self->caption_outgoing_username);
563 /* Prevent the use of some characters in the username,
564 * as required by our UI specification: */
565 easysetup_validating_entry_set_unallowed_characters_whitespace (
566 EASYSETUP_VALIDATING_ENTRY (self->entry_outgoing_username));
568 /* Set max length as in the UI spec:
569 * TODO: The UI spec seems to want us to show a dialog if we hit the maximum. */
570 gtk_entry_set_max_length (GTK_ENTRY (self->entry_outgoing_username), 64);
572 /* The password widgets: */
573 self->entry_outgoing_password = gtk_entry_new ();
574 gtk_entry_set_visibility (GTK_ENTRY (self->entry_outgoing_password), FALSE);
575 /* gtk_entry_set_invisible_char (GTK_ENTRY (self->entry_outgoing_password), '*'); */
576 self->caption_outgoing_password = create_caption_new_with_asterix (self, sizegroup,
577 _("mail_fi_password"), self->entry_outgoing_password, NULL, HILDON_CAPTION_OPTIONAL);
578 gtk_widget_show (self->entry_outgoing_password);
579 gtk_box_pack_start (GTK_BOX (box), self->caption_outgoing_password, FALSE, FALSE, 2);
580 gtk_widget_show (self->caption_outgoing_password);
582 /* The secure connection widgets: */
583 /* This will be filled and set with easysetup_serversecurity_combo_box_fill()
584 * and easysetup_serversecurity_combo_box_set_active_serversecurity().
586 if (!self->combo_outgoing_security)
587 self->combo_outgoing_security = GTK_WIDGET (easysetup_serversecurity_combo_box_new ());
588 caption = hildon_caption_new (sizegroup, _("mcen_li_emailsetup_secure_connection"),
589 self->combo_outgoing_security, NULL, HILDON_CAPTION_OPTIONAL);
590 gtk_widget_show (self->combo_outgoing_security);
591 gtk_box_pack_start (GTK_BOX (box), caption, FALSE, FALSE, 2);
592 gtk_widget_show (caption);
594 /* Show a default port number when the security method changes, as per the UI spec: */
595 g_signal_connect (G_OBJECT (self->combo_outgoing_security), "changed", (GCallback)on_combo_outgoing_security_changed, self);
597 /* The port widgets: */
598 if (!self->entry_outgoing_port)
599 self->entry_outgoing_port = GTK_WIDGET (gtk_entry_new ());
600 caption = hildon_caption_new (sizegroup, _("mcen_fi_emailsetup_port"),
601 self->entry_outgoing_port, NULL, HILDON_CAPTION_OPTIONAL);
602 gtk_widget_show (self->entry_outgoing_port);
603 gtk_box_pack_start (GTK_BOX (box), caption, FALSE, FALSE, 2);
604 gtk_widget_show (caption);
606 /* connection-specific checkbox: */
607 if (!self->checkbox_outgoing_smtp_specific) {
608 self->checkbox_outgoing_smtp_specific = gtk_check_button_new_with_label (_("mcen_fi_advsetup_connection_smtp"));
609 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (self->checkbox_outgoing_smtp_specific),
612 gtk_box_pack_start (GTK_BOX (box), self->checkbox_outgoing_smtp_specific, FALSE, FALSE, 2);
613 gtk_widget_show (self->checkbox_outgoing_smtp_specific);
615 /* Connection-specific SMTP-Severs Edit button: */
616 if (!self->button_outgoing_smtp_servers)
617 self->button_outgoing_smtp_servers = gtk_button_new_with_label (_("mcen_bd_emailsetup_edit"));
618 caption = hildon_caption_new (sizegroup, _("mcen_fi_advsetup_optional_smtp"),
619 self->button_outgoing_smtp_servers, NULL, HILDON_CAPTION_OPTIONAL);
620 gtk_widget_show (self->button_outgoing_smtp_servers);
621 gtk_box_pack_start (GTK_BOX (box), caption, FALSE, FALSE, 2);
622 gtk_widget_show (caption);
624 /* Only enable the button when the checkbox is checked: */
625 enable_widget_for_togglebutton (self->button_outgoing_smtp_servers,
626 GTK_TOGGLE_BUTTON (self->checkbox_outgoing_smtp_specific));
628 g_signal_connect (G_OBJECT (self->button_outgoing_smtp_servers), "clicked",
629 G_CALLBACK (on_button_outgoing_smtp_servers), self);
632 gtk_widget_show (GTK_WIDGET (box));
634 return GTK_WIDGET (box);
638 check_data (ModestAccountSettingsDialog *self)
640 /* Check that the title is not already in use: */
641 const gchar* account_title = gtk_entry_get_text (GTK_ENTRY (self->entry_account_title));
642 if ((!account_title) || (strlen(account_title) == 0))
643 return FALSE; /* Should be prevented already anyway. */
645 if (strcmp(account_title, self->original_account_title) != 0) {
646 /* Check the changed title: */
647 const gboolean name_in_use = modest_account_mgr_account_with_display_name_exists (self->account_manager,
651 /* Warn the user via a dialog: */
652 show_error (GTK_WINDOW (self), _("mail_ib_account_name_already_existing"));
658 /* Check that the email address is valud: */
659 const gchar* email_address = gtk_entry_get_text (GTK_ENTRY (self->entry_user_email));
660 if ((!email_address) || (strlen(email_address) == 0))
663 if (!modest_text_utils_validate_email_address (email_address)) {
664 /* Warn the user via a dialog: */
665 show_error (GTK_WINDOW (self), _("mcen_ib_invalid_email"));
667 /* Return focus to the email address entry: */
668 gtk_widget_grab_focus (self->entry_user_email);
673 /* TODO: The UI Spec wants us to check that the servernames are valid,
674 * but does not specify how.
682 on_response (GtkDialog *wizard_dialog,
686 ModestAccountSettingsDialog *self = MODEST_ACCOUNT_SETTINGS_DIALOG (wizard_dialog);
687 enable_buttons (self);
689 gboolean prevent_response = FALSE;
691 /* Warn about unsaved changes: */
692 /* TODO: Actually detect whether changes were made. */
693 if (response_id == GTK_RESPONSE_CANCEL) {
694 GtkDialog *dialog = GTK_DIALOG (gtk_message_dialog_new (GTK_WINDOW (self),
697 GTK_BUTTONS_OK_CANCEL, /* TODO: These button names are ambiguous, and not specified in the UI specification. */
698 _("imum_nc_wizard_confirm_lose_changes") ));
700 const gint dialog_response = gtk_dialog_run (dialog);
701 gtk_widget_destroy (GTK_WIDGET (dialog));
703 if (dialog_response != GTK_RESPONSE_OK)
704 prevent_response = TRUE;
706 /* Check for invalid input: */
707 else if (!check_data (self)) {
708 prevent_response = TRUE;
711 if (prevent_response) {
712 /* This is a nasty hack. murrayc. */
713 /* Don't let the dialog close */
714 g_signal_stop_emission_by_name (wizard_dialog, "response");
719 if (response_id == GTK_RESPONSE_OK) {
720 /* Try to save the changes: */
721 const gboolean saved = save_configuration (self);
723 show_ok (GTK_WINDOW (self), _("mcen_ib_advsetup_settings_saved"));
725 show_error (GTK_WINDOW (self), _("mail_ib_setting_failed"));
730 modest_account_settings_dialog_init (ModestAccountSettingsDialog *self)
732 /* Create the notebook to be used by the GtkDialog base class:
733 * Each page of the notebook will be a page of the wizard: */
734 GtkNotebook *notebook = GTK_NOTEBOOK (gtk_notebook_new());
737 gtk_window_set_title (GTK_WINDOW (self), _("mcen_ti_emailsetup"));
739 /* Get the account manager object,
740 * so we can check for existing accounts,
741 * and create new accounts: */
742 self->account_manager = modest_runtime_get_account_mgr ();
743 g_assert (self->account_manager);
744 g_object_ref (self->account_manager);
746 /* Create the common pages,
748 self->page_account_details = create_page_account_details (self);
749 self->page_user_details = create_page_user_details (self);
750 self->page_incoming = create_page_incoming (self);
751 self->page_outgoing = create_page_outgoing (self);
753 /* Add the notebook pages: */
754 gtk_notebook_append_page (notebook, self->page_account_details,
755 gtk_label_new (_("mcen_ti_account_settings_account")));
756 gtk_notebook_append_page (notebook, self->page_user_details,
757 gtk_label_new (_("mcen_ti_account_settings_userinfo")));
758 gtk_notebook_append_page (notebook, self->page_incoming,
759 gtk_label_new (_("mcen_ti_advsetup_retrieval")));
760 gtk_notebook_append_page (notebook, self->page_outgoing,
761 gtk_label_new (_("mcen_ti_advsetup_sending")));
763 GtkDialog *dialog = GTK_DIALOG (self);
764 gtk_container_add (GTK_CONTAINER (dialog->vbox), GTK_WIDGET (notebook));
765 gtk_widget_show (GTK_WIDGET (notebook));
767 /* Add the buttons: */
768 gtk_dialog_add_button (GTK_DIALOG(self), GTK_STOCK_OK, GTK_RESPONSE_OK);
769 gtk_dialog_add_button (GTK_DIALOG(self), GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL);
771 /* Connect to the dialog's response signal: */
772 /* We use connect-before
773 * so we can stop the signal emission,
774 * to stop the default signal handler from closing the dialog.
776 g_signal_connect (G_OBJECT (self), "response",
777 G_CALLBACK (on_response), self);
780 ModestAccountSettingsDialog*
781 modest_account_settings_dialog_new (void)
783 return g_object_new (MODEST_TYPE_ACCOUNT_SETTINGS_DIALOG, NULL);
786 /** Update the UI with the stored account details, so they can be edited.
787 * @account_name: Name of the account, which should contain incoming and outgoing server accounts.
789 void modest_account_settings_dialog_set_account_name (ModestAccountSettingsDialog *dialog, const gchar* account_name)
794 /* Save the account name so we can refer to it later: */
795 if (dialog->account_name)
796 g_free (dialog->account_name);
797 dialog->account_name = g_strdup (account_name);
800 /* Get the account data for this account name: */
801 ModestAccountData *account_data = modest_account_mgr_get_account_data (dialog->account_manager,
804 g_printerr ("modest: failed to get account data for %s\n", account_name);
808 /* Save the account title so we can refer to it if the user changes it: */
809 if (dialog->original_account_title)
810 g_free (dialog->original_account_title);
811 dialog->original_account_title = g_strdup (account_data->display_name);
814 if (!(account_data->store_account)) {
815 g_printerr ("modest: account has no stores: %s\n", account_name);
819 /* Show the account data in the widgets: */
821 /* Note that we never show the non-display name in the UI.
822 * (Though the display name defaults to the non-display name at the start.) */
823 gtk_entry_set_text( GTK_ENTRY (dialog->entry_account_title),
824 account_data->display_name ? account_data->display_name : "");
826 gtk_entry_set_text( GTK_ENTRY (dialog->entry_user_name),
827 account_data->fullname ? account_data->fullname : "");
828 gtk_entry_set_text( GTK_ENTRY (dialog->entry_user_email),
829 account_data->email ? account_data->email : "");
831 ModestServerAccountData *incoming_account = account_data->store_account;
833 if (incoming_account)
834 modest_retrieve_combo_box_fill (MODEST_RETRIEVE_COMBO_BOX (dialog->combo_retrieve), incoming_account->proto);
835 gchar *retrieve = modest_account_mgr_get_string (dialog->account_manager, account_name,
836 MODEST_ACCOUNT_RETRIEVE, FALSE /* not server account */);
838 /* Default to something, though no default is specified in the UI spec: */
839 retrieve = g_strdup (MODEST_ACCOUNT_RETRIEVE_VALUE_HEADERS_ONLY);
841 modest_retrieve_combo_box_set_active_retrieve_conf (MODEST_RETRIEVE_COMBO_BOX (dialog->combo_retrieve), retrieve);
844 const gint limit_retrieve = modest_account_mgr_get_int (dialog->account_manager, account_name,
845 MODEST_ACCOUNT_LIMIT_RETRIEVE, FALSE /* not server account */);
846 modest_limit_retrieve_combo_box_set_active_limit_retrieve (MODEST_LIMIT_RETRIEVE_COMBO_BOX (dialog->combo_limit_retrieve), limit_retrieve);
849 const gboolean leave_on_server = modest_account_mgr_get_bool (dialog->account_manager, account_name,
850 MODEST_ACCOUNT_LEAVE_ON_SERVER, FALSE /* not server account */);
851 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dialog->checkbox_leave_messages), leave_on_server);
853 /* Only show the leave-on-server checkbox for POP,
854 * as per the UI spec: */
855 if (incoming_account->proto != MODEST_PROTOCOL_STORE_POP) {
856 gtk_widget_hide (dialog->checkbox_leave_messages);
858 gtk_widget_show (dialog->checkbox_leave_messages);
861 if (incoming_account) {
862 gtk_entry_set_text( GTK_ENTRY (dialog->entry_user_username),
863 incoming_account->username ? incoming_account->username : "");
864 gtk_entry_set_text( GTK_ENTRY (dialog->entry_user_password),
865 incoming_account->password ? incoming_account->password : "");
867 gtk_entry_set_text( GTK_ENTRY (dialog->entry_incomingserver),
868 incoming_account->hostname ? incoming_account->hostname : "");
870 const ModestProtocol secure_auth = modest_server_account_get_secure_auth(
871 dialog->account_manager, incoming_account->account_name);
872 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON (dialog->checkbox_incoming_auth),
873 secure_auth == MODEST_PROTOCOL_AUTH_PASSWORD);
875 update_incoming_server_title (dialog, incoming_account->proto);
876 update_incoming_server_security_choices (dialog, incoming_account->proto);
878 const ModestProtocol security = modest_server_account_get_security (
879 dialog->account_manager, incoming_account->account_name);
880 easysetup_serversecurity_combo_box_set_active_serversecurity (
881 EASYSETUP_SERVERSECURITY_COMBO_BOX (dialog->combo_incoming_security), security);
883 const gint port_num = modest_account_mgr_get_int (dialog->account_manager, incoming_account->account_name,
884 MODEST_ACCOUNT_PORT, TRUE /* server account */);
885 gchar *port_str = g_strdup_printf ("%d", port_num);
886 gtk_entry_set_text (GTK_ENTRY (dialog->entry_incoming_port), port_str);
891 ModestProtocol proto;
899 ModestServerAccountData *outgoing_account = account_data->transport_account;
900 if (outgoing_account) {
901 gtk_entry_set_text( GTK_ENTRY (dialog->entry_outgoingserver),
902 outgoing_account->hostname ? outgoing_account->hostname : "");
904 gtk_entry_set_text( GTK_ENTRY (dialog->entry_outgoing_username),
905 outgoing_account->username ? outgoing_account->username : "");
906 gtk_entry_set_text( GTK_ENTRY (dialog->entry_outgoing_password),
907 outgoing_account->password ? outgoing_account->password : "");
909 /* Get the secure-auth setting: */
910 const ModestProtocol secure_auth = modest_server_account_get_secure_auth(
911 dialog->account_manager, outgoing_account->account_name);
912 easysetup_secureauth_combo_box_set_active_secureauth (
913 EASYSETUP_SECUREAUTH_COMBO_BOX (dialog->combo_outgoing_auth), secure_auth);
914 on_combo_outgoing_auth_changed (GTK_COMBO_BOX (dialog->combo_outgoing_auth), dialog);
916 easysetup_serversecurity_combo_box_fill (
917 EASYSETUP_SERVERSECURITY_COMBO_BOX (dialog->combo_outgoing_security), outgoing_account->proto);
919 /* Get the security setting: */
920 const ModestProtocol security = modest_server_account_get_security (
921 dialog->account_manager, outgoing_account->account_name);
922 easysetup_serversecurity_combo_box_set_active_serversecurity (
923 EASYSETUP_SERVERSECURITY_COMBO_BOX (dialog->combo_outgoing_security), security);
925 const gint port_num = modest_account_mgr_get_int (dialog->account_manager, outgoing_account->account_name,
926 MODEST_ACCOUNT_PORT, TRUE /* server account */);
927 gchar *port_str = g_strdup_printf ("%d", port_num);
928 gtk_entry_set_text (GTK_ENTRY (dialog->entry_outgoing_port), port_str);
932 /* account_data->is_enabled, */
933 /*account_data->is_default, */
935 /* account_data->store_account->proto */
937 modest_account_mgr_free_account_data (dialog->account_manager, account_data);
941 save_configuration (ModestAccountSettingsDialog *dialog)
943 g_assert (dialog->account_name);
945 const gchar* account_name = dialog->account_name;
947 /* Set the account data from the widgets: */
948 const gchar* user_name = gtk_entry_get_text (GTK_ENTRY (dialog->entry_user_name));
949 gboolean test = modest_account_mgr_set_string (dialog->account_manager, account_name,
950 MODEST_ACCOUNT_FULLNAME, user_name, FALSE /* not server account */);
954 const gchar* emailaddress = gtk_entry_get_text (GTK_ENTRY (dialog->entry_user_email));
955 test = modest_account_mgr_set_string (dialog->account_manager, account_name,
956 MODEST_ACCOUNT_EMAIL, emailaddress, FALSE /* not server account */);
960 gchar *retrieve = modest_retrieve_combo_box_get_active_retrieve_conf (
961 MODEST_RETRIEVE_COMBO_BOX (dialog->combo_retrieve));
962 modest_account_mgr_set_string (dialog->account_manager, account_name,
963 MODEST_ACCOUNT_RETRIEVE, retrieve, FALSE /* not server account */);
966 const gint limit_retrieve = modest_limit_retrieve_combo_box_get_active_limit_retrieve (
967 MODEST_LIMIT_RETRIEVE_COMBO_BOX (dialog->combo_limit_retrieve));
968 modest_account_mgr_set_int (dialog->account_manager, account_name,
969 MODEST_ACCOUNT_LIMIT_RETRIEVE, limit_retrieve, FALSE /* not server account */);
971 const gboolean leave_on_server = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (dialog->checkbox_leave_messages));
972 test = modest_account_mgr_set_bool (dialog->account_manager, account_name,
973 MODEST_ACCOUNT_LEAVE_ON_SERVER, leave_on_server, FALSE /* not server account */);
978 gchar* incoming_account_name = modest_account_mgr_get_string (dialog->account_manager, account_name,
979 MODEST_ACCOUNT_STORE_ACCOUNT, FALSE /* not server account */);
980 g_assert (incoming_account_name);
982 const gchar* hostname = gtk_entry_get_text (GTK_ENTRY (dialog->entry_incomingserver));
983 test = modest_account_mgr_set_string (dialog->account_manager, incoming_account_name,
984 MODEST_ACCOUNT_HOSTNAME, hostname, TRUE /* server account */);
988 const gchar* username = gtk_entry_get_text (GTK_ENTRY (dialog->entry_user_username));
989 test = modest_account_mgr_set_string (dialog->account_manager, incoming_account_name,
990 MODEST_ACCOUNT_USERNAME, username, TRUE /* server account */);
994 const gchar* password = gtk_entry_get_text (GTK_ENTRY (dialog->entry_user_password));
995 test = modest_account_mgr_set_string (dialog->account_manager, incoming_account_name,
996 MODEST_ACCOUNT_PASSWORD, password, TRUE /* server account */);
1000 const ModestProtocol protocol_authentication_incoming = gtk_toggle_button_get_active
1001 (GTK_TOGGLE_BUTTON (dialog->checkbox_incoming_auth))
1002 ? MODEST_PROTOCOL_AUTH_PASSWORD
1003 : MODEST_PROTOCOL_AUTH_NONE;
1004 modest_server_account_set_secure_auth (dialog->account_manager, incoming_account_name, protocol_authentication_incoming);
1006 const ModestProtocol protocol_security_incoming = easysetup_serversecurity_combo_box_get_active_serversecurity (
1007 EASYSETUP_SERVERSECURITY_COMBO_BOX (dialog->combo_incoming_security));
1008 modest_server_account_set_security (dialog->account_manager, incoming_account_name, protocol_security_incoming);
1011 const gchar* port_str = gtk_entry_get_text (GTK_ENTRY (dialog->entry_incoming_port));
1014 port_num = atoi (port_str);
1015 modest_account_mgr_set_int (dialog->account_manager, incoming_account_name,
1016 MODEST_ACCOUNT_PORT, port_num, TRUE /* server account */);
1018 g_free (incoming_account_name);
1021 gchar* outgoing_account_name = modest_account_mgr_get_string (dialog->account_manager, account_name,
1022 MODEST_ACCOUNT_TRANSPORT_ACCOUNT, FALSE /* not server account */);
1023 g_assert (outgoing_account_name);
1025 hostname = gtk_entry_get_text (GTK_ENTRY (dialog->entry_outgoingserver));
1026 test = modest_account_mgr_set_string (dialog->account_manager, outgoing_account_name,
1027 MODEST_ACCOUNT_HOSTNAME, hostname, TRUE /* server account */);
1031 username = gtk_entry_get_text (GTK_ENTRY (dialog->entry_outgoing_username));
1032 test = modest_account_mgr_set_string (dialog->account_manager, outgoing_account_name,
1033 MODEST_ACCOUNT_USERNAME, username, TRUE /* server account */);
1037 password = gtk_entry_get_text (GTK_ENTRY (dialog->entry_outgoing_password));
1038 test = modest_account_mgr_set_string (dialog->account_manager, outgoing_account_name,
1039 MODEST_ACCOUNT_PASSWORD, password, TRUE /* server account */);
1043 const ModestProtocol protocol_security_outgoing = easysetup_serversecurity_combo_box_get_active_serversecurity (
1044 EASYSETUP_SERVERSECURITY_COMBO_BOX (dialog->combo_outgoing_security));
1045 modest_server_account_set_security (dialog->account_manager, outgoing_account_name, protocol_security_outgoing);
1047 const ModestProtocol protocol_authentication_outgoing = easysetup_secureauth_combo_box_get_active_secureauth (
1048 EASYSETUP_SECUREAUTH_COMBO_BOX (dialog->combo_outgoing_auth));
1049 modest_server_account_set_secure_auth (dialog->account_manager, outgoing_account_name, protocol_authentication_outgoing);
1052 port_str = gtk_entry_get_text (GTK_ENTRY (dialog->entry_outgoing_port));
1055 port_num = atoi (port_str);
1056 modest_account_mgr_set_int (dialog->account_manager, outgoing_account_name,
1057 MODEST_ACCOUNT_PORT, port_num, TRUE /* server account */);
1059 g_free (outgoing_account_name);
1062 /* Set the changed account title last, to simplify the previous code: */
1063 const gchar* account_title = gtk_entry_get_text (GTK_ENTRY (dialog->entry_account_title));
1064 if ((!account_title) || (strlen(account_title) == 0))
1065 return FALSE; /* Should be prevented already anyway. */
1067 if (strcmp(account_title, account_name) != 0) {
1068 /* Change the title: */
1069 gboolean test = modest_account_mgr_set_string (dialog->account_manager, account_name,
1070 MODEST_ACCOUNT_DISPLAY_NAME, account_title, FALSE /* not server account */);
1078 static gboolean entry_is_empty (GtkWidget *entry)
1083 const gchar* text = gtk_entry_get_text (GTK_ENTRY (entry));
1084 if ((!text) || (strlen(text) == 0))
1091 enable_buttons (ModestAccountSettingsDialog *self)
1093 gboolean enable_ok = TRUE;
1095 /* The account details title is mandatory: */
1096 if (entry_is_empty(self->entry_account_title))
1099 /* The user details username is mandatory: */
1100 if (entry_is_empty(self->entry_user_username))
1103 /* The user details email address is mandatory: */
1104 if (enable_ok && entry_is_empty (self->entry_user_email))
1107 /* The custom incoming server is mandatory: */
1108 if (entry_is_empty(self->entry_incomingserver))
1111 /* Enable the buttons,
1112 * identifying them via their associated response codes:
1114 GtkDialog *dialog_base = GTK_DIALOG (self);
1115 gtk_dialog_set_response_sensitive (dialog_base,
1121 modest_account_settings_dialog_class_init (ModestAccountSettingsDialogClass *klass)
1123 GObjectClass *object_class = G_OBJECT_CLASS (klass);
1124 g_type_class_add_private (klass, sizeof (ModestAccountSettingsDialogPrivate));
1127 object_class->get_property = modest_account_settings_dialog_get_property;
1128 object_class->set_property = modest_account_settings_dialog_set_property;
1129 object_class->dispose = modest_account_settings_dialog_dispose;
1130 object_class->finalize = modest_account_settings_dialog_finalize;
1134 show_error (GtkWindow *parent_window, const gchar* text)
1136 GtkDialog *dialog = GTK_DIALOG (gtk_message_dialog_new (parent_window,
1142 gtk_dialog_run (dialog);
1143 gtk_widget_destroy (GTK_WIDGET (dialog));
1147 show_ok (GtkWindow *parent_window, const gchar* text)
1149 GtkDialog *dialog = GTK_DIALOG (gtk_message_dialog_new (parent_window,
1155 gtk_dialog_run (dialog);
1156 gtk_widget_destroy (GTK_WIDGET (dialog));