2005-06-08 [paul] 1.9.11cvs48
authorPaul Mangan <paul@claws-mail.org>
Wed, 8 Jun 2005 08:52:06 +0000 (08:52 +0000)
committerPaul Mangan <paul@claws-mail.org>
Wed, 8 Jun 2005 08:52:06 +0000 (08:52 +0000)
* src/codeconv.c
conv_get_outgoing_charset_str(): don't
use prefs_common setting
* src/compose.c
* src/compose.h
add /Options/Character encoding/... to
temporarily change the outgoing encoding

(belated sync with main)

ChangeLog-gtk2.claws
PATCHSETS
configure.ac
src/codeconv.c
src/compose.c
src/compose.h

index 1ed335277e8816c3d36a50c85d7de3c719d7c9ef..045b9f80dbea4e300fe4ee0466be16d528b54f77 100644 (file)
@@ -1,3 +1,15 @@
+2005-06-08 [paul]      1.9.11cvs48
+
+       * src/codeconv.c
+               conv_get_outgoing_charset_str(): don't
+               use prefs_common setting
+       * src/compose.c
+       * src/compose.h
+               add /Options/Character encoding/... to
+               temporarily change the outgoing encoding
+
+       (belated sync with main)
+
 2005-06-08 [paul]      1.9.11cvs47
 
        * src/compose.c
index 8d6b3cc95d371edb112fb62533b5b2034c470b69..6239d04c53488a1b02c70237a2677b6884a52951 100644 (file)
--- a/PATCHSETS
+++ b/PATCHSETS
 ( cvs diff -u -r 1.395.2.77 -r 1.395.2.78 src/summaryview.c;  ) > 1.9.11cvs45.patchset
 ( cvs diff -u -r 1.65.2.29 -r 1.65.2.30 src/codeconv.c;  cvs diff -u -r 1.15.2.7 -r 1.15.2.8 src/codeconv.h;  cvs diff -u -r 1.382.2.127 -r 1.382.2.128 src/compose.c;  cvs diff -u -r 1.274.2.41 -r 1.274.2.42 src/mainwindow.c;  cvs diff -u -r 1.94.2.53 -r 1.94.2.54 src/messageview.c;  cvs diff -u -r 1.1.2.2 -r 1.1.2.3 src/prefs_send.c;  cvs diff -u -r 1.9.2.12 -r 1.9.2.13 src/sourcewindow.c;  ) > 1.9.11cvs46.patchset
 ( cvs diff -u -r 1.382.2.128 -r 1.382.2.129 src/compose.c;  ) > 1.9.11cvs47.patchset
+( cvs diff -u -r 1.65.2.30 -r 1.65.2.31 src/codeconv.c;  cvs diff -u -r 1.382.2.129 -r 1.382.2.130 src/compose.c;  cvs diff -u -r 1.50.2.8 -r 1.50.2.9 src/compose.h;  ) > 1.9.11cvs48.patchset
index 995be5741d2cb671202829cd32dc3c36eddeb617..83c60a2d2862039f3b4747e70acdaa58366d6835 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=9
 MICRO_VERSION=11
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=47
+EXTRA_VERSION=48
 EXTRA_RELEASE=
 EXTRA_GTK2_VERSION=
 
index bdccf8169040541d6ab0071d9e4f4ae205ad8f17..2c9169599277d333e170d66e9a03c770a454d9a3 100644 (file)
@@ -1364,14 +1364,6 @@ const gchar *conv_get_outgoing_charset_str(void)
        CharSet out_charset;
        const gchar *str;
 
-       if (prefs_common.outgoing_charset) {
-               if (!isalpha((guchar)prefs_common.outgoing_charset[0])) {
-                       g_free(prefs_common.outgoing_charset);
-                       prefs_common.outgoing_charset = g_strdup(CS_AUTO);
-               } else if (strcmp(prefs_common.outgoing_charset, CS_AUTO) != 0)
-                       return prefs_common.outgoing_charset;
-       }
-
        out_charset = conv_get_outgoing_charset();
        str = conv_get_charset_str(out_charset);
 
