Statistics
| Revision:

root / src / prefs_filter_edit.h @ 2411

History | View | Annotate | Download (4.3 kB)

1 1 hiro
/*
2 1 hiro
 * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
3 2042 hiro
 * Copyright (C) 1999-2008 Hiroyuki Yamamoto
4 1 hiro
 *
5 1 hiro
 * This program is free software; you can redistribute it and/or modify
6 1 hiro
 * it under the terms of the GNU General Public License as published by
7 1 hiro
 * the Free Software Foundation; either version 2 of the License, or
8 1 hiro
 * (at your option) any later version.
9 1 hiro
 *
10 1 hiro
 * This program is distributed in the hope that it will be useful,
11 1 hiro
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 1 hiro
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 1 hiro
 * GNU General Public License for more details.
14 1 hiro
 *
15 1 hiro
 * You should have received a copy of the GNU General Public License
16 1 hiro
 * along with this program; if not, write to the Free Software
17 1 hiro
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 1 hiro
 */
19 1 hiro
20 1 hiro
#ifndef __PREFS_FILTER_EDIT_H__
21 1 hiro
#define __PREFS_FILTER_EDIT_H__
22 1 hiro
23 804 hiro
#include <gtk/gtkwidget.h>
24 804 hiro
25 1 hiro
#include "filter.h"
26 1 hiro
27 836 hiro
typedef struct _FilterCondEdit        FilterCondEdit;
28 836 hiro
typedef struct _CondHBox        CondHBox;
29 836 hiro
typedef struct _ActionHBox        ActionHBox;
30 836 hiro
31 804 hiro
typedef enum
32 804 hiro
{
33 804 hiro
        PF_COND_HEADER,
34 804 hiro
        PF_COND_TO_OR_CC,
35 804 hiro
        PF_COND_ANY_HEADER,
36 804 hiro
        PF_COND_BODY,
37 804 hiro
        PF_COND_CMD_TEST,
38 804 hiro
        PF_COND_SIZE,
39 804 hiro
        PF_COND_AGE,
40 905 hiro
        PF_COND_UNREAD,
41 905 hiro
        PF_COND_MARK,
42 905 hiro
        PF_COND_COLOR_LABEL,
43 905 hiro
        PF_COND_MIME,
44 804 hiro
        PF_COND_ACCOUNT,
45 804 hiro
        PF_COND_EDIT_HEADER,
46 804 hiro
        PF_COND_SEPARATOR,
47 804 hiro
        PF_COND_NONE
48 804 hiro
} CondMenuType;
49 804 hiro
50 804 hiro
typedef enum
51 804 hiro
{
52 804 hiro
        PF_MATCH_CONTAIN,
53 804 hiro
        PF_MATCH_NOT_CONTAIN,
54 804 hiro
        PF_MATCH_EQUAL,
55 804 hiro
        PF_MATCH_NOT_EQUAL,
56 804 hiro
        PF_MATCH_REGEX,
57 804 hiro
        PF_MATCH_NOT_REGEX,
58 804 hiro
        PF_MATCH_NONE
59 804 hiro
} MatchMenuType;
60 804 hiro
61 804 hiro
typedef enum
62 804 hiro
{
63 804 hiro
        PF_SIZE_LARGER,
64 804 hiro
        PF_SIZE_SMALLER
65 804 hiro
} SizeMatchType;
66 804 hiro
67 804 hiro
typedef enum
68 804 hiro
{
69 804 hiro
        PF_AGE_LONGER,
70 804 hiro
        PF_AGE_SHORTER
71 804 hiro
} AgeMatchType;
72 804 hiro
73 804 hiro
typedef enum
74 804 hiro
{
75 905 hiro
        PF_STATUS_MATCH,
76 905 hiro
        PF_STATUS_NOT_MATCH
77 905 hiro
} StatusMatchType;
78 905 hiro
79 905 hiro
typedef enum
80 905 hiro
{
81 804 hiro
        PF_ACTION_MOVE,
82 804 hiro
        PF_ACTION_COPY,
83 804 hiro
        PF_ACTION_NOT_RECEIVE,
84 804 hiro
        PF_ACTION_DELETE,
85 804 hiro
        PF_ACTION_EXEC,
86 804 hiro
        PF_ACTION_EXEC_ASYNC,
87 804 hiro
        PF_ACTION_MARK,
88 804 hiro
        PF_ACTION_COLOR_LABEL,
89 804 hiro
        PF_ACTION_MARK_READ,
90 804 hiro
        PF_ACTION_FORWARD,
91 804 hiro
        PF_ACTION_FORWARD_AS_ATTACHMENT,
92 804 hiro
        PF_ACTION_REDIRECT,
93 804 hiro
        PF_ACTION_STOP_EVAL,
94 804 hiro
        PF_ACTION_SEPARATOR,
95 804 hiro
        PF_ACTION_NONE
96 804 hiro
} ActionMenuType;
97 804 hiro
98 836 hiro
struct _FilterCondEdit {
99 808 hiro
        GtkWidget *cond_vbox;
100 808 hiro
        GSList *cond_hbox_list;
101 808 hiro
102 808 hiro
        GSList *hdr_list;
103 808 hiro
        GSList *rule_hdr_list;
104 808 hiro
105 836 hiro
        /* callback */
106 836 hiro
        void        (*add_hbox)        (CondHBox        *hbox);
107 836 hiro
};
108 836 hiro
109 836 hiro
struct _CondHBox {
110 804 hiro
        GtkWidget *hbox;
111 804 hiro
112 804 hiro
        GtkWidget *cond_type_optmenu;
113 804 hiro
        GtkWidget *match_type_optmenu;
114 804 hiro
        GtkWidget *size_match_optmenu;
115 804 hiro
        GtkWidget *age_match_optmenu;
116 905 hiro
        GtkWidget *status_match_optmenu;
117 804 hiro
        GtkWidget *key_entry;
118 804 hiro
        GtkWidget *spin_btn;
119 804 hiro
        GtkWidget *label;
120 804 hiro
121 804 hiro
        GtkWidget *del_btn;
122 804 hiro
        GtkWidget *add_btn;
123 804 hiro
124 804 hiro
        CondMenuType cur_type;
125 804 hiro
        gchar *cur_header_name;
126 808 hiro
127 808 hiro
        FilterCondEdit *cond_edit;
128 836 hiro
};
129 804 hiro
130 836 hiro
struct _ActionHBox {
131 804 hiro
        GtkWidget *hbox;
132 804 hiro
133 804 hiro
        GtkWidget *action_type_optmenu;
134 804 hiro
        GtkWidget *label;
135 804 hiro
        GtkWidget *folder_entry;
136 804 hiro
        GtkWidget *cmd_entry;
137 804 hiro
        GtkWidget *address_entry;
138 804 hiro
        GtkWidget *clabel_optmenu;
139 804 hiro
140 804 hiro
        GtkWidget *folder_sel_btn;
141 804 hiro
142 804 hiro
        GtkWidget *action_type_menu_items[PF_ACTION_NONE];
143 804 hiro
144 804 hiro
        GtkWidget *del_btn;
145 804 hiro
        GtkWidget *add_btn;
146 836 hiro
};
147 804 hiro
148 804 hiro
149 1 hiro
FilterRule *prefs_filter_edit_open        (FilterRule        *rule,
150 2042 hiro
                                         const gchar        *header,
151 2042 hiro
                                         const gchar        *key);
