2006-09-13 [colin] 2.4.0cvs185
authorColin Leroy <colin@colino.net>
Wed, 13 Sep 2006 17:25:48 +0000 (17:25 +0000)
committerColin Leroy <colin@colino.net>
Wed, 13 Sep 2006 17:25:48 +0000 (17:25 +0000)
* src/gedit-print.c
* src/messageview.c
* src/messageview.h
* src/summaryview.c
* src/textview.c
Fix misc. printing issues:
- Bad font for linkified headers
- Different font if the mail was displayed or not
- Factorize the thing

ChangeLog
PATCHSETS
configure.ac
src/gedit-print.c
src/messageview.c
src/messageview.h
src/summaryview.c
src/textview.c

index 85701388325ffcaaa61980884296a8c5330eb6df..e39d2dd172e4d1489e1c223a1025afd5c4d00df5 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2006-09-13 [colin]     2.4.0cvs185
+
+       * src/gedit-print.c
+       * src/messageview.c
+       * src/messageview.h
+       * src/summaryview.c
+       * src/textview.c
+               Fix misc. printing issues: 
+               - Bad font for linkified headers
+               - Different font if the mail was displayed or not
+               - Factorize the thing
+
 2006-09-13 [colin]     2.4.0cvs184
 
        * src/common/ssl_certificate.c
 2006-09-13 [colin]     2.4.0cvs184
 
        * src/common/ssl_certificate.c
index f95f37754c043af5cfed202c565ad3da17cb5d1c..6b3b40c0a62aaad3224db84d556328e2bbbe2a95 100644 (file)
--- a/PATCHSETS
+++ b/PATCHSETS
 ( cvs diff -u -r 1.654.2.1920 -r 1.654.2.1921 configure.ac;  cvs diff -u -r 1.20.2.37 -r 1.20.2.38 src/common/utils.h;  cvs diff -u -r 1.36.2.77 -r 1.36.2.78 src/common/utils.c;  ) > 2.4.0cvs182.patchset
 ( cvs diff -u -r 1.61.2.51 -r 1.61.2.52 src/account.c;  cvs diff -u -r 1.5.2.36 -r 1.5.2.37 src/gtk/pluginwindow.c;  ) > 2.4.0cvs183.patchset
 ( cvs diff -u -r 1.4.2.10 -r 1.4.2.11 src/common/ssl_certificate.c;  ) > 2.4.0cvs184.patchset
 ( cvs diff -u -r 1.654.2.1920 -r 1.654.2.1921 configure.ac;  cvs diff -u -r 1.20.2.37 -r 1.20.2.38 src/common/utils.h;  cvs diff -u -r 1.36.2.77 -r 1.36.2.78 src/common/utils.c;  ) > 2.4.0cvs182.patchset
 ( cvs diff -u -r 1.61.2.51 -r 1.61.2.52 src/account.c;  cvs diff -u -r 1.5.2.36 -r 1.5.2.37 src/gtk/pluginwindow.c;  ) > 2.4.0cvs183.patchset
 ( cvs diff -u -r 1.4.2.10 -r 1.4.2.11 src/common/ssl_certificate.c;  ) > 2.4.0cvs184.patchset
+( cvs diff -u -r 1.1.2.6 -r 1.1.2.7 src/gedit-print.c;  cvs diff -u -r 1.94.2.105 -r 1.94.2.106 src/messageview.c;  cvs diff -u -r 1.19.2.9 -r 1.19.2.10 src/messageview.h;  cvs diff -u -r 1.395.2.248 -r 1.395.2.249 src/summaryview.c;  cvs diff -u -r 1.96.2.147 -r 1.96.2.148 src/textview.c;  ) > 2.4.0cvs185.patchset
index 7841372067f011e00dee31ed9d8f1b026f1e458a..66642c341ccbe5e106e2b3b139755ac4e57ce7a6 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=4
 MICRO_VERSION=0
 INTERFACE_AGE=0
 BINARY_AGE=0
 MICRO_VERSION=0
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=184
+EXTRA_VERSION=185
 EXTRA_RELEASE=
 EXTRA_GTK2_VERSION=
 
 EXTRA_RELEASE=
 EXTRA_GTK2_VERSION=
 
index 445bca120d9fe5bc2a2b047152eb00cd56120393..6ca1edeb5ddc46b0d00bc7529d4c94ca42da9610 100644 (file)
@@ -92,6 +92,7 @@ struct _GeditPrintJobInfo
        GtkWidget         *progressbar;
 
        GtkWindow         *parent;
        GtkWidget         *progressbar;
 
        GtkWindow         *parent;
