2005-10-21 [colin] 1.9.15cvs89
authorColin Leroy <colin@colino.net>
Fri, 21 Oct 2005 17:31:15 +0000 (17:31 +0000)
committerColin Leroy <colin@colino.net>
Fri, 21 Oct 2005 17:31:15 +0000 (17:31 +0000)
* src/prefs_filtering.c
Clear fields after add and replace
* src/textview.c
Display xface differently (better)
* src/plugins/pgpinline/pgpinline.c
Fix crappy encodings/recodings

ChangeLog-gtk2.claws
PATCHSETS
configure.ac
src/plugins/pgpinline/pgpinline.c
src/prefs_filtering.c
src/textview.c

index 0c77574..c71bfdf 100644 (file)
@@ -1,3 +1,12 @@
+2005-10-21 [colin]     1.9.15cvs89
+
+       * src/prefs_filtering.c
+               Clear fields after add and replace
+       * src/textview.c
+               Display xface differently (better)
+       * src/plugins/pgpinline/pgpinline.c
+               Fix crappy encodings/recodings
+
 2005-10-21 [paul]      1.9.15cvs88
 
        * src/compose.c
index 09eedec..5dce8d7 100644 (file)
--- a/PATCHSETS
+++ b/PATCHSETS
 ( cvs diff -u -r 1.149.2.37 -r 1.149.2.38 src/inc.c;  ) > 1.9.15cvs86.patchset
 ( cvs diff -u -r 1.25.2.6 -r 1.25.2.7 tools/Makefile.am;  cvs diff -u -r 1.3.2.1 -r 1.3.2.2 tools/OOo2sylpheed.pl;  cvs diff -u -r 1.30.2.5 -r 1.30.2.6 tools/README;  cvs diff -u -r 1.1 -r 1.2 tools/README.sylprint;  cvs diff -u -r -1.1.2.2 -r -1.1.2.3 tools/asus_mailled.sh;  cvs diff -u -r 1.16.2.2 -r 1.16.2.3 tools/filter_conv.pl;  cvs diff -u -r 1.3.2.1 -r 1.3.2.2 tools/freshmeat_search.pl;  cvs diff -u -r 1.3.2.1 -r 1.3.2.2 tools/google_search.pl;  cvs diff -u -r -1.1 -r -1.2 tools/gpg-sign-syl;  cvs diff -u -r 1.1.14.1 -r 1.1.14.2 tools/kmail2sylpheed.pl;  cvs diff -u -r 1.3.4.1 -r 1.3.4.2 tools/kmail2sylpheed_v2.pl;  cvs diff -u -r 1.3.2.1 -r 1.3.2.2 tools/multiwebsearch.pl;  cvs diff -u -r 1.2.2.1 -r 1.2.2.2 tools/nautilus2sylpheed.sh;  cvs diff -u -r 1.2.14.1 -r 1.2.14.2 tools/newscache_clean.pl;  cvs diff -u -r 1.2.2.1 -r 1.2.2.2 tools/outlook2sylpheed.pl;  cvs diff -u -r -1.1.14.1 -r -1.1.14.2 tools/sylpheed-switcher;  cvs diff -u -r 1.2 -r 1.3 tools/sylprint.pl;  cvs diff -u -r 1.1 -r 1.2 tools/sylprint.rc;  cvs diff -u -r 1.2.2.1 -r 1.2.2.2 tools/tb2sylpheed;  cvs diff -u -r 1.1.4.2 -r 1.1.4.3 tools/vcard2xml.py;  cvs diff -u -r 1.5.2.2 -r 1.5.2.3 tools/kdeservicemenu/sylpheed-kdeservicemenu.pl;  ) > 1.9.15cvs87.patchset
 ( cvs diff -u -r 1.382.2.185 -r 1.382.2.186 src/compose.c;  cvs diff -u -r 1.207.2.77 -r 1.207.2.78 src/folderview.c;  cvs diff -u -r 1.52.2.15 -r 1.52.2.16 src/prefs_folder_item.c;  cvs diff -u -r 1.43.2.31 -r 1.43.2.32 src/toolbar.c;  ) > 1.9.15cvs88.patchset
