summaryrefslogtreecommitdiff
path: root/src/prefs_filter_edit.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/prefs_filter_edit.h')
-rw-r--r--src/prefs_filter_edit.h196
1 files changed, 196 insertions, 0 deletions
diff --git a/src/prefs_filter_edit.h b/src/prefs_filter_edit.h
new file mode 100644
index 0000000..1b748d8
--- /dev/null
+++ b/src/prefs_filter_edit.h
@@ -0,0 +1,196 @@
1/*
2 * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
3 * Copyright (C) 1999-2012 Hiroyuki Yamamoto
4 *
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.
9 *
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.
14 *
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 */
19
20#ifndef __PREFS_FILTER_EDIT_H__
21#define __PREFS_FILTER_EDIT_H__
22
23#include <gtk/gtkwidget.h>
24
25#include "filter.h"
26
27typedef struct _FilterCondEdit FilterCondEdit;
28typedef struct _CondHBox CondHBox;
29typedef struct _ActionHBox ActionHBox;
30
31typedef enum
32{
33 PF_COND_HEADER,
34 PF_COND_TO_OR_CC,
35 PF_COND_ANY_HEADER,
36 PF_COND_BODY,
37 PF_COND_CMD_TEST,
38 PF_COND_SIZE,
39 PF_COND_AGE,
40 PF_COND_UNREAD,
41 PF_COND_MARK,
42 PF_COND_COLOR_LABEL,
43 PF_COND_MIME,
44 PF_COND_ACCOUNT,
45 PF_COND_EDIT_HEADER,
46 PF_COND_SEPARATOR,
47 PF_COND_NONE
48} CondMenuType;
49
50typedef enum
51{
52 PF_MATCH_CONTAIN,
53 PF_MATCH_NOT_CONTAIN,
54 PF_MATCH_EQUAL,
55 PF_MATCH_NOT_EQUAL,
56 PF_MATCH_REGEX,
57 PF_MATCH_NOT_REGEX,
58 PF_MATCH_IN_ADDRESSBOOK,
59 PF_MATCH_NOT_IN_ADDRESSBOOK,
60 PF_MATCH_NONE
61} MatchMenuType;
62
63typedef enum
64{
65 PF_SIZE_LARGER,
66 PF_SIZE_SMALLER
67} SizeMatchType;
68
69typedef enum
70{
71 PF_AGE_SHORTER,
72 PF_AGE_LONGER
73} AgeMatchType;
74
75typedef enum
76{
77 PF_STATUS_MATCH,
78 PF_STATUS_NOT_MATCH
79} StatusMatchType;
80
81typedef enum
82{
83 PF_ACTION_MOVE,
84 PF_ACTION_COPY,
85 PF_ACTION_NOT_RECEIVE,
86 PF_ACTION_DELETE,
87 PF_ACTION_EXEC,
88 PF_ACTION_EXEC_ASYNC,
89 PF_ACTION_MARK,
90 PF_ACTION_COLOR_LABEL,
91 PF_ACTION_MARK_READ,
92 PF_ACTION_FORWARD,
93 PF_ACTION_FORWARD_AS_ATTACHMENT,
94 PF_ACTION_REDIRECT,
95 PF_ACTION_STOP_EVAL,
96 PF_ACTION_SEPARATOR,
97 PF_ACTION_NONE
98} ActionMenuType;
99
100struct _FilterCondEdit {
101 GtkWidget *cond_vbox;
102 GSList *cond_hbox_list;
103
104 GSList *hdr_list;
105 GSList *rule_hdr_list;
106
107 /* callback */
108 void (*add_hbox) (CondHBox *hbox);
109};
110
111struct _CondHBox {
112 GtkWidget *hbox;
113
114 GtkWidget *cond_type_optmenu;
115 GtkWidget *match_type_optmenu;
116 GtkWidget *size_match_optmenu;
117 GtkWidget *age_match_optmenu;
118 GtkWidget *status_match_optmenu;
119 GtkWidget *key_entry;
120 GtkWidget *spin_btn;
121 GtkWidget *label;
122
123 GtkWidget *match_menu_in_addr;
124 GtkWidget *match_menu_not_in_addr;
125
126 GtkWidget *del_btn;
127 GtkWidget *add_btn;
128
129 CondMenuType cur_type;
130 gchar *cur_header_name;
131
132 FilterCondEdit *cond_edit;
133};
134
135struct _ActionHBox {
136 GtkWidget *hbox;
137
138 GtkWidget *action_type_optmenu;
139 GtkWidget *label;
140 GtkWidget *folder_entry;
141 GtkWidget *cmd_entry;
142 GtkWidget *address_entry;
143 GtkWidget *clabel_optmenu;
144
145 GtkWidget *folder_sel_btn;
146
147 GtkWidget *action_type_menu_items[PF_ACTION_NONE];
148
149 GtkWidget *del_btn;
150 GtkWidget *add_btn;
151};
152
153
154FilterRule *prefs_filter_edit_open (FilterRule *rule,
155 const gchar *header,
156 const gchar *key);
157
158FilterCondEdit *prefs_filter_edit_cond_edit_create (void);
159void prefs_filter_edit_clear_cond_edit (FilterCondEdit *cond_edit);
160
161void prefs_filter_edit_set_header_list (FilterCondEdit *cond_edit,
162 FilterRule *rule);
163
164CondHBox *prefs_filter_edit_cond_hbox_create
165 (FilterCondEdit *cond_edit);
166ActionHBox *prefs_filter_edit_action_hbox_create (void);
167
168void prefs_filter_edit_cond_hbox_set (CondHBox *hbox,
169 FilterCond *cond);
170void prefs_filter_edit_action_hbox_set (ActionHBox *hbox,
171 FilterAction *action);
172
173void prefs_filter_edit_cond_hbox_select (CondHBox *hbox,
174 CondMenuType type,
175 const gchar *header_name);
176
177void prefs_filter_edit_set_cond_hbox_widgets (CondHBox *hbox,
178 CondMenuType type);
179void prefs_filter_edit_set_action_hbox_widgets (ActionHBox *hbox,
180 ActionMenuType type);
181
182void prefs_filter_edit_insert_cond_hbox (FilterCondEdit *cond_edit,
183 CondHBox *hbox,
184 gint pos);
185
186void prefs_filter_edit_add_rule_cond (FilterCondEdit *cond_edit,
187 FilterRule *rule);
188
189FilterCond *prefs_filter_edit_cond_hbox_to_cond (CondHBox *hbox,
190 gboolean case_sens,
191 gchar **error_msg);
192
193GSList *prefs_filter_edit_cond_edit_to_list (FilterCondEdit *cond_edit,
194 gboolean case_sens);
195
196#endif /* __PREFS_FILTER_EDIT_H__ */