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