1 /*
2  * e-shell.h
3  *
4  * This program is free software; you can redistribute it and/or modify it
5  * under the terms of the GNU Lesser General Public License as published by
6  * the Free Software Foundation.
7  *
8  * This program is distributed in the hope that it will be useful, but
9  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
10  * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
11  * for more details.
12  *
13  * You should have received a copy of the GNU Lesser General Public License
14  * along with this program; if not, see <http://www.gnu.org/licenses/>.
15  *
16  *
17  * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
18  *
19  */
20 
21 #ifndef E_SHELL_H
22 #define E_SHELL_H
23 
24 #include <libedataserver/libedataserver.h>
25 #include <libedataserverui/libedataserverui.h>
26 
27 #include <e-util/e-util.h>
28 
29 #include <shell/e-shell-common.h>
30 #include <shell/e-shell-backend.h>
31 
32 /* Standard GObject macros */
33 #define E_TYPE_SHELL \
34 	(e_shell_get_type ())
35 #define E_SHELL(obj) \
36 	(G_TYPE_CHECK_INSTANCE_CAST \
37 	((obj), E_TYPE_SHELL, EShell))
38 #define E_SHELL_CLASS(cls) \
39 	(G_TYPE_CHECK_CLASS_CAST \
40 	((cls), E_TYPE_SHELL, EShellClass))
41 #define E_IS_SHELL(obj) \
42 	(G_TYPE_CHECK_INSTANCE_TYPE \
43 	((obj), E_TYPE_SHELL))
44 #define E_IS_SHELL_CLASS(cls) \
45 	(G_TYPE_CHECK_CLASS_TYPE \
46 	((cls), E_TYPE_SHELL))
47 #define E_SHELL_GET_CLASS(obj) \
48 	(G_TYPE_INSTANCE_GET_CLASS \
49 	((obj), E_TYPE_SHELL, EShellClass))
50 
51 G_BEGIN_DECLS
52 
53 typedef struct _EShell EShell;
54 typedef struct _EShellClass EShellClass;
55 typedef struct _EShellPrivate EShellPrivate;
56 
57 /**
58  * EShellQuitReason:
59  * @E_SHELL_QUIT_ACTION:
60  *   @E_SHELL_WINDOW_ACTION_QUIT was activated.
61  * @E_SHELL_QUIT_LAST_WINDOW:
62  *   The last watched window has been destroyed.
63  * @E_SHELL_QUIT_OPTION:
64  *   The program was invoked with --quit.  Extensions will never
65  *   see this value because they are not loaded when --quit is given.
66  * @E_SHELL_QUIT_REMOTE_REQUEST:
67  *   Another Evolution process requested we quit.
68  * @E_SHELL_QUIT_SESSION_REQUEST:
69  *   The desktop session requested we quit.
70  *
71  * These values are passed in the #EShell::quit-requested signal to
72  * indicate why the shell is requesting to shut down.
73  **/
74 typedef enum {
75 	E_SHELL_QUIT_ACTION,
76 	E_SHELL_QUIT_LAST_WINDOW,
77 	E_SHELL_QUIT_OPTION,
78 	E_SHELL_QUIT_REMOTE_REQUEST,
79 	E_SHELL_QUIT_SESSION_REQUEST
80 } EShellQuitReason;
81 
82 /**
83  * EShell:
84  *
85  * Contains only private data that should be read and manipulated using the
86  * functions below.
87  **/
88 struct _EShell {
89 	GtkApplication parent;
90 	EShellPrivate *priv;
91 };
92 
93 struct _EShellClass {
94 	GtkApplicationClass parent_class;
95 
96 	gboolean	(*handle_uri)		(EShell *shell,
97 						 const gchar *uri);
98 	void		(*prepare_for_offline)	(EShell *shell,
99 						 EActivity *activity);
100 	void		(*prepare_for_online)	(EShell *shell,
101 						 EActivity *activity);
102 	void		(*prepare_for_quit)	(EShell *shell,
103 						 EActivity *activity);
104 	void		(*quit_requested)	(EShell *shell,
105 						 EShellQuitReason reason);
106 };
107 
108 GType		e_shell_get_type		(void);
109 EShell *	e_shell_get_default		(void);
110 void		e_shell_load_modules		(EShell *shell);
111 GList *		e_shell_get_shell_backends	(EShell *shell);
112 const gchar *	e_shell_get_canonical_name	(EShell *shell,
113 						 const gchar *name);
114 EShellBackend *	e_shell_get_backend_by_name	(EShell *shell,
115 						 const gchar *name);
116 EShellBackend *	e_shell_get_backend_by_scheme	(EShell *shell,
117 						 const gchar *scheme);
118 EClientCache *	e_shell_get_client_cache	(EShell *shell);
119 ESourceRegistry *
120 		e_shell_get_registry		(EShell *shell);
121 ECredentialsPrompter *
122 		e_shell_get_credentials_prompter(EShell *shell);
123 void		e_shell_allow_auth_prompt_for	(EShell *shell,
124 						 ESource *source);
125 GtkWidget *	e_shell_create_shell_window	(EShell *shell,
126 						 const gchar *view_name);
127 guint		e_shell_handle_uris		(EShell *shell,
128 						 const gchar * const *uris,
129 						 gboolean do_import);
130 void		e_shell_submit_alert		(EShell *shell,
131 						 EAlert *alert);
132 GtkWindow *     e_shell_get_active_window	(EShell *shell);
133 gboolean	e_shell_get_express_mode	(EShell *shell);
134 const gchar *	e_shell_get_module_directory	(EShell *shell);
135 gboolean	e_shell_get_network_available	(EShell *shell);
136 void		e_shell_set_network_available	(EShell *shell,
137 						 gboolean network_available);
138 void		e_shell_lock_network_available	(EShell *shell);
139 gboolean	e_shell_get_online		(EShell *shell);
140 void		e_shell_set_online		(EShell *shell,
141 						 gboolean online);
142 GtkWidget *	e_shell_get_preferences_window	(EShell *shell);
143 void		e_shell_event			(EShell *shell,
144 						 const gchar *event_name,
145 						 gpointer event_data);
146 gboolean	e_shell_quit			(EShell *shell,
147 						 EShellQuitReason reason);
148 void		e_shell_cancel_quit		(EShell *shell);
149 gboolean	e_shell_requires_shutdown	(EShell *shell);
150 void		e_shell_set_auth_prompt_parent	(EShell *shell,
151 						 ESource *source,
152 						 GtkWindow *parent);
153 
154 G_END_DECLS
155 
156 #endif /* E_SHELL_H */
157