-void
-_modest_ui_actions_on_password_requested (ModestTnyAccountStore *account_store,
- const gchar* account_name,
- gchar **password,
- gboolean *cancel,
- gboolean *remember,
- ModestMainWindow *main_window)
-{
- gchar *txt;
- GtkWidget *dialog, *entry, *remember_pass_check;
-
- dialog = gtk_dialog_new_with_buttons (_("Password requested"),
- GTK_WINDOW (main_window),
- GTK_DIALOG_MODAL,
- GTK_STOCK_CANCEL,
- GTK_RESPONSE_REJECT,
- GTK_STOCK_OK,
- GTK_RESPONSE_ACCEPT,
- NULL);
-
- txt = g_strdup_printf (_("Please enter your password for %s"), account_name);
- gtk_box_pack_start (GTK_BOX(GTK_DIALOG(dialog)->vbox), gtk_label_new(txt),
- FALSE, FALSE, 0);
- g_free (txt);
-
- entry = gtk_entry_new_with_max_length (40);
- gtk_entry_set_visibility (GTK_ENTRY(entry), FALSE);
- gtk_entry_set_invisible_char (GTK_ENTRY(entry), 0x2022); /* bullet unichar */
-
- gtk_box_pack_start (GTK_BOX(GTK_DIALOG(dialog)->vbox), entry,
- TRUE, FALSE, 0);
-
- remember_pass_check = gtk_check_button_new_with_label (_("Remember password"));
- gtk_box_pack_start (GTK_BOX(GTK_DIALOG(dialog)->vbox), remember_pass_check,
- TRUE, FALSE, 0);
-
- gtk_widget_show_all (GTK_WIDGET(GTK_DIALOG(dialog)->vbox));
-
- if (gtk_dialog_run (GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT) {
- *password = g_strdup (gtk_entry_get_text (GTK_ENTRY(entry)));
- *cancel = FALSE;
- } else {
- *password = NULL;
- *cancel = TRUE;
- }
-
- if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (remember_pass_check)))
- *remember = TRUE;
- else
- *remember = FALSE;
-
- gtk_widget_destroy (dialog);
-
- while (gtk_events_pending ())
- gtk_main_iteration ();
-}