2009-03-30 [colin] 3.7.1cvs30
[claws.git] / src / summaryview.h
1 /*
2  * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
3  * Copyright (C) 1999-2009 Hiroyuki Yamamoto and the Claws Mail team
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 3 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, see <http://www.gnu.org/licenses/>.
17  * 
18  */
19
20 #ifndef __SUMMARY_H__
21 #define __SUMMARY_H__
22
23 #include <sys/types.h>
24 #include <regex.h>
25
26 #include <glib.h>
27 #include <gdk/gdk.h>
28 #include <gtk/gtk.h>
29
30 typedef struct _SummaryView             SummaryView;
31 typedef struct _SummaryColumnState      SummaryColumnState;
32
33 #define MAIL_MANUAL_FILTERING_HOOKLIST "mail_manual_filtering_hooklist"
34
35 typedef enum
36 {
37         S_COL_MARK,
38         S_COL_STATUS,
39         S_COL_MIME,
40         S_COL_SUBJECT,
41         S_COL_FROM,
42         S_COL_TO,
43         S_COL_DATE,
44         S_COL_SIZE,
45         S_COL_NUMBER,
46         S_COL_SCORE,
47         S_COL_LOCKED,
48         S_COL_TAGS
49 } SummaryColumnType;
50
51 #define N_SUMMARY_COLS  12
52
53 typedef enum
54 {
55         SUMMARY_NONE,
56         SUMMARY_SELECTED_NONE,
57         SUMMARY_SELECTED_SINGLE,
58         SUMMARY_SELECTED_MULTIPLE
59 } SummarySelection;
60
61 typedef enum
62 {
63         TARGET_MAIL_URI_LIST,
64         TARGET_DUMMY
65 } TargetInfo;
66
67 #include "mainwindow.h"
68 #include "folderview.h"
69 #include "headerview.h"
70 #include "messageview.h"
71 #include "compose.h"
72 #include "folder.h"
73 #include "gtksctree.h"
74 #include "prefs_filtering.h"
75 #include "quicksearch.h"
76
77 extern GtkTargetEntry summary_drag_types[2];
78
79 struct _SummaryColumnState
80 {
81         SummaryColumnType type;
82         gboolean visible;
83 };
84
85 struct _SummaryView
86 {
87         GtkWidget *vbox;
88         GtkWidget *mainwidget_book;
89         GtkWidget *scrolledwin;
90         GtkWidget *ctree;
91         GtkWidget *hbox;
92         GtkWidget *hbox_l;
93         GtkWidget *hbox_spc;
94         GtkWidget *stat_box;
95         GtkWidget *stat_box2;
96         GtkWidget *folder_pixmap;
97         GtkWidget *folder_pixmap_eventbox;
98         GtkWidget *statlabel_folder;
99         GtkWidget *statlabel_select;
100         GtkWidget *statlabel_msgs;
101         GtkWidget *toggle_eventbox;
102         GtkWidget *toggle_arrow;
103 #ifdef GENERIC_UMPC
104         GtkWidget *multiple_sel_togbtn;
105         GtkWidget *multiple_sel_image;
106 #endif
107         GtkWidget *toggle_search;
108         GtkWidget *quick_search_pixmap;
109         GtkWidget *popupmenu;
110         GtkWidget *colorlabel_menu;
111         GtkWidget *tags_menu;
112
113         GtkWidget *window;
114
115         GtkCMCTreeNode *selected;
116         GtkCMCTreeNode *displayed;
117         GtkCMCTreeNode *last_displayed;
118
119         gboolean display_msg;
120
121         GdkColor color_important;
122         SummaryColumnState col_state[N_SUMMARY_COLS];
123         gint col_pos[N_SUMMARY_COLS];
124
125         GdkColor color_marked;
126         GdkColor color_dim;
127
128         guint lock_count;
129
130         MainWindow   *mainwin;
131         FolderView   *folderview;
132         HeaderView   *headerview;
133         MessageView  *messageview;
134         MessageView  *ext_messageview;
135         QuickSearch  *quicksearch;
136
137         FolderItem *folder_item;
138
139         /* summaryview prefs */
140         gint important_score;
141         FolderSortKey sort_key;
142         FolderSortType sort_type;
143         guint threaded;
144         guint thread_collapsed;
145
146         /* Extra data for summaryview */
147         regex_t *simplify_subject_preg;
148
149         /* current message status */
150         gint   unreadmarked;
151         goffset total_size;
152         gint   deleted;
153         gint   moved;
154         gint   copied;
155
156 /*
157 private:
158 */
159         /* table for looking up message-id */
160         GHashTable *msgid_table;
161         GHashTable *subject_table;
162
163         /* list for moving/deleting messages */
164         GSList *mlist;
165         int msginfo_update_callback_id;
166
167         /* update folder label when renaming */
168         gint folder_item_update_callback_id;
169         gint folder_update_callback_id;
170
171         GtkTargetList *target_list; /* DnD */
172         
173 #if !GTK_CHECK_VERSION(2,12,0)
174         GtkTooltips *tooltips;
175 #endif
176 };
177
178 SummaryView     *summary_create(MainWindow *mainwin);
179 void summaryview_destroy(SummaryView *summaryview);
180 void summary_init                 (SummaryView          *summaryview);
181 gboolean summary_show             (SummaryView          *summaryview,
182                                    FolderItem           *fitem);
183 void summary_clear_list           (SummaryView          *summaryview);
184 void summary_clear_all            (SummaryView          *summaryview);
185
186 void summary_lock                 (SummaryView          *summaryview);
187 void summary_unlock               (SummaryView          *summaryview);
188 void summary_freeze               (SummaryView          *summaryview);
189 void summary_thaw                 (SummaryView          *summaryview);
190 void summary_grab_focus           (SummaryView          *summaryview);
191 GtkWidget *summary_get_main_widget(SummaryView          *summaryview);
192 gboolean summary_is_locked        (SummaryView          *summaryview);
193
194 SummarySelection summary_get_selection_type     (SummaryView    *summaryview);
195 MsgInfo *summary_get_selected_msg               (SummaryView *summaryview);
196 GSList *summary_get_selected_msg_list           (SummaryView    *summaryview);
197
198 void summary_select_prev_unread   (SummaryView          *summaryview);
199 void summary_select_next_unread   (SummaryView          *summaryview);
200 void summary_select_prev_new      (SummaryView          *summaryview);
201 void summary_select_next_new      (SummaryView          *summaryview);
202 void summary_select_prev_marked   (SummaryView          *summaryview);
203 void summary_select_next_marked   (SummaryView          *summaryview);
204 void summary_select_prev_labeled  (SummaryView          *summaryview);
205 void summary_select_next_labeled  (SummaryView          *summaryview);
206 void summary_select_last_read     (SummaryView          *summaryview);
207 void summary_select_parent        (SummaryView          *summaryview);
208 void summary_select_by_msgnum     (SummaryView          *summaryview,
209                                    guint                 msgnum);
210 guint summary_get_current_msgnum  (SummaryView          *summaryview);
211 void summary_select_node          (SummaryView          *summaryview,
212                                    GtkCMCTreeNode               *node,
213                                    gboolean              display_msg,
214                                    gboolean              do_refresh);
215
216 void summary_expand_threads       (SummaryView          *summaryview);
217 void summary_collapse_threads     (SummaryView          *summaryview);
218 void summary_toggle_ignore_thread (SummaryView          *summaryview);
219 void summary_toggle_watch_thread  (SummaryView          *summaryview);
220
221 void summary_filter               (SummaryView          *summaryview,
222                                    gboolean              selected_only);
223 void summary_filter_open          (SummaryView *summaryview,
224                                    PrefsFilterType type,
225                                    gint processing_rule);
226 void summary_msginfo_filter_open  (FolderItem * item, MsgInfo *msginfo,
227                                    PrefsFilterType type, gint processing_rule);
228
229 void summary_sort                 (SummaryView          *summaryview,
230                                    FolderSortKey         sort_key,
231                                    FolderSortType        sort_type);
232
233 void summary_delete               (SummaryView          *summaryview);
234 void summary_delete_trash         (SummaryView          *summaryview);
235
236 void summary_cancel               (SummaryView          *summaryview);
237
238 gboolean summary_execute          (SummaryView          *summaryview);
239 gboolean summary_expunge          (SummaryView          *summaryview);
240
241 void summary_attract_by_subject   (SummaryView          *summaryview);
242
243 gint summary_write_cache          (SummaryView          *summaryview);
244
245 gboolean summary_pass_key_press_event (SummaryView              *summaryview,
246                                    GdkEventKey          *event);
247
248 void summary_display_msg_selected (SummaryView          *summaryview,
249                                    gboolean              all_headers);
250 void summary_redisplay_msg        (SummaryView          *summaryview);
251 void summary_open_msg             (SummaryView          *summaryview);
252 void summary_open_row             (GtkSCTree *sctree, SummaryView *summaryview);
253 void summary_view_source          (SummaryView          *summaryview);
254 void summary_reedit               (SummaryView          *summaryview);
255 gboolean summary_step             (SummaryView          *summaryview,
256                                    GtkScrollType         type);
257 void summary_toggle_view          (SummaryView          *summaryview);
258 void summary_set_marks_selected   (SummaryView          *summaryview);
259 guint summary_get_msgnum          (SummaryView          *summaryview,
260                                    GtkCMCTreeNode               *node);
261
262 void summary_move_selected_to     (SummaryView          *summaryview,
263                                    FolderItem           *to_folder);
264 void summary_move_to              (SummaryView          *summaryview);
265 void summary_copy_selected_to     (SummaryView          *summaryview,
266                                    FolderItem           *to_folder);
267 GSList *summary_get_selection     (SummaryView          *summaryview);
268 void summary_copy_to              (SummaryView          *summaryview);
269 void summary_save_as              (SummaryView          *summaryview);
270 void summary_print                (SummaryView          *summaryview);
271 void summary_mark                 (SummaryView          *summaryview);
272 void summary_unmark               (SummaryView          *summaryview);
273 void summary_mark_as_unread       (SummaryView          *summaryview);
274 void summary_mark_as_read         (SummaryView          *summaryview);
275 void summary_msgs_lock            (SummaryView          *summaryview);
276 void summary_msgs_unlock          (SummaryView          *summaryview);
277 void summary_mark_all_read        (SummaryView          *summaryview);
278 void summary_mark_as_spam         (SummaryView          *summaryview, 
279                                    guint                 action, 
280                                    GtkWidget            *widget);
281 void summary_ignore_thread        (SummaryView          *summaryview);
282 void summary_unignore_thread      (SummaryView          *summaryview);
283 void summary_watch_thread         (SummaryView          *summaryview);
284 void summary_unwatch_thread       (SummaryView          *summaryview);
285
286 void summary_add_address          (SummaryView          *summaryview);
287 void summary_select_all           (SummaryView          *summaryview);
288 void summary_unselect_all         (SummaryView          *summaryview);
289 void summary_select_thread        (SummaryView          *summaryview,
290                                    gboolean              delete_thread);
291
292 void summary_set_colorlabel       (SummaryView          *summaryview,
293                                    guint                 labelcolor,
294                                    GtkWidget            *widget);
295 void summary_set_tag              (SummaryView          *summaryview,
296                                    gint                  tag_id,
297                                    GtkWidget            *widget);
298
299 void summary_set_column_order     (SummaryView          *summaryview);
300
301 void summary_toggle_show_read_messages
302                                   (SummaryView *summaryview);
303 void summary_toggle_show_del_messages
304                                   (SummaryView *summaryview);
305
306 void summary_toggle_view_real     (SummaryView  *summaryview);
307
308 void summary_reflect_prefs_pixmap_theme
309                                   (SummaryView *summaryview);
310 void summary_reflect_prefs_custom_colors(SummaryView *summaryview);
311 void summary_reflect_tags_changes(SummaryView *summaryview);
312 void summary_harvest_address      (SummaryView *summaryview);
313 void summary_set_prefs_from_folderitem
314                                   (SummaryView *summaryview, FolderItem *item);
315 void summary_save_prefs_to_folderitem
316                                   (SummaryView *summaryview, FolderItem *item);
317 gint summaryview_export_mbox_list (SummaryView *summaryview);
318 void summaryview_lock(SummaryView *summaryview, FolderItem *item);
319 void summaryview_unlock(SummaryView *summaryview, FolderItem *item);
320 void summary_reflect_prefs(void);
321 void summaryview_activate_quicksearch(SummaryView *summaryview, gboolean show);
322 void summary_set_menu_sensitive (SummaryView            *summaryview);
323 void summary_relayout(SummaryView *summaryview);
324 void summary_update_unread(SummaryView *summaryview, FolderItem *removed_item);
325 gboolean summary_is_list(SummaryView *summaryview);
326 #endif /* __SUMMARY_H__ */