index 1acea3bff789aca266a0fdd766d0de25662d0037..fe5a0f309082a72c4c4036a58e52f3a323c7c851 100644 (file)
@@ -197,6 +197,7 @@ static Compose *compose_create                      (PrefsAccount   *account,
 
 static GtkWidget *compose_account_option_menu_create
                                                (Compose        *compose);
+static void compose_set_out_encoding           (Compose        *compose);
 static void compose_set_template_menu          (Compose        *compose);
 static void compose_template_apply             (Compose        *compose,
                                                 Template       *tmpl,
@@ -360,6 +361,10 @@ static void compose_close_cb               (gpointer        data,
                                         guint           action,
                                         GtkWidget      *widget);
 
+static void compose_set_encoding_cb    (gpointer        data,
+                                        guint           action,
+                                        GtkWidget      *widget);
+
 static void compose_address_cb         (gpointer        data,
                                         guint           action,
                                         GtkWidget      *widget);
@@ -669,7 +674,88 @@ static GtkItemFactoryEntry compose_entries[] =
        {N_("/_Options/Priority/_Lowest"),  NULL, compose_set_priority_cb, PRIORITY_LOWEST, "/Options/Priority/Highest"},
        {N_("/_Options/---"),           NULL,           NULL,   0, "<Separator>"},
        {N_("/_Options/_Request Return Receipt"),       NULL, compose_toggle_return_receipt_cb, 0, "<ToggleItem>"},
+       {N_("/_Options/---"),           NULL,           NULL,   0, "<Separator>"},
        {N_("/_Options/Remo_ve references"),    NULL, compose_toggle_remove_refs_cb, 0, "<ToggleItem>"},
+       {N_("/_Options/---"),           NULL,           NULL,   0, "<Separator>"},
+
+#define ENC_ACTION(action) \
+       NULL, compose_set_encoding_cb, action, \
+       "/Options/Character encoding/Automatic"
+
+       {N_("/_Options/Character _encoding"), NULL, NULL, 0, "<Branch>"},
+       {N_("/_Options/Character _encoding/_Automatic"),
+                       NULL, compose_set_encoding_cb, C_AUTO, "<RadioItem>"},
+       {N_("/_Options/Character _encoding/---"), NULL, NULL, 0, "<Separator>"},
+
+       {N_("/_Options/Character _encoding/7bit ascii (US-ASC_II)"),
+        ENC_ACTION(C_US_ASCII)},
+       {N_("/_Options/Character _encoding/Unicode (_UTF-8)"),
+        ENC_ACTION(C_UTF_8)},
+       {N_("/_Options/Character _encoding/---"), NULL, NULL, 0, "<Separator>"},
+
+       {N_("/_Options/Character _encoding/Western European (ISO-8859-_1)"),
+        ENC_ACTION(C_ISO_8859_1)},
+       {N_("/_Options/Character _encoding/Western European (ISO-8859-15)"),
+        ENC_ACTION(C_ISO_8859_15)},
+       {N_("/_Options/Character _encoding/---"), NULL, NULL, 0, "<Separator>"},
+
+       {N_("/_Options/Character _encoding/Central European (ISO-8859-_2)"),
+        ENC_ACTION(C_ISO_8859_2)},
+       {N_("/_Options/Character _encoding/---"), NULL, NULL, 0, "<Separator>"},
+
+       {N_("/_Options/Character _encoding/_Baltic (ISO-8859-13)"),
+        ENC_ACTION(C_ISO_8859_13)},
+       {N_("/_Options/Character _encoding/Baltic (ISO-8859-_4)"),
+        ENC_ACTION(C_ISO_8859_4)},
+       {N_("/_Options/Character _encoding/---"), NULL, NULL, 0, "<Separator>"},
+
+       {N_("/_Options/Character _encoding/Greek (ISO-8859-_7)"),
+        ENC_ACTION(C_ISO_8859_7)},
+       {N_("/_Options/Character _encoding/---"), NULL, NULL, 0, "<Separator>"},
+
+       {N_("/_Options/Character _encoding/Hebrew (ISO-8859-_8)"),
+        ENC_ACTION(C_ISO_8859_8)},
+       {N_("/_Options/Character _encoding/Hebrew (Windows-1255)"),
+        ENC_ACTION(C_WINDOWS_1255)},
+       {N_("/_Options/Character _encoding/---"), NULL, NULL, 0, "<Separator>"},
+
+       {N_("/_Options/Character _encoding/Turkish (ISO-8859-_9)"),
+        ENC_ACTION(C_ISO_8859_9)},
+       {N_("/_Options/Character _encoding/---"), NULL, NULL, 0, "<Separator>"},
+
+       {N_("/_Options/Character _encoding/Cyrillic (ISO-8859-_5)"),
+        ENC_ACTION(C_ISO_8859_5)},
+       {N_("/_Options/Character _encoding/Cyrillic (KOI8-_R)"),
+        ENC_ACTION(C_KOI8_R)},
+       {N_("/_Options/Character _encoding/Cyrillic (KOI8-U)"),
+        ENC_ACTION(C_KOI8_U)},
+       {N_("/_Options/Character _encoding/Cyrillic (Windows-1251)"),
+        ENC_ACTION(C_WINDOWS_1251)},
+       {N_("/_Options/Character _encoding/---"), NULL, NULL, 0, "<Separator>"},
+
+       {N_("/_Options/Character _encoding/Japanese (ISO-2022-_JP)"),
+        ENC_ACTION(C_ISO_2022_JP)},
+       {N_("/_Options/Character _encoding/---"), NULL, NULL, 0, "<Separator>"},
+
+       {N_("/_Options/Character _encoding/Simplified Chinese (_GB2312)"),
+        ENC_ACTION(C_GB2312)},
+       {N_("/_Options/Character _encoding/Simplified Chinese (GBK)"),
+        ENC_ACTION(C_GBK)},
+       {N_("/_Options/Character _encoding/Traditional Chinese (_Big5)"),
+        ENC_ACTION(C_BIG5)},
+       {N_("/_Options/Character _encoding/Traditional Chinese (EUC-_TW)"),
+        ENC_ACTION(C_EUC_TW)},
+       {N_("/_Options/Character _encoding/---"), NULL, NULL, 0, "<Separator>"},
+
+       {N_("/_Options/Character _encoding/Korean (EUC-_KR)"),
+        ENC_ACTION(C_EUC_KR)},
+       {N_("/_Options/Character _encoding/---"), NULL, NULL, 0, "<Separator>"},
+
+       {N_("/_Options/Character _encoding/Thai (TIS-620)"),
+        ENC_ACTION(C_TIS_620)},
+       {N_("/_Options/Character _encoding/Thai (Windows-874)"),
+        ENC_ACTION(C_WINDOWS_874)},
+
        {N_("/_Tools"),                 NULL, NULL, 0, "<Branch>"},
        {N_("/_Tools/Show _ruler"),     NULL, compose_toggle_ruler_cb, 0, "<ToggleItem>"},
        {N_("/_Tools/_Address book"),   "<shift><control>A", compose_address_cb , 0, NULL},
@@ -3453,7 +3539,10 @@ static gint compose_write_to_file(Compose *compose, FILE *fp, gint action)
        } else {
                const gchar *src_codeset;
 
-               out_codeset = conv_get_outgoing_charset_str();
+               out_codeset = conv_get_charset_str(compose->out_encoding);
+               if (!out_codeset)
+                       out_codeset = conv_get_outgoing_charset_str();
+
                if (!g_ascii_strcasecmp(out_codeset, CS_US_ASCII))
                        out_codeset = CS_ISO_8859_1;
 
@@ -5022,6 +5111,8 @@ static Compose *compose_create(PrefsAccount *account, ComposeMode mode)
        compose->priority = PRIORITY_NORMAL;
        compose_update_priority_menu_item(compose);
 
+       compose_set_out_encoding(compose);
+       
        /* Actions menu */
        compose_update_actions_menu(compose);
 
@@ -5189,6 +5280,41 @@ static void compose_update_privacy_system_menu_item(Compose * compose)
        menu_set_sensitive(ifactory, "/Options/Encrypt", can_encrypt);
 }      
  
+static void compose_set_out_encoding(Compose *compose)
+{
+       GtkItemFactoryEntry *entry;
+       GtkItemFactory *ifactory;
+       CharSet out_encoding;
+       gchar *path, *p, *q;
+       GtkWidget *item;
+
+       out_encoding = conv_get_charset_from_str(prefs_common.outgoing_charset);
+       ifactory = gtk_item_factory_from_widget(compose->menubar);
+
+       for (entry = compose_entries; entry->callback != compose_address_cb;
+            entry++) {
+               if (entry->callback == compose_set_encoding_cb &&
+                   (CharSet)entry->callback_action == out_encoding) {
+                       p = q = path = g_strdup(entry->path);
+                       while (*p) {
+                               if (*p == '_') {
+                                       if (p[1] == '_') {
+                                               p++;
+                                               *q++ = '_';
+                                       }
+                               } else
+                                       *q++ = *p;
+                               p++;
+                       }
+                       *q = '\0';
+                       item = gtk_item_factory_get_item(ifactory, path);
+                       gtk_widget_activate(item);
+                       g_free(path);
+                       break;
+               }
+       }
+}
+
 static void compose_set_template_menu(Compose *compose)
 {
        GSList *tmpl_list, *cur;
@@ -6462,6 +6588,15 @@ static void compose_close_cb(gpointer data, guint action, GtkWidget *widget)
        compose_close(compose);
 }
 
+static void compose_set_encoding_cb(gpointer data, guint action,
+                                   GtkWidget *widget)
+{
+       Compose *compose = (Compose *)data;
+
+       if (GTK_CHECK_MENU_ITEM(widget)->active)
+               compose->out_encoding = (CharSet)action;
+}
+
 static void compose_address_cb(gpointer data, guint action, GtkWidget *widget)
 {
        Compose *compose = (Compose *)data;
index d28051abc8b8f50d215ee37d636a8a169dbb1a91..060dbe6a99f370e6fff32060ab6ff4e26614e501 100644 (file)
@@ -34,6 +34,7 @@ typedef struct _AttachInfo    AttachInfo;
 #include "undo.h"
 #include "toolbar.h"
 #include "messageview.h"
+#include "codeconv.h"
 
 #ifdef USE_ASPELL
 #include "gtkaspell.h"
@@ -172,6 +173,8 @@ struct _Compose
        gboolean use_followupto;
        gboolean use_attach;
 
+       CharSet out_encoding;
+
        /* privacy settings */
        gboolean use_signing;
        gboolean use_encryption;