2 * Copyright © 2002 Olivier Martin <omartin@ifrance.com>
3 * Copyright © 2002 Jorn Baayen <jorn@nl.linux.org>
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 * $Id: ephy-node-filter.h 6952 2007-03-11 19:42:02Z chpe $
22 #ifndef EPHY_HISTORY_FILTER_H
23 #define EPHY_HISTORY_FILTER_H
25 #include <glib-object.h>
27 #include "ephy-history-node.h"
31 #define EPHY_TYPE_HISTORY_FILTER (ephy_history_filter_get_type ())
32 #define EPHY_HISTORY_FILTER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), EPHY_TYPE_HISTORY_FILTER, EphyHistoryFilter))
33 #define EPHY_HISTORY_FILTER_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), EPHY_TYPE_HISTORY_FILTER, EphyHistoryFilterClass))
34 #define EPHY_IS_HISTORY_FILTER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), EPHY_TYPE_HISTORY_FILTER))
35 #define EPHY_IS_HISTORY_FILTER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), EPHY_TYPE_HISTORY_FILTER))
36 #define EPHY_HISTORY_FILTER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), EPHY_TYPE_HISTORY_FILTER, EphyHistoryFilterClass))
38 typedef struct _EphyHistoryFilterPrivate EphyHistoryFilterPrivate
;
45 EphyHistoryFilterPrivate
*priv
;
52 void (*changed
) (EphyHistoryFilter
*filter
);
53 } EphyHistoryFilterClass
;
57 EPHY_HISTORY_FILTER_EXPRESSION_ALWAYS_TRUE
, /* args: none */
58 EPHY_HISTORY_FILTER_EXPRESSION_NODE_EQUALS
, /* args: EphyNode *a, EphyNode *b */
59 EPHY_HISTORY_FILTER_EXPRESSION_EQUALS
, /* args: EphyNode *node */
60 EPHY_HISTORY_FILTER_EXPRESSION_HAS_PARENT
, /* args: EphyNode *parent */
61 EPHY_HISTORY_FILTER_EXPRESSION_HAS_CHILD
, /* args: EphyNode *child */
62 EPHY_HISTORY_FILTER_EXPRESSION_NODE_PROP_EQUALS
, /* args: int prop_id, EphyNode *node */
63 EPHY_HISTORY_FILTER_EXPRESSION_CHILD_PROP_EQUALS
, /* args: int prop_id, EphyNode *node */
64 EPHY_HISTORY_FILTER_EXPRESSION_STRING_PROP_CONTAINS
, /* args: int prop_id, const char *string */
65 EPHY_HISTORY_FILTER_EXPRESSION_STRING_PROP_EQUALS
, /* args: int prop_id, const char *string */
66 EPHY_HISTORY_FILTER_EXPRESSION_KEY_PROP_CONTAINS
, /* args: int prop_id, const char *string */
67 EPHY_HISTORY_FILTER_EXPRESSION_KEY_PROP_EQUALS
, /* args: int prop_id, const char *string */
68 EPHY_HISTORY_FILTER_EXPRESSION_INT_PROP_EQUALS
, /* args: int prop_id, int int */
69 EPHY_HISTORY_FILTER_EXPRESSION_INT_PROP_BIGGER_THAN
, /* args: int prop_id, int int */
70 EPHY_HISTORY_FILTER_EXPRESSION_INT_PROP_LESS_THAN
/* args: int prop_id, int int */
71 } EphyHistoryFilterExpressionType
;
73 typedef struct _EphyHistoryFilterExpression EphyHistoryFilterExpression
;
75 /* The filter starts iterating over all expressions at level 0,
76 * if one of them is TRUE it continues to level 1, etc.
77 * If it still has TRUE when there are no more expressions at the
78 * next level, the result is TRUE. Otherwise, it's FALSE.
81 GType
ephy_history_filter_get_type (void);
83 EphyHistoryFilter
*ephy_history_filter_new (void);
85 void ephy_history_filter_add_expression (EphyHistoryFilter
*filter
,
86 EphyHistoryFilterExpression
*expression
,
89 void ephy_history_filter_empty (EphyHistoryFilter
*filter
);
91 void ephy_history_filter_done_changing (EphyHistoryFilter
*filter
);
93 gboolean
ephy_history_filter_evaluate (EphyHistoryFilter
*filter
,
94 EphyHistoryNode
*node
);
96 EphyHistoryFilterExpression
*ephy_history_filter_expression_new (EphyHistoryFilterExpressionType
,
98 /* no need to free unless you didn't add the expression to a filter */
99 void ephy_history_filter_expression_free (EphyHistoryFilterExpression
*expression
);
103 #endif /* EPHY_HISTORY_FILTER_H */