Updated Traditional Chinese translation.
[evolution.git] / filter / rule-editor.h
blobbe216edf7356fc8e12d888df739f3e72ff5e9f45
1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
2 /*
3 * Copyright (C) 2000-2002 Ximian Inc.
5 * Authors: Not Zed <notzed@lostzed.mmc.com.au>
6 * Jeffrey Stedfast <fejj@ximian.com>
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of version 2 of the GNU General Public
10 * License as published by the Free Software Foundation.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
17 * You should have received a copy of the GNU General Public
18 * License along with this program; if not, write to the
19 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20 * Boston, MA 02111-1307, USA.
24 #ifndef _RULE_EDITOR_H
25 #define _RULE_EDITOR_H
27 #include <gtk/gtk.h>
28 #include <glade/glade.h>
30 #include "rule-context.h"
31 #include "filter-rule.h"
33 #define RULE_TYPE_EDITOR (rule_editor_get_type ())
34 #define RULE_EDITOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RULE_TYPE_EDITOR, RuleEditor))
35 #define RULE_EDITOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RULE_TYPE_EDITOR, RuleEditorClass))
36 #define IS_RULE_EDITOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RULE_TYPE_EDITOR))
37 #define IS_RULE_EDITOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RULE_TYPE_EDITOR))
38 #define RULE_EDITOR_GET_CLASS(obj) (GTK_CHECK_GET_CLASS ((obj), RULE_TYPE_EDITOR, RuleEditorClass))
40 typedef struct _RuleEditor RuleEditor;
41 typedef struct _RuleEditorClass RuleEditorClass;
42 typedef struct _RuleEditorUndo RuleEditorUndo;
44 struct _RuleEditor {
45 GtkDialog parent_object;
47 GtkListStore *model;
48 GtkTreeView *list;
50 RuleContext *context;
51 FilterRule *current;
52 FilterRule *edit; /* for editing/adding rules, so we only do 1 at a time */
54 GtkWidget *dialog;
56 char *source;
58 struct _RuleEditorUndo *undo_log; /* cancel/undo log */
59 unsigned int undo_active:1; /* we're performing undo */
61 struct _RuleEditorPrivate *priv;
64 struct _RuleEditorClass {
65 GtkDialogClass parent_class;
67 /* virtual methods */
68 void (*set_sensitive) (RuleEditor *);
69 void (*set_source) (RuleEditor *, const char *source);
71 FilterRule *(*create_rule) (RuleEditor *);
73 /* signals */
76 enum {
77 RULE_EDITOR_LOG_EDIT,
78 RULE_EDITOR_LOG_ADD,
79 RULE_EDITOR_LOG_REMOVE,
80 RULE_EDITOR_LOG_RANK,
83 struct _RuleEditorUndo {
84 struct _RuleEditorUndo *next;
86 unsigned int type;
87 FilterRule *rule;
88 int rank;
89 int newrank;
92 GtkType rule_editor_get_type(void);
93 RuleEditor *rule_editor_new(RuleContext *rc, const char *source, const char *label);
95 void rule_editor_construct(RuleEditor *re, RuleContext *context, GladeXML *gui, const char *source, const char *label);
97 /* methods */
98 void rule_editor_set_source(RuleEditor *re, const char *source);
99 /* calculates the sensitivity of the editor */
100 void rule_editor_set_sensitive(RuleEditor *re);
101 /* used internally to create a new rule appropriate for the editor */
102 struct _FilterRule *rule_editor_create_rule(RuleEditor *re);
104 #endif /* ! _RULE_EDITOR_H */