From e745bf5517fa827e02bbf0ff94fbed323643f542 Mon Sep 17 00:00:00 2001 From: hiro Date: Mon, 4 Dec 2006 04:46:03 +0000 Subject: show confirmation dialog when printing MIME part. git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@1389 ee746299-78ed-0310-b773-934348b2243d --- src/printing.c | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) (limited to 'src/printing.c') diff --git a/src/printing.c b/src/printing.c index b83d10a3..ed609d0d 100644 --- a/src/printing.c +++ b/src/printing.c @@ -220,15 +220,10 @@ gint printing_print_messages_gtk(GSList *mlist, gboolean all_headers) #endif /* GTK_CHECK_VERSION(2, 10, 0) */ -gint printing_print_messages_with_command(GSList *mlist, gboolean all_headers, - const gchar *cmdline) +static gint check_command_line(const gchar *cmdline) { - MsgInfo *msginfo; - GSList *cur; gchar *msg; - g_return_val_if_fail(mlist != NULL, -1); - msg = g_strconcat (_("The message will be printed with the following command:"), "\n\n", cmdline ? cmdline : _("(Default print command)"), @@ -236,7 +231,7 @@ gint printing_print_messages_with_command(GSList *mlist, gboolean all_headers, if (alertpanel(_("Print"), msg, GTK_STOCK_OK, GTK_STOCK_CANCEL, NULL) != G_ALERTDEFAULT) { g_free(msg); - return 0; + return -2; } g_free(msg); @@ -246,6 +241,20 @@ gint printing_print_messages_with_command(GSList *mlist, gboolean all_headers, return -1; } + return 0; +} + +gint printing_print_messages_with_command(GSList *mlist, gboolean all_headers, + const gchar *cmdline) +{ + MsgInfo *msginfo; + GSList *cur; + + g_return_val_if_fail(mlist != NULL, -1); + + if (check_command_line(cmdline) < 0) + return -1; + for (cur = mlist; cur != NULL; cur = cur->next) { msginfo = (MsgInfo *)cur->data; if (msginfo) @@ -277,6 +286,9 @@ gint printing_print_message(MsgInfo *msginfo, gboolean all_headers) gint printing_print_message_part(MsgInfo *msginfo, MimeInfo *partinfo) { + if (check_command_line(prefs_common.print_cmd) < 0) + return -1; procmsg_print_message_part(msginfo, partinfo, prefs_common.print_cmd, FALSE); + return 0; } -- cgit v1.2.3