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