152 1 hiro
153 808 hiro
FilterCondEdit *prefs_filter_edit_cond_edit_create        (void);
154 808 hiro
void prefs_filter_edit_clear_cond_edit        (FilterCondEdit        *cond_edit);
155 808 hiro
156 811 hiro
void prefs_filter_edit_set_header_list        (FilterCondEdit        *cond_edit,
157 811 hiro
                                         FilterRule        *rule);
158 811 hiro
159 808 hiro
CondHBox *prefs_filter_edit_cond_hbox_create
160 808 hiro
                                        (FilterCondEdit        *cond_edit);
161 804 hiro
ActionHBox *prefs_filter_edit_action_hbox_create        (void);
162 804 hiro
163 804 hiro
void prefs_filter_edit_cond_hbox_set        (CondHBox        *hbox,
164 804 hiro
                                         FilterCond        *cond);
165 804 hiro
void prefs_filter_edit_action_hbox_set        (ActionHBox        *hbox,
166 804 hiro
                                         FilterAction        *action);
167 804 hiro
168 804 hiro
void prefs_filter_edit_cond_hbox_select        (CondHBox        *hbox,
169 804 hiro
                                         CondMenuType         type,
170 804 hiro
                                         const gchar        *header_name);
171 804 hiro
172 804 hiro
void prefs_filter_edit_set_cond_hbox_widgets        (CondHBox        *hbox,
173 804 hiro
                                                 CondMenuType         type);
174 804 hiro
void prefs_filter_edit_set_action_hbox_widgets        (ActionHBox        *hbox,
175 804 hiro
                                                 ActionMenuType         type);
176 804 hiro
177 808 hiro
void prefs_filter_edit_insert_cond_hbox                (FilterCondEdit        *cond_edit,
178 808 hiro
                                                 CondHBox        *hbox,
179 808 hiro
                                                 gint                 pos);
180 808 hiro
181 879 hiro
void prefs_filter_edit_add_rule_cond                (FilterCondEdit *cond_edit,
182 879 hiro
                                                 FilterRule        *rule);
183 879 hiro
184 811 hiro
FilterCond *prefs_filter_edit_cond_hbox_to_cond        (CondHBox        *hbox,
185 813 hiro
                                                 gboolean         case_sens,
186 811 hiro
                                                 gchar               **error_msg);
187 811 hiro
188 874 hiro
GSList *prefs_filter_edit_cond_edit_to_list        (FilterCondEdit        *cond_edit,
189 874 hiro
                                                 gboolean         case_sens);
190 874 hiro
191 1 hiro
#endif /* __PREFS_FILTER_EDIT_H__ */