From 12ad424164be25edf99c805e84bd9ea9112b800c Mon Sep 17 00:00:00 2001 From: Alfons Hoogervorst Date: Sat, 3 May 2003 15:01:13 +0000 Subject: [PATCH] * 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") --- ChangeLog.claws | 8 ++++++++ configure.ac | 2 +- src/compose.c | 19 +++++++++++++++---- src/compose.h | 1 - 4 files changed, 24 insertions(+), 6 deletions(-) diff --git a/ChangeLog.claws b/ChangeLog.claws index b98d602a6..a6b500f4e 100644 --- a/ChangeLog.claws +++ b/ChangeLog.claws @@ -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 diff --git a/configure.ac b/configure.ac index d76abebce..510eb7122 100644 --- a/configure.ac +++ b/configure.ac @@ -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 diff --git a/src/compose.c b/src/compose.c index 38c12bc25..8910d1043 100644 --- a/src/compose.c +++ b/src/compose.c @@ -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); diff --git a/src/compose.h b/src/compose.h index 640e4be45..d292ea92d 100644 --- a/src/compose.h +++ b/src/compose.h @@ -180,7 +180,6 @@ struct _Compose gboolean sending; gboolean return_receipt; - gboolean paste_as_quotation; GSList *to_list; GSList *newsgroup_list; -- 2.25.1