* src/compose.[ch]
authorAlfons Hoogervorst <alfons@proteus.demon.nl>
Sat, 3 May 2003 15:01:13 +0000 (15:01 +0000)
committerAlfons Hoogervorst <alfons@proteus.demon.nl>
Sat, 3 May 2003 15:01:13 +0000 (15:01 +0000)
make paste as quotation work even when the call to
text_inserted() was deferred (fixes bug #140 "Paste
as quotation does not work when using "external"
clipboard")

ChangeLog.claws
configure.ac
src/compose.c
src/compose.h

index b98d602..a6b500f 100644 (file)
@@ -1,3 +1,11 @@
+2003-05-03 [alfons]    0.8.11claws141
+
+       * src/compose.[ch]
+               make paste as quotation work even when the call to 
+               text_inserted() was deferred (fixes bug #140 "Paste 
+               as quotation does not work when using "external" 
+               clipboard")
+
 2003-05-03 [thorsten]  0.8.11claws140
 
        * src/addrquery.h
index d76abeb..510eb71 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=8
 MICRO_VERSION=11
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=claws140
+EXTRA_VERSION=claws141
 VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$EXTRA_VERSION
 
 dnl set $target
index 38c12bc..8910d10 100644 (file)
@@ -5063,7 +5063,6 @@ static Compose *compose_create(PrefsAccount *account, ComposeMode mode)
        compose->modified = FALSE;
 
        compose->return_receipt = FALSE;
-       compose->paste_as_quotation = FALSE;
 
        compose->to_list        = NULL;
        compose->newsgroup_list = NULL;
@@ -6472,10 +6471,18 @@ static void compose_paste_as_quote_cb(Compose *compose)
 {
        if (compose->focused_editable &&
            GTK_WIDGET_HAS_FOCUS(compose->focused_editable)) {
-               compose->paste_as_quotation = TRUE;
+               /* let text_insert() (called directly or at a later time
+                * after the gtk_editable_paste_clipboard) know that 
+                * text is to be inserted as a quotation. implemented
+                * by using a simple refcount... */
+               gint paste_as_quotation = GPOINTER_TO_INT(gtk_object_get_data(
+                                               GTK_OBJECT(compose->focused_editable),
+                                               "paste_as_quotation"));
+               gtk_object_set_data(GTK_OBJECT(compose->focused_editable),
+                                   "paste_as_quotation",
+                                   GINT_TO_POINTER(paste_as_quotation + 1));
                gtk_editable_paste_clipboard
                        (GTK_EDITABLE(compose->focused_editable));
-               compose->paste_as_quotation = FALSE;
        }
 }
 
@@ -6929,11 +6936,13 @@ static void text_inserted(GtkWidget *widget, const gchar *text,
                          gint length, gint *position, Compose *compose)
 {
        GtkEditable *editable = GTK_EDITABLE(widget);
+       gint paste_as_quotation = GPOINTER_TO_INT(gtk_object_get_data
+                               (GTK_OBJECT(widget), "paste_as_quotation"));
 
        gtk_signal_handler_block_by_func(GTK_OBJECT(widget),
                                         GTK_SIGNAL_FUNC(text_inserted),
                                         compose);
-       if (compose->paste_as_quotation) {
+       if (paste_as_quotation) {
                gchar *new_text;
                gchar *qmark;
                gint pos;
@@ -6949,6 +6958,8 @@ static void text_inserted(GtkWidget *widget, const gchar *text,
                gtk_editable_set_position(editable, pos);
                *position = pos;
                g_free(new_text);
+               gtk_object_set_data(GTK_OBJECT(widget), "paste_as_quotation",
+                                   GINT_TO_POINTER(paste_as_quotation - 1));
        } else
                gtk_editable_insert_text(editable, text, length, position);
 
index 640e4be..d292ea9 100644 (file)
@@ -180,7 +180,6 @@ struct _Compose
        gboolean sending;
        
        gboolean return_receipt;
-       gboolean paste_as_quotation;
 
        GSList *to_list;
        GSList *newsgroup_list;