2012-11-21 [colin] 3.9.0cvs7-stable
[claws.git] / src / mainwindow.h
1 /*
2  * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
3  * Copyright (C) 1999-2012 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 3 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, see <http://www.gnu.org/licenses/>.
17  * 
18  */
19
20 #ifndef __MAINWINDOW_H__
21 #define __MAINWINDOW_H__
22
23 #include <glib.h>
24
25 typedef struct _MainWindow  MainWindow;
26
27 #include "viewtypes.h"
28 #include "logwindow.h"
29 #include "procmsg.h"
30 #include "toolbar.h"
31
32 #define OFFLINE_SWITCH_HOOKLIST "offline_switch"
33 #define ACCOUNT_LIST_CHANGED_HOOKLIST "account_list_changed"
34 #define MAIN_WINDOW_CLOSE "mainwindow_close"
35 #define MAIN_WINDOW_GOT_ICONIFIED "mainwindow_iconified"
36 #define THEME_CHANGED_HOOKLIST "theme_changed"
37 typedef enum
38 {
39         M_UNLOCKED            = 1 << 0,
40         M_MSG_EXIST           = 1 << 1,
41         M_TARGET_EXIST        = 1 << 2,
42         M_SINGLE_TARGET_EXIST = 1 << 3,
43         M_EXEC                = 1 << 4,
44         M_ALLOW_REEDIT        = 1 << 5,
45         M_HAVE_ACCOUNT        = 1 << 6,
46         M_THREADED            = 1 << 7,
47         M_UNTHREADED          = 1 << 8,
48         M_ALLOW_DELETE        = 1 << 9,
49         M_INC_ACTIVE          = 1 << 10,
50         M_NEWS                = 1 << 11,
51         M_HAVE_NEWS_ACCOUNT   = 1 << 12,
52         M_HIDE_READ_MSG       = 1 << 13,
53         M_DELAY_EXEC          = 1 << 14,
54         M_NOT_NEWS            = 1 << 15,
55         M_CAN_LEARN_SPAM      = 1 << 16,
56         M_ACTIONS_EXIST       = 1 << 17,
57         M_HAVE_QUEUED_MAILS   = 1 << 18,
58         M_WANT_SYNC           = 1 << 19,
59         M_TAGS_EXIST          = 1 << 20,
60         M_HAVE_PROCESSING     = 1 << 21,
61         M_SUMMARY_ISLIST      = 1 << 22,
62         M_IN_MSGLIST          = 1 << 23,
63         M_HAVE_MULTI_ACCOUNT  = 1 << 24,
64         M_FOLDER_SELECTED     = 1 << 25,
65         M_SESSION_PASSWORDS   = 1 << 26,
66         M_DELETED_EXISTS      = 1 << 27,
67         M_NOT_TRASH           = 1 << 28,
68         M_HIDE_READ_THREADS   = 1 << 29,
69         M_HAVE_RETRIEVABLE_ACCOUNT = 1 << 30,
70         M_HAVE_ANY_RETRIEVABLE_ACCOUNT = 1 << 31
71 } SensitiveCond;
72
73 typedef enum
74 {
75         NORMAL_LAYOUT    = 0,
76         VERTICAL_LAYOUT  = 1 << 0,
77         WIDE_LAYOUT = 1 << 1,
78         WIDE_MSGLIST_LAYOUT = 1 << 2,
79         SMALL_LAYOUT
80 } LayoutType;
81
82 typedef enum
83 {       
84         TOOLBAR_NONE            = 0,
85         TOOLBAR_ICON            = 1,
86         TOOLBAR_TEXT            = 2,
87         TOOLBAR_BOTH            = 3,
88         TOOLBAR_BOTH_HORIZ      = 4
89 } ToolbarStyle;
90
91 struct _MainWindow
92 {
93         GtkWidget *hpaned;
94         GtkWidget *vpaned;
95
96         GtkWidget *window;
97         GtkWidget *vbox;
98         GtkWidget *menubar;
99
100         /* Toolbar handlebox */
101         GtkWidget *handlebox;
102         Toolbar *toolbar;
103
104         /* body */
105         GtkWidget *vbox_body;
106         GtkWidget *hbox_stat;
107         GtkWidget *statusbar;
108         GtkWidget *progressbar;
109         GtkWidget *statuslabel;
110         GtkWidget *ac_button;
111         GtkWidget *ac_label;
112         GtkWidget *ac_menu;
113         GtkWidget *online_switch;
114         GtkWidget *offline_switch;
115         GtkWidget *online_pixmap;
116         GtkWidget *offline_pixmap;
117
118         /* context IDs for status bar */
119         gint mainwin_cid;
120         gint folderview_cid;
121         gint summaryview_cid;
122         gint messageview_cid;
123
124         ToolbarStyle toolbar_style;
125
126         guint lock_count;
127         guint menu_lock_count;
128         guint cursor_count;
129
130         FolderView      *folderview;
131         SummaryView     *summaryview;
132         MessageView     *messageview;
133         LogWindow       *logwin;
134         LogWindow       *filtering_debugwin;
135
136         gint    progressindicator_hook;
137         
138         GtkWidget       *colorlabel_menu;
139         GtkWidget       *warning_btn;
140         GtkWidget       *tags_menu;
141         
142         gboolean         in_folder;
143         GtkActionGroup  *action_group;
144         GtkUIManager    *ui_manager;
145
146 #ifdef HAVE_LIBSM
147         gpointer smc_conn;
148 #endif
149 };
150
151 MainWindow *main_window_create          (void);
152
153 void main_window_update_actions_menu    (MainWindow     *mainwin);
154
155 void main_window_cursor_wait            (MainWindow     *mainwin);
156 void main_window_cursor_normal          (MainWindow     *mainwin);
157
158 void main_window_lock                   (MainWindow     *mainwin);
159 void main_window_unlock                 (MainWindow     *mainwin);
160
161 void main_window_reflect_prefs_all_real (gboolean        pixmap_theme_changed);
162 void main_window_reflect_prefs_all      (void);
163 void main_window_reflect_prefs_all_now  (void);
164 void main_window_reflect_prefs_custom_colors(MainWindow         *mainwindow);
165 void main_window_reflect_tags_changes(MainWindow        *mainwindow);
166 void main_window_set_summary_column     (void);
167 void main_window_set_folder_column      (void);
168 void main_window_set_account_menu       (GList          *account_list);
169 void main_window_set_account_menu_only_toolbar  (GList          *account_list);
170
171 /* Mailing list support */
172 void main_create_mailing_list_menu      (MainWindow *mainwin, MsgInfo *msginfo);
173 gint mailing_list_get_list_post_mailto  (gchar **url, gchar *mailto, gint maxlen);
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 gboolean main_window_empty_trash        (MainWindow     *mainwin,
183                                          gboolean        confirm,
184                                          gboolean        for_quit);
185
186 void main_window_set_menu_sensitive     (MainWindow     *mainwin);
187
188
189 void main_window_show                   (MainWindow     *mainwin);
190 void main_window_hide                   (MainWindow     *mainwin);
191 void main_window_popup                  (MainWindow     *mainwin);
192
193 SensitiveCond main_window_get_current_state   (MainWindow *mainwin);
194
195 void toolbar_set_compose_button               (Toolbar           *toolbar, 
196                                                ComposeButtonType  compose_btn_type);
197 void main_window_destroy_all                  (void);
198
199 void main_window_toggle_work_offline          (MainWindow        *mainwin, 
200                                                gboolean           offline,
201                                                gboolean           ask_sync);
202
203 MainWindow *mainwindow_get_mainwindow         (void);
204 void mainwindow_learn                         (MainWindow *mainwin,
205                                                gboolean is_spam);
206 void mainwindow_jump_to                       (const gchar       *target,
207                                                gboolean popup);
208 void mainwindow_show_error                    (void);
209 void mainwindow_clear_error                   (MainWindow *mainwin);
210 gboolean mainwindow_is_obscured               (void);
211 void mainwindow_exit_folder                   (MainWindow *mainwin);
212 void mainwindow_enter_folder                  (MainWindow *mainwin);
213 void mainwindow_reset_paned                   (GtkPaned *paned);
214
215 #ifdef MAEMO
216 gboolean maemo_mainwindow_is_fullscreen               (GtkWidget *widget);
217 void maemo_window_full_screen_if_needed               (GtkWindow *window);
218 void maemo_connect_key_press_to_mainwindow    (GtkWindow *window);
219 void mainwindow_maemo_led_set(gboolean state);
220 #endif
221
222 void mainwin_accel_changed_cb (GtkAccelGroup *accelgroup, guint keyval, GdkModifierType modifier,
223                                   GClosure *closure, GtkMenuItem *item);
224
225 #endif /* __MAINWINDOW_H__ */