}
void
+modest_account_settings_dialog_check_allow_changes (ModestAccountSettingsDialog *self)
+{
+ ModestServerAccountSettings *incoming_settings;
+ const gchar *server_account_name;
+ gboolean username_known;
+
+ if (!G_IS_OBJECT (self->settings))
+ return;
+
+ incoming_settings = modest_account_settings_get_store_settings (self->settings);
+ server_account_name = modest_server_account_settings_get_account_name (incomming_settings);
+
+ username_known = modest_account_mgr_get_server_account_username_has_succeeded (self->account_manager,
+ server_account_name);
+
+ /* Enable or disable widgets */
+ gtk_widget_set_sensitive (self->entry_user_username, !username_known);
+ gtk_widget_set_sensitive (self->entry_incomingserver, !username_known);
+ gtk_widget_set_sensitive (self->entry_outgoingserver, !username_known);
+ gtk_widget_set_sensitive (self->entry_outgoing_username, !username_known);
+}
+
+void
modest_account_settings_dialog_save_password (ModestAccountSettingsDialog *dialog)
{
g_return_if_fail (MODEST_IS_ACCOUNT_SETTINGS_DIALOG (dialog));
enable_ok);
}
+void
+modest_account_settings_dialog_check_allow_changes (ModestAccountSettingsDialog *self)
+{
+ ModestServerAccountSettings *incoming_settings;
+ const gchar *server_account_name;
+ gboolean username_known;
+
+ if (!G_IS_OBJECT (self->settings))
+ return;
+
+ incoming_settings = modest_account_settings_get_store_settings (self->settings);
+ server_account_name = modest_server_account_settings_get_account_name (incoming_settings);
+
+ username_known = modest_account_mgr_get_server_account_username_has_succeeded (self->account_manager,
+ server_account_name);
+
+ /* Enable or disable widgets */
+ gtk_widget_set_sensitive (self->entry_user_username, !username_known);
+ gtk_widget_set_sensitive (self->entry_incomingserver, !username_known);
+ gtk_widget_set_sensitive (self->entry_outgoingserver, !username_known);
+ gtk_widget_set_sensitive (self->entry_outgoing_username, !username_known);
+ gtk_widget_set_sensitive (self->entry_incoming_port, !username_known);
+ gtk_widget_set_sensitive (self->entry_outgoing_port, !username_known);
+ gtk_widget_set_sensitive (self->combo_incoming_security, !username_known);
+ gtk_widget_set_sensitive (self->combo_outgoing_security, !username_known);
+}
+
void
modest_account_settings_dialog_set_modified (ModestAccountSettingsDialog *dialog, gboolean modified)
{
protocol, TRUE));
}
- if (!has_errors) {
- modest_account_mgr_set_server_account_username_has_succeeded (self, account_name, FALSE);
- }
-
return !has_errors;
}
found = g_hash_table_lookup_extended (priv->account_settings_dialog_hash,
account_name, NULL, (gpointer*)&dialog_as_gpointer);
- if (found)
+ if (found) {
+ modest_account_settings_dialog_check_allow_changes ((ModestAccountSettingsDialog *) dialog_as_gpointer);
return (GtkWidget *) dialog_as_gpointer;
- else {
+ } else {
ModestAccountSettings *settings;
GtkWidget *dialog;
dialog = (GtkWidget *) modest_account_settings_dialog_new ();
modest_account_settings_dialog_set_account (MODEST_ACCOUNT_SETTINGS_DIALOG (dialog), settings);
g_object_unref (settings);
modest_account_settings_dialog_switch_to_user_info (MODEST_ACCOUNT_SETTINGS_DIALOG (dialog));
+ modest_account_settings_dialog_check_allow_changes (MODEST_ACCOUNT_SETTINGS_DIALOG (dialog));
modest_window_mgr_set_modal (modest_runtime_get_window_mgr (), GTK_WINDOW (dialog));
g_hash_table_insert (priv->account_settings_dialog_hash, g_strdup (account_name), dialog);
void modest_account_settings_dialog_save_password (ModestAccountSettingsDialog *dialog);
+void modest_account_settings_dialog_check_allow_changes (ModestAccountSettingsDialog *self);
G_END_DECLS
#endif /* _MODEST_ACCOUNT_SETTINGS_DIALOG */