2006-02-15 [colin] 2.0.0cvs56
authorColin Leroy <colin@colino.net>
Wed, 15 Feb 2006 17:59:37 +0000 (17:59 +0000)
committerColin Leroy <colin@colino.net>
Wed, 15 Feb 2006 17:59:37 +0000 (17:59 +0000)
* src/mimeview.c
* src/mimeview.h
Let MimeViewers know which MimeView they
depend of.
* src/summaryview.c
Swap From/To columns in Sent/Queue/Drafts
folders
* src/etpan/imap-thread.c
Use mailstream_low_tls_open() for STARTTLS
instead of mailstream_low_ssl_open()
** REQUIRES libetpan 0.42cvs3 **

ChangeLog
PATCHSETS
configure.ac
src/etpan/imap-thread.c
src/mimeview.c
src/mimeview.h
src/summaryview.c

index 997e9702f7bac4e38cdbe473acbc9e6266a14f23..9520714bf66de96c87ad48d041d3bf3835776a65 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2006-02-15 [colin]     2.0.0cvs56
+
+       * src/mimeview.c
+       * src/mimeview.h
+               Let MimeViewers know which MimeView they
+               depend of.
+       * src/summaryview.c
+               Swap From/To columns in Sent/Queue/Drafts
+               folders
+       * src/etpan/imap-thread.c
+               Use mailstream_low_tls_open() for STARTTLS
+               instead of mailstream_low_ssl_open()
+               ** REQUIRES libetpan 0.42cvs3 **
+
 2006-02-15 [wwp]       2.0.0cvs55
 
        * src/compose.c
index 9e1d4b2c2c8054d51ace95bdccb52e2e39fa6d0f..9333bb44cd39cfdf11ea1a995c8044bcd73da00d 100644 (file)
--- a/PATCHSETS
+++ b/PATCHSETS
 ( cvs diff -u -r 1.5.2.7 -r 1.5.2.8 src/prefs_gtk.h;  ) > 2.0.0cvs53.patchset
 ( cvs diff -u -r 1.10.2.16 -r 1.10.2.17 src/prefs_gtk.c;  ) > 2.0.0cvs54.patchset
 ( cvs diff -u -r 1.382.2.240 -r 1.382.2.241 src/compose.c;  cvs diff -u -r 1.50.2.20 -r 1.50.2.21 src/compose.h;  cvs diff -u -r 1.3.12.13 -r 1.3.12.14 src/message_search.c;  cvs diff -u -r 1.1.16.2 -r 1.1.16.3 src/message_search.h;  cvs diff -u -r 1.96.2.96 -r 1.96.2.97 src/textview.c;  cvs diff -u -r 1.5.2.20 -r 1.5.2.21 src/gtk/gtkutils.c;  cvs diff -u -r 1.4.2.17 -r 1.4.2.18 src/gtk/gtkutils.h;  ) > 2.0.0cvs55.patchset
+( cvs diff -u -r 1.83.2.64 -r 1.83.2.65 src/mimeview.c;  cvs diff -u -r 1.20.2.7 -r 1.20.2.8 src/mimeview.h;  cvs diff -u -r 1.395.2.169 -r 1.395.2.170 src/summaryview.c;  cvs diff -u -r 1.1.4.27 -r 1.1.4.28 src/etpan/imap-thread.c;  ) > 2.0.0cvs56.patchset
index 2f89d33662113f05261b64c94685704d6a72fd59..a46a470167d5d4f308eeb551205f6ea6cd8e0a2e 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=0
 MICRO_VERSION=0
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=55
+EXTRA_VERSION=56
 EXTRA_RELEASE=
 EXTRA_GTK2_VERSION=
 
index 47835f4a2bc9c5ff9fb6e69eae4d329331ca1baa..212e6cd40755458b3ac1c5c8c1802fbc57f721e3 100644 (file)
@@ -703,9 +703,9 @@ static void starttls_run(struct etpan_thread_op * op)
                        result->error = MAILIMAP_ERROR_STREAM;
                        return;
                }
-               tls_low = mailstream_low_ssl_open(fd);
+               tls_low = mailstream_low_tls_open(fd);
                if (tls_low == NULL) {
-                       debug_print("imap starttls run - can't ssl_open\n");
+                       debug_print("imap starttls run - can't tls_open\n");
                        result->error = MAILIMAP_ERROR_STREAM;
                        return;
                }
index 97509ad8e6dd6dcca41306e8c74b5d74360fae41..d58ecb8c6cd2973c453d6dca28d31e8c19b6d952 100644 (file)
@@ -602,6 +602,7 @@ gboolean mimeview_show_part(MimeView *mimeview, MimeInfo *partinfo)
                mimeview->mimeviewer = viewer;
                mimeview_change_view_type(mimeview, MIMEVIEW_VIEWER);
        }
+       viewer->mimeview = mimeview;
        viewer->show_mimepart(viewer, mimeview->file, partinfo);
 
        return TRUE;
