Fixed and improved NNTP authentication support.
[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_SIZE      = 4,
47         S_COL_DATE      = 5,
48         S_COL_FROM      = 6,
49         S_COL_SUBJECT   = 7
50 } SummaryColumnPos;
51
52 #define N_SUMMARY_COLS  8
53
54 typedef enum
55 {
56         SORT_BY_NONE,
57         SORT_BY_NUMBER,
58         SORT_BY_SIZE,
59         SORT_BY_DATE,
60         SORT_BY_FROM,
61         SORT_BY_SUBJECT
62 } SummarySortType;
63
64 typedef enum
65 {
66         SUMMARY_NONE,
67         SUMMARY_SELECTED_NONE,
68         SUMMARY_SELECTED_SINGLE,
69         SUMMARY_SELECTED_MULTIPLE
70 } SummarySelection;
71
72 typedef enum
73 {
74         TARGET_MAIL_URI_LIST,
75         TARGET_DUMMY
76 } TargetInfo;
77
78 extern GtkTargetEntry summary_drag_types[1];
79
80 struct _SummaryView
81 {
82         GtkWidget *vbox;
83         GtkWidget *scrolledwin;
84         GtkWidget *ctree;
85         GtkWidget *hbox;
86         GtkWidget *statlabel_folder;
87         GtkWidget *statlabel_select;
88         GtkWidget *statlabel_msgs;
89         GtkWidget *toggle_eventbox;
90         GtkWidget *toggle_arrow;
91         GtkWidget *popupmenu;
92
93         GtkItemFactory *popupfactory;
94
95         GtkWidget *window;
96
97         GtkCTreeNode *selected;
98         GtkCTreeNode *displayed;
99
100         gboolean msg_is_toggled_on;
101         gboolean display_msg;
102
103         GdkColor color_marked;
104         GdkColor color_dim;
105         GdkColor color_normal;
106
107         MainWindow   *mainwin;
108         FolderView   *folderview;
109         HeaderView   *headerview;
110         MessageView  *messageview;
111         HeaderWindow *headerwin;
112
113         FolderItem *folder_item;
114
115         /* current message status */
116         gint   newmsgs;
117         gint   unread;
118         gint   messages;
119         off_t  total_size;
120         gint   deleted;
121         gint   moved;
122         gint   copied;
123
124 /*
125 private:
126 */
127         /* table for looking up message-id */
128         GHashTable *msgid_table;
129
130         /* list for moving/deleting messages */
131         GSList *mlist;
132         /* table for updating folder tree */
133         GHashTable *folder_table;
134
135         /* current sorting state */
136         SummarySortType sort_mode;
137         GtkSortType sort_type;
138 };
139
140 SummaryView     *summary_create(void);
141
142 void summary_init                 (SummaryView          *summaryview);
143 gboolean summary_show             (SummaryView          *summaryview,
144                                    FolderItem           *fitem,
145                                    gboolean              update_cache);
146 void summary_clear_list           (SummaryView          *summaryview);
147 void summary_clear_all            (SummaryView          *summaryview);
148
149 void summary_select_next_unread   (SummaryView          *summaryview);
150 void summary_select_by_msgnum     (SummaryView          *summaryview,
151                                    guint                 msgnum);
152 guint summary_get_current_msgnum  (SummaryView          *summaryview);
153 void summary_thread_build         (SummaryView          *summaryview);
154 void summary_unthread             (SummaryView          *summaryview);
155 void summary_filter               (SummaryView          *summaryview);
156 void summary_sort                 (SummaryView          *summaryview,
157                                    SummarySortType       type);
158
159 void summary_delete               (SummaryView          *summaryview);
160 void summary_delete_duplicated    (SummaryView          *summaryview);
161 void summary_execute              (SummaryView          *summaryview);
162 void summary_attract_by_subject   (SummaryView          *summaryview);
163 gint summary_write_cache          (SummaryView          *summaryview);
164 void summary_pass_key_press_event (SummaryView          *summaryview,
165                                    GdkEventKey          *event);
166 void summary_change_display_item  (SummaryView          *summaryview);
167 void summary_redisplay_msg        (SummaryView          *summaryview);
168 void summary_open_msg             (SummaryView          *summaryview);
169 void summary_view_source          (SummaryView          *summaryview);
170 void summary_reedit               (SummaryView          *summaryview);
171 void summary_step                 (SummaryView          *summaryview,
172                                    GtkScrollType         type);
173 void summary_set_marks_selected   (SummaryView          *summaryview);
174
175 void summary_move_selected_to     (SummaryView          *summaryview,
176                                    FolderItem           *to_folder);
177 void summary_move_to              (SummaryView          *summaryview);
178 void summary_copy_selected_to     (SummaryView          *summaryview,
179                                    FolderItem           *to_folder);
180 void summary_copy_to              (SummaryView          *summaryview);
181 void summary_save_as              (SummaryView          *summaryview);
182 void summary_print                (SummaryView          *summaryview);
183 void summary_mark                 (SummaryView          *summaryview);
184 void summary_unmark               (SummaryView          *summaryview);
185 void summary_mark_as_unread       (SummaryView          *summaryview);
186 void summary_mark_as_read         (SummaryView          *summaryview);
187 void summary_select_all           (SummaryView          *summaryview);
188 void summary_unselect_all         (SummaryView          *summaryview);
189
190 #endif /* __SUMMARY_H__ */