[evolution-patches] [gtkhtml] #50646Multiple dialogs open on 'Replace'
- From: Radek Doulík <rodo novell com>
- To: Patches <evolution-patches ximian com>
- Cc: Larry Ewing <lewing ximian com>
- Subject: [evolution-patches] [gtkhtml] #50646Multiple dialogs open on 'Replace'
- Date: Fri, 15 Oct 2004 19:29:20 +0200
Attached patch fixes the bug better than the patch on the e-p from Jan 29 as it doesn't let grow the stack so much.
Index: components/html-editor/ChangeLog
===================================================================
RCS file: /cvs/gnome/gtkhtml/components/html-editor/ChangeLog,v
retrieving revision 1.476
diff -u -p -r1.476 ChangeLog
--- components/html-editor/ChangeLog 15 Oct 2004 14:32:25 -0000 1.476
+++ components/html-editor/ChangeLog 15 Oct 2004 17:23:19 -0000
@@ -1,5 +1,12 @@
2004-10-15 Radek Doulik <rodo ximian com>
+ * replace.c: add finished flag to ask dialog
+ (ask_dialog_response): set finished flag by return value from
+ html_engine_replace_do
+ (ask): run ask dialog until replacing process is finished
+
+ Fixes #50646
+
* test-html-editor-control.c (save_through_plain_persist_stream):
fixed save plain
Index: components/html-editor/replace.c
===================================================================
RCS file: /cvs/gnome/gtkhtml/components/html-editor/replace.c,v
retrieving revision 1.21
diff -u -p -r1.21 replace.c
--- components/html-editor/replace.c 12 Mar 2004 16:15:52 -0000 1.21
+++ components/html-editor/replace.c 15 Oct 2004 17:23:19 -0000
@@ -31,6 +31,7 @@
struct _GtkHTMLReplaceAskDialog {
GtkDialog *dialog;
HTMLEngine *engine;
+ gboolean finished;
};
typedef struct _GtkHTMLReplaceAskDialog GtkHTMLReplaceAskDialog;
@@ -49,22 +50,21 @@ struct _GtkHTMLReplaceDialog {
static void
ask_dialog_response (GtkDialog *dialog, gint response_id, GtkHTMLReplaceAskDialog *d)
{
+ HTMLReplaceQueryAnswer answer = RQA_Cancel;
+
switch (response_id) {
- case GTK_RESPONSE_DELETE_EVENT:
- case GTK_RESPONSE_CLOSE:
- case GTK_RESPONSE_CANCEL:
- html_engine_replace_do (d->engine, RQA_Cancel);
- break;
case 0: /* Replace */
- html_engine_replace_do (d->engine, RQA_Replace);
+ answer = RQA_Replace;
break;
case 1: /* Replace All */
- html_engine_replace_do (d->engine, RQA_ReplaceAll);
+ answer = RQA_ReplaceAll;
break;
case 2: /* Next */
- html_engine_replace_do (d->engine, RQA_Next);
+ answer = RQA_Next;
break;
}
+
+ d->finished = html_engine_replace_do (d->engine, answer);
}
static GtkHTMLReplaceAskDialog *
@@ -81,6 +81,7 @@ ask_dialog_new (HTMLEngine *e)
_("_Replace"), 0,
NULL));
d->engine = e;
+ d->finished = FALSE;
gnome_window_icon_set_from_file (GTK_WINDOW (d->dialog), ICONDIR "/search-and-replace-24.png");
g_signal_connect (d->dialog, "response", G_CALLBACK (ask_dialog_response), d);
@@ -94,7 +95,8 @@ ask (HTMLEngine *e, gpointer data)
GtkHTMLReplaceAskDialog *ask_dialog;
ask_dialog = ask_dialog_new (e);
- gtk_dialog_run (ask_dialog->dialog);
+ while (!ask_dialog->finished)
+ gtk_dialog_run (ask_dialog->dialog);
gtk_widget_destroy (GTK_WIDGET (ask_dialog->dialog));
gtk_widget_grab_focus (GTK_WIDGET (ask_dialog->engine->widget));
g_free (ask_dialog);
Index: src/ChangeLog
===================================================================
RCS file: /cvs/gnome/gtkhtml/src/ChangeLog,v
retrieving revision 1.2047
diff -u -p -r1.2047 ChangeLog
--- src/ChangeLog 13 Oct 2004 12:52:22 -0000 1.2047
+++ src/ChangeLog 15 Oct 2004 17:23:48 -0000
@@ -1,3 +1,10 @@
+2004-10-15 Radek Doulik <rodo ximian com>
+
+ * htmlengine.c (html_engine_replace_do): return true if replacing
+ is finished
+
+ Fixes #50646
+
2004-10-11 Radek Doulik <rodo ximian com>
* gtkhtml.c (gtk_html_size_request): make sure we keep layout in
Index: src/htmlengine.c
===================================================================
RCS file: /cvs/gnome/gtkhtml/src/htmlengine.c,v
retrieving revision 1.618
diff -u -p -r1.618 htmlengine.c
--- src/htmlengine.c 27 Aug 2004 12:59:50 -0000 1.618
+++ src/htmlengine.c 15 Oct 2004 17:23:50 -0000
@@ -5607,9 +5607,11 @@ replace (HTMLEngine *e)
html_search_push (e->search_info, e->cursor->object->parent);
}
-void
+gboolean
html_engine_replace_do (HTMLEngine *e, HTMLReplaceQueryAnswer answer)
{
+ gboolean finished;
+
g_assert (e->replace_info);
switch (answer) {
@@ -5623,6 +5625,7 @@ html_engine_replace_do (HTMLEngine *e, H
html_replace_destroy (e->replace_info);
e->replace_info = NULL;
html_engine_disable_selection (e);
+ finished = TRUE;
break;
case RQA_Replace:
@@ -5630,12 +5633,13 @@ html_engine_replace_do (HTMLEngine *e, H
replace (e);
html_undo_level_end (e->undo);
case RQA_Next:
- if (html_engine_search_next (e))
- e->replace_info->ask (e, e->replace_info->ask_data);
- else
+ finished = !html_engine_search_next (e);
+ if (finished)
html_engine_disable_selection (e);
break;
}
+
+ return finished;
}
/* spell checking */
Index: src/htmlengine.h
===================================================================
RCS file: /cvs/gnome/gtkhtml/src/htmlengine.h,v
retrieving revision 1.184
diff -u -p -r1.184 htmlengine.h
--- src/htmlengine.h 8 Jun 2004 11:47:54 -0000 1.184
+++ src/htmlengine.h 15 Oct 2004 17:23:50 -0000
@@ -406,7 +406,7 @@ void html_engine_replace
gboolean forward,
gboolean regular,
void (*ask)(HTMLEngine *, gpointer), gpointer ask_data);
-void html_engine_replace_do (HTMLEngine *e, HTMLReplaceQueryAnswer answer);
+gboolean html_engine_replace_do (HTMLEngine *e, HTMLReplaceQueryAnswer answer);
gint html_engine_replaced (void);
/* Magic links */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]