From c0a255eb90769638d57ae4122932f75c46e4e531 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Thu, 11 Sep 2008 15:34:29 +0000 Subject: Merge revisions 36016:36303 from trunk. svn path=/branches/kill-bonobo/; revision=36307 --- mail/em-search-context.c | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) (limited to 'mail/em-search-context.c') diff --git a/mail/em-search-context.c b/mail/em-search-context.c index 56c07a9a17..5bf98614c6 100644 --- a/mail/em-search-context.c +++ b/mail/em-search-context.c @@ -1,23 +1,25 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ /* - * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) - * - * Authors: Not Zed - * Jeffrey Stedfast * * 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. + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) version 3. * * 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. + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with the program; if not, see + * + * + * Authors: + * Not Zed + * Jeffrey Stedfast + * + * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) * - * 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., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. */ #ifdef HAVE_CONFIG_H -- cgit v1.2.3 From 54b80a7271e8ce1b2f3ccc68bb553940a24b80e2 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Fri, 17 Oct 2008 03:48:03 +0000 Subject: Get the mail folder tree compiling, though I'm not yet sure why it's not showing anything. Probably something stupid. Also enabled the composer. svn path=/branches/kill-bonobo/; revision=36623 --- mail/em-search-context.c | 84 +++++++++++++++++++++--------------------------- 1 file changed, 36 insertions(+), 48 deletions(-) (limited to 'mail/em-search-context.c') diff --git a/mail/em-search-context.c b/mail/em-search-context.c index 5bf98614c6..a8a63ebe2d 100644 --- a/mail/em-search-context.c +++ b/mail/em-search-context.c @@ -33,35 +33,40 @@ #include "filter/filter-option.h" #include "filter/filter-int.h" -static FilterElement *em_search_new_element(RuleContext *rc, const char *type); +static gpointer parent_class; -static RuleContextClass *parent_class = NULL; - -static void -em_search_context_finalise (GObject *obj) +static FilterElement * +search_context_new_element (RuleContext *context, + const gchar *type) { - G_OBJECT_CLASS (parent_class)->finalize (obj); + if (strcmp (type, "system-flag") == 0) + return (FilterElement *) filter_option_new (); + + if (strcmp (type, "score") == 0) + return (FilterElement *) filter_int_new_type ("score", -3, 3); + + /* Chain up to parent's new_element() method. */ + return RULE_CONTEXT_CLASS (parent_class)->new_element (context, type); } static void -em_search_context_class_init (EMSearchContextClass *klass) +search_context_class_init (EMSearchContextClass *class) { - parent_class = g_type_class_ref (RULE_TYPE_CONTEXT); + RuleContextClass *rule_context_class; - ((GObjectClass *)klass)->finalize = em_search_context_finalise; - ((RuleContextClass *)klass)->new_element = em_search_new_element; + parent_class = g_type_class_peek_parent (class); + + rule_context_class = RULE_CONTEXT_CLASS (class); + rule_context_class->new_element = search_context_new_element; } static void -em_search_context_init (EMSearchContext *vc) +search_context_init (EMSearchContext *vc) { - rule_context_add_part_set ((RuleContext *)vc, "partset", filter_part_get_type (), - rule_context_add_part, rule_context_next_part); - - rule_context_add_rule_set ((RuleContext *)vc, "ruleset", filter_rule_get_type (), - rule_context_add_rule, rule_context_next_rule); + RuleContext *rule_context; - ((RuleContext *)vc)->flags = RULE_CONTEXT_THREADING | RULE_CONTEXT_GROUPING; + rule_context = RULE_CONTEXT (vc); + rule_context->flags = RULE_CONTEXT_THREADING | RULE_CONTEXT_GROUPING; } GType @@ -69,46 +74,29 @@ em_search_context_get_type (void) { static GType type = 0; - if (!type) { - static const GTypeInfo info = { + if (G_UNLIKELY (type == 0)) { + static const GTypeInfo type_info = { sizeof (EMSearchContextClass), - NULL, /* base_class_init */ - NULL, /* base_class_finalize */ - (GClassInitFunc) em_search_context_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ + (GBaseInitFunc) NULL, + (GBaseFinalizeFunc) NULL, + (GClassInitFunc) search_context_class_init, + (GClassFinalizeFunc) NULL, + NULL, /* class_data */ sizeof (EMSearchContext), - 0, /* n_preallocs */ - (GInstanceInitFunc) em_search_context_init, + 0, /* n_preallocs */ + (GInstanceInitFunc) search_context_init, + NULL /* value_table */ }; - type = g_type_register_static (RULE_TYPE_CONTEXT, "EMSearchContext", &info, 0); + type = g_type_register_static ( + RULE_TYPE_CONTEXT, "EMSearchContext", &type_info, 0); } return type; } -/** - * em_search_context_new: - * - * Create a new EMSearchContext object. - * - * Return value: A new #EMSearchContext object. - **/ -EMSearchContext * +RuleContext * em_search_context_new (void) { - return (EMSearchContext *) g_object_new (EM_SEARCH_TYPE_CONTEXT, NULL, NULL); -} - -static FilterElement * -em_search_new_element(RuleContext *rc, const char *type) -{ - if (!strcmp (type, "system-flag")) { - return (FilterElement *) filter_option_new (); - } else if (!strcmp (type, "score")) { - return (FilterElement *) filter_int_new_type("score", -3, 3); - } else { - return parent_class->new_element(rc, type); - } + return g_object_new (EM_SEARCH_TYPE_CONTEXT, NULL); } -- cgit v1.2.3 From e4afd3f9fb962ea1295a0657ec9f83a427829171 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Tue, 26 May 2009 23:21:02 -0400 Subject: Remove trailing whitespace, again. --- mail/em-search-context.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'mail/em-search-context.c') diff --git a/mail/em-search-context.c b/mail/em-search-context.c index 5bf98614c6..ac03d40a80 100644 --- a/mail/em-search-context.c +++ b/mail/em-search-context.c @@ -11,7 +11,7 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with the program; if not, see + * License along with the program; if not, see * * * Authors: -- cgit v1.2.3