[evolution-patches] patch for 49702
- From: Charles Zhang <Charles Zhang Sun Com>
- To: evolution-patches <evolution-patches lists ximian com>
- Subject: [evolution-patches] patch for 49702
- Date: Fri, 12 Dec 2003 23:27:37 +0800
Hello all.
I attach a patch to fix the bug 49702.
In it, I use the existing search dialog, but not destroy and new blindly
each time.
And when nothing found, I disable the Find button and leave the dialog
visible to indicate the user, but not hide it whatever found.
Please check it.
Best Regards
Charles Zhang
? components/html-editor/GNOME_GtkHTML_Editor-emacs.xml
? components/html-editor/test_editor
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 12 Dec 2003 15:22:28 -0000
@@ -0,0 +0,8 @@
+2003-12-12 Charles Zhang <charles zhang sun com>
+
+ * search.c (search): use existing find dialog, not new one blindly.
+ (search_dialog_response): if not found, disable the Find button
+ and leave dialog visible to indicate the user.
+ (entry_changed): enable the Find button when entry changed.
+ Fixes bug #49702
+
Index: components/html-editor/search.c
===================================================================
RCS file: /cvs/gnome/gtkhtml/components/html-editor/search.c,v
retrieving revision 1.22
diff -u -p -r1.22 search.c
--- components/html-editor/search.c 12 May 2003 20:46:48 -0000 1.22
+++ components/html-editor/search.c 12 Dec 2003 15:22:30 -0000
@@ -44,6 +44,8 @@ entry_changed (GtkWidget *entry, GtkHTML
if (d->cd->search_text)
g_free (d->cd->search_text);
d->cd->search_text = g_strdup (gtk_entry_get_text (GTK_ENTRY (d->entry)));
+
+ gtk_dialog_set_response_sensitive (d->dialog, 0, TRUE);
}
static void
@@ -55,12 +57,24 @@ entry_activate (GtkWidget *entry, GtkHTM
static void
search_dialog_response (GtkDialog *dialog, gint response_id, GtkHTMLSearchDialog *d)
{
+ g_assert (d && d->dialog );
+
switch (response_id) {
case 0: /* Search */
- gtk_widget_hide (GTK_WIDGET (d->dialog));
- html_engine_search (d->html->engine, gtk_entry_get_text (GTK_ENTRY (d->entry)),
- GTK_TOGGLE_BUTTON (d->case_sensitive)->active,
- GTK_TOGGLE_BUTTON (d->backward)->active == 0, d->cd->regular);
+ if (!html_engine_search (d->html->engine, gtk_entry_get_text (GTK_ENTRY (d->entry)),
+ GTK_TOGGLE_BUTTON (d->case_sensitive)->active,
+ GTK_TOGGLE_BUTTON (d->backward)->active == 0, d->cd->regular)) {
+ /* not found, then disable Find button and leave dialog visible */
+ gtk_dialog_set_response_sensitive (d->dialog, 0, FALSE);
+ } else {
+ gtk_widget_hide (d->dialog);
+ }
+ break;
+
+ case GTK_RESPONSE_DELETE_EVENT:
+ case GTK_RESPONSE_CLOSE:
+ gtk_dialog_set_response_sensitive (d->dialog, 0, TRUE);
+ gtk_widget_hide (d->dialog);
break;
}
}
@@ -115,6 +129,8 @@ gtk_html_search_dialog_new (GtkHTML *htm
void
gtk_html_search_dialog_destroy (GtkHTMLSearchDialog *d)
{
+ g_assert (d && d->dialog);
+
gtk_widget_destroy (GTK_WIDGET (d->dialog));
g_free (d);
}
@@ -124,8 +140,14 @@ search (GtkHTMLControlData *cd, gboolean
{
cd->regular = regular;
RUN_DIALOG (search, regular ? _("Find Regular Expression") : _("Find"));
- gtk_html_search_dialog_destroy (cd->search_dialog);
- cd->search_dialog = NULL;
+
+ g_assert (cd->search_dialog && cd->search_dialog->dialog);
+
+ /* if visible, then leave dialog as not found state */
+ if (!GTK_WIDGET_VISIBLE (cd->search_dialog->dialog)) {
+ gtk_html_search_dialog_destroy (cd->search_dialog);
+ cd->search_dialog = NULL;
+ }
}
void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]