18548d3871bd9a5a2dc13f7ef167fc87e883c989
[claws.git] / src / summaryview.h
1 /*
2  * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
3  * Copyright (C) 1999-2002 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 <regex.h>
24
25 #include <glib.h>
26 #include <gdk/gdk.h>
27 #include <gtk/gtkwidget.h>
28 #include <gtk/gtkitemfactory.h>
29 #include <gtk/gtkctree.h>
30 #include <gtk/gtkdnd.h>
31
32 typedef struct _SummaryView             SummaryView;
33 typedef struct _SummaryColumnState      SummaryColumnState;
34
35 #include "mainwindow.h"
36 #include "folderview.h"
37 #include "headerview.h"
38 #include "messageview.h"
39 #include "compose.h"
40 #include "prefs_filter.h"
41 #include "folder.h"
42 #include "gtksctree.h"
43
44 typedef enum
45 {
46         S_COL_MARK,
47         S_COL_UNREAD,
48         S_COL_MIME,
49         S_COL_SUBJECT,
50         S_COL_FROM,
51         S_COL_DATE,
52         S_COL_SIZE,
53         S_COL_NUMBER,
54         S_COL_SCORE,
55         S_COL_LOCKED
56 } SummaryColumnType;
57
58 #define N_SUMMARY_COLS  10
59
60 typedef enum
61 {
62         SUMMARY_NONE,
63         SUMMARY_SELECTED_NONE,
64         SUMMARY_SELECTED_SINGLE,
65         SUMMARY_SELECTED_MULTIPLE
66 } SummarySelection;
67
68 typedef enum
69 {
70         TARGET_MAIL_URI_LIST,
71         TARGET_DUMMY
72 } TargetInfo;
73
74 typedef enum
75 {
76         S_SEARCH_SUBJECT,
77         S_SEARCH_FROM,
78         S_SEARCH_TO
79 } SummarySearchType;
80
81 extern GtkTargetEntry summary_drag_types[1];
82
83 struct _SummaryColumnState
84 {
85         SummaryColumnType type;
86         gboolean visible;
87 };
88
89 struct _SummaryView
90 {
91         GtkWidget *vbox;
92         GtkWidget *scrolledwin;
93         GtkWidget *ctree;
94         GtkWidget *hbox;
95         GtkWidget *hbox_l;
96         GtkWidget *hbox_search;
97         GtkWidget *folder_pixmap;
98         GtkWidget *statlabel_folder;
99         GtkWidget *statlabel_select;
100         GtkWidget *statlabel_msgs;
101         GtkWidget *toggle_eventbox;
102         GtkWidget *toggle_arrow;
103         GtkWidget *popupmenu;
104         GtkWidget *colorlabel_menu;
105         GtkWidget *search_type_opt;
106         GtkWidget *search_type;
107         GtkWidget *search_string;
108
109         GtkItemFactory *popupfactory;
110
111         GtkWidget *window;
112
113         GtkCTreeNode *selected;
114         GtkCTreeNode *displayed;
115
116         gboolean display_msg;
117
118         GdkColor color_important;
119         SummaryColumnState col_state[N_SUMMARY_COLS];
120         gint col_pos[N_SUMMARY_COLS];
121
122         GdkColor color_marked;
123         GdkColor color_dim;
124
125         guint lock_count;
126
127         MainWindow   *mainwin;
128         FolderView   *folderview;
129         HeaderView   *headerview;
130         MessageView  *messageview;
131
132         FolderItem *folder_item;
133
134         /* summaryview prefs */
135         gint important_score;
136         FolderSortKey sort_key;
137         FolderSortType sort_type;
138
139         /* Extra data for summaryview */
140         regex_t *simplify_subject_preg;
141
142         /* current message status */
143         gint   newmsgs;
144         gint   unread;
145         gint   messages;
146         off_t  total_size;
147         gint   deleted;
148         gint   moved;
149         gint   copied;
150
151 /*
152 private:
153 */
154         /* table for looking up message-id */
155         GHashTable *msgid_table;
156         GHashTable *subject_table;
157
158         /* list for moving/deleting messages */
159         GSList *mlist;
160         /* table for updating folder tree */
161         GHashTable *folder_table;
162 };
163
164 SummaryView     *summary_create(void);
165
166 void summary_init                 (SummaryView          *summaryview);
167 gboolean summary_show             (SummaryView          *summaryview,
168                                    FolderItem           *fitem);
169 void summary_clear_list           (SummaryView          *summaryview);
170 void summary_clear_all            (SummaryView          *summaryview);
171
172 void summary_lock                 (SummaryView          *summaryview);
173 void summary_unlock               (SummaryView          *summaryview);
174 gboolean summary_is_locked        (SummaryView          *summaryview);
175
176 SummarySelection summary_get_selection_type     (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
200 void summary_filter               (SummaryView          *summaryview);
201 void summary_filter_open          (SummaryView          *summaryview,
202                                    PrefsFilterType       type);
203
204 void summary_sort                 (SummaryView          *summaryview,
205                                    FolderSortKey         sort_key,
206                                    FolderSortType        sort_type);
207
208 void summary_delete               (SummaryView          *summaryview);
209 void summary_delete_duplicated    (SummaryView          *summaryview);
210
211 gboolean summary_execute          (SummaryView          *summaryview);
212
213 void summary_attract_by_subject   (SummaryView          *summaryview);
214
215 gint summary_write_cache          (SummaryView          *summaryview);
216
217 void summary_pass_key_press_event (SummaryView          *summaryview,
218                                    GdkEventKey          *event);
219
220 void summary_display_msg_selected (SummaryView          *summaryview,
221                                    gboolean              all_headers);
222 void summary_redisplay_msg        (SummaryView          *summaryview);
223 void summary_open_msg             (SummaryView          *summaryview);
224 void summary_view_source          (SummaryView          *summaryview);
225 void summary_reedit               (SummaryView          *summaryview);
226 void summary_step                 (SummaryView          *summaryview,
227                                    GtkScrollType         type);
228 void summary_toggle_view          (SummaryView          *summaryview);
229 void summary_set_marks_selected   (SummaryView          *summaryview);
230
231 void summary_move_selected_to     (SummaryView          *summaryview,
232                                    FolderItem           *to_folder);
233 void summary_move_to              (SummaryView          *summaryview);
234 void summary_copy_selected_to     (SummaryView          *summaryview,
235                                    FolderItem           *to_folder);
236 void summary_copy_to              (SummaryView          *summaryview);
237 void summary_save_as              (SummaryView          *summaryview);
238 void summary_print                (SummaryView          *summaryview);
239 void summary_mark                 (SummaryView          *summaryview);
240 void summary_unmark               (SummaryView          *summaryview);
241 void summary_mark_as_unread       (SummaryView          *summaryview);
242 void summary_mark_as_read         (SummaryView          *summaryview);
243 void summary_mark_all_read        (SummaryView          *summaryview);
244 void summary_add_address          (SummaryView          *summaryview);
245 void summary_select_all           (SummaryView          *summaryview);
246 void summary_unselect_all         (SummaryView          *summaryview);
247 void summary_select_thread        (SummaryView          *summaryview);
248 void summary_reply                (SummaryView          *summaryview,
249                                    ComposeMode           mode);
250
251 void summary_set_colorlabel       (SummaryView          *summaryview,
252                                    guint                 labelcolor,
253                                    GtkWidget            *widget);
254 void summary_set_colorlabel_color (GtkCTree             *ctree,
255                                    GtkCTreeNode         *node,
256                                    guint                 labelcolor);
257
258 void summary_set_column_order     (SummaryView          *summaryview);
259
260 #if 0 /* OLD PROCESSING */
261 void processing_apply();
262 #endif
263
264 void summary_toggle_show_read_messages
265                                   (SummaryView *summaryview);
266
267 void summary_toggle_view_real     (SummaryView  *summaryview);
268
269 void summary_reflect_prefs_pixmap_theme
270                                   (SummaryView *summaryview);
271
272 void summary_harvest_address      (SummaryView *summaryview);
273 void summary_set_prefs_from_folderitem
274                                   (SummaryView *summaryview, FolderItem *item);
275 void summary_save_prefs_to_folderitem
276                                   (SummaryView *summaryview, FolderItem *item);
277
278 #endif /* __SUMMARY_H__ */