2009-12-01 [holger] 3.7.3cvs25
[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         TARGET_MAIL_CM_PATH_LIST,
66 } TargetInfo;
67
68 #include "mainwindow.h"
69 #include "folderview.h"
70 #include "headerview.h"
71 #include "messageview.h"
72 #include "compose.h"
73 #include "folder.h"
74 #include "gtksctree.h"
75 #include "prefs_filtering.h"
76 #include "quicksearch.h"
77
78 extern GtkTargetEntry summary_drag_types[3];
79
80 struct _SummaryColumnState
81 {
82         SummaryColumnType type;
83         gboolean visible;
84 };
85
86 struct _SummaryView
87 {
88         GtkWidget *vbox;
89         GtkWidget *mainwidget_book;
90         GtkWidget *scrolledwin;
91         GtkWidget *ctree;
92         GtkWidget *hbox;
93         GtkWidget *hbox_l;
94         GtkWidget *hbox_spc;
95         GtkWidget *stat_box;
96         GtkWidget *stat_box2;
97         GtkWidget *folder_pixmap;
98         GtkWidget *folder_pixmap_eventbox;
99         GtkWidget *statlabel_folder;
100         GtkWidget *statlabel_select;
101         GtkWidget *statlabel_msgs;
102         GtkWidget *toggle_eventbox;
103         GtkWidget *toggle_arrow;
104 #ifdef GENERIC_UMPC
105         GtkWidget *multiple_sel_togbtn;
106         GtkWidget *multiple_sel_image;
107 #endif
108         GtkWidget *toggle_search;
109         GtkWidget *quick_search_pixmap;
110         GtkWidget *popupmenu;
111         GtkWidget *colorlabel_menu;
112         GtkWidget *tags_menu;
113
114         GtkWidget *window;
115
116         GtkCMCTreeNode *selected;
117         GtkCMCTreeNode *displayed;
118         GtkCMCTreeNode *last_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         MessageView  *ext_messageview;
136         QuickSearch  *quicksearch;
137
138         FolderItem *folder_item;
139
140         /* summaryview prefs */
141         gint important_score;
142         FolderSortKey sort_key;
143         FolderSortType sort_type;
144         guint threaded;
145         guint thread_collapsed;
146
147         /* Extra data for summaryview */
148         regex_t *simplify_subject_preg;
149
150         /* current message status */
151         gint   unreadmarked;
152         goffset total_size;
153         gint   deleted;
154         gint   moved;
155         gint   copied;
156
157 /*
158 private:
159 */
160         /* table for looking up message-id */
161         GHashTable *msgid_table;
162         GHashTable *subject_table;
163
164         /* list for moving/deleting messages */
165         GSList *mlist;
166         int msginfo_update_callback_id;
167
168         /* update folder label when renaming */
169         gint folder_item_update_callback_id;
170         gint folder_update_callback_id;
171
172         GtkTargetList *target_list; /* DnD */
173         
174 #if !GTK_CHECK_VERSION(2,12,0)
175         GtkTooltips *tooltips;
176 #endif
177 };
178
179 SummaryView     *summary_create(MainWindow *mainwin);
180 void summaryview_destroy(SummaryView *summaryview);
181 void summary_init                 (SummaryView          *summaryview);
182 gboolean summary_show             (SummaryView          *summaryview,
183                                    FolderItem           *fitem);
184 void summary_clear_list           (SummaryView          *summaryview);
185 void summary_clear_all            (SummaryView          *summaryview);
186
187 void summary_lock                 (SummaryView          *summaryview);
188 void summary_unlock               (SummaryView          *summaryview);
189 void summary_freeze               (SummaryView          *summaryview);
190 void summary_thaw                 (SummaryView          *summaryview);
191 void summary_grab_focus           (SummaryView          *summaryview);
192 GtkWidget *summary_get_main_widget(SummaryView          *summaryview);
193 gboolean summary_is_locked        (SummaryView          *summaryview);
194
195 SummarySelection summary_get_selection_type     (SummaryView    *summaryview);
196 MsgInfo *summary_get_selected_msg               (SummaryView *summaryview);
197 GSList *summary_get_selected_msg_list           (SummaryView    *summaryview);
198
199 void summary_select_prev_unread   (SummaryView          *summaryview);
200 void summary_select_next_unread   (SummaryView          *summaryview);
201 void summary_select_prev_new      (SummaryView          *summaryview);
202 void summary_select_next_new      (SummaryView          *summaryview);
203 void summary_select_prev_marked   (SummaryView          *summaryview);
204 void summary_select_next_marked   (SummaryView          *summaryview);
205 void summary_select_prev_labeled  (SummaryView          *summaryview);
206 void summary_select_next_labeled  (SummaryView          *summaryview);
207 void summary_select_last_read     (SummaryView          *summaryview);
208 void summary_select_parent        (SummaryView          *summaryview);
209 void summary_select_by_msgnum     (SummaryView          *summaryview,
210                                    guint                 msgnum);
211 guint summary_get_current_msgnum  (SummaryView          *summaryview);
212 void summary_select_node          (SummaryView          *summaryview,
213                                    GtkCMCTreeNode               *node,
214                                    gboolean              display_msg,
215                                    gboolean              do_refresh);
216
217 void summary_expand_threads       (SummaryView          *summaryview);
218 void summary_collapse_threads     (SummaryView          *summaryview);
219 void summary_toggle_ignore_thread (SummaryView          *summaryview);
220 void summary_toggle_watch_thread  (SummaryView          *summaryview);
221
222 void summary_filter               (SummaryView          *summaryview,
223                                    gboolean              selected_only);
224 void summary_filter_open          (SummaryView *summaryview,
225                                    PrefsFilterType type,
226                                    gint processing_rule);
227 void summary_msginfo_filter_open  (FolderItem * item, MsgInfo *msginfo,
228                                    PrefsFilterType type, gint processing_rule);
229
230 void summary_sort                 (SummaryView          *summaryview,
231                                    FolderSortKey         sort_key,
232                                    FolderSortType        sort_type);
233
234 void summary_delete               (SummaryView          *summaryview);
235 void summary_delete_trash         (SummaryView          *summaryview);
236
237 void summary_cancel               (SummaryView          *summaryview);
238
239 gboolean summary_execute          (SummaryView          *summaryview);
240 gboolean summary_expunge          (SummaryView          *summaryview);
241
242 void summary_attract_by_subject   (SummaryView          *summaryview);
243
244 gint summary_write_cache          (SummaryView          *summaryview);
245
246 gboolean summary_pass_key_press_event (SummaryView              *summaryview,
247                                    GdkEventKey          *event);
248
249 void summary_display_msg_selected (SummaryView          *summaryview,
250                                    gboolean              all_headers);
251 void summary_redisplay_msg        (SummaryView          *summaryview);
252 void summary_open_msg             (SummaryView          *summaryview);
253 void summary_open_row             (GtkSCTree *sctree, SummaryView *summaryview);
254 void summary_view_source          (SummaryView          *summaryview);
255 void summary_reedit               (SummaryView          *summaryview);
256 gboolean summary_step             (SummaryView          *summaryview,
257                                    GtkScrollType         type);
258 void summary_toggle_view          (SummaryView          *summaryview);
259 void summary_set_marks_selected   (SummaryView          *summaryview);
260 guint summary_get_msgnum          (SummaryView          *summaryview,
261                                    GtkCMCTreeNode               *node);
262
263 void summary_move_selected_to     (SummaryView          *summaryview,
264                                    FolderItem           *to_folder);
265 void summary_move_to              (SummaryView          *summaryview);
266 void summary_copy_selected_to     (SummaryView          *summaryview,
267                                    FolderItem           *to_folder);
268 GSList *summary_get_selection     (SummaryView          *summaryview);
269 void summary_copy_to              (SummaryView          *summaryview);
270 void summary_save_as              (SummaryView          *summaryview);
271 void summary_print                (SummaryView          *summaryview);
272 void summary_mark                 (SummaryView          *summaryview);
273 void summary_unmark               (SummaryView          *summaryview);
274 void summary_mark_as_unread       (SummaryView          *summaryview);
275 void summary_mark_as_read         (SummaryView          *summaryview);
276 void summary_msgs_lock            (SummaryView          *summaryview);
277 void summary_msgs_unlock          (SummaryView          *summaryview);
278 void summary_mark_all_read        (SummaryView          *summaryview);
279 void summary_mark_as_spam         (SummaryView          *summaryview, 
280                                    guint                 action, 
281                                    GtkWidget            *widget);
282 void summary_ignore_thread        (SummaryView          *summaryview);
283 void summary_unignore_thread      (SummaryView          *summaryview);
284 void summary_watch_thread         (SummaryView          *summaryview);
285 void summary_unwatch_thread       (SummaryView          *summaryview);
286
287 void summary_add_address          (SummaryView          *summaryview);
288 void summary_select_all           (SummaryView          *summaryview);
289 void summary_unselect_all         (SummaryView          *summaryview);
290 void summary_select_thread        (SummaryView          *summaryview,
291                                    gboolean              delete_thread);
292
293 void summary_set_colorlabel       (SummaryView          *summaryview,
294                                    guint                 labelcolor,
295                                    GtkWidget            *widget);
296 void summary_set_tag              (SummaryView          *summaryview,
297                                    gint                  tag_id,
298                                    GtkWidget            *widget);
299
300 void summary_set_column_order     (SummaryView          *summaryview);
301
302 void summary_toggle_show_read_messages
303                                   (SummaryView *summaryview);
304 void summary_toggle_show_del_messages
305                                   (SummaryView *summaryview);
306
307 void summary_toggle_view_real     (SummaryView  *summaryview);
308
309 void summary_reflect_prefs_pixmap_theme
310                                   (SummaryView *summaryview);
311 void summary_reflect_prefs_custom_colors(SummaryView *summaryview);
312 void summary_reflect_tags_changes(SummaryView *summaryview);
313 void summary_harvest_address      (SummaryView *summaryview);
314 void summary_set_prefs_from_folderitem
315                                   (SummaryView *summaryview, FolderItem *item);
316 void summary_save_prefs_to_folderitem
317                                   (SummaryView *summaryview, FolderItem *item);
318 gint summaryview_export_mbox_list (SummaryView *summaryview);
319 void summaryview_lock(SummaryView *summaryview, FolderItem *item);
320 void summaryview_unlock(SummaryView *summaryview, FolderItem *item);
321 void summary_reflect_prefs(void);
322 void summaryview_activate_quicksearch(SummaryView *summaryview, gboolean show);
323 void summary_set_menu_sensitive (SummaryView            *summaryview);
324 void summary_relayout(SummaryView *summaryview);
325 void summary_update_unread(SummaryView *summaryview, FolderItem *removed_item);
326 gboolean summary_is_list(SummaryView *summaryview);
327 #endif /* __SUMMARY_H__ */