diff options
Diffstat (limited to 'filter/rule-context.h')
-rw-r--r-- | filter/rule-context.h | 136 |
1 files changed, 0 insertions, 136 deletions
diff --git a/filter/rule-context.h b/filter/rule-context.h deleted file mode 100644 index 9a7fcae837..0000000000 --- a/filter/rule-context.h +++ /dev/null @@ -1,136 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Copyright (C) 2000-2002 Ximian Inc. - * - * Authors: Not Zed <notzed@lostzed.mmc.com.au> - * Jeffrey Stedfast <fejj@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 _RULE_CONTEXT_H -#define _RULE_CONTEXT_H - -#include <glib.h> -#include <glib-object.h> -#include <libxml/parser.h> - -#include "filter-part.h" -#include "filter-rule.h" - -#define RULE_TYPE_CONTEXT (rule_context_get_type ()) -#define RULE_CONTEXT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RULE_TYPE_CONTEXT, RuleContext)) -#define RULE_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RULE_TYPE_CONTEXT, RuleContextClass)) -#define IS_RULE_CONTEXT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RULE_TYPE_CONTEXT)) -#define IS_RULE_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RULE_TYPE_CONTEXT)) -#define RULE_CONTEXT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RULE_TYPE_CONTEXT, RuleContextClass)) - -typedef struct _RuleContext RuleContext; -typedef struct _RuleContextClass RuleContextClass; - -struct _RuleContext { - GObject parent_object; - struct _RuleContextPrivate *priv; - - char *error; /* string version of error */ - - xmlDocPtr system; /* system rules source */ - xmlDocPtr user; /* user defined rules source */ - - GList *parts; - GList *rules; - - GHashTable *part_set_map; /* map set types to part types */ - GList *part_set_list; - GHashTable *rule_set_map; /* map set types to rule types */ - GList *rule_set_list; -}; - -typedef void (*RCRegisterFunc) (RuleContext *rc, FilterRule *rule, gpointer user_data); - -struct _RuleContextClass { - GObjectClass parent_class; - - /* virtual methods */ - int (*load) (RuleContext *rc, const char *system, const char *user); - int (*save) (RuleContext *rc, const char *user); - int (*revert) (RuleContext *rc, const char *user); - - GList *(*delete_uri) (RuleContext *rc, const char *uri, GCompareFunc cmp); - GList *(*rename_uri) (RuleContext *rc, const char *olduri, const char *newuri, GCompareFunc cmp); - - /* signals */ - void (*rule_added) (RuleContext *rc, FilterRule *rule); - void (*rule_removed) (RuleContext *rc, FilterRule *rule); - void (*changed) (RuleContext *rc); -}; - -typedef void (*RCPartFunc) (RuleContext *rc, FilterPart *part); -typedef void (*RCRuleFunc) (RuleContext *rc, FilterRule *part); -typedef FilterPart * (*RCNextPartFunc) (RuleContext *rc, FilterPart *part); -typedef FilterRule * (*RCNextRuleFunc) (RuleContext *rc, FilterRule *rule, const char *source); - -struct _part_set_map { - char *name; - int type; - RCPartFunc append; - RCNextPartFunc next; -}; - -struct _rule_set_map { - char *name; - int type; - RCRuleFunc append; - RCNextRuleFunc next; -}; - -GType rule_context_get_type (void); -RuleContext *rule_context_new (void); - -/* methods */ -int rule_context_load (RuleContext *rc, const char *system, const char *user); -int rule_context_save (RuleContext *rc, const char *user); -int rule_context_revert (RuleContext *rc, const char *user); - -void rule_context_add_part (RuleContext *rc, FilterPart *new); -FilterPart *rule_context_find_part (RuleContext *rc, const char *name); -FilterPart *rule_context_create_part (RuleContext *rc, const char *name); -FilterPart *rule_context_next_part (RuleContext *rc, FilterPart *last); - -FilterRule *rule_context_next_rule (RuleContext *rc, FilterRule *last, const char *source); -FilterRule *rule_context_find_rule (RuleContext *rc, const char *name, const char *source); -FilterRule *rule_context_find_rank_rule (RuleContext *rc, int rank, const char *source); -void rule_context_add_rule (RuleContext *rc, FilterRule *new); -void rule_context_add_rule_gui (RuleContext *rc, FilterRule *rule, const char *title, const char *path); -void rule_context_remove_rule (RuleContext *rc, FilterRule *rule); - -/* get/set the rank (position) of a rule */ -void rule_context_rank_rule (RuleContext *rc, FilterRule *rule, int rank); -int rule_context_get_rank_rule (RuleContext *rc, FilterRule *rule, const char *source); - -/* setup type for set parts */ -void rule_context_add_part_set (RuleContext *rc, const char *setname, int part_type, - RCPartFunc append, RCNextPartFunc next); -void rule_context_add_rule_set (RuleContext *rc, const char *setname, int rule_type, - RCRuleFunc append, RCNextRuleFunc next); - -/* uri's disappear/renamed externally */ -GList *rule_context_delete_uri (RuleContext *rc, const char *uri, GCompareFunc cmp); -GList *rule_context_rename_uri (RuleContext *rc, const char *olduri, const char *newuri, GCompareFunc cmp); - -void rule_context_free_uri_list (RuleContext *rc, GList *uris); - -#endif /* ! _RULE_CONTEXT_H */ |