rever to filter from inbox approach
[claws.git] / src / summaryview.h
1 /*
2  * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
3  * Copyright (C) 1999-2001 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 "folder.h"
39 #include "gtksctree.h"
40
41 typedef enum
42 {
43         S_COL_MARK,
44         S_COL_UNREAD,
45         S_COL_MIME,
46         S_COL_SUBJECT,
47         S_COL_FROM,
48         S_COL_DATE,
49         S_COL_SIZE,
50         S_COL_NUMBER,
51         S_COL_SCORE,
52         S_COL_LOCKED
53 } SummaryColumnType;
54
55 #define N_SUMMARY_COLS  10
56
57 typedef enum
58 {
59         SORT_BY_NONE,
60         SORT_BY_NUMBER,
61         SORT_BY_SIZE,
62         SORT_BY_DATE,
63         SORT_BY_FROM,
64         SORT_BY_SUBJECT,
65         SORT_BY_SCORE,
66         SORT_BY_LOCKED,
67         SORT_BY_LABEL,
68         SORT_BY_MARK,
69         SORT_BY_UNREAD,
70         SORT_BY_MIME
71 } SummarySortType;
72
73 typedef enum
74 {
75         SUMMARY_NONE,
76         SUMMARY_SELECTED_NONE,
77         SUMMARY_SELECTED_SINGLE,
78         SUMMARY_SELECTED_MULTIPLE
79 } SummarySelection;
80
81 typedef enum
82 {
83         TARGET_MAIL_URI_LIST,
84         TARGET_DUMMY
85 } TargetInfo;
86
87 extern GtkTargetEntry summary_drag_types[1];
88
89 struct _SummaryColumnState
90 {
91         SummaryColumnType type;
92         gboolean visible;
93 };
94
95 struct _SummaryView
96 {
97         GtkWidget *vbox;
98         GtkWidget *scrolledwin;
99         GtkWidget *ctree;
100         GtkWidget *hbox;
101         GtkWidget *statlabel_folder;
102         GtkWidget *statlabel_select;
103         GtkWidget *statlabel_msgs;
104         GtkWidget *toggle_eventbox;
105         GtkWidget *toggle_arrow;
106         GtkWidget *popupmenu;
107         GtkWidget *colorlabel_menu;
108
109         GtkItemFactory *popupfactory;
110
111         GtkWidget *window;
112
113         GtkCTreeNode *selected;
114         GtkCTreeNode *displayed;
115
116         gboolean msg_is_toggled_on;
117         gboolean display_msg;
118
119         GdkColor color_important;
120         SummaryColumnState col_state[N_SUMMARY_COLS];
121         gint col_pos[N_SUMMARY_COLS];
122
123         GdkColor color_marked;
124         GdkColor color_dim;
125
126         guint lock_count;
127
128         MainWindow   *mainwin;
129         FolderView   *folderview;
130         HeaderView   *headerview;
131         MessageView  *messageview;
132         HeaderWindow *headerwin;
133
134         FolderItem *folder_item;
135
136         GSList * killed_messages;
137         gint important_score;
138
139         /* current message status */
140         gint   newmsgs;
141         gint   unread;
142         gint   messages;
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         /* table for updating folder tree */
158         GHashTable *folder_table;
159
160         /* current sorting state */
161         SummarySortType sort_mode;
162         GtkSortType sort_type;
163
164 };
165
166 SummaryView     *summary_create(void);
167
168 void summary_init                 (SummaryView          *summaryview);
169 gboolean summary_show             (SummaryView          *summaryview,
170                                    FolderItem           *fitem,
171                                    gboolean              update_cache);
172 void summary_clear_list           (SummaryView          *summaryview);
173 void summary_clear_all            (SummaryView          *summaryview);
174
175 void summary_lock                 (SummaryView          *summaryview);
176 void summary_unlock               (SummaryView          *summaryview);
177 gboolean summary_is_locked        (SummaryView          *summaryview);
178
179 SummarySelection summary_get_selection_type     (SummaryView    *summaryview);
180
181 void summary_select_prev_unread   (SummaryView          *summaryview);
182 void summary_select_next_unread   (SummaryView          *summaryview);
183 void summary_select_prev_marked   (SummaryView          *summaryview);
184 void summary_select_next_marked   (SummaryView          *summaryview);
185 void summary_select_prev_labeled  (SummaryView          *summaryview);
186 void summary_select_next_labeled  (SummaryView          *summaryview);
187 void summary_select_by_msgnum     (SummaryView          *summaryview,
188                                    guint                 msgnum);
189 guint summary_get_current_msgnum  (SummaryView          *summaryview);
190 void summary_select_node          (SummaryView          *summaryview,
191                                    GtkCTreeNode         *node,
192                                    gboolean              display_msg);
193
194 void summary_thread_build         (SummaryView          *summaryview);
195 void summary_unthread             (SummaryView          *summaryview);
196
197 void summary_filter               (SummaryView          *summaryview);
198 void summary_sort                 (SummaryView          *summaryview,
199                                    SummarySortType       type);
200
201 void summary_delete               (SummaryView          *summaryview);
202 void summary_delete_duplicated    (SummaryView          *summaryview);
203
204 gboolean summary_execute          (SummaryView          *summaryview);
205
206 void summary_attract_by_subject   (SummaryView          *summaryview);
207
208 gint summary_write_cache          (SummaryView          *summaryview);
209
210 void summary_pass_key_press_event (SummaryView          *summaryview,
211                                    GdkEventKey          *event);
212
213 void summary_redisplay_msg        (SummaryView          *summaryview);
214 void summary_open_msg             (SummaryView          *summaryview);
215 void summary_view_source          (SummaryView          *summaryview);
216 void summary_reedit               (SummaryView          *summaryview);
217 void summary_step                 (SummaryView          *summaryview,
218                                    GtkScrollType         type);
219 void summary_set_marks_selected   (SummaryView          *summaryview);
220
221 void summary_move_selected_to     (SummaryView          *summaryview,
222                                    FolderItem           *to_folder);
223 void summary_move_to              (SummaryView          *summaryview);
224 void summary_copy_selected_to     (SummaryView          *summaryview,
225                                    FolderItem           *to_folder);
226 void summary_copy_to              (SummaryView          *summaryview);
227 void summary_save_as              (SummaryView          *summaryview);
228 void summary_print                (SummaryView          *summaryview);
229 void summary_mark                 (SummaryView          *summaryview);
230 void summary_unmark               (SummaryView          *summaryview);
231 void summary_mark_as_unread       (SummaryView          *summaryview);
232 void summary_mark_as_read         (SummaryView          *summaryview);
233 void summary_mark_all_read        (SummaryView          *summaryview);
234 void summary_add_address          (SummaryView          *summaryview);
235 void summary_select_all           (SummaryView          *summaryview);
236 void summary_unselect_all         (SummaryView          *summaryview);
237
238 void summary_set_colorlabel       (SummaryView          *summaryview,
239                                    guint                 labelcolor,
240                                    GtkWidget            *widget);
241 void summary_set_colorlabel_color (GtkCTree             *ctree,
242                                    GtkCTreeNode         *node,
243                                    guint                 labelcolor);
244
245 void summary_set_column_order     (SummaryView          *summaryview);
246
247 void processing_apply();
248
249 #endif /* __SUMMARY_H__ */