2005-09-21 [colin] 1.9.14cvs46
authorColin Leroy <colin@colino.net>
Wed, 21 Sep 2005 17:22:10 +0000 (17:22 +0000)
committerColin Leroy <colin@colino.net>
Wed, 21 Sep 2005 17:22:10 +0000 (17:22 +0000)
        * 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
configure.ac
src/gedit-print.c
src/procmsg.c
src/procmsg.h
src/summaryview.c
src/textview.c

index 102325bf2ed1ca45962cabcb384ea8bd94589306..cbb854a49b47663d6b9ac72e350cc38f370cef23 100644 (file)
@@ -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
index ba3640eebc826195935ca1f5194c330bba5116c9..c588412a6eb206741d8b4b39dd27a71911beb82a 100644 (file)
@@ -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=
 
index 4d0bb06a8b03a4872dafff1c50eabbb2efbe78df..312116f4023a986407e07bbe4928739e59f8d179 100644 (file)
@@ -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),
index cb9be31a31ed8f0fd4de706b0c995e0cb4502989..342a510dc526e5f499e76ea300e117afd53dd0a1 100644 (file)
@@ -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;
index 671f7181e7a67d1ae4ae8c839bbe80e7258c28ba..158c4a8fea3267d3a4de0fcb7f5a2f5605a7b5ed 100644 (file)
@@ -200,7 +200,6 @@ struct _MsgInfo
        gchar *fromspace;
 
        gint score;
-       gint threadscore;
 
        /* used only for encrypted messages */
        gchar *plaintext_file;
index 0ba613a926215745f664e432f6dab783f9329a47..fa4aa4f6ca05221c5368f39a98831fe6db7ba0ee 100644 (file)
@@ -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
index 2a3df05aa144b5fa35be4663e4260e6585885fbe..ad46b18542e7ad9019a439d0563125e34d15bb09 100644 (file)
@@ -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);           \
 }