2012-10-31 [colin] 3.8.1cvs109
authorColin Leroy <colin@colino.net>
Wed, 31 Oct 2012 10:25:17 +0000 (10:25 +0000)
committerColin Leroy <colin@colino.net>
Wed, 31 Oct 2012 10:25:17 +0000 (10:25 +0000)
* src/folder_item_prefs.c
* src/folder_item_prefs.h
* src/messageview.c
* src/prefs_folder_item.c
Implement feature from bug #2569,
"select html part on folder specific properties"
Patch based on Andrej's patch.

ChangeLog
PATCHSETS
configure.ac
src/folder_item_prefs.c
src/folder_item_prefs.h
src/messageview.c
src/prefs_folder_item.c

index 9bd2523..e295b95 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2012-10-31 [colin]     3.8.1cvs109
+
+       * src/folder_item_prefs.c
+       * src/folder_item_prefs.h
+       * src/messageview.c
+       * src/prefs_folder_item.c
+               Implement feature from bug #2569, 
+               "select html part on folder specific properties"
+               Patch based on Andrej's patch.
+
 2012-10-29 [wwp]       3.8.1cvs108
 
        * src/textview.c
index 033bc3e..6d18d3f 100644 (file)
--- a/PATCHSETS
+++ b/PATCHSETS
 ( cvs diff -u -r 1.36.2.207 -r 1.36.2.208 src/common/utils.c;  cvs diff -u -r 1.20.2.82 -r 1.20.2.83 src/common/utils.h;  cvs diff -u -r 1.96.2.251 -r 1.96.2.252 src/textview.c;  ) > 3.8.1cvs106.patchset
 ( cvs diff -u -r 1.96.2.252 -r 1.96.2.253 src/textview.c;  ) > 3.8.1cvs107.patchset
 ( cvs diff -u -r 1.96.2.253 -r 1.96.2.254 src/textview.c;  ) > 3.8.1cvs108.patchset
+( cvs diff -u -r 1.2.2.40 -r 1.2.2.41 src/folder_item_prefs.c;  cvs diff -u -r 1.2.2.25 -r 1.2.2.26 src/folder_item_prefs.h;  cvs diff -u -r 1.94.2.239 -r 1.94.2.240 src/messageview.c;  cvs diff -u -r 1.52.2.88 -r 1.52.2.89 src/prefs_folder_item.c;  ) > 3.8.1cvs109.patchset
index c4dc802..7772b59 100644 (file)
@@ -12,7 +12,7 @@ MINOR_VERSION=8
 MICRO_VERSION=1
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=108
+EXTRA_VERSION=109
 EXTRA_RELEASE=
 EXTRA_GTK2_VERSION=
 
index 1df0443..950863a 100644 (file)
@@ -95,6 +95,8 @@ static PrefParam param[] = {
         NULL, NULL, NULL},
        {"remove_old_bodies", "FALSE", &tmp_prefs.remove_old_bodies, P_BOOL,
         NULL, NULL, NULL},
+       {"promote_html_part", "0", &tmp_prefs.promote_html_part, P_ENUM,
+        NULL, NULL, NULL},
 
        {"compose_with_format", "FALSE", &tmp_prefs.compose_with_format, P_BOOL,
         NULL, NULL, NULL},
@@ -211,6 +213,7 @@ static FolderItemPrefs *folder_item_prefs_clear(FolderItemPrefs *prefs)
        prefs->offlinesync = FALSE;
        prefs->offlinesync_days = 0;
        prefs->remove_old_bodies = FALSE;
+       prefs->promote_html_part = HTML_PROMOTE_DEFAULT;
 
        prefs->compose_with_format = FALSE;
        prefs->compose_subject_format = NULL;
@@ -270,6 +273,7 @@ void folder_item_prefs_copy_prefs(FolderItem * src, FolderItem * dest)
        tmp_prefs.offlinesync                   = src->prefs->offlinesync;
        tmp_prefs.offlinesync_days              = src->prefs->offlinesync_days;
        tmp_prefs.remove_old_bodies             = src->prefs->remove_old_bodies;
+       tmp_prefs.promote_html_part             = src->prefs->promote_html_part;
 
        prefs_matcher_read_config();
 
index 5c7cf77..12846ba 100644 (file)
 typedef struct _FolderItemPrefs FolderItemPrefs;
 
 #include "folder.h"
