From 6c2c75c8f3bfdbaf0542828c00d20dc00e05a31c Mon Sep 17 00:00:00 2001 From: Colin Leroy Date: Wed, 21 Sep 2005 17:22:10 +0000 Subject: [PATCH] 2005-09-21 [colin] 1.9.14cvs46 * src/gedit-print.c * src/procmsg.c * src/procmsg.h * src/textview.c * src/summaryview.c Remove some printing hacks (deselection/reselection), which by the way fix printing the currently displayed mime part (still only text) Plus a little optimisation of summary_show --- ChangeLog-gtk2.claws | 13 ++++ configure.ac | 2 +- src/gedit-print.c | 8 ++- src/procmsg.c | 1 - src/procmsg.h | 1 - src/summaryview.c | 140 +++++++++++++++++++++---------------------- src/textview.c | 8 +-- 7 files changed, 92 insertions(+), 81 deletions(-) diff --git a/ChangeLog-gtk2.claws b/ChangeLog-gtk2.claws index 102325bf2..cbb854a49 100644 --- a/ChangeLog-gtk2.claws +++ b/ChangeLog-gtk2.claws @@ -1,3 +1,16 @@ +2005-09-21 [colin] 1.9.14cvs46 + + * src/gedit-print.c + * src/procmsg.c + * src/procmsg.h + * src/textview.c + * src/summaryview.c + Remove some printing hacks (deselection/reselection), + which by the way fix printing the currently + displayed mime part (still only text) + Plus a little optimisation of summary_show + + 2005-09-20 [colin] 1.9.14cvs45 * src/mainwindow.c diff --git a/configure.ac b/configure.ac index ba3640eeb..c588412a6 100644 --- a/configure.ac +++ b/configure.ac @@ -11,7 +11,7 @@ MINOR_VERSION=9 MICRO_VERSION=14 INTERFACE_AGE=0 BINARY_AGE=0 -EXTRA_VERSION=45 +EXTRA_VERSION=46 EXTRA_RELEASE= EXTRA_GTK2_VERSION= diff --git a/src/gedit-print.c b/src/gedit-print.c index 4d0bb06a8..312116f40 100644 --- a/src/gedit-print.c +++ b/src/gedit-print.c @@ -54,6 +54,7 @@ #include "gedit-print.h" #include "gtk/gtksourceprintjob.h" +#include "mainwindow.h" #ifdef DEBUG # define DEBUG_PRINT "DEBUG_PRINT: %s" @@ -333,6 +334,7 @@ gedit_print (GtkTextView *view) { GeditPrintJobInfo *pji; GtkWidget *dialog; + GtkWidget *parent; gedit_debug (DEBUG_PRINT, ""); @@ -340,8 +342,12 @@ gedit_print (GtkTextView *view) pji = gedit_print_job_info_new (view); pji->preview = PREVIEW_NO; + + parent = gtk_widget_get_toplevel (GTK_WIDGET (view)); + if (parent == NULL || !GTK_IS_WINDOW(parent)) + parent = mainwindow_get_mainwindow()->window; - dialog = get_print_dialog (pji, GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (view)))); + dialog = get_print_dialog (pji, GTK_WINDOW (parent)); g_signal_connect (dialog, "response", G_CALLBACK (gedit_print_dialog_response), diff --git a/src/procmsg.c b/src/procmsg.c index cb9be31a3..342a510dc 100644 --- a/src/procmsg.c +++ b/src/procmsg.c @@ -1164,7 +1164,6 @@ MsgInfo *procmsg_msginfo_copy(MsgInfo *msginfo) newmsginfo->references = g_slist_reverse(newmsginfo->references); MEMBCOPY(score); - MEMBCOPY(threadscore); MEMBDUP(plaintext_file); return newmsginfo; diff --git a/src/procmsg.h b/src/procmsg.h index 671f7181e..158c4a8fe 100644 --- a/src/procmsg.h +++ b/src/procmsg.h @@ -200,7 +200,6 @@ struct _MsgInfo gchar *fromspace; gint score; - gint threadscore; /* used only for encrypted messages */ gchar *plaintext_file; diff --git a/src/summaryview.c b/src/summaryview.c index 0ba613a92..fa4aa4f6c 100644 --- a/src/summaryview.c +++ b/src/summaryview.c @@ -809,6 +809,7 @@ gboolean summary_show(SummaryView *summaryview, FolderItem *item) guint displayed_msgnum = 0; GSList *cur; GSList *not_killed; + gboolean hidden_removed = FALSE; if (summary_is_locked(summaryview)) return FALSE; @@ -909,19 +910,23 @@ gboolean summary_show(SummaryView *summaryview, FolderItem *item) for(cur = mlist ; cur != NULL && cur->data != NULL ; cur = g_slist_next(cur)) { MsgInfo * msginfo = (MsgInfo *) cur->data; - if (MSG_IS_UNREAD(msginfo->flags) && - !MSG_IS_IGNORE_THREAD(msginfo->flags)) - not_killed = g_slist_prepend(not_killed, msginfo); - else if (MSG_IS_MARKED(msginfo->flags) || - MSG_IS_LOCKED(msginfo->flags)) - not_killed = g_slist_prepend(not_killed, msginfo); - else if (is_refresh && - (msginfo->msgnum == selected_msgnum || - msginfo->msgnum == displayed_msgnum)) - not_killed = g_slist_prepend(not_killed, msginfo); - else - procmsg_msginfo_free(msginfo); + if (!msginfo->hidden) { + if (MSG_IS_UNREAD(msginfo->flags) && + !MSG_IS_IGNORE_THREAD(msginfo->flags)) + not_killed = g_slist_prepend(not_killed, msginfo); + else if (MSG_IS_MARKED(msginfo->flags) || + MSG_IS_LOCKED(msginfo->flags)) + not_killed = g_slist_prepend(not_killed, msginfo); + else if (is_refresh && + (msginfo->msgnum == selected_msgnum || + msginfo->msgnum == displayed_msgnum)) + not_killed = g_slist_prepend(not_killed, msginfo); + else + procmsg_msginfo_free(msginfo); + } else + procmsg_msginfo_free(msginfo); } + hidden_removed = TRUE; g_slist_free(mlist); mlist = not_killed; } else { @@ -935,12 +940,12 @@ gboolean summary_show(SummaryView *summaryview, FolderItem *item) for (cur = mlist ; cur != NULL && cur->data != NULL ; cur = g_slist_next(cur)) { MsgInfo * msginfo = (MsgInfo *) cur->data; - if (quicksearch_match(summaryview->quicksearch, msginfo)) + if (!msginfo->hidden && quicksearch_match(summaryview->quicksearch, msginfo)) not_killed = g_slist_prepend(not_killed, msginfo); else procmsg_msginfo_free(msginfo); } - + hidden_removed = TRUE; if (quicksearch_is_running(summaryview->quicksearch)) { /* only scan subfolders when quicksearch changed, * not when search is the same and folder changed */ @@ -956,38 +961,19 @@ gboolean summary_show(SummaryView *summaryview, FolderItem *item) mlist = not_killed; } -#if 0 - if ((global_scoring || item->prefs->scoring)) { - GSList *not_killed; - gint kill_score; + if (!hidden_removed) { + not_killed = NULL; + for(cur = mlist ; cur != NULL && cur->data != NULL ; cur = g_slist_next(cur)) { + MsgInfo * msginfo = (MsgInfo *) cur->data; - not_killed = NULL; - kill_score = prefs_common.kill_score; - if (item->prefs->kill_score > kill_score) - kill_score = item->prefs->kill_score; - for(cur = mlist ; cur != NULL && cur->data != NULL ; cur = g_slist_next(cur)) { - MsgInfo * msginfo = (MsgInfo *) cur->data; - - if (msginfo->score > kill_score) - not_killed = g_slist_prepend(not_killed, msginfo); - else - procmsg_msginfo_free(msginfo); - } + if (!msginfo->hidden) + not_killed = g_slist_prepend(not_killed, msginfo); + else + procmsg_msginfo_free(msginfo); + } g_slist_free(mlist); mlist = not_killed; } -#endif - not_killed = NULL; - for(cur = mlist ; cur != NULL && cur->data != NULL ; cur = g_slist_next(cur)) { - MsgInfo * msginfo = (MsgInfo *) cur->data; - - if (!msginfo->hidden) - not_killed = g_slist_prepend(not_killed, msginfo); - else - procmsg_msginfo_free(msginfo); - } - g_slist_free(mlist); - mlist = not_killed; STATUSBAR_POP(summaryview->mainwin); @@ -2264,11 +2250,6 @@ static void summary_set_ctree_from_list(SummaryView *summaryview, if (prefs_common.use_addr_book) start_address_completion(); - for (cur = mlist ; cur != NULL && cur->data != NULL; cur = cur->next) { - msginfo = (MsgInfo *)cur->data; - msginfo->threadscore = msginfo->score; - } - if (summaryview->threaded) { GNode *root, *gnode; @@ -3556,6 +3537,19 @@ void summary_save_as(SummaryView *summaryview) 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 + gedit_print(GTK_TEXT_VIEW(mimeview->textview->text)); +} +#endif + void summary_print(SummaryView *summaryview) { GtkCList *clist = GTK_CLIST(summaryview->ctree); @@ -3564,9 +3558,6 @@ void summary_print(SummaryView *summaryview) MsgInfo *msginfo; gchar *cmdline = NULL; gchar *p; -#else - gboolean first = TRUE; - GList *tmplist; #endif GList *cur; @@ -3584,36 +3575,39 @@ void summary_print(SummaryView *summaryview) g_free(cmdline); return; } - for (cur = clist->selection; cur != NULL && cur->data != NULL; cur = cur->next) { + for (cur = clist->selection; + cur != NULL && cur->data != NULL; + cur = cur->next) { msginfo = gtk_ctree_node_get_row_data (ctree, GTK_CTREE_NODE(cur->data)); - if (msginfo) procmsg_print_message(msginfo, cmdline); + if (msginfo) + procmsg_print_message(msginfo, cmdline); } g_free(cmdline); - #else - tmplist = g_list_copy(clist->selection); - summary_unselect_all(summaryview); - for (cur = tmplist; cur != NULL && cur->data != NULL; cur = cur->next) { - GtkCTreeNode *node = GTK_CTREE_NODE(cur->data); - summary_select_node(summaryview, node, TRUE, TRUE); - if (!summaryview->messageview->mimeview - || !summaryview->messageview->mimeview->textview - || !summaryview->messageview->mimeview->textview->text) - alertpanel_warning(_("Cannot print: the message doesn't " - "contain text.")); - gedit_print( - GTK_TEXT_VIEW(summaryview->messageview->mimeview - ->textview->text)); - } - for (cur = tmplist; cur != NULL && cur->data != NULL; cur = cur->next) { + for (cur = clist->selection; + cur != NULL && cur->data != NULL; + cur = cur->next) { GtkCTreeNode *node = GTK_CTREE_NODE(cur->data); - gtk_sctree_select_with_state( - GTK_SCTREE(clist), node, first ? 0:GDK_CONTROL_MASK); - first = FALSE; + 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); + } } - g_list_free(tmplist); #endif } @@ -5173,7 +5167,7 @@ static gint summary_cmp_by_score(GtkCList *clist, /* if score are equal, sort by date */ - diff = msginfo1->threadscore - msginfo2->threadscore; + diff = msginfo1->score - msginfo2->score; if (diff != 0) return diff; else diff --git a/src/textview.c b/src/textview.c index 2a3df05aa..ad46b1854 100644 --- a/src/textview.c +++ b/src/textview.c @@ -105,14 +105,14 @@ static GdkColor error_color = { static GdkCursor *hand_cursor = NULL; static GdkCursor *text_cursor = NULL; -#define TEXTVIEW_STATUSBAR_PUSH(textview, str) \ -{ \ +#define TEXTVIEW_STATUSBAR_PUSH(textview, str) \ +{ if (textview->messageview->statusbar) \ gtk_statusbar_push(GTK_STATUSBAR(textview->messageview->statusbar), \ textview->messageview->statusbar_cid, str); \ } -#define TEXTVIEW_STATUSBAR_POP(textview) \ -{ \ +#define TEXTVIEW_STATUSBAR_POP(textview) \ +{ if (textview->messageview->statusbar) \ gtk_statusbar_pop(GTK_STATUSBAR(textview->messageview->statusbar), \ textview->messageview->statusbar_cid); \ } -- 2.25.1