+
+GtkWidget *
+modest_tny_account_store_show_account_settings_dialog (ModestTnyAccountStore *self,
+ const gchar *account_name)
+{
+ ModestTnyAccountStorePrivate *priv;
+ gpointer dialog_as_gpointer = NULL;
+ gboolean found;
+
+ priv = MODEST_TNY_ACCOUNT_STORE_GET_PRIVATE(self);
+ found = g_hash_table_lookup_extended (priv->account_settings_dialog_hash,
+ account_name, NULL, (gpointer*)&dialog_as_gpointer);
+
+ if (found)
+ return (GtkWidget *) dialog_as_gpointer;
+ else {
+ ModestAccountSettings *settings;
+ GtkWidget *dialog;
+ dialog = (GtkWidget *) modest_account_settings_dialog_new ();
+ settings = modest_account_mgr_load_account_settings (priv->account_mgr, account_name);
+ 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_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);
+
+ g_signal_connect (G_OBJECT (dialog), "hide", G_CALLBACK (on_account_settings_hide),
+ g_strdup (account_name));
+
+ /* Show it and delete it when it closes: */
+ g_signal_connect_swapped (dialog,
+ "response",
+ G_CALLBACK (gtk_widget_destroy),
+ dialog);
+ gtk_widget_show (GTK_WIDGET (dialog));
+
+ return dialog;
+ }
+
+}