revise label colouring, add filter action for label colouring, fix filtering issues
[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 } SummarySortType;
66
67 typedef enum
68 {
69         SUMMARY_NONE,
70         SUMMARY_SELECTED_NONE,
71         SUMMARY_SELECTED_SINGLE,
72         SUMMARY_SELECTED_MULTIPLE
73 } SummarySelection;
74
75 typedef enum
76 {
77         TARGET_MAIL_URI_LIST,
78         TARGET_DUMMY
79 } TargetInfo;
80
81 extern GtkTargetEntry summary_drag_types[1];
82
83 struct _SummaryView
84 {
85         GtkWidget *vbox;
86         GtkWidget *scrolledwin;
87         GtkWidget *ctree;
88         GtkWidget *hbox;
89         GtkWidget *statlabel_folder;
90         GtkWidget *statlabel_select;
91         GtkWidget *statlabel_msgs;
92         GtkWidget *toggle_eventbox;
93         GtkWidget *toggle_arrow;
94         GtkWidget *popupmenu;
95         GtkWidget *label_menu_item; /* label menu item */
96         GtkWidget *label_menu;      /* label menu itself */
97
98         GtkItemFactory *popupfactory;
99
100         GtkWidget *window;
101
102         GtkCTreeNode *selected;
103         GtkCTreeNode *displayed;
104
105         gboolean msg_is_toggled_on;
106         gboolean display_msg;
107
108         GdkColor color_important;
109         GdkColor color_marked;
110         GdkColor color_dim;
111
112         MainWindow   *mainwin;
113         FolderView   *folderview;
114         HeaderView   *headerview;
115         MessageView  *messageview;
116         HeaderWindow *headerwin;
117
118         FolderItem *folder_item;
119
120         GSList * killed_messages;
121         gint important_score;
122
123         /* current message status */
124         gint   newmsgs;
125         gint   unread;
126         gint   messages;
127         off_t  total_size;
128         gint   deleted;
129         gint   moved;
130         gint   copied;
131
132 /*
133 private:
134 */
135         /* table for looking up message-id */
136         GHashTable *msgid_table;
137         GHashTable *subject_table;
138
139         /* list for moving/deleting messages */
140         GSList *mlist;
141         /* table for updating folder tree */
142         GHashTable *folder_table;
143
144         /* current sorting state */
145         SummarySortType sort_mode;
146         GtkSortType sort_type;
147
148         /* tell filtering happened recently */
149         gboolean filtering_happened;
150
151 };
152
153 SummaryView     *summary_create(void);
154
155 void summary_init                 (SummaryView          *summaryview);
156
157 gboolean summary_show             (SummaryView          *summaryview,
158                                    FolderItem           *fitem,
159                                    gboolean              update_cache);
160
161                                    
162 void summary_clear_list           (SummaryView          *summaryview);
163 void summary_clear_all            (SummaryView          *summaryview);
164
165 void summary_select_next_unread   (SummaryView          *summaryview);
166 void summary_select_next_marked   (SummaryView          *summaryview);
167 void summary_select_prev_marked   (SummaryView          *summaryview);
168 void summary_select_by_msgnum     (SummaryView          *summaryview,
169                                    guint                 msgnum);
170 guint summary_get_current_msgnum  (SummaryView          *summaryview);
171 void summary_thread_build         (SummaryView          *summaryview);
172 void summary_unthread             (SummaryView          *summaryview);
173 void summary_filter               (SummaryView          *summaryview);
174 void summary_sort                 (SummaryView          *summaryview,
175                                    SummarySortType       type);
176
177 void summary_delete               (SummaryView          *summaryview);
178 void summary_delete_duplicated    (SummaryView          *summaryview);
179 void summary_execute              (SummaryView          *summaryview);
180 void summary_attract_by_subject   (SummaryView          *summaryview);
181 gint summary_write_cache          (SummaryView          *summaryview);
182 void summary_pass_key_press_event (SummaryView          *summaryview,
183                                    GdkEventKey          *event);
184 void summary_change_display_item  (SummaryView          *summaryview);
185 void summary_redisplay_msg        (SummaryView          *summaryview);
186 void summary_open_msg             (SummaryView          *summaryview);
187 void summary_view_source          (SummaryView          *summaryview);
188 void summary_reedit               (SummaryView          *summaryview);
189 void summary_step                 (SummaryView          *summaryview,
190                                    GtkScrollType         type);
191 void summary_set_marks_selected   (SummaryView          *summaryview);
192
193 void summary_move_selected_to     (SummaryView          *summaryview,
194                                    FolderItem           *to_folder);
195 void summary_move_to              (SummaryView          *summaryview);
196 void summary_copy_selected_to     (SummaryView          *summaryview,
197                                    FolderItem           *to_folder);
198 void summary_copy_to              (SummaryView          *summaryview);
199 void summary_save_as              (SummaryView          *summaryview);
200 void summary_print                (SummaryView          *summaryview);
201 void summary_mark                 (SummaryView          *summaryview);
202 void summary_unmark               (SummaryView          *summaryview);
203 void summary_mark_as_unread       (SummaryView          *summaryview);
204 void summary_mark_as_read         (SummaryView          *summaryview);
205 void summary_select_all           (SummaryView          *summaryview);
206 void summary_unselect_all         (SummaryView          *summaryview);
207 void summary_set_label            (SummaryView          *summaryview, guint labelcolor, GtkWidget *widget);
208 void summary_set_label_color      (GtkCTree *ctree, GtkCTreeNode *node, guint labelcolor);
209
210 #endif /* __SUMMARY_H__ */