630fbfdb0484905cb0e5c19b512e65c2d086a544
[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_LABEL,
67         SORT_BY_MARK,
68         SORT_BY_UNREAD,
69         SORT_BY_MIME
70 } SummarySortType;
71
72 typedef enum
73 {
74         SUMMARY_NONE,
75         SUMMARY_SELECTED_NONE,
76         SUMMARY_SELECTED_SINGLE,
77         SUMMARY_SELECTED_MULTIPLE
78 } SummarySelection;
79
80 typedef enum
81 {
82         TARGET_MAIL_URI_LIST,
83         TARGET_DUMMY
84 } TargetInfo;
85
86 extern GtkTargetEntry summary_drag_types[1];
87
88 struct _SummaryColumnState
89 {
90         SummaryColumnType type;
91         gboolean visible;
92 };
93
94 struct _SummaryView
95 {
96         GtkWidget *vbox;
97         GtkWidget *scrolledwin;
98         GtkWidget *ctree;
99         GtkWidget *hbox;
100         GtkWidget *statlabel_folder;
101         GtkWidget *statlabel_select;
102         GtkWidget *statlabel_msgs;
103         GtkWidget *toggle_eventbox;
104         GtkWidget *toggle_arrow;
105         GtkWidget *popupmenu;
106         GtkWidget *colorlabel_menu;
107
108         GtkItemFactory *popupfactory;
109
110         GtkWidget *window;
111
112         GtkCTreeNode *selected;
113         GtkCTreeNode *displayed;
114
115         gboolean msg_is_toggled_on;
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         HeaderWindow *headerwin;
132
133         FolderItem *folder_item;
134
135         GSList * killed_messages;
136         gint important_score;
137
138         /* current message status */
139         gint   newmsgs;
140         gint   unread;
141         gint   messages;
142         off_t  total_size;
143         gint   deleted;
144         gint   moved;
145         gint   copied;
146
147 /*
148 private:
149 */
150         /* table for looking up message-id */
151         GHashTable *msgid_table;
152         GHashTable *subject_table;
153
154         /* list for moving/deleting messages */
155         GSList *mlist;
156         /* table for updating folder tree */
157         GHashTable *folder_table;
158
159         /* current sorting state */
160         SummarySortType sort_mode;
161         GtkSortType sort_type;
162
163         /* tell filtering happened recently */
164         gboolean filtering_happened;
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_sort                 (SummaryView          *summaryview,
201                                    SummarySortType       type);
202
203 void summary_delete               (SummaryView          *summaryview);
204 void summary_delete_duplicated    (SummaryView          *summaryview);
205
206 gboolean summary_execute          (SummaryView          *summaryview);
207
208 void summary_attract_by_subject   (SummaryView          *summaryview);
209
210 gint summary_write_cache          (SummaryView          *summaryview);
211
212 void summary_pass_key_press_event (SummaryView          *summaryview,
213                                    GdkEventKey          *event);
214
215 void summary_redisplay_msg        (SummaryView          *summaryview);
216 void summary_open_msg             (SummaryView          *summaryview);
217 void summary_view_source          (SummaryView          *summaryview);
218 void summary_reedit               (SummaryView          *summaryview);
219 void summary_step                 (SummaryView          *summaryview,
220                                    GtkScrollType         type);
221 void summary_set_marks_selected   (SummaryView          *summaryview);
222
223 void summary_move_selected_to     (SummaryView          *summaryview,
224                                    FolderItem           *to_folder);
225 void summary_move_to              (SummaryView          *summaryview);
226 void summary_copy_selected_to     (SummaryView          *summaryview,
227                                    FolderItem           *to_folder);
228 void summary_copy_to              (SummaryView          *summaryview);
229 void summary_save_as              (SummaryView          *summaryview);
230 void summary_print                (SummaryView          *summaryview);
231 void summary_mark                 (SummaryView          *summaryview);
232 void summary_unmark               (SummaryView          *summaryview);
233 void summary_mark_as_unread       (SummaryView          *summaryview);
234 void summary_mark_as_read         (SummaryView          *summaryview);
235 void summary_mark_as_locked       (SummaryView          *summaryview);
236 void summary_mark_all_read        (SummaryView          *summaryview);
237 void summary_add_address          (SummaryView          *summaryview);
238 void summary_select_all           (SummaryView          *summaryview);
239 void summary_unselect_all         (SummaryView          *summaryview);
240
241 void summary_set_colorlabel       (SummaryView          *summaryview,
242                                    guint                 labelcolor,
243                                    GtkWidget            *widget);
244 void summary_set_colorlabel_color (GtkCTree             *ctree,
245                                    GtkCTreeNode         *node,
246                                    guint                 labelcolor);
247
248 void summary_set_column_order     (SummaryView          *summaryview);
249
250 #endif /* __SUMMARY_H__ */