f094ffa9e9adef76cd36a074387017dfeb0091f0
[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,
40         M_MSG_EXIST,
41         M_TARGET_EXIST,
42         M_SINGLE_TARGET_EXIST,
43         M_EXEC,
44         M_ALLOW_REEDIT,
45         M_HAVE_ACCOUNT,
46         M_THREADED,
47         M_UNTHREADED,
48         M_ALLOW_DELETE,
49         M_INC_ACTIVE,
50         M_NEWS,
51         M_HAVE_NEWS_ACCOUNT,
52         M_HIDE_READ_MSG,
53         M_DELAY_EXEC,
54         M_NOT_NEWS,
55         M_CAN_LEARN_SPAM,
56         M_ACTIONS_EXIST,
57         M_HAVE_QUEUED_MAILS,
58         M_WANT_SYNC,
59         M_TAGS_EXIST,
60         M_HAVE_PROCESSING,
61         M_SUMMARY_ISLIST,
62         M_IN_MSGLIST,
63         M_HAVE_MULTI_ACCOUNT,
64         M_FOLDER_SELECTED,
65         M_SESSION_PASSWORDS,
66         M_DELETED_EXISTS,
67         M_NOT_TRASH,
68         M_HIDE_READ_THREADS,
69         M_HAVE_RETRIEVABLE_ACCOUNT,
70         M_HAVE_ANY_RETRIEVABLE_ACCOUNT,
71
72 /* reserved */
73     M_MAX_RESERVED
74 } SensitiveCond;
75
76 typedef guint64 SensitiveCondMask;
77
78 typedef enum
79 {
80         NORMAL_LAYOUT       = 0,
81         VERTICAL_LAYOUT     = 1 << 0,
82         WIDE_LAYOUT         = 1 << 1,
83         WIDE_MSGLIST_LAYOUT = 1 << 2,
84         SMALL_LAYOUT
85 } LayoutType;
86
87 typedef enum
88 {       
89         TOOLBAR_NONE            = 0,
90         TOOLBAR_ICON            = 1,
91         TOOLBAR_TEXT            = 2,
92         TOOLBAR_BOTH            = 3,
93         TOOLBAR_BOTH_HORIZ      = 4
94 } ToolbarStyle;
95
96 struct _MainWindow
97 {
98         GtkWidget *hpaned;
99         GtkWidget *vpaned;
100
101         GtkWidget *window;
102         GtkWidget *vbox;
103         GtkWidget *menubar;
104
105         /* Toolbar handlebox */
106         GtkWidget *handlebox;
107         Toolbar *toolbar;
108
109         /* body */
110         GtkWidget *vbox_body;
111         GtkWidget *hbox_stat;
112         GtkWidget *statusbar;
113         GtkWidget *progressbar;
114         GtkWidget *statuslabel;
115         GtkWidget *ac_button;
116         GtkWidget *ac_label;
117         GtkWidget *ac_menu;
118         GtkWidget *online_switch;
119         GtkWidget *offline_switch;
120         GtkWidget *online_pixmap;
121         GtkWidget *offline_pixmap;
122
123         /* context IDs for status bar */
124         gint mainwin_cid;
125         gint folderview_cid;
126         gint summaryview_cid;
127         gint messageview_cid;
128
129         ToolbarStyle toolbar_style;
130
131         guint lock_count;
132         guint menu_lock_count;
133         guint cursor_count;
134
135         FolderView      *folderview;
136         SummaryView     *summaryview;
137         MessageView     *messageview;
138         LogWindow       *logwin;
139         LogWindow       *filtering_debugwin;
140
141         gint    progressindicator_hook;
142         
143         GtkWidget       *colorlabel_menu;
144         GtkWidget       *warning_btn;
145         GtkWidget       *tags_menu;
146         
147         gboolean         in_folder;
148         GtkActionGroup  *action_group;
149         GtkUIManager    *ui_manager;
150
151 #ifdef HAVE_LIBSM
152         gpointer smc_conn;
153 #endif
154 };
155
156 MainWindow *main_window_create          (void);
157
158 void main_window_update_actions_menu    (MainWindow     *mainwin);
159
160 void main_window_cursor_wait            (MainWindow     *mainwin);
161 void main_window_cursor_normal          (MainWindow     *mainwin);
162
163 void main_window_lock                   (MainWindow     *mainwin);
164 void main_window_unlock                 (MainWindow     *mainwin);
165
166 void main_window_reflect_prefs_all_real (gboolean        pixmap_theme_changed);
167 void main_window_reflect_prefs_all      (void);
168 void main_window_reflect_prefs_all_now  (void);
169 void main_window_reflect_prefs_custom_colors(MainWindow         *mainwindow);
170 void main_window_reflect_tags_changes(MainWindow        *mainwindow);
171 void main_window_set_summary_column     (void);
172 void main_window_set_folder_column      (void);
173 void main_window_set_account_menu       (GList          *account_list);
174 void main_window_set_account_menu_only_toolbar  (GList          *account_list);
175
176 /* Mailing list support */
177 void main_create_mailing_list_menu      (MainWindow *mainwin, MsgInfo *msginfo);
178 gint mailing_list_get_list_post_mailto  (gchar **url, gchar *mailto, gint maxlen);
179
180 void main_window_toggle_message_view    (MainWindow *mainwin);
181
182 void main_window_get_size               (MainWindow     *mainwin);
183 void main_window_get_position           (MainWindow     *mainwin);
184
185 void main_window_progress_on            (MainWindow     *mainwin);
186 void main_window_progress_off           (MainWindow     *mainwin);
187 gboolean main_window_empty_trash        (MainWindow     *mainwin,
188                                          gboolean        confirm,
189                                          gboolean        for_quit);
190
191 guint64 main_window_get_mask(SensitiveCond cond, ...);
192
193 void main_window_set_menu_sensitive     (MainWindow     *mainwin);
194
195
196 void main_window_show                   (MainWindow     *mainwin);
197 void main_window_hide                   (MainWindow     *mainwin);
198 void main_window_popup                  (MainWindow     *mainwin);
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 MainWindow *mainwindow_get_mainwindow         (void);
211 void mainwindow_learn                         (MainWindow *mainwin,
212                                                gboolean is_spam);
213 void mainwindow_jump_to                       (const gchar       *target,
214                                                gboolean popup);
215 void mainwindow_show_error                    (void);
216 void mainwindow_clear_error                   (MainWindow *mainwin);
217 gboolean mainwindow_is_obscured               (void);
218 void mainwindow_exit_folder                   (MainWindow *mainwin);
219 void mainwindow_enter_folder                  (MainWindow *mainwin);
220 void mainwindow_reset_paned                   (GtkPaned *paned);
221
222 #ifdef MAEMO
223 gboolean maemo_mainwindow_is_fullscreen               (GtkWidget *widget);
224 void maemo_window_full_screen_if_needed               (GtkWindow *window);
225 void maemo_connect_key_press_to_mainwindow    (GtkWindow *window);
226 void mainwindow_maemo_led_set(gboolean state);
227 #endif
228
229 void mainwin_accel_changed_cb (GtkAccelGroup *accelgroup, guint keyval, GdkModifierType modifier,
230                                   GClosure *closure, GtkMenuItem *item);
231
232 #endif /* __MAINWINDOW_H__ */