sync with sylpheed 0.6.2cvs5
[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
32 #include "mainwindow.h"
33 #include "folderview.h"
34 #include "headerview.h"
35 #include "messageview.h"
36 #include "headerwindow.h"
37 #include "folder.h"
38 #include "gtksctree.h"
39
40 typedef enum
41 {
42         S_COL_MARK      = 0,
43         S_COL_UNREAD    = 1,
44         S_COL_MIME      = 2,
45         S_COL_NUMBER    = 3,
46         S_COL_SCORE     = 4,
47         S_COL_SIZE      = 5,
48         S_COL_DATE      = 6,
49         S_COL_FROM      = 7,
50         S_COL_SUBJECT   = 8
51 } SummaryColumnPos;
52
53 #define N_SUMMARY_COLS  9
54
55 typedef enum
56 {
57         SORT_BY_NONE,
58         SORT_BY_NUMBER,
59         SORT_BY_SIZE,
60         SORT_BY_DATE,
61         SORT_BY_FROM,
62         SORT_BY_SUBJECT,
63         SORT_BY_SCORE,
64         SORT_BY_LABEL,
65         SORT_BY_MARK,
66         SORT_BY_UNREAD,
67         SORT_BY_MIME
68 } SummarySortType;
69
70 typedef enum
71 {
72         SUMMARY_NONE,
73         SUMMARY_SELECTED_NONE,
74         SUMMARY_SELECTED_SINGLE,
75         SUMMARY_SELECTED_MULTIPLE
76 } SummarySelection;
77
78 typedef enum
79 {
80         TARGET_MAIL_URI_LIST,
81         TARGET_DUMMY
82 } TargetInfo;
83
84 extern GtkTargetEntry summary_drag_types[1];
85
86 struct _SummaryView
87 {
88         GtkWidget *vbox;
89         GtkWidget *scrolledwin;
90         GtkWidget *ctree;
91         GtkWidget *hbox;
92         GtkWidget *statlabel_folder;
93         GtkWidget *statlabel_select;
94         GtkWidget *statlabel_msgs;
95         GtkWidget *toggle_eventbox;
96         GtkWidget *toggle_arrow;
97         GtkWidget *popupmenu;
98         GtkWidget *colorlabel_menu;
99
100         GtkItemFactory *popupfactory;
101
102         GtkWidget *window;
103
104         GtkCTreeNode *selected;
105         GtkCTreeNode *displayed;
106
107         gboolean msg_is_toggled_on;
108         gboolean display_msg;
109
110         GdkColor color_important;
111         GdkColor color_marked;
112         GdkColor color_dim;
113
114         MainWindow   *mainwin;
115         FolderView   *folderview;
116         HeaderView   *headerview;
117         MessageView  *messageview;
118         HeaderWindow *headerwin;
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         /* current sorting state */
147         SummarySortType sort_mode;
148         GtkSortType sort_type;
149
150         /* tell filtering happened recently */
151         gboolean filtering_happened;
152
153 };
154
155 SummaryView     *summary_create(void);
156
157 void summary_init                 (SummaryView          *summaryview);
158 gboolean summary_show             (SummaryView          *summaryview,
159                                    FolderItem           *fitem,
160                                    gboolean              update_cache);
161 void summary_clear_list           (SummaryView          *summaryview);
162 void summary_clear_all            (SummaryView          *summaryview);
163
164 SummarySelection summary_get_selection_type     (SummaryView    *summaryview);
165
166 void summary_select_prev_unread   (SummaryView          *summaryview);
167 void summary_select_next_unread   (SummaryView          *summaryview);
168 void summary_select_prev_marked   (SummaryView          *summaryview);
169 void summary_select_next_marked   (SummaryView          *summaryview);
170 void summary_select_prev_labeled  (SummaryView          *summaryview);
171 void summary_select_next_labeled  (SummaryView          *summaryview);
172 void summary_select_by_msgnum     (SummaryView          *summaryview,
173                                    guint                 msgnum);
174 guint summary_get_current_msgnum  (SummaryView          *summaryview);
175 void summary_select_node          (SummaryView          *summaryview,
176                                    GtkCTreeNode         *node,
177                                    gboolean              display_msg);
178 void summary_thread_build         (SummaryView          *summaryview,
179                                    gboolean              init);
180 void summary_unthread             (SummaryView          *summaryview);
181 void summary_filter               (SummaryView          *summaryview);
182 void summary_sort                 (SummaryView          *summaryview,
183                                    SummarySortType       type);
184
185 void summary_delete               (SummaryView          *summaryview);
186 void summary_delete_duplicated    (SummaryView          *summaryview);
187 void summary_execute              (SummaryView          *summaryview);
188 void summary_attract_by_subject   (SummaryView          *summaryview);
189 gint summary_write_cache          (SummaryView          *summaryview);
190 void summary_pass_key_press_event (SummaryView          *summaryview,
191                                    GdkEventKey          *event);
192 void summary_change_display_item  (SummaryView          *summaryview);
193 void summary_redisplay_msg        (SummaryView          *summaryview);
194 void summary_open_msg             (SummaryView          *summaryview);
195 void summary_view_source          (SummaryView          *summaryview);
196 void summary_reedit               (SummaryView          *summaryview);
197 void summary_step                 (SummaryView          *summaryview,
198                                    GtkScrollType         type);
199 void summary_set_marks_selected   (SummaryView          *summaryview);
200
201 void summary_move_selected_to     (SummaryView          *summaryview,
202                                    FolderItem           *to_folder);
203 void summary_move_to              (SummaryView          *summaryview);
204 void summary_copy_selected_to     (SummaryView          *summaryview,
205                                    FolderItem           *to_folder);
206 void summary_copy_to              (SummaryView          *summaryview);
207 void summary_save_as              (SummaryView          *summaryview);
208 void summary_print                (SummaryView          *summaryview);
209 void summary_mark                 (SummaryView          *summaryview);
210 void summary_unmark               (SummaryView          *summaryview);
211 void summary_mark_as_unread       (SummaryView          *summaryview);
212 void summary_mark_as_read         (SummaryView          *summaryview);
213 void summary_mark_all_read        (SummaryView          *summaryview);
214 void summary_add_address          (SummaryView          *summaryview);
215 void summary_select_all           (SummaryView          *summaryview);
216 void summary_unselect_all         (SummaryView          *summaryview);
217
218 void summary_set_colorlabel       (SummaryView          *summaryview,
219                                    guint                 labelcolor,
220                                    GtkWidget            *widget);
221 void summary_set_colorlabel_color (GtkCTree             *ctree,
222                                    GtkCTreeNode         *node,
223                                    guint                 labelcolor);
224
225 #endif /* __SUMMARY_H__ */