sync with sylpheed 0.6.5cvs25
authorPaul Mangan <paul@claws-mail.org>
Tue, 11 Dec 2001 09:18:29 +0000 (09:18 +0000)
committerPaul Mangan <paul@claws-mail.org>
Tue, 11 Dec 2001 09:18:29 +0000 (09:18 +0000)
12 files changed:
ChangeLog
ChangeLog.claws
ChangeLog.jp
configure.in
src/compose.c
src/gtkutils.c
src/gtkutils.h
src/mainwindow.c
src/messageview.c
src/mimeview.c
src/summaryview.c
src/textview.c

index 525e978..877bf3b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2001-12-11
+
+       * src/gtkutils.[ch]: gtkut_container_remove(): new. It's a wrapper
+         of gtk_container_remove() for workaround of a bug in
+         Gtk{Text,Entry} (thanks to Sergey Vlasov).
+       * src/compose.c
+         src/mainwindow.c
+         src/messageview.c
+         src/mimeview.c
+         src/summaryview.c
+         src/textview.c: replaced gtk_container_remove() with
+         gtkut_container_remove(), and removed previous partial fix.
+
 2001-12-09
 
        * src/prefs_account.c: prefs_account_apply(): fixed a bug that
index d718a9b..8fb948d 100644 (file)
@@ -1,3 +1,8 @@
+2001-12-11 [paul]      0.6.5claws74
+
+       * sync with sylpheed 0.6.5cvs25
+               see ChangeLog entry 2001-12-11
+
 2001-12-10 [alfons]    0.6.5claws73
 
        * src/matcher.c
index 72cc8e6..59fb9e3 100644 (file)
@@ -1,3 +1,16 @@
+2001-12-11
+
+       * src/gtkutils.[ch]: gtkut_container_remove(): ¿·µ¬¡£ Gtk{Text,Entry}
+         ¤Î¥Ð¥°¤Ø¤ÎÂнè¤Î¤¿¤á¤Î gtk_container_remove() ¤Î¥é¥Ã¥Ñ¡¼
+         (Sergey Vlasov ¤µ¤ó thanks)¡£
+       * src/compose.c
+         src/mainwindow.c
+         src/messageview.c
+         src/mimeview.c
+         src/summaryview.c
+         src/textview.c: gtk_container_remove() ¤ò gtkut_container_remove()
+         ¤ÇÃÖ´¹¤·¡¢°ÊÁ°¤ÎÉôʬŪ¤Ê½¤Àµ¤òºï½ü¡£
+
 2001-12-09
 
        * src/prefs_account.c: prefs_account_apply(): ¡Ö¥í¡¼¥«¥ë¡×¤Ç
index d6d416a..3dde6a6 100644 (file)
@@ -8,7 +8,7 @@ MINOR_VERSION=6
 MICRO_VERSION=5
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=claws73
+EXTRA_VERSION=claws74
 VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$EXTRA_VERSION
 
 dnl
