2007-02-21 [wwp] 2.7.2cvs59
[claws.git] / src / mainwindow.h
1 /*
2  * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
3  * Copyright (C) 1999-2007 Hiroyuki Yamamoto and the Claws Mail 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 #define OFFLINE_SWITCH_HOOKLIST "offline_switch"
35 #define ACCOUNT_LIST_CHANGED_HOOKLIST "account_list_changed"
36 #define MAIN_WINDOW_CLOSE "mainwindow_close"
37
38 typedef enum
39 {
40         M_UNLOCKED            = 1 << 0,
41         M_MSG_EXIST           = 1 << 1,
42         M_TARGET_EXIST        = 1 << 2,
43         M_SINGLE_TARGET_EXIST = 1 << 3,
44         M_EXEC                = 1 << 4,
45         M_ALLOW_REEDIT        = 1 << 5,
46         M_HAVE_ACCOUNT        = 1 << 6,
47         M_THREADED            = 1 << 7,
48         M_UNTHREADED          = 1 << 8,
49         M_ALLOW_DELETE        = 1 << 9,
50         M_INC_ACTIVE          = 1 << 10,
51         M_NEWS                = 1 << 11,
52         M_HAVE_NEWS_ACCOUNT   = 1 << 12,
53         M_HIDE_READ_MSG       = 1 << 13,
54         M_DELAY_EXEC          = 1 << 14,
55         M_NOT_NEWS            = 1 << 15,
56         M_CAN_LEARN_SPAM      = 1 << 16,
57         M_ACTIONS_EXIST       = 1 << 17,
58         M_HAVE_QUEUED_MAILS   = 1 << 18,
59         M_WANT_SYNC           = 1 << 19
60 } SensitiveCond;
61
62 typedef enum
63 {
64         NORMAL_LAYOUT    = 0,
65         VERTICAL_LAYOUT  = 1 << 0,
66         WIDE_LAYOUT = 1 << 1,
67         WIDE_MSGLIST_LAYOUT = 1 << 2
68 } LayoutType;
69
70 typedef enum
71 {       
72         TOOLBAR_NONE            = 0,
73         TOOLBAR_ICON            = 1,
74         TOOLBAR_TEXT            = 2,
75         TOOLBAR_BOTH            = 3,
76         TOOLBAR_BOTH_HORIZ      = 4
77 } ToolbarStyle;
78
79 struct _MainWindow
80 {
81         GtkWidget *hpaned;
82         GtkWidget *vpaned;
83
84         GtkWidget *window;
85         GtkWidget *vbox;
86         GtkWidget *menubar;
87
88         GtkItemFactory *menu_factory;
89
90         /* Toolbar handlebox */
91         GtkWidget *handlebox;
92         Toolbar *toolbar;
93
94         /* body */
95         GtkWidget *vbox_body;
96         GtkWidget *hbox_stat;
97         GtkWidget *statusbar;
98         GtkWidget *progressbar;
99         GtkWidget *statuslabel;
100         GtkWidget *ac_button;
101         GtkWidget *ac_label;
102         GtkWidget *ac_menu;
103         GtkWidget *online_switch;
104         GtkWidget *offline_switch;
105         GtkWidget *online_pixmap;
106         GtkWidget *offline_pixmap;
107
108         /* context IDs for status bar */
109         gint mainwin_cid;
110         gint folderview_cid;
111         gint summaryview_cid;
112         gint messageview_cid;
113
114         ToolbarStyle toolbar_style;
115
116         guint lock_count;
117         guint menu_lock_count;
118         guint cursor_count;
119
120         FolderView      *folderview;
121         SummaryView     *summaryview;
122         MessageView     *messageview;
123         LogWindow       *logwin;
124
125         gint    progressindicator_hook;
126         
127         GtkWidget       *colorlabel_menu;
128         GtkWidget       *warning_btn;
129         
130 #ifdef HAVE_LIBSM
131         gpointer smc_conn;
132 #endif
133 };
134
135 MainWindow *main_window_create          (void);
136
137 void main_window_destroy                (MainWindow *mainwin);
138
139 void main_window_update_actions_menu    (MainWindow     *mainwin);
140
141 void main_window_cursor_wait            (MainWindow     *mainwin);
142 void main_window_cursor_normal          (MainWindow     *mainwin);
143
144 void main_window_lock                   (MainWindow     *mainwin);
145 void main_window_unlock                 (MainWindow     *mainwin);
146
147 void main_window_reflect_prefs_all_real (gboolean        pixmap_theme_changed);
148 void main_window_reflect_prefs_all      (void);
149 void main_window_reflect_prefs_all_now  (void);
150 void main_window_reflect_prefs_custom_colors(MainWindow         *mainwindow);
151 void main_window_set_summary_column     (void);
152 void main_window_set_folder_column      (void);
153 void main_window_set_account_menu       (GList          *account_list);
154 void main_window_set_account_menu_only_toolbar  (GList          *account_list);
155
156 /* Mailing list support */
157 void main_create_mailing_list_menu      (MainWindow *mainwin, MsgInfo *msginfo);
158 gint mailing_list_get_list_post_mailto  (gchar **url, gchar *mailto, gint maxlen);
159
160 void main_window_toggle_message_view    (MainWindow *mainwin);
161
162 void main_window_get_size               (MainWindow     *mainwin);
163 void main_window_get_position           (MainWindow     *mainwin);
164
165 void main_window_progress_on            (MainWindow     *mainwin);
166 void main_window_progress_off           (MainWindow     *mainwin);
167 void main_window_progress_set           (MainWindow     *mainwin,
168                                          gint            cur,
169                                          gint            total);
170
171 void main_window_empty_trash            (MainWindow     *mainwin,
172                                          gboolean        confirm);
173 void main_window_add_mailbox            (MainWindow     *mainwin);
174
175 void main_window_set_menu_sensitive     (MainWindow     *mainwin);
176
177
178 void main_window_show                   (MainWindow     *mainwin);
179 void main_window_hide                   (MainWindow     *mainwin);
180 void main_window_popup                  (MainWindow     *mainwin);
181
182 void main_window_toolbar_set_compose_button     (MainWindow *mainwin, 
183                                                  ComposeButtonType compose_btn_type);
184
185 SensitiveCond main_window_get_current_state   (MainWindow *mainwin);
186
187 void toolbar_set_compose_button               (Toolbar           *toolbar, 
188                                                ComposeButtonType  compose_btn_type);
189 void main_window_destroy_all                  (void);
190
191 void main_window_toggle_work_offline          (MainWindow        *mainwin, 
192                                                gboolean           offline,
193                                                gboolean           ask_sync);
194
195 /* public so it can be disabled from summaryview */
196 gboolean mainwindow_key_pressed               (GtkWidget         *widget, 
197                                                GdkEventKey       *event,
198                                                gpointer           data);
199 MainWindow *mainwindow_get_mainwindow         (void);
200 void mainwindow_learn                         (MainWindow *mainwin,
201                                                gboolean is_spam);
202 void mainwindow_jump_to                       (const gchar       *target);
203 void mainwindow_show_error                    (void);
204 void mainwindow_clear_error                   (MainWindow *mainwin);
205 gboolean mainwindow_is_obscured      (void);
206 #endif /* __MAINWINDOW_H__ */