index b8b360e72bc3be5650046f5405df013edf920639..16cedb45e8c87b061c4b62ad9f4dbe39986eccdc 100644 (file)
@@ -116,11 +116,12 @@ struct _MimeViewerFactory
 struct _MimeViewer
 {
        MimeViewerFactory *factory;
-    
+       
        GtkWidget       *(*get_widget)          (MimeViewer *);
        void            (*show_mimepart)        (MimeViewer *, const gchar *infile, MimeInfo *);
        void            (*clear_viewer)         (MimeViewer *);
        void            (*destroy_viewer)       (MimeViewer *);
+       MimeView        *mimeview;
 };
 
 #ifdef __cplusplus
index a129c3cb520fb45e31bbbdb480f4be3668b105f5..90698bb5066d45fc47a76095ef0f09884363c2aa 100644 (file)
@@ -177,7 +177,7 @@ static void summary_set_ctree_from_list     (SummaryView            *summaryview,
 static void summary_set_header         (SummaryView            *summaryview,
                                         gchar                  *text[],
                                         MsgInfo                *msginfo,
-                                        gboolean               *free_from_to);
+                                        gboolean               *free_from);
 static void summary_display_msg                (SummaryView            *summaryview,
                                         GtkCTreeNode           *row);
 static void summary_display_msg_full   (SummaryView            *summaryview,
@@ -816,6 +816,66 @@ GtkCTreeNode * summary_find_prev_important_score(SummaryView *summaryview,
 ( (m->msgnum == displayed_msgnum) \
   && (!g_ascii_strcasecmp(m->folder->name,item->name)) )
 
+static void summary_switch_from_to(SummaryView *summaryview, FolderItem *item)
+{
+       gboolean show_from = FALSE, show_to = FALSE;
+       gboolean showing_from = FALSE, showing_to = FALSE;
+       gint from_pos = 0, to_pos = 0;
+       SummaryColumnState *col_state = summaryview->col_state;
+       GtkCTree *ctree = GTK_CTREE(summaryview->ctree);
+       
+       if (!item)
+               return;
+       if (folder_has_parent_of_type(item, F_OUTBOX)
+       ||  folder_has_parent_of_type(item, F_DRAFT)
+       ||  folder_has_parent_of_type(item, F_QUEUE))
+               show_to = TRUE;
+       else
+               show_from = TRUE;
+       
+       from_pos = summaryview->col_pos[S_COL_FROM];
+       to_pos = summaryview->col_pos[S_COL_TO];
+       showing_from = col_state[from_pos].visible;
+       showing_to = col_state[to_pos].visible;
+       
+       if (showing_from && showing_to) {
+               debug_print("showing both\n");
+               return;
+       }
+
+       if (!showing_from && !showing_to) {
+               debug_print("showing none\n");
+               return;
+       }
+
+       debug_print("showing %s %s, must show %s %s\n", 
+               showing_from?"From":"",
+               showing_to?"To":"",
+               show_from?"From":"",
+               show_to?"To":"");
+
+       if (showing_from == show_from && showing_to == show_to)
+               return;
+       /* else we'll switch both */
+
+       debug_print("switching columns\n");
+       col_state[from_pos].type = S_COL_TO;
+       col_state[from_pos].visible = show_to;
+
+       col_state[to_pos].type = S_COL_FROM;
+       col_state[to_pos].visible = show_from;
+
+       summaryview->col_pos[S_COL_TO] = from_pos;
+       summaryview->col_pos[S_COL_FROM] = to_pos;
+
+       gtk_clist_set_column_visibility
+               (GTK_CLIST(ctree), from_pos, col_state[from_pos].visible);
+       gtk_clist_set_column_visibility
+               (GTK_CLIST(ctree), to_pos, col_state[to_pos].visible);
+
+       summary_set_column_titles(summaryview);
+}
+
 gboolean summary_show(SummaryView *summaryview, FolderItem *item)
 {
        GtkCTree *ctree = GTK_CTREE(summaryview->ctree);
@@ -834,6 +894,8 @@ gboolean summary_show(SummaryView *summaryview, FolderItem *item)
        if (!summaryview->mainwin)
                return FALSE;
 
+       summary_switch_from_to(summaryview, item);
+
        inc_lock();
        summary_lock(summaryview);
 
@@ -2244,9 +2306,9 @@ gboolean summary_insert_gnode_func(GtkCTree *ctree, guint depth, GNode *gnode,
        gint *col_pos = summaryview->col_pos;
        const gchar *msgid = msginfo->msgid;
        GHashTable *msgid_table = summaryview->msgid_table;
-       gboolean free_from_to = FALSE;
+       gboolean free_from = FALSE;
        
-       summary_set_header(summaryview, text, msginfo, &free_from_to);
+       summary_set_header(summaryview, text, msginfo, &free_from);
 
        gtk_sctree_set_node_info(ctree, cnode, text[col_pos[S_COL_SUBJECT]], 2,
                                NULL, NULL, NULL, NULL, FALSE,
@@ -2263,11 +2325,9 @@ gboolean summary_insert_gnode_func(GtkCTree *ctree, guint depth, GNode *gnode,
        SET_TEXT(S_COL_TO);
        /* SET_TEXT(S_COL_SUBJECT);  already set by node info */
 
-       if (free_from_to) {
+       if (free_from) {
                g_free(text[col_pos[S_COL_FROM]]);
-               g_free(text[col_pos[S_COL_TO]]);
                text[col_pos[S_COL_FROM]] = NULL;
-               text[col_pos[S_COL_TO]] = NULL;
        }
 
 #undef SET_TEXT
@@ -2327,24 +2387,22 @@ static void summary_set_ctree_from_list(SummaryView *summaryview,
                summary_thread_init(summaryview);
        } else {
                gchar *text[N_SUMMARY_COLS];
-               gboolean free_from_to = FALSE;
+               gboolean free_from = FALSE;
                gint *col_pos = summaryview->col_pos;
 
                cur = mlist;
                for (; mlist != NULL; mlist = mlist->next) {
                        msginfo = (MsgInfo *)mlist->data;
 
-                       summary_set_header(summaryview, text, msginfo, &free_from_to);
+                       summary_set_header(summaryview, text, msginfo, &free_from);
 
                        node = gtk_sctree_insert_node
                                (ctree, NULL, node, text, 2,
                                 NULL, NULL, NULL, NULL,
                                 FALSE, FALSE);
-                       if (free_from_to) {
+                       if (free_from) {
                                g_free(text[col_pos[S_COL_FROM]]);
-                               g_free(text[col_pos[S_COL_TO]]);
                                text[col_pos[S_COL_FROM]] = NULL;
-                               text[col_pos[S_COL_TO]] = NULL;
                        }
                        GTKUT_CTREE_NODE_SET_ROW_DATA(node, msginfo);
                        summary_set_marks_func(ctree, node, summaryview);
@@ -2427,7 +2485,7 @@ static gchar *summary_complete_address(const gchar *addr)
 }
 
 static void summary_set_header(SummaryView *summaryview, gchar *text[],
-                              MsgInfo *msginfo, gboolean *free_from_to)
+                              MsgInfo *msginfo, gboolean *free_from)
 {
        static gchar date_modified[80];
        static gchar col_score[11];
@@ -2458,7 +2516,8 @@ static void summary_set_header(SummaryView *summaryview, gchar *text[],
        else
                text[col_pos[S_COL_DATE]] = _("(No Date)");
 
-       if (prefs_common.swap_from && msginfo->from && msginfo->to) {
+       if (prefs_common.swap_from && msginfo->from && msginfo->to
+       &&  !summaryview->col_state[summaryview->col_pos[S_COL_TO]].visible) {
                gchar *addr = NULL;
                
                addr = g_strdup(msginfo->from);
@@ -2489,17 +2548,15 @@ static void summary_set_header(SummaryView *summaryview, gchar *text[],
                     )
                   );
 
+       text[col_pos[S_COL_TO]] = to_text;
        if (!should_swap) {
                text[col_pos[S_COL_FROM]] = from_text;
-               text[col_pos[S_COL_TO]] = to_text;
-               *free_from_to = FALSE;
+               *free_from = FALSE;
        } else {
                gchar *tmp = NULL;
                tmp = g_strconcat("-->", to_text, NULL);
                text[col_pos[S_COL_FROM]] = tmp;
-               tmp = g_strconcat("<--", from_text, NULL);
-               text[col_pos[S_COL_TO]] = tmp;
-               *free_from_to = TRUE;
+               *free_from = TRUE;
        }
        
        if (summaryview->simplify_subject_preg != NULL)
@@ -5131,12 +5188,18 @@ static void summary_date_clicked(GtkWidget *button, SummaryView *summaryview)
 
 static void summary_from_clicked(GtkWidget *button, SummaryView *summaryview)
 {
-       summary_sort_by_column_click(summaryview, SORT_BY_FROM);
+       if (summaryview->col_state[summaryview->col_pos[S_COL_FROM]].visible)
+               summary_sort_by_column_click(summaryview, SORT_BY_FROM);
+       else
+               summary_sort_by_column_click(summaryview, SORT_BY_TO);
 }
 
 static void summary_to_clicked(GtkWidget *button, SummaryView *summaryview)
 {
-       summary_sort_by_column_click(summaryview, SORT_BY_TO);
+       if (summaryview->col_state[summaryview->col_pos[S_COL_TO]].visible)
+               summary_sort_by_column_click(summaryview, SORT_BY_TO);
+       else
+               summary_sort_by_column_click(summaryview, SORT_BY_FROM);
 }
 
 static void summary_subject_clicked(GtkWidget *button,