+( cvs diff -u -r 1.59.2.25 -r 1.59.2.26 src/prefs_filtering.c;  cvs diff -u -r 1.96.2.81 -r 1.96.2.82 src/textview.c;  cvs diff -u -r 1.1.2.7 -r 1.1.2.8 src/plugins/pgpinline/pgpinline.c;  ) > 1.9.15cvs89.patchset
index 8a71bd2..c4aa8bc 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=9
 MICRO_VERSION=15
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=88
+EXTRA_VERSION=89
 EXTRA_RELEASE=
 EXTRA_GTK2_VERSION=
 
index dab84d4..f20aae8 100644 (file)
@@ -78,6 +78,37 @@ static void pgpinline_free_privacydata(PrivacyData *_data)
        g_free(data);
 }
 
+static gchar *fp_read_noconv(FILE *fp)
+{
+       GByteArray *array;
+       guchar buf[BUFSIZ];
+       gint n_read;
+       gchar *result = NULL;
+
+       if (!fp)
+               return NULL;
+       array = g_byte_array_new();
+
+       while ((n_read = fread(buf, sizeof(gchar), sizeof(buf), fp)) > 0) {
+               if (n_read < sizeof(buf) && ferror(fp))
+                       break;
+               g_byte_array_append(array, buf, n_read);
+       }
+
+       if (ferror(fp)) {
+               FILE_OP_ERROR("file stream", "fread");
+               g_byte_array_free(array, TRUE);
+               return NULL;
+       }
+
+       buf[0] = '\0';
+       g_byte_array_append(array, buf, 1);
+       result = (gchar *)array->data;
+       g_byte_array_free(array, FALSE);
+       
+       return result;
+}
+
 static gchar *get_part_as_string(MimeInfo *mimeinfo)
 {
        gchar *textdata = NULL;
@@ -86,8 +117,39 @@ static gchar *get_part_as_string(MimeInfo *mimeinfo)
        procmime_decode_content(mimeinfo);
        if (mimeinfo->content == MIMECONTENT_MEM)
                textdata = g_strdup(mimeinfo->data.mem);
-       else
-               textdata = file_read_to_str(mimeinfo->data.filename);
+       else {
+               /* equals file_read_to_str but without conversion */
+               FILE *fp = fopen(mimeinfo->data.filename, "r");
+               if (!fp)
+                       return NULL;
+               textdata = fp_read_noconv(fp);
+               fclose(fp);
+       }
+
+       if (!g_utf8_validate(textdata, -1, NULL)) {
+               gchar *tmp = NULL;
+               codeconv_set_strict(TRUE);
+               if (procmime_mimeinfo_get_parameter(mimeinfo, "charset")) {
+                       tmp = conv_codeset_strdup(textdata,
+                               procmime_mimeinfo_get_parameter(mimeinfo, "charset"),
+                               CS_UTF_8);
+               }
+               if (!tmp) {
+                       tmp = conv_codeset_strdup(textdata,
+                               conv_get_locale_charset_str_no_utf8(), 
+                               CS_UTF_8);
+               }
+               codeconv_set_strict(FALSE);
+               if (!tmp) {
+                       tmp = conv_codeset_strdup(textdata,
+                               conv_get_locale_charset_str_no_utf8(), 
+                               CS_UTF_8);
+               }
+               if (tmp) {
+                       g_free(textdata);
+                       textdata = tmp;
+               }
+       }
 
        return textdata;        
 }
@@ -409,15 +471,8 @@ static gboolean pgpinline_sign(MimeInfo *mimeinfo, PrefsAccount *account)
        rewind(fp);
 
        /* read temporary file into memory */
-       textstr = file_read_stream_to_str(fp);
+       textstr = fp_read_noconv(fp);
        
-       /* gtk2: convert back from utf8 */
-       tmp = conv_codeset_strdup(textstr, CS_UTF_8, 
-                       procmime_mimeinfo_get_parameter(msgcontent, "charset"));
-       g_free(textstr);
-       textstr = g_strdup(tmp);
-       g_free(tmp);
-
        fclose(fp);
                
        gpgme_data_new_from_mem(&gpgtext, textstr, strlen(textstr), 0);
@@ -526,14 +581,8 @@ static gboolean pgpinline_encrypt(MimeInfo *mimeinfo, const gchar *encrypt_data)
        rewind(fp);
 
        /* read temporary file into memory */
-       textstr = file_read_stream_to_str(fp);
+       textstr = fp_read_noconv(fp);
        
-       /* gtk2: convert back from utf8 */
-       tmp = conv_codeset_strdup(textstr, CS_UTF_8, 
-                       procmime_mimeinfo_get_parameter(msgcontent, "charset"));
-       g_free(textstr);
-       textstr = g_strdup(tmp);
-       g_free(tmp);
        fclose(fp);
 
        /* encrypt data */
