98b7e1d74bcb3e406a7ae0f3295881e4875df17d
[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 "headerwindow.h"
38 #include "compose.h"
39 #include "prefs_filter.h"
40 #include "folder.h"
41 #include "gtksctree.h"
42
43 typedef enum
44 {
45         S_COL_MARK,
46         S_COL_UNREAD,
47         S_COL_MIME,
48         S_COL_SUBJECT,
49         S_COL_FROM,
50         S_COL_DATE,
51         S_COL_SIZE,
52         S_COL_NUMBER,
53         S_COL_SCORE,
54         S_COL_LOCKED
55 } SummaryColumnType;
56
57 #define N_SUMMARY_COLS  10
58
59 typedef enum
60 {
61         SORT_BY_NONE,
62         SORT_BY_NUMBER,
63         SORT_BY_SIZE,
64         SORT_BY_DATE,
65         SORT_BY_FROM,
66         SORT_BY_SUBJECT,
67         SORT_BY_SCORE,
68         SORT_BY_LOCKED,
69         SORT_BY_LABEL,
70         SORT_BY_MARK,
71         SORT_BY_UNREAD,
72         SORT_BY_MIME
73 } SummarySortType;
74
75 typedef enum
76 {
77         SUMMARY_NONE,
78         SUMMARY_SELECTED_NONE,
79         SUMMARY_SELECTED_SINGLE,
80         SUMMARY_SELECTED_MULTIPLE
81 } SummarySelection;
82
83 typedef enum
84 {
85         TARGET_MAIL_URI_LIST,
86         TARGET_DUMMY
87 } TargetInfo;
88
89 extern GtkTargetEntry summary_drag_types[1];
90
91 struct _SummaryColumnState
92 {
93         SummaryColumnType type;
94         gboolean visible;
95 };
96
97 struct _SummaryView
98 {
99         GtkWidget *vbox;
100         GtkWidget *scrolledwin;
101         GtkWidget *ctree;
102         GtkWidget *hbox;
103         GtkWidget *statlabel_folder;
104         GtkWidget *statlabel_select;
105         GtkWidget *statlabel_msgs;
106         GtkWidget *toggle_view_btn;
107         GtkWidget *toggle_view_arrow;
108         GtkWidget *popupmenu;
109         GtkWidget *colorlabel_menu;
110
111         GtkItemFactory *popupfactory;
112
113         GtkWidget *window;
114
115         GtkCTreeNode *selected;
116         GtkCTreeNode *displayed;
117
118         gboolean msg_is_toggled_on;
119         gboolean display_msg;
120
121         GdkColor color_important;
122         SummaryColumnState col_state[N_SUMMARY_COLS];
123         gint col_pos[N_SUMMARY_COLS];
124
125         GdkColor color_marked;
126         GdkColor color_dim;
127
128         guint lock_count;
129
130         MainWindow   *mainwin;
131         FolderView   *folderview;
132         HeaderView   *headerview;
133         MessageView  *messageview;
134         HeaderWindow *headerwin;
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
196 void summary_thread_build         (SummaryView          *summaryview);
197 void summary_unthread             (SummaryView          *summaryview);
198
199 void summary_filter               (SummaryView          *summaryview);
200 void summary_filter_open          (SummaryView          *summaryview,
201                                    PrefsFilterType       type);
202
203 void summary_sort                 (SummaryView          *summaryview,
204                                    SummarySortType       type);
205
206 void summary_delete               (SummaryView          *summaryview);
207 void summary_delete_duplicated    (SummaryView          *summaryview);
208
209 gboolean summary_execute          (SummaryView          *summaryview);
210
211 void summary_attract_by_subject   (SummaryView          *summaryview);
212
213 gint summary_write_cache          (SummaryView          *summaryview);
214
215 void summary_pass_key_press_event (SummaryView          *summaryview,
216                                    GdkEventKey          *event);
217
218 void summary_redisplay_msg        (SummaryView          *summaryview);
219 void summary_open_msg             (SummaryView          *summaryview);
220 void summary_view_source          (SummaryView          *summaryview);
221 void summary_reedit               (SummaryView          *summaryview);
222 void summary_step                 (SummaryView          *summaryview,
223                                    GtkScrollType         type);
224 void summary_set_marks_selected   (SummaryView          *summaryview);
225
226 void summary_move_selected_to     (SummaryView          *summaryview,
227                                    FolderItem           *to_folder);
228 void summary_move_to              (SummaryView          *summaryview);
229 void summary_copy_selected_to     (SummaryView          *summaryview,
230                                    FolderItem           *to_folder);
231 void summary_copy_to              (SummaryView          *summaryview);
232 void summary_save_as              (SummaryView          *summaryview);
233 void summary_print                (SummaryView          *summaryview);
234 void summary_mark                 (SummaryView          *summaryview);
235 void summary_unmark               (SummaryView          *summaryview);
236 void summary_mark_as_unread       (SummaryView          *summaryview);
237 void summary_mark_as_read         (SummaryView          *summaryview);
238 void summary_mark_all_read        (SummaryView          *summaryview);
239 void summary_add_address          (SummaryView          *summaryview);
240 void summary_select_all           (SummaryView          *summaryview);
241 void summary_unselect_all         (SummaryView          *summaryview);
242
243 void summary_reply                (SummaryView          *summaryview,
244                                    ComposeMode           mode);
245
246 void summary_set_colorlabel       (SummaryView          *summaryview,
247                                    guint                 labelcolor,
248                                    GtkWidget            *widget);
249 void summary_set_colorlabel_color (GtkCTree             *ctree,
250                                    GtkCTreeNode         *node,
251                                    guint                 labelcolor);
252
253 void summary_set_column_order     (SummaryView          *summaryview);
254
255 void processing_apply();
256
257 void summary_toggle_show_read_messages (SummaryView *summaryview);
258
259 void summary_toggle_view_real   (SummaryView    *summaryview);
260
261 #endif /* __SUMMARY_H__ */