Do you think this one is ok? Charles Zhang wrote:
|
? 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 22 Dec 2003 11:05:02 -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 22 Dec 2003 11:05:02 -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,22 @@ 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)) + 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 +127,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 +138,13 @@ 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 (!GTK_WIDGET_VISIBLE (cd->search_dialog->dialog)) { + gtk_html_search_dialog_destroy (cd->search_dialog); + cd->search_dialog = NULL; + } } void