index 009061b..4c4deb5 100644 (file)
@@ -5938,8 +5938,8 @@ static void compose_toggle_attach_cb(gpointer data, guint action,
        if (GTK_CHECK_MENU_ITEM(widget)->active) {
                gtk_widget_ref(compose->edit_vbox);
 
-               gtk_container_remove(GTK_CONTAINER(compose->vbox2),
-                                    compose->edit_vbox);
+               gtkut_container_remove(GTK_CONTAINER(compose->vbox2),
+                                      compose->edit_vbox);
                gtk_paned_add2(GTK_PANED(compose->paned), compose->edit_vbox);
                gtk_box_pack_start(GTK_BOX(compose->vbox2), compose->paned,
                                   TRUE, TRUE, 0);
@@ -5953,10 +5953,10 @@ static void compose_toggle_attach_cb(gpointer data, guint action,
                gtk_widget_ref(compose->paned);
                gtk_widget_ref(compose->edit_vbox);
 
-               gtk_container_remove(GTK_CONTAINER(compose->vbox2),
-                                    compose->paned);
-               gtk_container_remove(GTK_CONTAINER(compose->paned),
-                                    compose->edit_vbox);
+               gtkut_container_remove(GTK_CONTAINER(compose->vbox2),
+                                      compose->paned);
+               gtkut_container_remove(GTK_CONTAINER(compose->paned),
+                                      compose->edit_vbox);
                gtk_box_pack_start(GTK_BOX(compose->vbox2),
                                   compose->edit_vbox, TRUE, TRUE, 0);
 
index a968907..238eef4 100644 (file)
@@ -248,6 +248,46 @@ void gtkut_combo_set_items(GtkCombo *combo, const gchar *str1, ...)
        g_list_free(combo_items);
 }
 
+/*
+ * Walk through the widget tree and disclaim the selection from all currently
+ * realized GtkEditable widgets.
+ */
+static void gtkut_check_before_remove(GtkWidget *widget, gpointer unused)
+{
+       g_return_if_fail(widget != NULL);
+
+       if (!GTK_WIDGET_REALIZED(widget))
+               return; /* all nested widgets must be unrealized too */
+       if (GTK_IS_CONTAINER(widget))
+               gtk_container_forall(GTK_CONTAINER(widget),
+                                    gtkut_check_before_remove, NULL);
+       if (GTK_IS_EDITABLE(widget))
+               gtk_editable_claim_selection(GTK_EDITABLE(widget),
+                                            FALSE, GDK_CURRENT_TIME);
+}
+
+/*
+ * Wrapper around gtk_container_remove to work around a bug in GtkText and
+ * GtkEntry (in all GTK+ versions up to and including at least 1.2.10).
+ *
+ * The problem is that unrealizing a GtkText or GtkEntry widget which has the
+ * active selection completely messes up selection handling, leading to
+ * non-working selections and crashes.  Removing a widget from its container
+ * implies unrealizing it and all its child widgets; this triggers the bug if
+ * the removed widget or any of its children is GtkText or GtkEntry.  As a
+ * workaround, this function walks through the widget subtree before removing
+ * and disclaims the selection from all GtkEditable widgets found.
+ *
+ * A similar workaround may be needed for gtk_widget_reparent(); currently it
+ * is not necessary because Sylpheed does not use gtk_widget_reparent() for
+ * GtkEditable widgets or containers holding such widgets.
+ */
+void gtkut_container_remove(GtkContainer *container, GtkWidget *widget)
+{
+       gtkut_check_before_remove(widget, NULL);
+       gtk_container_remove(container, widget);
+}
+
 gboolean gtkut_text_match_string(GtkSText *text, gint pos, wchar_t *wcs,
                                 gint len, gboolean case_sens)
 {
index 25a3289..4b9fdae 100644 (file)
@@ -28,6 +28,8 @@
 #include <gdk/gdk.h>
 #include <gtk/gtkmain.h>
 #include <gtk/gtkwidget.h>
+#include <gtk/gtkcontainer.h>
+#include <gtk/gtkeditable.h>
 #include <gtk/gtkctree.h>
 #include <gtk/gtkcombo.h>
 #include "gtkstext.h"
@@ -100,6 +102,9 @@ void gtkut_clist_set_focus_row              (GtkCList       *clist,
 void gtkut_combo_set_items             (GtkCombo       *combo,
                                         const gchar    *str1, ...);
 
+void gtkut_container_remove            (GtkContainer   *container,
+                                        GtkWidget      *widget);
+
 gboolean gtkut_text_match_string       (GtkSText       *text,
                                         gint            pos,
                                         wchar_t        *wcs,
index 4fc83a6..9fa7c3a 100644 (file)
@@ -1109,11 +1109,11 @@ void main_window_separation_change(MainWindow *mainwin, SeparateType type)
        gtk_widget_ref(folder_wid);
        gtk_widget_ref(summary_wid);
        gtk_widget_ref(message_wid);
-       gtk_container_remove
+       gtkut_container_remove
                (GTK_CONTAINER(folder_wid->parent), folder_wid);
-       gtk_container_remove
+       gtkut_container_remove
                (GTK_CONTAINER(summary_wid->parent), summary_wid);
-       gtk_container_remove
+       gtkut_container_remove
                (GTK_CONTAINER(message_wid->parent), message_wid);
 
        /* clean containers */
index 056c753..2cc74f5 100644 (file)
@@ -472,9 +472,7 @@ static void messageview_change_view_type(MessageView *messageview,
        if (messageview->type == type) return;
 
        if (type == MVIEW_MIME) {
-               gtk_editable_claim_selection(GTK_EDITABLE(textview->text),
-                                            FALSE, GDK_CURRENT_TIME);
-               gtk_container_remove
+               gtkut_container_remove
                        (GTK_CONTAINER(GTK_WIDGET_PTR(messageview)),
                         GTK_WIDGET_PTR(textview));
                gtk_box_pack_start(GTK_BOX(messageview->vbox),
@@ -483,18 +481,16 @@ static void messageview_change_view_type(MessageView *messageview,
                                  GTK_WIDGET_PTR(textview));
                mimeview->type = MIMEVIEW_TEXT;
        } else if (type == MVIEW_TEXT) {
-               gtk_editable_claim_selection(GTK_EDITABLE(textview->text),
-                                            FALSE, GDK_CURRENT_TIME);
-               gtk_container_remove
+               gtkut_container_remove
                        (GTK_CONTAINER(GTK_WIDGET_PTR(messageview)),
                         GTK_WIDGET_PTR(mimeview));
 
                if (mimeview->vbox == GTK_WIDGET_PTR(textview)->parent) {
-                       gtk_container_remove(GTK_CONTAINER(mimeview->vbox),
-                                            GTK_WIDGET_PTR(textview));
+                       gtkut_container_remove(GTK_CONTAINER(mimeview->vbox),
+                                              GTK_WIDGET_PTR(textview));
                } else {
-                       gtk_container_remove(GTK_CONTAINER(mimeview->vbox),
-                                            GTK_WIDGET_PTR(imageview));
+                       gtkut_container_remove(GTK_CONTAINER(mimeview->vbox),
+                                              GTK_WIDGET_PTR(imageview));
                }
 
                gtk_box_pack_start(GTK_BOX(messageview->vbox),
index 14e0438..b4fbcb7 100644 (file)
@@ -447,14 +447,14 @@ static void mimeview_change_view_type(MimeView *mimeview, MimeViewType type)
 
        switch (type) {
        case MIMEVIEW_IMAGE:
-               gtk_container_remove(GTK_CONTAINER(mimeview->vbox),
-                                    GTK_WIDGET_PTR(textview));
+               gtkut_container_remove(GTK_CONTAINER(mimeview->vbox),
+                                      GTK_WIDGET_PTR(textview));
                gtk_container_add(GTK_CONTAINER(mimeview->vbox),
                                  GTK_WIDGET_PTR(imageview));
                break;
        case MIMEVIEW_TEXT:
-               gtk_container_remove(GTK_CONTAINER(mimeview->vbox),
-                                    GTK_WIDGET_PTR(imageview));
+               gtkut_container_remove(GTK_CONTAINER(mimeview->vbox),
+                                      GTK_WIDGET_PTR(imageview));
                gtk_container_add(GTK_CONTAINER(mimeview->vbox),
                                  GTK_WIDGET_PTR(textview));
                break;
index c73f331..a305bca 100644 (file)
@@ -2362,10 +2362,7 @@ static void summary_toggle_view(SummaryView *summaryview)
                summaryview->msg_is_toggled_on = FALSE;
                summaryview->displayed = NULL;
                gtk_widget_ref(vpaned);
-               gtk_editable_claim_selection
-                       (GTK_EDITABLE(summaryview->messageview->textview->text),
-                        FALSE, GDK_CURRENT_TIME);
-               gtk_container_remove(GTK_CONTAINER(container), vpaned);
+               gtkut_container_remove(GTK_CONTAINER(container), vpaned);
                gtk_widget_reparent(GTK_WIDGET_PTR(summaryview), container);
                gtk_arrow_set(GTK_ARROW(summaryview->toggle_arrow),
                              GTK_ARROW_UP, GTK_SHADOW_OUT);
index 53d8e0f..6ad5732 100644 (file)
@@ -958,10 +958,8 @@ void textview_set_font(TextView *textview, const gchar *codeset)
                GtkWidget *parent;
 
                parent = textview->scrolledwin_mb->parent;
-               gtk_editable_claim_selection(GTK_EDITABLE(textview->text_mb),
-                                            FALSE, GDK_CURRENT_TIME);
-               gtk_container_remove(GTK_CONTAINER(parent),
-                                    textview->scrolledwin_mb);
+               gtkut_container_remove(GTK_CONTAINER(parent),
+                                      textview->scrolledwin_mb);
                gtk_container_add(GTK_CONTAINER(parent),
                                  textview->scrolledwin_sb);
 
@@ -971,10 +969,8 @@ void textview_set_font(TextView *textview, const gchar *codeset)
                GtkWidget *parent;
 
                parent = textview->scrolledwin_sb->parent;
-               gtk_editable_claim_selection(GTK_EDITABLE(textview->text_sb),
-                                            FALSE, GDK_CURRENT_TIME);
-               gtk_container_remove(GTK_CONTAINER(parent),
-                                    textview->scrolledwin_sb);
+               gtkut_container_remove(GTK_CONTAINER(parent),
+                                      textview->scrolledwin_sb);
                gtk_container_add(GTK_CONTAINER(parent),
                                  textview->scrolledwin_mb);