71bbcf1475d632a2e1dee2950c1d80fd7c4106d9
[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 <glib.h>
24 #include <gdk/gdk.h>
25 #include <gtk/gtkwidget.h>
26 #include <gtk/gtkitemfactory.h>
27 #include <gtk/gtkctree.h>
28 #include <gtk/gtkdnd.h>
29
30 typedef struct _SummaryView             SummaryView;
31 typedef struct _SummaryColumnState      SummaryColumnState;
32
33 #include "mainwindow.h"
34 #include "folderview.h"
35 #include "headerview.h"
36 #include "messageview.h"
37 #include "compose.h"
38 #include "prefs_filter.h"
39 #include "folder.h"
40 #include "gtksctree.h"
41
42 typedef enum
43 {
44         S_COL_MARK,
45         S_COL_UNREAD,
46         S_COL_MIME,
47         S_COL_SUBJECT,
48         S_COL_FROM,
49         S_COL_DATE,
50         S_COL_SIZE,
51         S_COL_NUMBER,
52         S_COL_SCORE,
53         S_COL_LOCKED
54 } SummaryColumnType;
55
56 #define N_SUMMARY_COLS  10
57
58 typedef enum
59 {
60         SORT_BY_NONE,
61         SORT_BY_NUMBER,
62         SORT_BY_SIZE,
63         SORT_BY_DATE,
64         SORT_BY_FROM,
65         SORT_BY_SUBJECT,
66         SORT_BY_SCORE,
67         SORT_BY_LOCKED,
68         SORT_BY_LABEL,
69         SORT_BY_MARK,
70         SORT_BY_UNREAD,
71         SORT_BY_MIME
72 } SummarySortType;
73
74 typedef enum
75 {
76         SUMMARY_NONE,
77         SUMMARY_SELECTED_NONE,
78         SUMMARY_SELECTED_SINGLE,
79         SUMMARY_SELECTED_MULTIPLE
80 } SummarySelection;
81
82 typedef enum
83 {
84         TARGET_MAIL_URI_LIST,
85         TARGET_DUMMY
86 } TargetInfo;
87
88 extern GtkTargetEntry summary_drag_types[1];
89
90 struct _SummaryColumnState
91 {
92         SummaryColumnType type;
93         gboolean visible;
94 };
95
96 struct _SummaryView
97 {
98         GtkWidget *vbox;
99         GtkWidget *scrolledwin;
100         GtkWidget *ctree;
101         GtkWidget *hbox;
102         GtkWidget *hbox_l;
103         GtkWidget *folder_pixmap;
104         GtkWidget *statlabel_folder;
105         GtkWidget *statlabel_select;
106         GtkWidget *statlabel_msgs;
107         GtkWidget *toggle_view_btn;
108         GtkWidget *toggle_view_arrow;
109         GtkWidget *popupmenu;
110         GtkWidget *colorlabel_menu;
111
112         GtkItemFactory *popupfactory;
113
114         GtkWidget *window;
115
116         GtkCTreeNode *selected;
117         GtkCTreeNode *displayed;
118
119         gboolean msg_is_toggled_on;
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
136         FolderItem *folder_item;
137
138         GSList * killed_messages;
139         gint important_score;
140
141         /* current message status */
142         gint   newmsgs;
143         gint   unread;
144         gint   messages;
145         off_t  total_size;
146         gint   deleted;
147         gint   moved;
148         gint   copied;
149
150 /*
151 private:
152 */
153         /* table for looking up message-id */
154         GHashTable *msgid_table;
155         GHashTable *subject_table;
156
157         /* list for moving/deleting messages */
158         GSList *mlist;
159         /* table for updating folder tree */
160         GHashTable *folder_table;
161
162         /* current sorting state */
163         SummarySortType sort_mode;
164         GtkSortType sort_type;
165
166 };
167
168 SummaryView     *summary_create(void);
169
170 void summary_init                 (SummaryView          *summaryview);
171 gboolean summary_show             (SummaryView          *summaryview,
172                                    FolderItem           *fitem,
173                                    gboolean              update_cache);
174 void summary_clear_list           (SummaryView          *summaryview);
175 void summary_clear_all            (SummaryView          *summaryview);
176
177 void summary_lock                 (SummaryView          *summaryview);
178 void summary_unlock               (SummaryView          *summaryview);
179 gboolean summary_is_locked        (SummaryView          *summaryview);
180
181 SummarySelection summary_get_selection_type     (SummaryView    *summaryview);
182
183 void summary_select_prev_unread   (SummaryView          *summaryview);
184 void summary_select_next_unread   (SummaryView          *summaryview);
185 void summary_select_prev_marked   (SummaryView          *summaryview);
186 void summary_select_next_marked   (SummaryView          *summaryview);
187 void summary_select_prev_labeled  (SummaryView          *summaryview);
188 void summary_select_next_labeled  (SummaryView          *summaryview);
189 void summary_select_by_msgnum     (SummaryView          *summaryview,
190                                    guint                 msgnum);
191 guint summary_get_current_msgnum  (SummaryView          *summaryview);
192 void summary_select_node          (SummaryView          *summaryview,
193                                    GtkCTreeNode         *node,
194                                    gboolean              display_msg,
195                                    gboolean              do_refresh);
196
197 void summary_thread_build         (SummaryView          *summaryview);
198 void summary_unthread             (SummaryView          *summaryview);
199
200 void summary_expand_threads       (SummaryView          *summaryview);
201 void summary_collapse_threads     (SummaryView          *summaryview);
202
203 void summary_filter               (SummaryView          *summaryview);
204 void summary_filter_open          (SummaryView          *summaryview,
205                                    PrefsFilterType       type);
206
207 void summary_sort                 (SummaryView          *summaryview,
208                                    SummarySortType       type);
209
210 void summary_delete               (SummaryView          *summaryview);
211 void summary_delete_duplicated    (SummaryView          *summaryview);
212
213 gboolean summary_execute          (SummaryView          *summaryview);
214
215 void summary_attract_by_subject   (SummaryView          *summaryview);
216
217 gint summary_write_cache          (SummaryView          *summaryview);
218
219 void summary_pass_key_press_event (SummaryView          *summaryview,
220                                    GdkEventKey          *event);
221
222 void summary_display_msg_selected (SummaryView          *summaryview,
223                                    gboolean              all_headers);
224 void summary_redisplay_msg        (SummaryView          *summaryview);
225 void summary_open_msg             (SummaryView          *summaryview);
226 void summary_view_source          (SummaryView          *summaryview);
227 void summary_reedit               (SummaryView          *summaryview);
228 void summary_step                 (SummaryView          *summaryview,
229                                    GtkScrollType         type);
230 void summary_set_marks_selected   (SummaryView          *summaryview);
231
232 void summary_move_selected_to     (SummaryView          *summaryview,
233                                    FolderItem           *to_folder);
234 void summary_move_to              (SummaryView          *summaryview);
235 void summary_copy_selected_to     (SummaryView          *summaryview,
236                                    FolderItem           *to_folder);
237 void summary_copy_to              (SummaryView          *summaryview);
238 void summary_save_as              (SummaryView          *summaryview);
239 void summary_print                (SummaryView          *summaryview);
240 void summary_mark                 (SummaryView          *summaryview);
241 void summary_unmark               (SummaryView          *summaryview);
242 void summary_mark_as_unread       (SummaryView          *summaryview);
243 void summary_mark_as_read         (SummaryView          *summaryview);
244 void summary_mark_all_read        (SummaryView          *summaryview);
245 void summary_add_address          (SummaryView          *summaryview);
246 void summary_select_all           (SummaryView          *summaryview);
247 void summary_unselect_all         (SummaryView          *summaryview);
248 void summary_select_thread        (SummaryView          *summaryview);
249 void summary_reply                (SummaryView          *summaryview,
250                                    ComposeMode           mode);
251
252 void summary_set_colorlabel       (SummaryView          *summaryview,
253                                    guint                 labelcolor,
254                                    GtkWidget            *widget);
255 void summary_set_colorlabel_color (GtkCTree             *ctree,
256                                    GtkCTreeNode         *node,
257                                    guint                 labelcolor);
258
259 void summary_set_column_order     (SummaryView          *summaryview);
260
261 void processing_apply();
262
263 void summary_toggle_show_read_messages (SummaryView *summaryview);
264
265 void summary_toggle_view_real   (SummaryView    *summaryview);
266
267 void summary_reflect_prefs_pixmap_theme(SummaryView *summaryview);
268
269 void summary_harvest_address    ( SummaryView *summaryview );
270
271 #endif /* __SUMMARY_H__ */