index 6b83796..a53b109 100644 (file)
@@ -884,6 +884,8 @@ static void prefs_filtering_register_cb(void)
        prefs_filtering_list_view_set_row(-1, prop);
        
        filteringprop_free(prop);
+
+       prefs_filtering_reset_dialog();
 }
 
 static void prefs_filtering_substitute_cb(void)
@@ -901,6 +903,8 @@ static void prefs_filtering_substitute_cb(void)
        prefs_filtering_list_view_set_row(selected_row, prop);
 
        filteringprop_free(prop);
+
+       prefs_filtering_reset_dialog();
 }
 
 static void prefs_filtering_delete_cb(void)
index ef95231..5380943 100644 (file)
@@ -242,16 +242,24 @@ static void scrolled_cb (GtkAdjustment *adj, TextView *textview)
 {
 #if HAVE_LIBCOMPFACE
        if (textview->image) {
-               gint x, y;
+               gint x, y, x1;
+               x1 = textview->text->allocation.width - WIDTH - 5;
                gtk_text_view_buffer_to_window_coords(
                        GTK_TEXT_VIEW(textview->text),
-                       GTK_TEXT_WINDOW_RIGHT, 5, 5, &x, &y);
+                       GTK_TEXT_WINDOW_TEXT, x1, 5, &x, &y);
                gtk_text_view_move_child(GTK_TEXT_VIEW(textview->text), 
-                       textview->image, 5, y);
+                       textview->image, x1, y);
        }
 #endif
 }
 
+static void textview_size_allocate_cb  (GtkWidget      *widget,
+                                        GtkAllocation  *allocation,
+                                        gpointer        data)
+{
+       scrolled_cb(NULL, (TextView *)data);
+}
+
 TextView *textview_create(void)
 {
        TextView *textview;
@@ -309,6 +317,10 @@ TextView *textview_create(void)
                GTK_SCROLLED_WINDOW(scrolledwin));
        g_signal_connect(G_OBJECT(adj), "value-changed",
                         G_CALLBACK(scrolled_cb), textview);
+       g_signal_connect(G_OBJECT(text), "size_allocate",
+                        G_CALLBACK(textview_size_allocate_cb),
+                        textview);
+
 
        gtk_widget_show(scrolledwin);
 
@@ -504,7 +516,6 @@ void textview_show_part(TextView *textview, MimeInfo *mimeinfo, FILE *fp)
                textview_add_parts(textview, mimeinfo);
        else
                textview_write_body(textview, mimeinfo);
-
 }
 
 static void textview_add_part(TextView *textview, MimeInfo *mimeinfo)
@@ -1124,8 +1135,6 @@ void textview_clear(TextView *textview)
        if (textview->image) 
                gtk_widget_destroy(textview->image);
        textview->image = NULL;
-       gtk_text_view_set_border_window_size(text, GTK_TEXT_WINDOW_RIGHT, 
-               0);
 }
 
 void textview_destroy(TextView *textview)
@@ -1297,9 +1306,7 @@ static void textview_show_xface(TextView *textview)
        GdkPixmap *pixmap;
        GdkBitmap *mask;
        GtkTextView *text = GTK_TEXT_VIEW(textview->text);
-       
-       gtk_text_view_set_border_window_size(text, GTK_TEXT_WINDOW_RIGHT, 0);
-
+       int x = 0;
        if (prefs_common.display_header_pane
        ||  !prefs_common.display_xface)
                goto bail;
@@ -1334,16 +1341,16 @@ static void textview_show_xface(TextView *textview)
                (textview->text->window, &mask, 
                 &textview->text->style->white, xpm_xface);
        
-       gtk_text_view_set_border_window_size(text, GTK_TEXT_WINDOW_RIGHT, 
-               WIDTH+10);
-
        if (textview->image) 
                gtk_widget_destroy(textview->image);
        
        textview->image = gtk_image_new_from_pixmap(pixmap, mask);
        gtk_widget_show(textview->image);
+       
+       x = textview->text->allocation.width - WIDTH -5;
+
        gtk_text_view_add_child_in_window(text, textview->image, 
-               GTK_TEXT_WINDOW_RIGHT, 5, 5);
+               GTK_TEXT_WINDOW_TEXT, x, 5);
 
        gtk_widget_show_all(textview->text);