sync with sylpheed 0.6.3cvs7
[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_NUMBER,
47         S_COL_SCORE,
48         S_COL_SIZE,
49         S_COL_DATE,
50         S_COL_FROM,
51         S_COL_SUBJECT,
52 } SummaryColumnType;
53
54 #define N_SUMMARY_COLS  9
55
56 typedef enum
57 {
58         SORT_BY_NONE,
59         SORT_BY_NUMBER,
60         SORT_BY_SIZE,
61         SORT_BY_DATE,
62         SORT_BY_FROM,
63         SORT_BY_SUBJECT,
64         SORT_BY_SCORE,
65         SORT_BY_LABEL,
66         SORT_BY_MARK,
67         SORT_BY_UNREAD,
68         SORT_BY_MIME
69 } SummarySortType;
70
71 typedef enum
72 {
73         SUMMARY_NONE,
74         SUMMARY_SELECTED_NONE,
75         SUMMARY_SELECTED_SINGLE,
76         SUMMARY_SELECTED_MULTIPLE
77 } SummarySelection;
78
79 typedef enum
80 {
81         TARGET_MAIL_URI_LIST,
82         TARGET_DUMMY
83 } TargetInfo;
84
85 extern GtkTargetEntry summary_drag_types[1];
86
87 struct _SummaryColumnState
88 {
89         SummaryColumnType type;
90         gboolean visible;
91 };
92
93 struct _SummaryView
94 {
95         GtkWidget *vbox;
96         GtkWidget *scrolledwin;
97         GtkWidget *ctree;
98         GtkWidget *hbox;
99         GtkWidget *statlabel_folder;
100         GtkWidget *statlabel_select;
101         GtkWidget *statlabel_msgs;
102         GtkWidget *toggle_eventbox;
103         GtkWidget *toggle_arrow;
104         GtkWidget *popupmenu;
105         GtkWidget *colorlabel_menu;
106
107         GtkItemFactory *popupfactory;
108
109         GtkWidget *window;
110
111         GtkCTreeNode *selected;
112         GtkCTreeNode *displayed;
113
114         gboolean msg_is_toggled_on;
115         gboolean display_msg;
116
117         GdkColor color_important;
118         SummaryColumnState col_state[N_SUMMARY_COLS];
119         gint col_pos[N_SUMMARY_COLS];
120
121         GdkColor color_marked;
122         GdkColor color_dim;
123
124         guint lock_count;
125
126         MainWindow   *mainwin;
127         FolderView   *folderview;
128         HeaderView   *headerview;
129         MessageView  *messageview;
130         HeaderWindow *headerwin;
131
132         FolderItem *folder_item;
133
134         GSList * killed_messages;
135         gint important_score;
136
137         /* current message status */
138         gint   newmsgs;
139         gint   unread;
140         gint   messages;
141         off_t  total_size;
142         gint   deleted;
143         gint   moved;
144         gint   copied;
145
146 /*
147 private:
148 */
149         /* table for looking up message-id */
150         GHashTable *msgid_table;
151         GHashTable *subject_table;
152
153         /* list for moving/deleting messages */
154         GSList *mlist;
155         /* table for updating folder tree */
156         GHashTable *folder_table;
157
158         /* current sorting state */
159         SummarySortType sort_mode;
160         GtkSortType sort_type;
161
162         /* tell filtering happened recently */
163         gboolean filtering_happened;
164
165 };
166
167 SummaryView     *summary_create(void);
168
169 void summary_init                 (SummaryView          *summaryview);
170 gboolean summary_show             (SummaryView          *summaryview,
171                                    FolderItem           *fitem,
172                                    gboolean              update_cache);
173 void summary_clear_list           (SummaryView          *summaryview);
174 void summary_clear_all            (SummaryView          *summaryview);
175
176 void summary_lock                 (SummaryView          *summaryview);
177 void summary_unlock               (SummaryView          *summaryview);
178 gboolean summary_is_locked        (SummaryView          *summaryview);
179
180 SummarySelection summary_get_selection_type     (SummaryView    *summaryview);
181
182 void summary_select_prev_unread   (SummaryView          *summaryview);
183 void summary_select_next_unread   (SummaryView          *summaryview);
184 void summary_select_prev_marked   (SummaryView          *summaryview);
185 void summary_select_next_marked   (SummaryView          *summaryview);
186 void summary_select_prev_labeled  (SummaryView          *summaryview);
187 void summary_select_next_labeled  (SummaryView          *summaryview);
188 void summary_select_by_msgnum     (SummaryView          *summaryview,
189                                    guint                 msgnum);
190 guint summary_get_current_msgnum  (SummaryView          *summaryview);
191 void summary_select_node          (SummaryView          *summaryview,
192                                    GtkCTreeNode         *node,
193                                    gboolean              display_msg);
194 void summary_thread_build         (SummaryView          *summaryview);
195 void summary_unthread             (SummaryView          *summaryview);
196 void summary_filter               (SummaryView          *summaryview);
197 void summary_sort                 (SummaryView          *summaryview,
198                                    SummarySortType       type);
199
200 void summary_delete               (SummaryView          *summaryview);
201 void summary_delete_duplicated    (SummaryView          *summaryview);
202 gboolean summary_execute          (SummaryView          *summaryview);
203 void summary_attract_by_subject   (SummaryView          *summaryview);
204 gint summary_write_cache          (SummaryView          *summaryview);
205 void summary_pass_key_press_event (SummaryView          *summaryview,
206                                    GdkEventKey          *event);
207 void summary_change_display_item  (SummaryView          *summaryview);
208 void summary_redisplay_msg        (SummaryView          *summaryview);
209 void summary_open_msg             (SummaryView          *summaryview);
210 void summary_view_source          (SummaryView          *summaryview);
211 void summary_reedit               (SummaryView          *summaryview);
212 void summary_step                 (SummaryView          *summaryview,
213                                    GtkScrollType         type);
214 void summary_set_marks_selected   (SummaryView          *summaryview);
215
216 void summary_move_selected_to     (SummaryView          *summaryview,
217                                    FolderItem           *to_folder);
218 void summary_move_to              (SummaryView          *summaryview);
219 void summary_copy_selected_to     (SummaryView          *summaryview,
220                                    FolderItem           *to_folder);
221 void summary_copy_to              (SummaryView          *summaryview);
222 void summary_save_as              (SummaryView          *summaryview);
223 void summary_print                (SummaryView          *summaryview);
224 void summary_mark                 (SummaryView          *summaryview);
225 void summary_unmark               (SummaryView          *summaryview);
226 void summary_mark_as_unread       (SummaryView          *summaryview);
227 void summary_mark_as_read         (SummaryView          *summaryview);
228 void summary_mark_all_read        (SummaryView          *summaryview);
229 void summary_add_address          (SummaryView          *summaryview);
230 void summary_select_all           (SummaryView          *summaryview);
231 void summary_unselect_all         (SummaryView          *summaryview);
232
233 void summary_set_colorlabel       (SummaryView          *summaryview,
234                                    guint                 labelcolor,
235                                    GtkWidget            *widget);
236 void summary_set_colorlabel_color (GtkCTree             *ctree,
237                                    GtkCTreeNode         *node,
238                                    guint                 labelcolor);
239
240 #endif /* __SUMMARY_H__ */