gpointer data);
static gboolean passphrase_key_pressed(GtkWidget *widget, GdkEventKey *event,
gpointer data);
-static gchar* passphrase_mbox(const gchar *uid_hint, const gchar *pass_hint,
- gint prev_bad);
static GtkWidget *create_description(const gchar *uid_hint,
- const gchar *pass_hint, gint prev_bad);
+ const gchar *pass_hint, gint prev_bad, gint new_key);
void
gpgmegtk_set_passphrase_grab(gint yes)
grab_all = yes;
}
-static gchar*
-passphrase_mbox(const gchar *uid_hint, const gchar *pass_hint, gint prev_bad)
+gchar*
+passphrase_mbox(const gchar *uid_hint, const gchar *pass_hint, gint prev_bad, gint new_key)
{
gchar *the_passphrase = NULL;
GtkWidget *vbox, *hbox;
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_title(GTK_WINDOW(window), _("Passphrase"));
- gtk_widget_set_size_request(window, 450, -1);
+ gtk_window_set_resizable(GTK_WINDOW(window), TRUE);
gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER);
gtk_window_set_modal(GTK_WINDOW(window), TRUE);
- gtk_window_set_policy(GTK_WINDOW(window), FALSE, FALSE, FALSE);
+ gtk_window_set_policy(GTK_WINDOW(window), FALSE, TRUE, FALSE);
g_signal_connect(G_OBJECT(window), "delete_event",
G_CALLBACK(passphrase_deleted), NULL);
g_signal_connect(G_OBJECT(window), "key_press_event",
if (uid_hint || pass_hint) {
GtkWidget *label, *icon;
- label = create_description (uid_hint, pass_hint, prev_bad);
+ label = create_description (uid_hint, pass_hint, prev_bad, new_key);
icon = gtk_image_new_from_stock(GTK_STOCK_DIALOG_AUTHENTICATION,
GTK_ICON_SIZE_DIALOG);
&cancel_button, GTK_STOCK_CANCEL,
&ok_button, GTK_STOCK_OK,
NULL, NULL);
+
+ gtk_widget_set_size_request(confirm_box, 375, -1);
+
gtk_box_pack_end(GTK_BOX(vbox), confirm_box, FALSE, FALSE, 0);
gtk_widget_grab_default(ok_button);
}
static GtkWidget *
-create_description(const gchar *uid_hint, const gchar *pass_hint, gint prev_bad)
+create_description(const gchar *uid_hint, const gchar *pass_hint, gint prev_bad, gint new_key)
{
const gchar *uid = NULL, *info = NULL;
gchar *buf;
while (strchr(my_uid, '>'))
*(strchr(my_uid, '>')) = ')';
- buf = g_strdup_printf (_("<span weight=\"bold\" size=\"larger\">%sPlease enter the passphrase for:</span>\n\n"
+ if (new_key == 1) {
+ buf = g_strdup_printf (_("<span weight=\"bold\" size=\"larger\">%sPlease enter the passphrase for the new key:</span>\n\n"
+ "%.*s\n"),
+ prev_bad ?
+ _("Passphrases did not match.\n") : "",
+ linelen (my_uid), my_uid);
+ } else if (new_key == 2) {
+ buf = g_strdup_printf (_("<span weight=\"bold\" size=\"larger\">Please re-enter the passphrase for the new key:</span>\n\n"
+ "%.*s\n"),
+ linelen (my_uid), my_uid);
+ } else {
+ buf = g_strdup_printf (_("<span weight=\"bold\" size=\"larger\">%sPlease enter the passphrase for:</span>\n\n"
"%.*s\n"),
prev_bad ?
_("Bad passphrase.\n") : "",
linelen (my_uid), my_uid);
+ }
g_free(my_uid);
label = gtk_label_new (buf);
gtk_label_set_use_markup(GTK_LABEL (label), TRUE);
else {
gpgmegtk_set_passphrase_grab (prefs_gpg_get_config()->passphrase_grab);
debug_print ("%% requesting passphrase for '%s'\n ", uid_hint);
- pass = passphrase_mbox (uid_hint, passphrase_hint, prev_bad);
+ pass = passphrase_mbox (uid_hint, passphrase_hint, prev_bad, FALSE);
gpgmegtk_free_passphrase();
if (!pass) {
debug_print ("%% cancel passphrase entry\n");