+typedef enum {
+       HTML_PROMOTE_DEFAULT=0,
+       HTML_PROMOTE_NEVER,
+       HTML_PROMOTE_ALWAYS
+} HTMLPromoteType;
 
 struct _FolderItemPrefs {
        gchar * directory;
@@ -38,6 +43,7 @@ struct _FolderItemPrefs {
        int offlinesync;
        int offlinesync_days;
        int remove_old_bodies;
+       HTMLPromoteType promote_html_part;
 
        gboolean request_return_receipt;
        gboolean enable_default_to;
index 7dbcfac..088a129 100644 (file)
@@ -66,6 +66,7 @@
 #include "quoted-printable.h"
 #include "version.h"
 #include "statusbar.h"
+#include "folder_item_prefs.h"
 #ifndef USE_NEW_ADDRBOOK
        #include "addressbook.h"
 #else
@@ -1503,7 +1504,9 @@ gint messageview_show(MessageView *messageview, MsgInfo *msginfo,
                                        } else if (mimeinfo->type == MIMETYPE_TEXT && 
                                            !strcasecmp(mimeinfo->subtype, "html") &&
                                            mimeinfo->disposition != DISPOSITIONTYPE_ATTACHMENT &&
-                                           prefs_common.promote_html_part) {
+                                                       (msginfo->folder->prefs->promote_html_part == HTML_PROMOTE_ALWAYS ||
+                                                        (msginfo->folder->prefs->promote_html_part == HTML_PROMOTE_DEFAULT &&
+                                                               prefs_common.promote_html_part))) {
                                                mimeview_select_mimepart_icon(messageview->mimeview, mimeinfo);
                                                goto done;
                                        }
@@ -1531,7 +1534,9 @@ gint messageview_show(MessageView *messageview, MsgInfo *msginfo,
                                        } else if (mimeinfo->type == MIMETYPE_TEXT && 
                                            !strcasecmp(mimeinfo->subtype, "html") &&
                                            mimeinfo->disposition != DISPOSITIONTYPE_ATTACHMENT &&
-                                           prefs_common.promote_html_part) {
+                                                       (msginfo->folder->prefs->promote_html_part == HTML_PROMOTE_ALWAYS ||
+                                                        (msginfo->folder->prefs->promote_html_part == HTML_PROMOTE_DEFAULT &&
+                                                               prefs_common.promote_html_part))) {
                                                mimeview_select_mimepart_icon(messageview->mimeview, mimeinfo);
                                                goto done;
                                        }
index 112a005..6369bc1 100644 (file)
@@ -94,6 +94,7 @@ struct _FolderItemGeneralPage
        GtkWidget *entry_offlinesync;
        GtkWidget *label_end_offlinesync;
        GtkWidget *checkbtn_remove_old_offlinesync;
+       GtkWidget *promote_html_part;
        
        /* apply to sub folders */
 #ifndef G_OS_WIN32
@@ -105,6 +106,7 @@ struct _FolderItemGeneralPage
        GtkWidget *enable_processing_when_opening_rec_checkbtn;
        GtkWidget *newmailcheck_rec_checkbtn;
        GtkWidget *offlinesync_rec_checkbtn;
+       GtkWidget *promote_html_part_rec_checkbtn;
 
        gint       folder_color;
 };
@@ -240,6 +242,8 @@ static void prefs_folder_item_general_create_widget_func(PrefsPage * page_,
        GtkWidget *entry_offlinesync;
        GtkWidget *label_end_offlinesync;
        GtkWidget *checkbtn_remove_old_offlinesync;
+       GtkWidget *promote_html_part;
+       GtkListStore *promote_html_part_menu;
 
 #ifndef G_OS_WIN32
        GtkWidget *simplify_subject_rec_checkbtn;
@@ -250,6 +254,7 @@ static void prefs_folder_item_general_create_widget_func(PrefsPage * page_,
        GtkWidget *enable_processing_when_opening_rec_checkbtn;
        GtkWidget *newmailcheck_rec_checkbtn;
        GtkWidget *offlinesync_rec_checkbtn;
+       GtkWidget *promote_html_part_rec_checkbtn;
 
        page->item         = item;
 
@@ -490,6 +495,39 @@ static void prefs_folder_item_general_create_widget_func(PrefsPage * page_,
 
        rowcount++;
 
+       /* Select HTML part by default? */
+       hbox = gtk_hbox_new (FALSE, 2);
+       gtk_widget_show (hbox);
+       gtk_table_attach (GTK_TABLE(table), hbox, 0, 2,
+                       rowcount, rowcount+1, GTK_FILL, GTK_FILL, 0, 0);
+
+       label = gtk_label_new(_("Select the HTML part of multipart messages:"));
+       gtk_widget_show (label);
+       gtk_box_pack_start (GTK_BOX(hbox), label, FALSE, FALSE, 0);
+
+       promote_html_part = gtkut_sc_combobox_create (NULL, FALSE);
+       gtk_widget_show (promote_html_part);
+       gtk_box_pack_start (GTK_BOX(hbox), promote_html_part, FALSE, FALSE, 0);
+
+       promote_html_part_menu = GTK_LIST_STORE(gtk_combo_box_get_model(
+                               GTK_COMBO_BOX(promote_html_part)));
+       COMBOBOX_ADD (promote_html_part_menu, _("Default"), HTML_PROMOTE_DEFAULT);
+       COMBOBOX_ADD (promote_html_part_menu, _("No"), HTML_PROMOTE_NEVER);
+       COMBOBOX_ADD (promote_html_part_menu, _("Yes"), HTML_PROMOTE_ALWAYS);
+
+       combobox_select_by_data(GTK_COMBO_BOX(promote_html_part),
+                       item->prefs->promote_html_part);
+
+       CLAWS_SET_TIP(hbox, _(
+                               "\"Default\" will follow global preference (found in Preferences -> "
+                               "Message View -> Text Options"));
+
+       promote_html_part_rec_checkbtn = gtk_check_button_new();
+       gtk_widget_show (promote_html_part_rec_checkbtn);
+       gtk_table_attach(GTK_TABLE(table), promote_html_part_rec_checkbtn, 2, 3, 
+                        rowcount, rowcount + 1, GTK_SHRINK, GTK_SHRINK, 0, 0);
+       rowcount++;
+
        /* Synchronise folder for offline use */
        checkbtn_offlinesync = gtk_check_button_new_with_label(_("Synchronise for offline use"));
        gtk_table_attach(GTK_TABLE(table), checkbtn_offlinesync, 0, 2,
@@ -597,6 +635,7 @@ static void prefs_folder_item_general_create_widget_func(PrefsPage * page_,
        page->entry_offlinesync = entry_offlinesync;
        page->label_end_offlinesync = label_end_offlinesync;
        page->checkbtn_remove_old_offlinesync = checkbtn_remove_old_offlinesync;
+       page->promote_html_part = promote_html_part;
 
 #ifndef G_OS_WIN32
        page->simplify_subject_rec_checkbtn  = simplify_subject_rec_checkbtn;
@@ -607,6 +646,7 @@ static void prefs_folder_item_general_create_widget_func(PrefsPage * page_,
        page->enable_processing_when_opening_rec_checkbtn = enable_processing_when_opening_rec_checkbtn;
        page->newmailcheck_rec_checkbtn      = newmailcheck_rec_checkbtn;
        page->offlinesync_rec_checkbtn       = offlinesync_rec_checkbtn;
+       page->promote_html_part_rec_checkbtn = promote_html_part_rec_checkbtn;
 
        page->page.widget = table;
 
@@ -632,6 +672,7 @@ static void general_save_folder_prefs(FolderItem *folder, FolderItemGeneralPage
        gboolean all = FALSE, summary_update_needed = FALSE;
        SpecialFolderItemType type = F_NORMAL;
        FolderView *folderview = mainwindow_get_mainwindow()->folderview;
+       HTMLPromoteType promote_html_part = HTML_PROMOTE_DEFAULT;
 
        if (folder->path == NULL)
                return;
@@ -647,6 +688,11 @@ static void general_save_folder_prefs(FolderItem *folder, FolderItemGeneralPage
                summary_update_needed = TRUE;
        }
 
+       promote_html_part =
+               combobox_get_active_data(GTK_COMBO_BOX(page->promote_html_part));
+       if (all || gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->promote_html_part_rec_checkbtn)))
+               prefs->promote_html_part = promote_html_part;
+
 #ifndef G_OS_WIN32
        if (all || gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->simplify_subject_rec_checkbtn))) {
                gboolean old_simplify_subject = prefs->enable_simplify_subject;
@@ -732,7 +778,9 @@ static gboolean general_save_recurse_func(GNode *node, gpointer data)
              gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->enable_processing_rec_checkbtn)) ||
              gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->enable_processing_when_opening_rec_checkbtn)) ||
              gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->newmailcheck_rec_checkbtn)) ||
-             gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->offlinesync_rec_checkbtn))))
+             gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->offlinesync_rec_checkbtn)) ||
+                               gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->promote_html_part_rec_checkbtn))
+                       ))
                return TRUE;
        else 
                return FALSE;