2006-08-15 [colin] 2.4.0cvs51
[claws.git] / src / mainwindow.h
1 /*
2  * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
3  * Copyright (C) 1999-2006 Hiroyuki Yamamoto and the Sylpheed-Claws team
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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         M_CAN_LEARN_SPAM      = 1 << 16,
53         M_ACTIONS_EXIST       = 1 << 17,
54         M_HAVE_QUEUED_MAILS   = 1 << 18
55 } SensitiveCond;
56
57 typedef enum
58 {
59         SEPARATE_NONE    = 0,
60         SEPARATE_FOLDER  = 1 << 0,
61         SEPARATE_MESSAGE = 1 << 1,
62         SEPARATE_BOTH    = (SEPARATE_FOLDER | SEPARATE_MESSAGE)
63 } SeparateType;
64
65 typedef enum
66 {
67         TOOLBAR_NONE            = 0,
68         TOOLBAR_ICON            = 1,
69         TOOLBAR_TEXT            = 2,
70         TOOLBAR_BOTH            = 3,
71         TOOLBAR_BOTH_HORIZ      = 4
72 } ToolbarStyle;
73
74 struct _MainWindow
75 {
76         SeparateType type;
77
78         union CompositeWin {
79                 struct 
80                 {
81                         GtkWidget *hpaned;
82                         GtkWidget *vpaned;
83                 } sep_none;
84                 struct {
85                         GtkWidget *folderwin;
86                         GtkWidget *vpaned;
87                 } sep_folder;
88                 struct {
89                         GtkWidget *messagewin;
90                         GtkWidget *hpaned;
91                 } sep_message;
92                 struct {
93                         GtkWidget *folderwin;
94                         GtkWidget *messagewin;
95                 } sep_both;
96         } win;
97
98         GtkWidget *window;
99         GtkWidget *vbox;
100         GtkWidget *menubar;
101
102         GtkItemFactory *menu_factory;
103
104         /* Toolbar handlebox */
105         GtkWidget *handlebox;
106         Toolbar *toolbar;
107
108         /* body */
109         GtkWidget *vbox_body;
110         GtkWidget *hbox_stat;
111         GtkWidget *statusbar;
112         GtkWidget *progressbar;
113         GtkWidget *statuslabel;
114         GtkWidget *ac_button;
115         GtkWidget *ac_label;
116         GtkWidget *ac_menu;
117         GtkWidget *online_switch;
118         GtkWidget *offline_switch;
119         GtkWidget *online_pixmap;
120         GtkWidget *offline_pixmap;
121
122         /* context IDs for status bar */
123         gint mainwin_cid;
124         gint folderview_cid;
125         gint summaryview_cid;
126         gint messageview_cid;
127
128         ToolbarStyle toolbar_style;
129
130         guint lock_count;
131         guint menu_lock_count;
132         guint cursor_count;
133
134         FolderView      *folderview;
135         SummaryView     *summaryview;
136         MessageView     *messageview;
137         LogWindow       *logwin;
138
139         gint    progressindicator_hook;
140         
141         GtkWidget       *colorlabel_menu;
142 };
143
144 MainWindow *main_window_create          (SeparateType    type);
145
146 void main_window_destroy                (MainWindow *mainwin);
147
148 void main_window_update_actions_menu    (MainWindow     *mainwin);
149
150 void main_window_cursor_wait            (MainWindow     *mainwin);
151 void main_window_cursor_normal          (MainWindow     *mainwin);
152
153 void main_window_lock                   (MainWindow     *mainwin);
154 void main_window_unlock                 (MainWindow     *mainwin);
155
156 void main_window_reflect_prefs_all_real (gboolean        pixmap_theme_changed);
157 void main_window_reflect_prefs_all      (void);
158 void main_window_reflect_prefs_all_now  (void);
159 void main_window_reflect_prefs_custom_colors(MainWindow         *mainwindow);
160 void main_window_set_summary_column     (void);
161 void main_window_set_folder_column      (void);
162 void main_window_set_account_menu       (GList          *account_list);
163 void main_window_set_account_menu_only_toolbar  (GList          *account_list);
164
165 GtkWidget *main_window_get_folder_window        (MainWindow     *mainwin);
166 GtkWidget *main_window_get_message_window       (MainWindow     *mainwin);
167
168 /* Mailing list support */
169 void main_create_mailing_list_menu      (MainWindow *mainwin, MsgInfo *msginfo);
170 gint mailing_list_get_list_post_mailto  (gchar **url, gchar *mailto, gint maxlen);
171
172 void main_window_separation_change      (MainWindow     *mainwin,
173                                          SeparateType    type);
174
175 void main_window_toggle_message_view    (MainWindow *mainwin);
176
177 void main_window_get_size               (MainWindow     *mainwin);
178 void main_window_get_position           (MainWindow     *mainwin);
179
180 void main_window_progress_on            (MainWindow     *mainwin);
181 void main_window_progress_off           (MainWindow     *mainwin);
182 void main_window_progress_set           (MainWindow     *mainwin,
183                                          gint            cur,
184                                          gint            total);
185
186 void main_window_empty_trash            (MainWindow     *mainwin,
187                                          gboolean        confirm);
188 void main_window_add_mailbox            (MainWindow     *mainwin);
189
190 void main_window_set_menu_sensitive     (MainWindow     *mainwin);
191
192
193 void main_window_show                   (MainWindow     *mainwin);
194 void main_window_hide                   (MainWindow     *mainwin);
195 void main_window_popup                  (MainWindow     *mainwin);
196
197 void main_window_toolbar_set_compose_button     (MainWindow *mainwin, 
198                                                  ComposeButtonType compose_btn_type);
199
200 SensitiveCond main_window_get_current_state   (MainWindow *mainwin);
201
202 void toolbar_set_compose_button               (Toolbar           *toolbar, 
203                                                ComposeButtonType  compose_btn_type);
204 void main_window_destroy_all                  (void);
205
206 void main_window_toggle_work_offline          (MainWindow        *mainwin, 
207                                                gboolean           offline,
208                                                gboolean           ask_sync);
209
210 /* public so it can be disabled from summaryview */
211 gboolean mainwindow_key_pressed               (GtkWidget         *widget, 
212                                                GdkEventKey       *event,
213                                                gpointer           data);
214 MainWindow *mainwindow_get_mainwindow         (void);
215 void mainwindow_learn                         (MainWindow *mainwin,
216                                                gboolean is_spam);
217 void mainwindow_jump_to                       (const gchar       *target);
218 #endif /* __MAINWINDOW_H__ */