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