use execvp() correctly (suggested by wwp; thanks!)
[claws.git] / src / mainwindow.h
1 /*
2  * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
3  * Copyright (C) 1999-2001 Hiroyuki Yamamoto
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, 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 } SensitiveCond;
51
52 typedef enum
53 {
54         SEPARATE_NONE    = 0,
55         SEPARATE_FOLDER  = 1 << 0,
56         SEPARATE_MESSAGE = 1 << 1,
57         SEPARATE_BOTH    = (SEPARATE_FOLDER | SEPARATE_MESSAGE)
58 } SeparateType;
59
60 typedef enum
61 {
62         TOOLBAR_NONE    = 0,
63         TOOLBAR_ICON    = 1,
64         TOOLBAR_TEXT    = 2,
65         TOOLBAR_BOTH    = 3
66 } ToolbarStyle;
67
68 struct _MainWindow
69 {
70         SeparateType type;
71
72         union CompositeWin {
73                 struct 
74                 {
75                         GtkWidget *hpaned;
76                         GtkWidget *vpaned;
77                 } sep_none;
78                 struct {
79                         GtkWidget *folderwin;
80                         GtkWidget *vpaned;
81                 } sep_folder;
82                 struct {
83                         GtkWidget *messagewin;
84                         GtkWidget *hpaned;
85                 } sep_message;
86                 struct {
87                         GtkWidget *folderwin;
88                         GtkWidget *messagewin;
89                 } sep_both;
90         } win;
91
92         GtkWidget *window;
93         GtkWidget *vbox;
94         GtkWidget *menubar;
95
96         GtkItemFactory *menu_factory;
97         
98         /* Toolbar handlebox */
99         GtkWidget *handlebox;
100         
101         MainToolbar *toolbar;
102
103         /* body */
104         GtkWidget *vbox_body;
105         GtkWidget *hbox_stat;
106         GtkWidget *statusbar;
107         GtkWidget *progressbar;
108         GtkWidget *statuslabel;
109         GtkWidget *ac_button;
110         GtkWidget *ac_label;
111         GtkWidget *ac_menu;
112         GtkWidget *online_switch;
113         GtkWidget *offline_switch;
114
115         /* context IDs for status bar */
116         gint mainwin_cid;
117         gint folderview_cid;
118         gint summaryview_cid;
119
120         ToolbarStyle toolbar_style;
121
122         guint lock_count;
123         guint menu_lock_count;
124         guint cursor_count;
125
126         FolderView      *folderview;
127         SummaryView     *summaryview;
128         MessageView     *messageview;
129         LogWindow       *logwin;
130 };
131
132 MainWindow *main_window_create          (SeparateType    type);
133
134 void main_window_cursor_wait            (MainWindow     *mainwin);
135 void main_window_cursor_normal          (MainWindow     *mainwin);
136
137 void main_window_lock                   (MainWindow     *mainwin);
138 void main_window_unlock                 (MainWindow     *mainwin);
139
140 void main_window_reflect_prefs_all_real         (gboolean pixmap_theme_changed);
141 void main_window_reflect_prefs_all      (void);
142 void main_window_set_summary_column     (void);
143 void main_window_set_account_menu       (GList          *account_list);
144 void main_window_separation_change      (MainWindow     *mainwin,
145                                          SeparateType    type);
146
147 void main_window_toggle_message_view    (MainWindow *mainwin);
148
149 void main_window_get_size               (MainWindow     *mainwin);
150 void main_window_get_position           (MainWindow     *mainwin);
151
152 void main_window_empty_trash            (MainWindow     *mainwin,
153                                          gboolean        confirm);
154 void main_window_add_mailbox            (MainWindow     *mainwin);
155
156 void main_window_set_menu_sensitive     (MainWindow     *mainwin);
157
158
159 void main_window_popup                  (MainWindow     *mainwin);
160
161 void main_window_toolbar_set_compose_button     (MainWindow *mainwin, 
162                                          ComposeButtonType compose_btn_type);
163
164 SensitiveCond main_window_get_current_state   (MainWindow *mainwin);
165
166 void reply_cb                             (MainWindow   *mainwin,
167                                          guint           action,
168                                          GtkWidget      *widget);
169
170 void inc_mail_cb                                  (MainWindow   *mainwin,
171                                          guint           action,
172                                          GtkWidget      *widget);
173
174 void inc_all_account_mail_cb              (MainWindow   *mainwin,
175                                          guint           action,
176                                          GtkWidget      *widget);
177
178 void send_queue_cb                        (MainWindow   *mainwin,
179                                          guint           action,
180                                          GtkWidget      *widget);
181
182 void compose_mail_cb                          (MainWindow       *mainwin, 
183                                          guint action,
184                                            GtkWidget         *widget);
185
186 void compose_news_cb                          (MainWindow       *mainwin, 
187                                          guint action,
188                                            GtkWidget         *widget);
189
190 void next_unread_cb                        (MainWindow  *mainwin,
191                                           guint          action,
192                                           GtkWidget     *widget);
193
194 #endif /* __MAINWINDOW_H__ */