root / src / prefs_filter_edit.h @ 2411
History | View | Annotate | Download (4.3 kB)
| 1 | /*
|
|---|---|
| 2 | * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client |
| 3 | * Copyright (C) 1999-2008 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 | |
| 27 | typedef struct _FilterCondEdit FilterCondEdit; |
| 28 | typedef struct _CondHBox CondHBox; |
| 29 | typedef struct _ActionHBox ActionHBox; |
| 30 | |
| 31 | typedef 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 | |
| 50 | typedef 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_NONE |
| 59 | } MatchMenuType; |
| 60 | |
| 61 | typedef enum |
| 62 | {
|
| 63 | PF_SIZE_LARGER, |
| 64 | PF_SIZE_SMALLER |
| 65 | } SizeMatchType; |
| 66 | |
| 67 | typedef enum |
| 68 | {
|
| 69 | PF_AGE_LONGER, |
| 70 | PF_AGE_SHORTER |
| 71 | } AgeMatchType; |
| 72 | |
| 73 | typedef enum |
| 74 | {
|
| 75 | PF_STATUS_MATCH, |
| 76 | PF_STATUS_NOT_MATCH |
| 77 | } StatusMatchType; |
| 78 | |
| 79 | typedef enum |
| 80 | {
|
| 81 | PF_ACTION_MOVE, |
| 82 | PF_ACTION_COPY, |
| 83 | PF_ACTION_NOT_RECEIVE, |
| 84 | PF_ACTION_DELETE, |
| 85 | PF_ACTION_EXEC, |
| 86 | PF_ACTION_EXEC_ASYNC, |
| 87 | PF_ACTION_MARK, |
| 88 | PF_ACTION_COLOR_LABEL, |
| 89 | PF_ACTION_MARK_READ, |
| 90 | PF_ACTION_FORWARD, |
| 91 | PF_ACTION_FORWARD_AS_ATTACHMENT, |
| 92 | PF_ACTION_REDIRECT, |
| 93 | PF_ACTION_STOP_EVAL, |
| 94 | PF_ACTION_SEPARATOR, |
| 95 | PF_ACTION_NONE |
| 96 | } ActionMenuType; |
| 97 | |
| 98 | struct _FilterCondEdit {
|
| 99 | GtkWidget *cond_vbox; |
| 100 | GSList *cond_hbox_list; |
| 101 | |
| 102 | GSList *hdr_list; |
| 103 | GSList *rule_hdr_list; |
| 104 | |
| 105 | /* callback */
|
| 106 | void (*add_hbox) (CondHBox *hbox);
|
| 107 | }; |
| 108 | |
| 109 | struct _CondHBox {
|
| 110 | GtkWidget *hbox; |
| 111 | |
| 112 | GtkWidget *cond_type_optmenu; |
| 113 | GtkWidget *match_type_optmenu; |
| 114 | GtkWidget *size_match_optmenu; |
| 115 | GtkWidget *age_match_optmenu; |
| 116 | GtkWidget *status_match_optmenu; |
| 117 | GtkWidget *key_entry; |
| 118 | GtkWidget *spin_btn; |
| 119 | GtkWidget *label; |
| 120 | |
| 121 | GtkWidget *del_btn; |
| 122 | GtkWidget *add_btn; |
| 123 | |
| 124 | CondMenuType cur_type; |
| 125 | gchar *cur_header_name; |
| 126 | |
| 127 | FilterCondEdit *cond_edit; |
| 128 | }; |
| 129 | |
| 130 | struct _ActionHBox {
|
| 131 | GtkWidget *hbox; |
| 132 | |
| 133 | GtkWidget *action_type_optmenu; |
| 134 | GtkWidget *label; |
| 135 | GtkWidget *folder_entry; |
| 136 | GtkWidget *cmd_entry; |
| 137 | GtkWidget *address_entry; |
| 138 | GtkWidget *clabel_optmenu; |
| 139 | |
| 140 | GtkWidget *folder_sel_btn; |
| 141 | |
| 142 | GtkWidget *action_type_menu_items[PF_ACTION_NONE]; |
| 143 | |
| 144 | GtkWidget *del_btn; |
| 145 | GtkWidget *add_btn; |
| 146 | }; |
| 147 | |
| 148 | |
| 149 | FilterRule *prefs_filter_edit_open (FilterRule *rule, |
| 150 | const gchar *header,
|
| 151 | const gchar *key);
|
| 152 | |
| 153 | FilterCondEdit *prefs_filter_edit_cond_edit_create (void);
|
| 154 | void prefs_filter_edit_clear_cond_edit (FilterCondEdit *cond_edit);
|
| 155 | |
| 156 | void prefs_filter_edit_set_header_list (FilterCondEdit *cond_edit,
|
| 157 | FilterRule *rule); |
| 158 | |
| 159 | CondHBox *prefs_filter_edit_cond_hbox_create |
| 160 | (FilterCondEdit *cond_edit); |
| 161 | ActionHBox *prefs_filter_edit_action_hbox_create (void);
|
| 162 | |
| 163 | void prefs_filter_edit_cond_hbox_set (CondHBox *hbox,
|
| 164 | FilterCond *cond); |
| 165 | void prefs_filter_edit_action_hbox_set (ActionHBox *hbox,
|
| 166 | FilterAction *action); |
| 167 | |
| 168 | void prefs_filter_edit_cond_hbox_select (CondHBox *hbox,
|
| 169 | CondMenuType type, |
| 170 | const gchar *header_name);
|
| 171 | |
| 172 | void prefs_filter_edit_set_cond_hbox_widgets (CondHBox *hbox,
|
| 173 | CondMenuType type); |
| 174 | void prefs_filter_edit_set_action_hbox_widgets (ActionHBox *hbox,
|
| 175 | ActionMenuType type); |
| 176 | |
| 177 | void prefs_filter_edit_insert_cond_hbox (FilterCondEdit *cond_edit,
|
| 178 | CondHBox *hbox, |
| 179 | gint pos); |
| 180 | |
| 181 | void prefs_filter_edit_add_rule_cond (FilterCondEdit *cond_edit,
|
| 182 | FilterRule *rule); |
| 183 | |
| 184 | FilterCond *prefs_filter_edit_cond_hbox_to_cond (CondHBox *hbox, |
| 185 | gboolean case_sens, |
| 186 | gchar **error_msg); |
| 187 | |
| 188 | GSList *prefs_filter_edit_cond_edit_to_list (FilterCondEdit *cond_edit, |
| 189 | gboolean case_sens); |
| 190 | |
| 191 | #endif /* __PREFS_FILTER_EDIT_H__ */ |