proper utf8
authorColin Leroy <colin@colino.net>
Sun, 18 Jul 2004 11:39:58 +0000 (11:39 +0000)
committerColin Leroy <colin@colino.net>
Sun, 18 Jul 2004 11:39:58 +0000 (11:39 +0000)
ChangeLog-gtk2.claws
PATCHSETS
configure.ac
src/sourcewindow.c

index 4a8b10ae022fa7b2f4a0f35f76ce73f7725f6f71..422910d856dcbaa8f2ddaa76632c7570a62b4da2 100644 (file)
@@ -1,3 +1,8 @@
+2004-07-18 [colin]     0.9.12cvs32.3
+
+       * src/sourcewindow.c
+               Proper utf8
+
 2004-07-18 [colin]     0.9.12cvs32.2
 
        * src/compose.c
index cb19123b01d1859233217399853770ddd7c29e26..37c0a0fa9b8ea4de6d3e3f8843f0cad6955add70 100644 (file)
--- a/PATCHSETS
+++ b/PATCHSETS
@@ -50,3 +50,4 @@
 ( cvs diff -u -r 1.56.2.19 -r 1.56.2.20 src/pop.c; ) > 0.9.12cvs31.11.patchset
 ( cvs diff -u -r 1.2.2.7 -r 1.2.2.8 src/gtk/filesel.c; ) > 0.9.12cvs31.12.patchset
 ( cvs diff -u -r 1.382.2.26 -r 1.382.2.27 src/compose.c; ) > 0.9.12cvs32.2.patchset
+( cvs diff -u -r 1.9.2.3 -r 1.9.2.4 src/sourcewindow.c; ) > 0.9.12cvs32.3.patchset
index e5700eb5902646e742db000d62ce94ca1885a311..90d0d56de734adb872e1f5dbcab737cb92e28933 100644 (file)
@@ -13,7 +13,7 @@ INTERFACE_AGE=0
 BINARY_AGE=0
 EXTRA_VERSION=32
 EXTRA_RELEASE=
-EXTRA_GTK2_VERSION=.2
+EXTRA_GTK2_VERSION=.3
 
 if test \( $EXTRA_VERSION -eq 0 \) -o \( "x$EXTRA_RELEASE" != "x" \); then
     VERSION=${MAJOR_VERSION}.${MINOR_VERSION}.${MICRO_VERSION}${EXTRA_RELEASE}${EXTRA_GTK2_VERSION}
index 1b056e6e80848d9b3f5e77a9bc4def7185fbb1bc..7a1d1f383f525c9c9b13081bf1393cfd529dd1d9 100644 (file)
@@ -153,9 +153,20 @@ void source_window_append(SourceWindow *sourcewin, const gchar *str)
        Xalloca(out, len, return);
        
        conv_localetodisp(out, len, str);
-
-       gtk_text_buffer_get_iter_at_offset(buffer, &iter, -1);
-       gtk_text_buffer_insert(buffer, &iter, out, -1);
+       if (!g_utf8_validate(out, -1, NULL)) {
+               gchar *buf;
+               gint buflen;
+               const gchar *src_codeset, *dest_codeset;
+               src_codeset = conv_get_current_charset_str();
+               dest_codeset = CS_UTF_8;
+               buf = conv_codeset_strdup(out, src_codeset, dest_codeset);
+               gtk_text_buffer_get_iter_at_offset(buffer, &iter, -1);
+               gtk_text_buffer_insert(buffer, &iter, buf, -1);
+               g_free(buf);
+       } else {
+               gtk_text_buffer_get_iter_at_offset(buffer, &iter, -1);
+               gtk_text_buffer_insert(buffer, &iter, out, -1);
+       }
 }
 
 static void source_window_size_alloc_cb(GtkWidget *widget,
@@ -185,6 +196,11 @@ static gboolean key_pressed(GtkWidget *widget, GdkEventKey *event,
                if ((event->state & GDK_CONTROL_MASK) != 0)
                        gtk_editable_select_region(GTK_EDITABLE(sourcewin->text), 0, -1);
                break;
+       case GDK_W:
+       case GDK_w:
+               if ((event->state & GDK_CONTROL_MASK) != 0)
+                       gtk_widget_destroy(sourcewin->window);
+               break;
        case GDK_Escape:
                gtk_widget_destroy(sourcewin->window);
                break;