Fix bug #591676 (MSG_QUEUED lost on restart)
[claws.git] / src / mainwindow.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 __MAINWINDOW_H__
21 #define __MAINWINDOW_H__
22
23 #include <glib.h>
24
25 typedef struct _MainWindow  MainWindow;
26
27 #include "folderview.h"
28 #include "summaryview.h"
29 #include "headerview.h"
30 #include "messageview.h"
31 #include "logwindow.h"
32 #include "toolbar.h"
33
34 typedef enum
35 {
36         M_UNLOCKED            = 1 << 0,
37         M_MSG_EXIST           = 1 << 1,
38         M_TARGET_EXIST        = 1 << 2,
39         M_SINGLE_TARGET_EXIST = 1 << 3,
40         M_EXEC                = 1 << 4,
41         M_ALLOW_REEDIT        = 1 << 5,
42         M_HAVE_ACCOUNT        = 1 << 6,
43         M_THREADED            = 1 << 7,
44         M_UNTHREADED          = 1 << 8,
45         M_ALLOW_DELETE        = 1 << 9,
46         M_INC_ACTIVE          = 1 << 10,
47         M_NEWS                = 1 << 11,
48         M_HAVE_NEWS_ACCOUNT   = 1 << 12,
49         M_HIDE_READ_MSG       = 1 << 13,
50         M_DELAY_EXEC          = 1 << 14,
51         M_NOT_NEWS            = 1 << 15,
52 } SensitiveCond;
53
54 typedef enum
55 {
56         SEPARATE_NONE    = 0,
57         SEPARATE_FOLDER  = 1 << 0,
58         SEPARATE_MESSAGE = 1 << 1,
59         SEPARATE_BOTH    = (SEPARATE_FOLDER | SEPARATE_MESSAGE)
60 } SeparateType;
61
62 typedef enum
63 {
64         TOOLBAR_NONE    = 0,
65         TOOLBAR_ICON    = 1,
66         TOOLBAR_TEXT    = 2,
67         TOOLBAR_BOTH    = 3
68 } ToolbarStyle;
69
70 struct _MainWindow
71 {
72         SeparateType type;
73
74         union CompositeWin {
75                 struct 
76                 {
77                         GtkWidget *hpaned;
78                         GtkWidget *vpaned;
79                 } sep_none;
80                 struct {
81                         GtkWidget *folderwin;
82                         GtkWidget *vpaned;
83                 } sep_folder;
84                 struct {
85                         GtkWidget *messagewin;
86                         GtkWidget *hpaned;
87                 } sep_message;
88                 struct {
89                         GtkWidget *folderwin;
90                         GtkWidget *messagewin;
91                 } sep_both;
92         } win;
93
94         GtkWidget *window;
95         GtkWidget *vbox;
96         GtkWidget *menubar;
97
98         GtkItemFactory *menu_factory;
99         
100         /* Toolbar handlebox */
101         GtkWidget *handlebox;
102         
103         MainToolbar *toolbar;
104
105         /* body */
106         GtkWidget *vbox_body;
107         GtkWidget *hbox_stat;
108         GtkWidget *statusbar;
109         GtkWidget *progressbar;
110         GtkWidget *statuslabel;
111         GtkWidget *ac_button;
112         GtkWidget *ac_label;
113         GtkWidget *ac_menu;
114         GtkWidget *online_switch;
115         GtkWidget *offline_switch;
116
117         /* context IDs for status bar */
118         gint mainwin_cid;
119         gint folderview_cid;
120         gint summaryview_cid;
121
122         ToolbarStyle toolbar_style;
123
124         guint lock_count;
125         guint menu_lock_count;
126         guint cursor_count;
127
128         FolderView      *folderview;
129         SummaryView     *summaryview;
130         MessageView     *messageview;
131         LogWindow       *logwin;
132 };
133
134 MainWindow *main_window_create          (SeparateType    type);
135
136 void main_window_cursor_wait            (MainWindow     *mainwin);
137 void main_window_cursor_normal          (MainWindow     *mainwin);
138
139 void main_window_lock                   (MainWindow     *mainwin);
140 void main_window_unlock                 (MainWindow     *mainwin);
141
142 void main_window_reflect_prefs_all_real         (gboolean pixmap_theme_changed);
143 void main_window_reflect_prefs_all      (void);
144 void main_window_set_summary_column     (void);
145 void main_window_set_account_menu       (GList          *account_list);
146 void main_window_separation_change      (MainWindow     *mainwin,
147                                          SeparateType    type);
148
149 void main_window_toggle_message_view    (MainWindow *mainwin);
150
151 void main_window_get_size               (MainWindow     *mainwin);
152 void main_window_get_position           (MainWindow     *mainwin);
153
154 void main_window_empty_trash            (MainWindow     *mainwin,
155                                          gboolean        confirm);
156 void main_window_add_mailbox            (MainWindow     *mainwin);
157
158 void main_window_set_menu_sensitive     (MainWindow     *mainwin);
159
160
161 void main_window_popup                  (MainWindow     *mainwin);
162
163 void main_window_toolbar_set_compose_button     (MainWindow *mainwin, 
164                                          ComposeButtonType compose_btn_type);
165
166 SensitiveCond main_window_get_current_state   (MainWindow *mainwin);
167
168 void reply_cb                             (MainWindow   *mainwin,
169                                          guint           action,
170                                          GtkWidget      *widget);
171
172 void inc_mail_cb                                  (MainWindow   *mainwin,
173                                          guint           action,
174                                          GtkWidget      *widget);
175
176 void inc_all_account_mail_cb              (MainWindow   *mainwin,
177                                          guint           action,
178                                          GtkWidget      *widget);
179
180 void send_queue_cb                        (MainWindow   *mainwin,
181                                          guint           action,
182                                          GtkWidget      *widget);
183
184 void compose_mail_cb                          (MainWindow       *mainwin, 
185                                          guint action,
186                                            GtkWidget         *widget);
187
188 void compose_news_cb                          (MainWindow       *mainwin, 
189                                          guint action,
190                                            GtkWidget         *widget);
191
192 void next_unread_cb                        (MainWindow  *mainwin,
193                                           guint          action,
194                                           GtkWidget     *widget);
195
196 #endif /* __MAINWINDOW_H__ */