+       gboolean           done;
 };
 
 static GeditPrintJobInfo* gedit_print_job_info_new     (GtkTextView       *view);
 };
 
 static GeditPrintJobInfo* gedit_print_job_info_new     (GtkTextView       *view);
@@ -200,7 +201,7 @@ gedit_print_dialog_response (GtkWidget *dialog, int response, GeditPrintJobInfo
 
        default:
                gtk_widget_destroy (dialog);
 
        default:
                gtk_widget_destroy (dialog);
-               gedit_print_job_info_destroy (pji, FALSE);
+               pji->done = TRUE;
         }
 } 
 
         }
 } 
 
@@ -304,7 +305,7 @@ preview_finished_cb (GtkSourcePrintJob *job, GeditPrintJobInfo *pji)
        gtk_widget_destroy (pji->dialog);
 
        if (pji->preview == PREVIEW)
        gtk_widget_destroy (pji->dialog);
 
        if (pji->preview == PREVIEW)
-               gedit_print_job_info_destroy (pji, FALSE);
+               pji->done = TRUE;
        else
        {
                g_signal_handlers_disconnect_by_func (pji->pjob, (GCallback) page_cb, pji);
        else
        {
                g_signal_handlers_disconnect_by_func (pji->pjob, (GCallback) page_cb, pji);
@@ -327,7 +328,7 @@ print_finished_cb (GtkSourcePrintJob *job, GeditPrintJobInfo *pji)
 
        gtk_widget_destroy (pji->dialog);
 
 
        gtk_widget_destroy (pji->dialog);
 
-       gedit_print_job_info_destroy (pji, TRUE);
+       pji->done = TRUE;
 }
 
 void 
 }
 
 void 
@@ -355,6 +356,10 @@ gedit_print (GtkTextView *view)
                          pji);
 
        gtk_widget_show (dialog);
                          pji);
 
        gtk_widget_show (dialog);
+       while (pji->done != TRUE)
+               gtk_main_iteration();
+       gedit_print_job_info_destroy (pji, pji->preview ? FALSE:TRUE);
+       
 }
 
 static void 
 }
 
 static void 
index aaf3560261c276b36a4c61b12374b0b7b6ebceeb..c3f21bcf3230e09cd4cf3a18ea9db48cb02ac8e7 100644 (file)
@@ -439,7 +439,7 @@ void messageview_add_toolbar(MessageView *msgview, GtkWidget *window)
        msgview_list = g_list_append(msgview_list, msgview);
 }
 
        msgview_list = g_list_append(msgview_list, msgview);
 }
 
-MessageView *messageview_create_with_new_window(MainWindow *mainwin)
+static MessageView *messageview_create_with_new_window_visible(MainWindow *mainwin, gboolean show)
 {
        MessageView *msgview;
        GtkWidget *window;
 {
        MessageView *msgview;
        GtkWidget *window;
@@ -471,8 +471,12 @@ MessageView *messageview_create_with_new_window(MainWindow *mainwin)
 
        messageview_add_toolbar(msgview, window);
 
 
        messageview_add_toolbar(msgview, window);
 
-       gtk_widget_grab_focus(msgview->mimeview->textview->text);
-       gtk_widget_show(window);
+       if (show) {
+               gtk_widget_grab_focus(msgview->mimeview->textview->text);
+               gtk_widget_show(window);
+       } else {
+               gtk_widget_realize(window);
+       }
 
        msgview->new_window = TRUE;
        msgview->window = window;
 
        msgview->new_window = TRUE;
        msgview->window = window;
@@ -485,6 +489,10 @@ MessageView *messageview_create_with_new_window(MainWindow *mainwin)
        return msgview;
 }
 
        return msgview;
 }
 
+MessageView *messageview_create_with_new_window(MainWindow *mainwin)
+{
+       return messageview_create_with_new_window_visible(mainwin, TRUE);
+}
 void messageview_init(MessageView *messageview)
 {
        headerview_init(messageview->headerview);
 void messageview_init(MessageView *messageview)
 {
        headerview_init(messageview->headerview);
@@ -1441,6 +1449,48 @@ static void save_as_cb(gpointer data, guint action, GtkWidget *widget)
        messageview_save_as(messageview);
 }
 
        messageview_save_as(messageview);
 }
 
