[Evolution-hackers] fix "Multiple dialogs open on replace"



This patch fix the "Multiple dialogs open on 'Replace'" bug.
It modified some file in the gtkhtml component.
It will modify the file gtkhtml/components/html-editor/replace.c and the
file gtkhtml/src/htmlreplace.c
Also see:
	http://bugzilla.ximian.com/show_bug.cgi?id=50646

Index: components/html-editor/ChangeLog
===================================================================
RCS file: /cvs/gnome/gtkhtml/components/html-editor/ChangeLog,v
retrieving revision 1.410.2.12
diff -u -p -r1.410.2.12 ChangeLog
--- components/html-editor/ChangeLog	10 Dec 2003 03:35:55 -0000	1.410.2.12
+++ components/html-editor/ChangeLog	10 Dec 2003 11:17:17 -0000
@@ -0,0 +0,5 @@
+2003-12-09  Charles Zhang  <charles zhang sun com>
+
+	* replace.c (ask):  use exist dialog, don't new dialog blindly.
+	Fixes bug #50646
+
Index: components/html-editor/replace.c
===================================================================
RCS file: /cvs/gnome/gtkhtml/components/html-editor/replace.c,v
retrieving revision 1.18.6.1
diff -u -p -r1.18.6.1 replace.c
--- components/html-editor/replace.c	10 Dec 2003 03:35:56 -0000	1.18.6.1
+++ components/html-editor/replace.c	10 Dec 2003 11:17:21 -0000
@@ -27,6 +27,7 @@
 #include "replace.h"
 #include "dialog.h"
 #include "htmlengine.h"
+#include "htmlreplace.h"
 
 struct _GtkHTMLReplaceAskDialog {
 	GtkDialog  *dialog;
@@ -79,6 +80,7 @@ ask_dialog_new (HTMLEngine *e)
 							     _("_Replace"), 0,
 							     NULL));
 	d->engine = e;
+	e->replace_info->ask_dialog = d;
 
 	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);
@@ -91,6 +93,14 @@ ask (HTMLEngine *e, gpointer data)
 {
 	GtkHTMLReplaceAskDialog *ask_dialog;
 
+	g_assert (e && e->replace_info);
+
+	ask_dialog = (GtkHTMLReplaceAskDialog *) e->replace_info->ask_dialog;
+	if (ask_dialog) {
+		gtk_dialog_run (ask_dialog->dialog);
+		return;
+	}
+
 	ask_dialog = ask_dialog_new (e);
 	gtk_dialog_run (ask_dialog->dialog);
 	gtk_widget_destroy (GTK_WIDGET (ask_dialog->dialog));
Index: src/ChangeLog
===================================================================
RCS file: /cvs/gnome/gtkhtml/src/ChangeLog,v
retrieving revision 1.1814.2.18
diff -u -p -r1.1814.2.18 ChangeLog
--- src/ChangeLog	28 Nov 2003 11:02:25 -0000	1.1814.2.18
+++ src/ChangeLog	10 Dec 2003 11:19:46 -0000
@@ -0,0 +0,6 @@
+2003-12-07  Charles Zhang  <charles zhang sun com>
+
+	* htmlreplace.h: add member ask_dialog.
+	* htmlreplace.c(html_replace_new): init member ask_dialog.
+	Fixes bug #50646
+
Index: src/htmlreplace.c
===================================================================
RCS file: /cvs/gnome/gtkhtml/src/htmlreplace.c,v
retrieving revision 1.4
diff -u -p -r1.4 htmlreplace.c
--- src/htmlreplace.c	13 Dec 2000 23:10:51 -0000	1.4
+++ src/htmlreplace.c	10 Dec 2003 11:19:49 -0000
@@ -33,6 +33,7 @@ html_replace_new (const gchar *text, voi
 	nr->replaced = 0;
 	nr->ask      = ask;
 	nr->ask_data = ask_data;
+	nr->ask_dialog = NULL;
 
 	return nr;
 }
Index: src/htmlreplace.h
===================================================================
RCS file: /cvs/gnome/gtkhtml/src/htmlreplace.h,v
retrieving revision 1.4
diff -u -p -r1.4 htmlreplace.h
--- src/htmlreplace.h	21 Nov 2000 10:42:26 -0000	1.4
+++ src/htmlreplace.h	10 Dec 2003 11:19:49 -0000
@@ -30,6 +30,7 @@ struct _HTMLReplace {
 	gint   replaced;
 	void (*ask) (HTMLEngine *, gpointer);
 	gpointer ask_data;
+	gpointer ask_dialog;
 };
 
 HTMLReplace     *html_replace_new            (const gchar *text, void (*ask) (HTMLEngine *, gpointer), gpointer ask_data);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]