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