From 7f00b2761e85c7b439224e9e0ddf38559ac288b8 Mon Sep 17 00:00:00 2001 From: hiro Date: Fri, 16 May 2008 09:32:06 +0000 Subject: display alert dialog when signing/encryption failed. git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@1994 ee746299-78ed-0310-b773-934348b2243d --- src/compose.c | 28 ++++++++++++++++++++++------ src/select-keys.c | 2 ++ 2 files changed, 24 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/compose.c b/src/compose.c index 69f75e05..83dded09 100644 --- a/src/compose.c +++ b/src/compose.c @@ -3434,8 +3434,13 @@ static gint compose_clearsign_text(Compose *compose, gchar **text) return -1; } - if (compose_create_signers_list(compose, &key_list) < 0 || - rfc2015_clearsign(tmp_file, key_list) < 0) { + if (compose_create_signers_list(compose, &key_list) < 0) { + g_unlink(tmp_file); + g_free(tmp_file); + return -1; + } + if (rfc2015_clearsign(tmp_file, key_list) < 0) { + alertpanel_error(_("Can't sign the message.")); g_unlink(tmp_file); g_free(tmp_file); return -1; @@ -3462,6 +3467,7 @@ static gint compose_encrypt_armored(Compose *compose, gchar **text) } if (rfc2015_encrypt_armored(tmp_file, compose->to_list) < 0) { + alertpanel_error(_("Can't encrypt the message.")); g_unlink(tmp_file); g_free(tmp_file); return -1; @@ -3496,6 +3502,7 @@ static gint compose_encrypt_sign_armored(Compose *compose, gchar **text) if (rfc2015_encrypt_sign_armored (tmp_file, compose->to_list, key_list) < 0) { + alertpanel_error(_("Can't encrypt or sign the message.")); g_unlink(tmp_file); g_free(tmp_file); return -1; @@ -3813,8 +3820,12 @@ static gint compose_write_to_file(Compose *compose, const gchar *file, if (use_pgpmime_signing && !use_pgpmime_encryption) { GSList *key_list; - if (compose_create_signers_list(compose, &key_list) < 0 || - rfc2015_sign(file, key_list) < 0) { + if (compose_create_signers_list(compose, &key_list) < 0) { + g_unlink(file); + return -1; + } + if (rfc2015_sign(file, key_list) < 0) { + alertpanel_error(_("Can't sign the message.")); g_unlink(file); return -1; } @@ -3846,13 +3857,18 @@ static gint compose_write_to_file(Compose *compose, const gchar *file, } if (use_pgpmime_signing) { if (compose_create_signers_list - (compose, &key_list) < 0 || - rfc2015_encrypt_sign(file, compose->to_list, + (compose, &key_list) < 0) { + g_unlink(file); + return -1; + } + if (rfc2015_encrypt_sign(file, compose->to_list, key_list) < 0) { + alertpanel_error(_("Can't encrypt or sign the message.")); g_unlink(file); return -1; } } else if (rfc2015_encrypt(file, compose->to_list) < 0) { + alertpanel_error(_("Can't encrypt the message.")); g_unlink(file); return -1; } diff --git a/src/select-keys.c b/src/select-keys.c index d8394a93..49d3a222 100644 --- a/src/select-keys.c +++ b/src/select-keys.c @@ -291,6 +291,7 @@ create_dialog (struct select_keys_s *sk) gtk_widget_set_size_request (window, 520, 280); gtk_container_set_border_width (GTK_CONTAINER (window), 8); gtk_window_set_title (GTK_WINDOW (window), _("Select Keys")); + gtk_window_set_position (GTK_WINDOW (window), GTK_WIN_POS_CENTER); gtk_window_set_modal (GTK_WINDOW (window), TRUE); g_signal_connect (G_OBJECT (window), "delete_event", G_CALLBACK (delete_event_cb), sk); @@ -347,6 +348,7 @@ create_dialog (struct select_keys_s *sk) &other_btn, _("Other")); gtk_box_pack_end (GTK_BOX (hbox), bbox, FALSE, FALSE, 0); gtk_widget_grab_default (select_btn); + gtk_widget_grab_focus (select_btn); g_signal_connect (G_OBJECT (select_btn), "clicked", G_CALLBACK (select_btn_cb), sk); -- cgit v1.2.3