Add gtkut_tree_view_get_selected_pointer() helper function.
[claws.git] / src / mainwindow.h
1 /*
2  * Claws Mail -- a GTK+ based, lightweight, and fast e-mail client
3  * Copyright (C) 1999-2016 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 #ifndef __MAINWINDOW_H__
20 #define __MAINWINDOW_H__
21
22 #include <glib.h>
23
24 typedef struct _MainWindow  MainWindow;
25
26 #include "viewtypes.h"
27 #include "logwindow.h"
28 #include "procmsg.h"
29 #include "toolbar.h"
30
31 #define OFFLINE_SWITCH_HOOKLIST "offline_switch"
32 #define ACCOUNT_LIST_CHANGED_HOOKLIST "account_list_changed"
33 #define MAIN_WINDOW_CLOSE "mainwindow_close"
34 #define MAIN_WINDOW_GOT_ICONIFIED "mainwindow_iconified"
35 #define THEME_CHANGED_HOOKLIST "theme_changed"
36 typedef enum
37 {
38         M_UNLOCKED,
39         M_MSG_EXIST,
40         M_TARGET_EXIST,
41         M_SINGLE_TARGET_EXIST,
42         M_EXEC,
43         M_ALLOW_REEDIT,
44         M_HAVE_ACCOUNT,
45         M_THREADED,
46         M_UNTHREADED,
47         M_ALLOW_DELETE,
48         M_INC_ACTIVE,
49         M_SEND_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_MASTER_PASSPHRASE,
67         M_DELETED_EXISTS,
68         M_NOT_TRASH,
69         M_HIDE_READ_THREADS,
70         M_HAVE_RETRIEVABLE_ACCOUNT,
71         M_HAVE_ANY_RETRIEVABLE_ACCOUNT,
72         M_NOT_DRAFT,
73
74 /* reserved */
75     M_MAX_RESERVED
76 } SensitiveCond;
77
78 typedef guint64 SensitiveCondMask;
79
80 typedef enum
81 {
82         NORMAL_LAYOUT       = 0,
83         VERTICAL_LAYOUT     = 1 << 0,
84         WIDE_LAYOUT         = 1 << 1,
85         WIDE_MSGLIST_LAYOUT = 1 << 2,
86         SMALL_LAYOUT
87 } LayoutType;
88
89 typedef enum
90 {       
91         TOOLBAR_NONE            = 0,
92         TOOLBAR_ICON            = 1,
93         TOOLBAR_TEXT            = 2,
94         TOOLBAR_BOTH            = 3,
95         TOOLBAR_BOTH_HORIZ      = 4
96 } ToolbarStyle;
97
98 struct _MainWindow
99 {
100         GtkWidget *hpaned;
101         GtkWidget *vpaned;
102
103         GtkWidget *window;
104         GtkWidget *vbox;
105         GtkWidget *menubar;
106
107         /* Toolbar handlebox */
108         GtkWidget *handlebox;
109         Toolbar *toolbar;
110
111         /* body */
112         GtkWidget *vbox_body;
113         GtkWidget *hbox_stat;
114         GtkWidget *statusbar;
115         GtkWidget *progressbar;
116         GtkWidget *statuslabel;
117         GtkWidget *ac_button;
118         GtkWidget *ac_label;
119         GtkWidget *ac_menu;
120         GtkWidget *online_switch;
121         GtkWidget *offline_switch;
122         GtkWidget *online_pixmap;
123         GtkWidget *offline_pixmap;
124
125         /* context IDs for status bar */
126         gint mainwin_cid;
127         gint folderview_cid;
128         gint summaryview_cid;
129         gint messageview_cid;
130
131         ToolbarStyle toolbar_style;
132
133         guint lock_count;
134         guint menu_lock_count;
135         guint cursor_count;
136
137         FolderView      *folderview;
138         SummaryView     *summaryview;
139         MessageView     *messageview;
140         LogWindow       *logwin;
141         LogWindow       *filtering_debugwin;
142
143         gint    progressindicator_hook;
144         
145         GtkWidget       *colorlabel_menu;
146         GtkWidget       *warning_btn;
147         GtkWidget       *tags_menu;
148         
149         gboolean         in_folder;
150         GtkActionGroup  *action_group;
151         GtkUIManager    *ui_manager;
152
153 #ifdef HAVE_LIBSM
154         gpointer smc_conn;
155 #endif
156 };
157
158 MainWindow *main_window_create          (void);
159
160 void main_window_update_actions_menu    (MainWindow     *mainwin);
161
162 void main_window_cursor_wait            (MainWindow     *mainwin);
163 void main_window_cursor_normal          (MainWindow     *mainwin);
164
165 void main_window_lock                   (MainWindow     *mainwin);
166 void main_window_unlock                 (MainWindow     *mainwin);
167
168 void main_window_reflect_prefs_all_real (gboolean        pixmap_theme_changed);
169 void main_window_reflect_prefs_all      (void);
170 void main_window_reflect_prefs_all_now  (void);
171 void main_window_reflect_prefs_custom_colors(MainWindow         *mainwindow);
172 void main_window_reflect_tags_changes(MainWindow        *mainwindow);
173 void main_window_set_summary_column     (void);
174 void main_window_set_folder_column      (void);
175 void main_window_set_account_menu       (GList          *account_list);
176 void main_window_set_account_menu_only_toolbar  (GList          *account_list);
177
178 /* Mailing list support */
179 void main_create_mailing_list_menu      (MainWindow *mainwin, MsgInfo *msginfo);
180 gint mailing_list_get_list_post_mailto  (gchar **url, gchar *mailto, gint maxlen);
181
182 void main_window_toggle_message_view    (MainWindow *mainwin);
183
184 void main_window_get_size               (MainWindow     *mainwin);
185 void main_window_get_position           (MainWindow     *mainwin);
186
187 void main_window_progress_on            (MainWindow     *mainwin);
188 void main_window_progress_off           (MainWindow     *mainwin);
189 gboolean main_window_empty_trash        (MainWindow     *mainwin,
190                                          gboolean        confirm,
191                                          gboolean        for_quit);
192
193 SensitiveCondMask main_window_get_mask(SensitiveCond cond, ...);
194
195 void main_window_set_menu_sensitive     (MainWindow     *mainwin);
196
197
198 void main_window_show                   (MainWindow     *mainwin);
199 void main_window_hide                   (MainWindow     *mainwin);
200 void main_window_popup                  (MainWindow     *mainwin);
201
202 SensitiveCondMask main_window_get_current_state   (MainWindow *mainwin);
203
204 void toolbar_set_compose_button               (Toolbar           *toolbar, 
205                                                ComposeButtonType  compose_btn_type);
206 void main_window_destroy_all                  (void);
207
208 void main_window_toggle_work_offline          (MainWindow        *mainwin, 
209                                                gboolean           offline,
210                                                gboolean           ask_sync);
211
212 MainWindow *mainwindow_get_mainwindow         (void);
213 void mainwindow_learn                         (MainWindow *mainwin,
214                                                gboolean is_spam);
215 void mainwindow_jump_to                       (const gchar       *target,
216                                                gboolean popup);
217 void mainwindow_show_error                    (void);
218 void mainwindow_clear_error                   (MainWindow *mainwin);
219 void mainwindow_delete_duplicated     (MainWindow *mainwin);
220 void mainwindow_delete_duplicated_all (MainWindow *mainwin);
221 gboolean mainwindow_is_obscured               (void);
222 void mainwindow_exit_folder                   (MainWindow *mainwin);
223 void mainwindow_enter_folder                  (MainWindow *mainwin);
224 void mainwindow_reset_paned                   (GtkPaned *paned);
225
226 void mainwin_accel_changed_cb (GtkAccelGroup *accelgroup, guint keyval, GdkModifierType modifier,
227                                   GClosure *closure, GtkMenuItem *item);
228
229 #endif /* __MAINWINDOW_H__ */