From e3e9fc8d4a8c1ebd9cff9852c1f17be5d38d48cf Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Tue, 11 Dec 2007 12:35:28 +0000 Subject: ** Fix for bug #502318 2007-12-11 Milan Crha ** Fix for bug #502318 * em-format-html-display.c: (struct _EMFormatHTMLDisplayPrivate), (efhd_search_destroy), (em_format_html_get_search_dialog), (em_format_html_display_search), (em_format_html_display_search_with), (em_format_html_display_search_close), (efhd_complete): Track search dialog activity rather based on flag than on widget existence, because the pointer to that widget it still there (non-NULL) even after destroy of that widget. svn path=/trunk/; revision=34689 --- mail/ChangeLog | 12 ++++++++++++ mail/em-format-html-display.c | 36 ++++++++++++++++++++++-------------- 2 files changed, 34 insertions(+), 14 deletions(-) diff --git a/mail/ChangeLog b/mail/ChangeLog index 514285c279..c3ab44e4f8 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,15 @@ +2007-12-11 Milan Crha + + ** Fix for bug #502318 + + * em-format-html-display.c: (struct _EMFormatHTMLDisplayPrivate), + (efhd_search_destroy), (em_format_html_get_search_dialog), + (em_format_html_display_search), (em_format_html_display_search_with), + (em_format_html_display_search_close), (efhd_complete): + Track search dialog activity rather based on flag than on widget + existence, because the pointer to that widget it still + there (non-NULL) even after destroy of that widget. + 2007-12-11 Milan Crha ** Fix for bug #336074 diff --git a/mail/em-format-html-display.c b/mail/em-format-html-display.c index 0c7c46def4..eb06d8a095 100644 --- a/mail/em-format-html-display.c +++ b/mail/em-format-html-display.c @@ -135,6 +135,7 @@ struct _EMFormatHTMLDisplayPrivate { GtkWidget *search_case_check; char *search_text; int search_wrap; /* are we doing a wrap search */ + gboolean search_active; /* if the search is active */ /* for Attachment bar */ GtkWidget *attachment_bar; @@ -601,6 +602,7 @@ efhd_search_destroy(GtkWidget *w, EMFormatHTMLDisplay *efhd) p->search_text = NULL; gtk_widget_hide((GtkWidget *)p->search_dialog); em_format_html_display_set_search(efhd, EM_FORMAT_HTML_DISPLAY_SEARCH_PRIMARY, NULL); + p->search_active = FALSE; } static void @@ -705,6 +707,8 @@ em_format_html_get_search_dialog (EMFormatHTMLDisplay *efhd) g_signal_connect (button2, "clicked", G_CALLBACK(efhd_search_response), efhd); g_signal_connect (button3, "clicked", G_CALLBACK(efhd_search_response_back), efhd); + p->search_active = FALSE; + efhd_update_matches(efhd); return (GtkWidget *)p->search_dialog; @@ -737,14 +741,17 @@ em_format_html_display_search(EMFormatHTMLDisplay *efhd) struct _EMFormatHTMLDisplayPrivate *p = efhd->priv; if (p->search_dialog){ - GtkWidget *toplevel; - gtk_widget_show ( (GtkWidget *)(p->search_dialog)); - gtk_widget_grab_focus ( (GtkWidget *)(p->search_entry)); - gtk_widget_show ( (GtkWidget *) p->search_entry_box); + GtkWidget *toplevel; + + gtk_widget_show (GTK_WIDGET (p->search_dialog)); + gtk_widget_grab_focus (p->search_entry); + gtk_widget_show (p->search_entry_box); + + p->search_active = TRUE; - toplevel = gtk_widget_get_toplevel ((GtkWidget *)(p->search_dialog)); + toplevel = gtk_widget_get_toplevel (GTK_WIDGET (p->search_dialog)); - g_signal_connect (toplevel, "set-focus", + g_signal_connect (toplevel, "set-focus", G_CALLBACK (set_focus_cb), efhd); } @@ -761,14 +768,15 @@ em_format_html_display_search_with (EMFormatHTMLDisplay *efhd, char *word) struct _EMFormatHTMLDisplayPrivate *p = efhd->priv; if (p->search_dialog){ - gtk_widget_show ( (GtkWidget *)(p->search_dialog)); + gtk_widget_show (GTK_WIDGET (p->search_dialog)); + p->search_active = TRUE; - /* Set the query */ - gtk_entry_set_text (GTK_ENTRY (p->search_entry), word); - gtk_widget_hide ( (GtkWidget *) p->search_entry_box); + /* Set the query */ + gtk_entry_set_text (GTK_ENTRY (p->search_entry), word); + gtk_widget_hide (p->search_entry_box); - /* Trigger the search */ - gtk_signal_emit_by_name (GTK_OBJECT (p->search_entry), "activate", efhd); + /* Trigger the search */ + gtk_signal_emit_by_name (GTK_OBJECT (p->search_entry), "activate", efhd); } } @@ -777,7 +785,7 @@ em_format_html_display_search_close (EMFormatHTMLDisplay *efhd) { struct _EMFormatHTMLDisplayPrivate *p = efhd->priv; - if (p->search_dialog) + if (p->search_dialog && p->search_active) efhd_search_destroy(GTK_WIDGET (p->search_dialog), efhd); } @@ -919,7 +927,7 @@ efhd_complete(EMFormat *emf) { EMFormatHTMLDisplay *efhd = (EMFormatHTMLDisplay *)emf; - if (efhd->priv->search_dialog) + if (efhd->priv->search_dialog && efhd->priv->search_active) efhd_update_matches(efhd); if (efhd->priv->files) { -- cgit