diff options
author | Jeffrey Stedfast <fejj@ximian.com> | 2003-02-23 13:03:18 +0800 |
---|---|---|
committer | Jeffrey Stedfast <fejj@src.gnome.org> | 2003-02-23 13:03:18 +0800 |
commit | 59796eb93c1eeaf5c53559f1424e795da4f137a6 (patch) | |
tree | 0f74d3bc9462cb416b9d53f83b1ec312d080faa0 /mail | |
parent | 1247dfa0f36b97099863ea202221e0604bdd311f (diff) | |
download | gsoc2013-evolution-59796eb93c1eeaf5c53559f1424e795da4f137a6.tar.gz gsoc2013-evolution-59796eb93c1eeaf5c53559f1424e795da4f137a6.tar.zst gsoc2013-evolution-59796eb93c1eeaf5c53559f1424e795da4f137a6.zip |
New overloaded virtual method, does what dialog_destroy_cb was trying to
2003-02-23 Jeffrey Stedfast <fejj@ximian.com>
* mail-search.c (mail_search_destroy): New overloaded virtual
method, does what dialog_destroy_cb was trying to do.
(mail_search_construct): Connect to the "response" signal rather
than "clicked" to correspond to the GtkDialog API
(instead og the old GnomeDialog API).
(dialog_response_cb): Changed the function name and made it check
button == GTK_RESPONSE_ACCEPT to search, any other button
closes. Fixes bug #37947.
svn path=/trunk/; revision=20005
Diffstat (limited to 'mail')
-rw-r--r-- | mail/ChangeLog | 11 | ||||
-rw-r--r-- | mail/mail-search-dialogue.c | 5 | ||||
-rw-r--r-- | mail/mail-search.c | 102 | ||||
-rw-r--r-- | mail/mail-search.h | 46 |
4 files changed, 87 insertions, 77 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog index edd6807050..a0292c068f 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,14 @@ +2003-02-23 Jeffrey Stedfast <fejj@ximian.com> + + * mail-search.c (mail_search_destroy): New overloaded virtual + method, does what dialog_destroy_cb was trying to do. + (mail_search_construct): Connect to the "response" signal rather + than "clicked" to correspond to the GtkDialog API + (instead og the old GnomeDialog API). + (dialog_response_cb): Changed the function name and made it check + button == GTK_RESPONSE_ACCEPT to search, any other button + closes. Fixes bug #37947. + 2003-02-21 Hans Petter Jansson <hpj@ximian.com> * component-factory.c (factory): Don't try to get a FontPrefs control. diff --git a/mail/mail-search-dialogue.c b/mail/mail-search-dialogue.c index a00eaa0f92..0a692b1ec3 100644 --- a/mail/mail-search-dialogue.c +++ b/mail/mail-search-dialogue.c @@ -1,5 +1,6 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ /* - * Copyright (C) 2000, 2001 Ximian, Inc. + * Copyright (C) 2000, 2003 Ximian, Inc. * * Authors: Not Zed <notzed@lostzed.mmc.com.au> * @@ -159,7 +160,7 @@ mail_search_dialogue_new_with_rule (FilterRule *rule) { MailSearchDialogue *o = (MailSearchDialogue *)g_object_new (mail_search_dialogue_get_type (), NULL); if (rule) - g_object_ref((rule)); + g_object_ref (rule); mail_search_dialogue_construct (o, rule); return o; } diff --git a/mail/mail-search.c b/mail/mail-search.c index 9955b34e3a..6fa681ff83 100644 --- a/mail/mail-search.c +++ b/mail/mail-search.c @@ -1,28 +1,25 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ - /* - * mail-search.c + * Authors: Jon Trowbridge <trow@ximian.com> + * + * Copyright 2001-2003 Ximian, Inc. (www.ximian.com) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. * - * Copyright (C) 2001 Ximian, Inc. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA. * - * Developed by Jon Trowbridge <trow@ximian.com> */ -/* - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA. - */ #ifdef HAVE_CONFIG_H #include <config.h> @@ -42,39 +39,54 @@ static void mail_search_finalise (GObject *obj) { MailSearch *ms = MAIL_SEARCH (obj); - + g_signal_handler_disconnect(ms->mail->html->engine->ht, ms->match_handler); g_signal_handler_disconnect(ms->mail->html->engine->ht, ms->begin_handler); - + g_free (ms->last_search); - g_object_unref((ms->mail)); + g_object_unref (ms->mail); + + G_OBJECT_CLASS (parent_class)->finalize (obj); +} - ((GObjectClass *)parent_class)->finalize(obj); +static void +mail_search_destroy (GtkObject *obj) +{ + MailSearch *ms = (MailSearch *) obj; + ESearchingTokenizer *st = mail_search_tokenizer (ms); + + e_searching_tokenizer_set_primary_search_string (st, NULL); + mail_search_redisplay_message (ms); + + GTK_OBJECT_CLASS (parent_class)->destroy (obj); } static void mail_search_class_init (MailSearchClass *klass) { GObjectClass *object_class = (GObjectClass *) klass; - - parent_class = GTK_OBJECT_CLASS (g_type_class_ref(gtk_dialog_get_type ())); + GtkObjectClass *gtk_object_class = (GtkObjectClass *) klass; + + parent_class = (GtkObjectClass *) g_type_class_ref (GTK_TYPE_DIALOG); object_class->finalize = mail_search_finalise; + + gtk_object_class->destroy = mail_search_destroy; } static void mail_search_init (MailSearch *ms) { - + } GtkType mail_search_get_type (void) { - static GType mail_search_type = 0; + static GType type = 0; - if (! mail_search_type) { - GTypeInfo mail_search_info = { + if (!type) { + static const GTypeInfo info = { sizeof (MailSearchClass), NULL, NULL, (GClassInitFunc) mail_search_class_init, @@ -83,11 +95,11 @@ mail_search_get_type (void) 0, (GInstanceInitFunc) mail_search_init, }; - - mail_search_type = g_type_register_static (GTK_TYPE_DIALOG, "MailSearch", &mail_search_info, 0); + + type = g_type_register_static (GTK_TYPE_DIALOG, "MailSearch", &info, 0); } - - return mail_search_type; + + return type; } /* @@ -160,20 +172,11 @@ toggled_fwd_cb (GtkToggleButton *b, MailSearch *ms) #endif static void -dialog_destroy_cb (GtkWidget *w, MailSearch *ms) -{ - ESearchingTokenizer *st = mail_search_tokenizer (ms); - - e_searching_tokenizer_set_primary_search_string (st, NULL); - mail_search_redisplay_message (ms); -} - -static void -dialog_clicked_cb (GtkWidget *widget, gint button_number, MailSearch *ms) +dialog_response_cb (GtkWidget *widget, int button, MailSearch *ms) { ESearchingTokenizer *st = mail_search_tokenizer (ms); - if (button_number == 0) { /* "Search" */ + if (button == GTK_RESPONSE_ACCEPT) { char *search_text; search_text = gtk_editable_get_chars (GTK_EDITABLE (ms->entry), 0, -1); @@ -182,7 +185,7 @@ dialog_clicked_cb (GtkWidget *widget, gint button_number, MailSearch *ms) if (search_text && *search_text) { if (ms->last_search && !strcmp (ms->last_search, search_text)) { - if (! gtk_html_engine_search_next (ms->mail->html)) { + if (!gtk_html_engine_search_next (ms->mail->html)) { g_free (ms->last_search); ms->last_search = NULL; } @@ -204,7 +207,7 @@ dialog_clicked_cb (GtkWidget *widget, gint button_number, MailSearch *ms) } g_free (search_text); - } else if (button_number == 1) { /* "Close" */ + } else if (button == GTK_RESPONSE_CANCEL) { gtk_widget_destroy (widget); } } @@ -237,7 +240,7 @@ match_cb (ESearchingTokenizer *st, MailSearch *ms) } static void -entry_run_search(GtkWidget *w, MailSearch *ms) +entry_run_search (GtkWidget *w, MailSearch *ms) { /* run search when enter pressed on widget */ gtk_dialog_response ((GtkDialog *) ms, GTK_RESPONSE_ACCEPT); @@ -362,9 +365,8 @@ mail_search_construct (MailSearch *ms, MailDisplay *mail) #if 0 g_signal_connect (fwd_check, "toggled", G_CALLBACK (toggled_fwd_cb), ms); #endif - g_signal_connect (ms, "clicked", G_CALLBACK (dialog_clicked_cb), ms); + g_signal_connect (ms, "response", G_CALLBACK (dialog_response_cb), ms); - g_object_weak_ref ((GObject *) ms, (GWeakNotify) dialog_destroy_cb, ms); g_object_weak_ref ((GObject *) ms->mail, (GWeakNotify) gtk_widget_destroy, ms); } @@ -373,7 +375,7 @@ mail_search_new (MailDisplay *mail) { GtkWidget *widget; - g_return_val_if_fail (mail && IS_MAIL_DISPLAY (mail), NULL); + g_return_val_if_fail (IS_MAIL_DISPLAY (mail), NULL); widget = g_object_new (mail_search_get_type (), NULL); mail_search_construct (MAIL_SEARCH (widget), mail); diff --git a/mail/mail-search.h b/mail/mail-search.h index 590fabb1ba..cbcf563636 100644 --- a/mail/mail-search.h +++ b/mail/mail-search.h @@ -1,28 +1,25 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ - /* - * mail-search.h + * Authors: Jon Trowbridge <trow@ximian.com> + * + * Copyright 2001-2003 Ximian, Inc. (www.ximian.com) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. * - * Copyright (C) 2001 Ximian, Inc. + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA. * - * Developed by Jon Trowbridge <trow@ximian.com> */ -/* - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA. - */ #ifndef _MAIL_SEARCH_H_ #define _MAIL_SEARCH_H_ @@ -48,21 +45,21 @@ struct _MailSearch { GtkDialog parent; MailDisplay *mail; - + GtkWidget *entry; GtkWidget *msg_frame; GtkWidget *count_label; - + gboolean search_forward, case_sensitive; - gchar *last_search; - + char *last_search; + guint begin_handler; guint match_handler; }; struct _MailSearchClass { GtkDialogClass parent_class; - + }; GtkType mail_search_get_type (void); @@ -76,4 +73,3 @@ GtkWidget *mail_search_new (MailDisplay *); #endif /* _cplusplus */ #endif /* _MAIL_SEARCH_H_ */ - |