+#ifdef USE_GNOMEPRINT
+static void print_mimeview(MimeView *mimeview) 
+{
+       if (!mimeview 
+       ||  !mimeview->textview
+       ||  !mimeview->textview->text)
+               alertpanel_warning(_("Cannot print: the message doesn't "
+                                    "contain text."));
+       else {
+               gtk_widget_realize(mimeview->textview->text);
+               gedit_print(GTK_TEXT_VIEW(mimeview->textview->text));
+       }
+}
+
+void messageview_print(MsgInfo *msginfo, gboolean all_headers) 
+{
+       PangoFontDescription *font_desc = NULL;
+       MessageView *tmpview = messageview_create_with_new_window_visible(
+                               mainwindow_get_mainwindow(), FALSE);
+
+       if (prefs_common.use_different_print_font) {
+               font_desc = pango_font_description_from_string
+                                               (prefs_common.printfont);
+       } else {
+               font_desc = pango_font_description_from_string
+                                               (prefs_common.textfont);
+       }
+       if (font_desc) {
+               gtk_widget_modify_font(tmpview->mimeview->textview->text, 
+                       font_desc);
+               pango_font_description_free(font_desc);
+       }
+
+       tmpview->all_headers = all_headers;
+       if (msginfo && messageview_show(tmpview, msginfo, 
+               tmpview->all_headers) >= 0) {
+                       print_mimeview(tmpview->mimeview);
+       }
+       messageview_destroy(tmpview);
+}
+#endif
+
 static void print_cb(gpointer data, guint action, GtkWidget *widget)
 {
        MessageView *messageview = (MessageView *)data;
 static void print_cb(gpointer data, guint action, GtkWidget *widget)
 {
        MessageView *messageview = (MessageView *)data;
@@ -1466,15 +1516,7 @@ static void print_cb(gpointer data, guint action, GtkWidget *widget)
        procmsg_print_message(messageview->msginfo, cmdline);
        g_free(cmdline);
 #else
        procmsg_print_message(messageview->msginfo, cmdline);
        g_free(cmdline);
 #else
-       if (!messageview->mimeview 
-       ||  !messageview->mimeview->textview
-       ||  !messageview->mimeview->textview->text)
-               alertpanel_warning(_("Cannot print: the message doesn't "
-                                    "contain text."));
-
-       gedit_print(
-               GTK_TEXT_VIEW(messageview->mimeview
-                               ->textview->text));
+       messageview_print(messageview->msginfo, messageview->all_headers);
 #endif
 }
 
 #endif
 }
 
index bef39145a1b25f567fa0524494cc6efb1fc0873b..b1b1e5b4f92837ac461918fcbb6472f5d21177b3 100644 (file)
 #ifndef __MESSAGEVIEW_H__
 #define __MESSAGEVIEW_H__
 
 #ifndef __MESSAGEVIEW_H__
 #define __MESSAGEVIEW_H__
 
+#ifdef HAVE_CONFIG_H
+#  include "config.h"
+#endif
+
 #include <glib.h>
 #include <gtk/gtkwidget.h>
 
 #include <glib.h>
 #include <gtk/gtkwidget.h>
 
@@ -113,5 +117,8 @@ gchar *messageview_get_selection            (MessageView    *msgview);
 void messageview_set_menu_sensitive            (MessageView    *msgview);
 void messageview_learn                         (MessageView    *msgview,
                                                 gboolean is_spam);
 void messageview_set_menu_sensitive            (MessageView    *msgview);
 void messageview_learn                         (MessageView    *msgview,
                                                 gboolean is_spam);
-
+#ifdef USE_GNOMEPRINT
+void messageview_print                         (MsgInfo        *msginfo,
+                                                gboolean        all_headers);
+#endif
 #endif /* __MESSAGEVIEW_H__ */
 #endif /* __MESSAGEVIEW_H__ */
index 528df22faadb7c1e720124773540fa9eb38f44f9..dc224dc24f6162093c25f945751e6c44c19dc592 100644 (file)
@@ -4054,21 +4054,6 @@ void summary_save_as(SummaryView *summaryview)
        g_free(tmp);
 }
 
        g_free(tmp);
 }
 
