if (account == NULL)
account = account_get_default();
+ if (account->address == NULL) {
+ alertpanel_error(_("You have to save the account's information with \"OK\" "
+ "before being able to generate a key pair.\n"));
+ return;
+ }
if (ask_create) {
val = alertpanel(_("No PGP key found"),
_("Sylpheed-Claws did not find a secret PGP key, "
gpgme_release(ctx);
return;
} else {
- alertpanel_notice(_("Your new key pair has been generated. "
- "Its fingerprint is:\n%s"),
+ gchar *buf = g_strdup_printf(_("Your new key pair has been generated. "
+ "Its fingerprint is:\n%s\n\nDo you want to export it "
+ "to a keyserver?"),
key->fpr ? key->fpr:"null");
+ AlertValue val = alertpanel(_("Key generated"), buf,
+ GTK_STOCK_NO, "+" GTK_STOCK_YES, NULL);
+ g_free(buf);
+ if (val == G_ALERTALTERNATE) {
+#ifndef G_OS_WIN32
+ gchar *cmd = g_strdup_printf("gpg --send-keys %s", key->fpr);
+ int res = 0;
+ GTK_EVENTS_FLUSH();
+ res = system(cmd);
+ if (res == 0) {
+ alertpanel_notice(_("Key exported."));
+ } else {
+ alertpanel_notice(_("Couldn't export key."));
+ }
+ g_free(cmd);
+#else
+ alertpanel_error(_("Key export isn't implemented in Windows."));
+#endif
+ }
}
prefs_gpg_get_config()->gpg_ask_create_key = FALSE;
prefs_gpg_save_config();
#include "inputdialog.h"
#include "timing.h"
-struct _ClickableText
-{
- gchar *uri;
-
- gchar *filename;
-
- gpointer data;
-
- guint start;
- guint end;
-
- gboolean is_quote;
- gint quote_level;
- gboolean q_expanded;
- gchar *fg_color;
-};
-
gint previousquotelevel = -1;
static GdkColor quote_colors[3] = {
static void open_image_cb (TextView *textview,
guint action,
void *data);
-static void textview_show_icon(TextView *textview, const gchar *stock_id);
static GtkItemFactoryEntry textview_link_popup_entries[] =
{
END_TIMING();
}
-#define TEXT_INSERT(str) \
- gtk_text_buffer_insert_with_tags_by_name \
- (buffer, &iter, str, -1,\
- "header", NULL)
-
-#define TEXT_INSERT_LINK(str, fname, udata) { \
- ClickableText *uri; \
- uri = g_new0(ClickableText, 1); \
- uri->uri = g_strdup(""); \
- uri->start = gtk_text_iter_get_offset(&iter); \
- gtk_text_buffer_insert_with_tags_by_name \
- (buffer, &iter, str, -1, \
- "link", "header_title", "header", \
- NULL); \
- uri->end = gtk_text_iter_get_offset(&iter); \
- uri->filename = fname?g_strdup(fname):NULL; \
- uri->data = udata; \
- textview->uri_list = \
- g_slist_prepend(textview->uri_list, uri); \
-}
-
static void textview_add_part(TextView *textview, MimeInfo *mimeinfo)
{
GtkTextView *text;
|| (mimeinfo->disposition == DISPOSITIONTYPE_INLINE &&
mimeinfo->type != MIMETYPE_TEXT)) {
gtk_text_buffer_insert(buffer, &iter, "\n", 1);
- TEXT_INSERT_LINK(buf, "sc://select_attachment", mimeinfo);
+ TEXTVIEW_INSERT_LINK(buf, "sc://select_attachment", mimeinfo);
gtk_text_buffer_insert(buffer, &iter, " \n", -1);
if (mimeinfo->type == MIMETYPE_IMAGE &&
prefs_common.inline_img ) {
buffer = gtk_text_view_get_buffer(text);
gtk_text_buffer_get_start_iter(buffer, &iter);
- TEXT_INSERT(_("\n"
+ TEXTVIEW_INSERT(_("\n"
" This message can't be displayed.\n"
" This is probably due to a network error.\n"
"\n"
" Use "));
- TEXT_INSERT_LINK(_("'View Log'"), "sc://view_log", NULL);
- TEXT_INSERT(_(" in the Tools menu for more information."));
+ TEXTVIEW_INSERT_LINK(_("'View Log'"), "sc://view_log", NULL);
+ TEXTVIEW_INSERT(_(" in the Tools menu for more information."));
textview_show_icon(textview, GTK_STOCK_DIALOG_ERROR);
}
buffer = gtk_text_view_get_buffer(text);
gtk_text_buffer_get_start_iter(buffer, &iter);
- TEXT_INSERT("\n");
- TEXT_INSERT(_(" The following can be performed on this part by\n"));
- TEXT_INSERT(_(" right-clicking the icon or list item:\n"));
-
- TEXT_INSERT(_(" - To save, select "));
- TEXT_INSERT_LINK(_("'Save as...'"), "sc://save_as", NULL);
- TEXT_INSERT(_(" (Shortcut key: 'y')\n"));
- TEXT_INSERT(_(" - To display as text, select "));
- TEXT_INSERT_LINK(_("'Display as text'"), "sc://display_as_text", NULL);
- TEXT_INSERT(_(" (Shortcut key: 't')\n"));
- TEXT_INSERT(_(" - To open with an external program, select "));
- TEXT_INSERT_LINK(_("'Open'"), "sc://open", NULL);
- TEXT_INSERT(_(" (Shortcut key: 'l')\n"));
- TEXT_INSERT(_(" (alternately double-click, or click the middle "));
- TEXT_INSERT(_("mouse button)\n"));
- TEXT_INSERT(_(" - Or use "));
- TEXT_INSERT_LINK(_("'Open with...'"), "sc://open_with", NULL);
- TEXT_INSERT(_(" (Shortcut key: 'o')\n"));
+ TEXTVIEW_INSERT("\n");
+ TEXTVIEW_INSERT(_(" The following can be performed on this part by\n"));
+ TEXTVIEW_INSERT(_(" right-clicking the icon or list item:\n"));
+
+ TEXTVIEW_INSERT(_(" - To save, select "));
+ TEXTVIEW_INSERT_LINK(_("'Save as...'"), "sc://save_as", NULL);
+ TEXTVIEW_INSERT(_(" (Shortcut key: 'y')\n"));
+ TEXTVIEW_INSERT(_(" - To display as text, select "));
+ TEXTVIEW_INSERT_LINK(_("'Display as text'"), "sc://display_as_text", NULL);
+ TEXTVIEW_INSERT(_(" (Shortcut key: 't')\n"));
+ TEXTVIEW_INSERT(_(" - To open with an external program, select "));
+ TEXTVIEW_INSERT_LINK(_("'Open'"), "sc://open", NULL);
+ TEXTVIEW_INSERT(_(" (Shortcut key: 'l')\n"));
+ TEXTVIEW_INSERT(_(" (alternately double-click, or click the middle "));
+ TEXTVIEW_INSERT(_("mouse button)\n"));
+ TEXTVIEW_INSERT(_(" - Or use "));
+ TEXTVIEW_INSERT_LINK(_("'Open with...'"), "sc://open_with", NULL);
+ TEXTVIEW_INSERT(_(" (Shortcut key: 'o')\n"));
textview_show_icon(textview, GTK_STOCK_DIALOG_INFO);
}
-#undef TEXT_INSERT
-#undef TEXT_INSERT_LINK
-
static void textview_write_body(TextView *textview, MimeInfo *mimeinfo)
{
FILE *tmpfp;
textview->image = NULL;
}
-static void textview_show_icon(TextView *textview, const gchar *stock_id)
+void textview_show_icon(TextView *textview, const gchar *stock_id)
{
GtkTextView *text = GTK_TEXT_VIEW(textview->text);
int x = 0;
typedef struct _TextView TextView;
typedef struct _ClickableText ClickableText;
+struct _ClickableText
+{
+ gchar *uri;
+
+ gchar *filename;
+
+ gpointer data;
+
+ guint start;
+ guint end;
+
+ gboolean is_quote;
+ gint quote_level;
+ gboolean q_expanded;
+ gchar *fg_color;
+};
+
#include "messageview.h"
#include "procmime.h"
gboolean case_sens);
void textview_cursor_wait(TextView *textview);
void textview_cursor_normal(TextView *textview);
+void textview_show_icon(TextView *textview, const gchar *stock_id);
+
+#define TEXTVIEW_INSERT(str) \
+ gtk_text_buffer_insert_with_tags_by_name \
+ (buffer, &iter, str, -1,\
+ "header", NULL)
+
+#define TEXTVIEW_INSERT_LINK(str, fname, udata) { \
+ ClickableText *uri; \
+ uri = g_new0(ClickableText, 1); \
+ uri->uri = g_strdup(""); \
+ uri->start = gtk_text_iter_get_offset(&iter); \
+ gtk_text_buffer_insert_with_tags_by_name \
+ (buffer, &iter, str, -1, \
+ "link", "header_title", "header", \
+ NULL); \
+ uri->end = gtk_text_iter_get_offset(&iter); \
+ uri->filename = fname?g_strdup(fname):NULL; \
+ uri->data = udata; \
+ textview->uri_list = \
+ g_slist_prepend(textview->uri_list, uri); \
+}
#endif /* __TEXTVIEW_H__ */