add Lock/Unlock to summary view popup menu
[claws.git] / src / summaryview.h
1 /*
2  * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
3  * Copyright (C) 1999-2002 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 __SUMMARY_H__
21 #define __SUMMARY_H__
22
23 #include <regex.h>
24
25 #include <glib.h>
26 #include <gdk/gdk.h>
27 #include <gtk/gtkwidget.h>
28 #include <gtk/gtkitemfactory.h>
29 #include <gtk/gtkctree.h>
30 #include <gtk/gtkdnd.h>
31
32 typedef struct _SummaryView             SummaryView;
33 typedef struct _SummaryColumnState      SummaryColumnState;
34
35 #include "mainwindow.h"
36 #include "folderview.h"
37 #include "headerview.h"
38 #include "messageview.h"
39 #include "compose.h"
40 #include "folder.h"
41 #include "gtksctree.h"
42 #include "prefs_filtering.h"
43
44 typedef enum
45 {
46         S_COL_MARK,
47         S_COL_STATUS,
48         S_COL_MIME,
49         S_COL_SUBJECT,
50         S_COL_FROM,
51         S_COL_DATE,
52         S_COL_SIZE,
53         S_COL_NUMBER,
54         S_COL_SCORE,
55         S_COL_LOCKED
56 } SummaryColumnType;
57
58 #define N_SUMMARY_COLS  10
59
60 typedef enum
61 {
62         SUMMARY_NONE,
63         SUMMARY_SELECTED_NONE,
64         SUMMARY_SELECTED_SINGLE,
65         SUMMARY_SELECTED_MULTIPLE
66 } SummarySelection;
67
68 typedef enum
69 {
70         TARGET_MAIL_URI_LIST,
71         TARGET_DUMMY
72 } TargetInfo;
73
74 typedef enum
75 {
76         S_SEARCH_SUBJECT,
77         S_SEARCH_FROM,
78         S_SEARCH_TO,
79         S_SEARCH_EXTENDED
80 } SummarySearchType;
81
82 extern GtkTargetEntry summary_drag_types[1];
83
84 struct _SummaryColumnState
85 {
86         SummaryColumnType type;
87         gboolean visible;
88 };
89
90 struct _SummaryView
91 {
92         GtkWidget *vbox;
93         GtkWidget *scrolledwin;
94         GtkWidget *ctree;
95         GtkWidget *hbox;
96         GtkWidget *hbox_l;
97         GtkWidget *hbox_search;
98         GtkWidget *folder_pixmap;
99         GtkWidget *statlabel_folder;
100         GtkWidget *statlabel_select;
101         GtkWidget *statlabel_msgs;
102         GtkWidget *toggle_eventbox;
103         GtkWidget *toggle_arrow;
104         GtkWidget *toggle_search;
105         GtkWidget *quick_search_pixmap;
106         GtkWidget *popupmenu;
107         GtkWidget *colorlabel_menu;
108         GtkWidget *search_type_opt;
109         GtkWidget *search_type;
110         GtkWidget *search_string;
111         GtkWidget *search_description;
112
113         GtkItemFactory *popupfactory;
114
115         GtkWidget *window;
116
117         GtkCTreeNode *selected;
118         GtkCTreeNode *displayed;
119
120         gboolean display_msg;
121
122         GdkColor color_important;
123         SummaryColumnState col_state[N_SUMMARY_COLS];
124         gint col_pos[N_SUMMARY_COLS];
125
126         GdkColor color_marked;
127         GdkColor color_dim;
128
129         guint lock_count;
130
131         MainWindow   *mainwin;
132         FolderView   *folderview;
133         HeaderView   *headerview;
134         MessageView  *messageview;
135
136         FolderItem *folder_item;
137
138         /* summaryview prefs */
139         gint important_score;
140         FolderSortKey sort_key;
141         FolderSortType sort_type;
142         guint threaded;
143         guint thread_collapsed;
144
145         /* Extra data for summaryview */
146         regex_t *simplify_subject_preg;
147
148         /* current message status */
149         gint   newmsgs;
150         gint   unread;
151         gint   unreadmarked;
152         gint   messages;
153         off_t  total_size;
154         gint   deleted;
155         gint   moved;
156         gint   copied;
157
158 /*
159 private:
160 */
161         /* table for looking up message-id */
162         GHashTable *msgid_table;
163         GHashTable *subject_table;
164
165         /* list for moving/deleting messages */
166         GSList *mlist;
167         int msginfo_update_callback_id;
168 };
169
170 SummaryView     *summary_create(void);
171
172 void summary_init                 (SummaryView          *summaryview);
173 gboolean summary_show             (SummaryView          *summaryview,
174                                    FolderItem           *fitem);
175 void summary_clear_list           (SummaryView          *summaryview);
176 void summary_clear_all            (SummaryView          *summaryview);
177
178 void summary_lock                 (SummaryView          *summaryview);
179 void summary_unlock               (SummaryView          *summaryview);
180 gboolean summary_is_locked        (SummaryView          *summaryview);
181
182 SummarySelection summary_get_selection_type     (SummaryView    *summaryview);
183
184 void summary_select_prev_unread   (SummaryView          *summaryview);
185 void summary_select_next_unread   (SummaryView          *summaryview);
186 void summary_select_prev_new      (SummaryView          *summaryview);
187 void summary_select_next_new      (SummaryView          *summaryview);
188 void summary_select_prev_marked   (SummaryView          *summaryview);
189 void summary_select_next_marked   (SummaryView          *summaryview);
190 void summary_select_prev_labeled  (SummaryView          *summaryview);
191 void summary_select_next_labeled  (SummaryView          *summaryview);
192 void summary_select_by_msgnum     (SummaryView          *summaryview,
193                                    guint                 msgnum);
194 guint summary_get_current_msgnum  (SummaryView          *summaryview);
195 void summary_select_node          (SummaryView          *summaryview,
196                                    GtkCTreeNode         *node,
197                                    gboolean              display_msg,
198                                    gboolean              do_refresh);
199
200 void summary_thread_build         (SummaryView          *summaryview);
201 void summary_unthread             (SummaryView          *summaryview);
202
203 void summary_expand_threads       (SummaryView          *summaryview);
204 void summary_collapse_threads     (SummaryView          *summaryview);
205
206 void summary_filter               (SummaryView          *summaryview);
207 void summary_filter_open          (SummaryView          *summaryview,
208                                    PrefsFilterType       type);
209
210 void summary_sort                 (SummaryView          *summaryview,
211                                    FolderSortKey         sort_key,
212                                    FolderSortType        sort_type);
213
214 void summary_delete               (SummaryView          *summaryview);
215 void summary_delete_duplicated    (SummaryView          *summaryview);
216
217 void summary_cancel               (SummaryView          *summaryview);
218
219 gboolean summary_execute          (SummaryView          *summaryview);
220
221 void summary_attract_by_subject   (SummaryView          *summaryview);
222
223 gint summary_write_cache          (SummaryView          *summaryview);
224
225 void summary_pass_key_press_event (SummaryView          *summaryview,
226                                    GdkEventKey          *event);
227
228 void summary_display_msg_selected (SummaryView          *summaryview,
229                                    gboolean              all_headers);
230 void summary_redisplay_msg        (SummaryView          *summaryview);
231 void summary_open_msg             (SummaryView          *summaryview);
232 void summary_view_source          (SummaryView          *summaryview);
233 void summary_reedit               (SummaryView          *summaryview);
234 void summary_step                 (SummaryView          *summaryview,
235                                    GtkScrollType         type);
236 void summary_toggle_view          (SummaryView          *summaryview);
237 void summary_set_marks_selected   (SummaryView          *summaryview);
238
239 void summary_move_selected_to     (SummaryView          *summaryview,
240                                    FolderItem           *to_folder);
241 void summary_move_to              (SummaryView          *summaryview);
242 void summary_copy_selected_to     (SummaryView          *summaryview,
243                                    FolderItem           *to_folder);
244 GSList *summary_get_selection     (SummaryView          *summaryview);
245 void summary_copy_to              (SummaryView          *summaryview);
246 void summary_save_as              (SummaryView          *summaryview);
247 void summary_print                (SummaryView          *summaryview);
248 void summary_mark                 (SummaryView          *summaryview);
249 void summary_unmark               (SummaryView          *summaryview);
250 void summary_mark_as_unread       (SummaryView          *summaryview);
251 void summary_mark_as_read         (SummaryView          *summaryview);
252 void summary_msgs_lock            (SummaryView          *summaryview);
253 void summary_msgs_unlock          (SummaryView          *summaryview);
254 void summary_mark_all_read        (SummaryView          *summaryview);
255 void summary_add_address          (SummaryView          *summaryview);
256 void summary_select_all           (SummaryView          *summaryview);
257 void summary_unselect_all         (SummaryView          *summaryview);
258 void summary_select_thread        (SummaryView          *summaryview);
259
260 void summary_set_colorlabel       (SummaryView          *summaryview,
261                                    guint                 labelcolor,
262                                    GtkWidget            *widget);
263 void summary_set_colorlabel_color (GtkCTree             *ctree,
264                                    GtkCTreeNode         *node,
265                                    guint                 labelcolor);
266
267 void summary_set_column_order     (SummaryView          *summaryview);
268
269 #if 0 /* OLD PROCESSING */
270 void processing_apply();
271 #endif
272
273 void summary_toggle_show_read_messages
274                                   (SummaryView *summaryview);
275
276 void summary_toggle_view_real     (SummaryView  *summaryview);
277
278 void summary_reflect_prefs_pixmap_theme
279                                   (SummaryView *summaryview);
280
281 void summary_harvest_address      (SummaryView *summaryview);
282 void summary_set_prefs_from_folderitem
283                                   (SummaryView *summaryview, FolderItem *item);
284 void summary_save_prefs_to_folderitem
285                                   (SummaryView *summaryview, FolderItem *item);
286
287 #endif /* __SUMMARY_H__ */