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