-#ifdef USE_GNOMEPRINT
-static void print_mimeview(MimeView *mimeview) 
-{
-       if (!mimeview 
-       ||  !mimeview->textview
-       ||  !mimeview->textview->text)
-               alertpanel_warning(_("Cannot print: the message doesn't "
-                                    "contain text."));
-       else {
-               gtk_widget_realize(mimeview->textview->text);
-               gedit_print(GTK_TEXT_VIEW(mimeview->textview->text));
-       }
-}
-#endif
-
 void summary_print(SummaryView *summaryview)
 {
        GtkCList *clist = GTK_CLIST(summaryview->ctree);
 void summary_print(SummaryView *summaryview)
 {
        GtkCList *clist = GTK_CLIST(summaryview->ctree);
@@ -4109,23 +4094,10 @@ void summary_print(SummaryView *summaryview)
             cur != NULL && cur->data != NULL; 
             cur = cur->next) {
                GtkCTreeNode *node = GTK_CTREE_NODE(cur->data);
             cur != NULL && cur->data != NULL; 
             cur = cur->next) {
                GtkCTreeNode *node = GTK_CTREE_NODE(cur->data);
-               if (node != summaryview->displayed) {
-                       MessageView *tmpview = messageview_create(
-                                               summaryview->mainwin);
-                       MsgInfo *msginfo = gtk_ctree_node_get_row_data(
-                                               GTK_CTREE(summaryview->ctree),
-                                               node);
-
-                       messageview_init(tmpview);
-                       tmpview->all_headers = summaryview->messageview->all_headers;
-                       if (msginfo && messageview_show(tmpview, msginfo, 
-                               tmpview->all_headers) >= 0) {
-                                       print_mimeview(tmpview->mimeview);
-                       }
-                       messageview_destroy(tmpview);
-               } else {
-                       print_mimeview(summaryview->messageview->mimeview);
-               }
+               MsgInfo *msginfo = gtk_ctree_node_get_row_data(
+                                       GTK_CTREE(summaryview->ctree),
+                                       node);
+               messageview_print(msginfo, summaryview->messageview->all_headers);
        }
 #endif
 }
        }
 #endif
 }
index 98cee2683ed4492910f76103644933c512bd69e6..63842336a7a1638c2a369be4022de25498686bc7 100644 (file)
@@ -405,6 +405,18 @@ static void textview_create_tags(GtkTextView *text, TextView *textview)
        gtk_text_buffer_create_tag(buffer, "header_title",
                                   "font-desc", bold_font_desc,
                                   NULL);
        gtk_text_buffer_create_tag(buffer, "header_title",
                                   "font-desc", bold_font_desc,
                                   NULL);
+       tag = gtk_text_buffer_create_tag(buffer, "hlink",
+                                  "pixels-above-lines", 0,
+                                  "pixels-above-lines-set", TRUE,
+                                  "pixels-below-lines", 0,
+                                  "pixels-below-lines-set", TRUE,
+                                  "font-desc", font_desc,
+                                  "left-margin", 3,
+                                  "left-margin-set", TRUE,
+                                  "foreground-gdk", &uri_color,
+                                  NULL);
+       g_signal_connect(G_OBJECT(tag), "event",
+                         G_CALLBACK(textview_uri_button_pressed), textview);
        if (prefs_common.enable_bgcolor) {
                gtk_text_buffer_create_tag(buffer, "quote0",
                                "foreground-gdk", &quote_colors[0],
        if (prefs_common.enable_bgcolor) {
                gtk_text_buffer_create_tag(buffer, "quote0",
                                "foreground-gdk", &quote_colors[0],
@@ -1898,7 +1910,7 @@ static void textview_show_header(TextView *textview, GPtrArray *headers)
                          procheader_headername_equal(header->name, "Reply-To") ||
                          procheader_headername_equal(header->name, "Sender");
                        textview_make_clickable_parts(textview, "header", 
                          procheader_headername_equal(header->name, "Reply-To") ||
                          procheader_headername_equal(header->name, "Sender");
                        textview_make_clickable_parts(textview, "header", 
-                                                     "link", header->body, 
+                                                     "hlink", header->body, 
                                                      hdr);
                }
                gtk_text_buffer_get_end_iter (buffer, &iter);
                                                      hdr);
                }
                gtk_text_buffer_get_end_iter (buffer, &iter);
@@ -2108,7 +2120,7 @@ static void textview_uri_update(TextView *textview, gint x, gint y)
 
                        g_object_get(G_OBJECT(tag), "name", &name, NULL);
 
 
                        g_object_get(G_OBJECT(tag), "name", &name, NULL);
 
-                       if ((!strcmp(name, "link"))
+                       if ((!strcmp(name, "link") || !strcmp(name, "hlink"))
                            && textview_get_uri_range(textview, &iter, tag,
                                                      &start_iter, &end_iter)) {
 
                            && textview_get_uri_range(textview, &iter, tag,
                                                      &start_iter, &end_iter)) {