1 | /* |
2 | * Copyright © 2010 Codethink Limited |
3 | * |
4 | * This library is free software; you can redistribute it and/or |
5 | * modify it under the terms of the GNU Lesser General Public |
6 | * License as published by the Free Software Foundation; either |
7 | * version 2.1 of the License, or (at your option) any later version. |
8 | * |
9 | * This library is distributed in the hope that it will be useful, |
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
12 | * Lesser General Public License for more details. |
13 | * |
14 | * You should have received a copy of the GNU Lesser General |
15 | * Public License along with this library; if not, see <http://www.gnu.org/licenses/>. |
16 | * |
17 | * Authors: Ryan Lortie <[email protected]> |
18 | */ |
19 | |
20 | #ifndef __G_APPLICATION_H__ |
21 | #define __G_APPLICATION_H__ |
22 | |
23 | #if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION) |
24 | #error "Only <gio/gio.h> can be included directly." |
25 | #endif |
26 | |
27 | #include <gio/giotypes.h> |
28 | |
29 | G_BEGIN_DECLS |
30 | |
31 | #define G_TYPE_APPLICATION (g_application_get_type ()) |
32 | #define G_APPLICATION(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), \ |
33 | G_TYPE_APPLICATION, GApplication)) |
34 | #define G_APPLICATION_CLASS(class) (G_TYPE_CHECK_CLASS_CAST ((class), \ |
35 | G_TYPE_APPLICATION, GApplicationClass)) |
36 | #define G_IS_APPLICATION(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), G_TYPE_APPLICATION)) |
37 | #define G_IS_APPLICATION_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), G_TYPE_APPLICATION)) |
38 | #define G_APPLICATION_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), \ |
39 | G_TYPE_APPLICATION, GApplicationClass)) |
40 | |
41 | typedef struct _GApplicationPrivate GApplicationPrivate; |
42 | typedef struct _GApplicationClass GApplicationClass; |
43 | |
44 | struct _GApplication |
45 | { |
46 | /*< private >*/ |
47 | GObject parent_instance; |
48 | |
49 | GApplicationPrivate *priv; |
50 | }; |
51 | |
52 | struct _GApplicationClass |
53 | { |
54 | /*< private >*/ |
55 | GObjectClass parent_class; |
56 | |
57 | /*< public >*/ |
58 | /* signals */ |
59 | void (* startup) (GApplication *application); |
60 | |
61 | void (* activate) (GApplication *application); |
62 | |
63 | void (* open) (GApplication *application, |
64 | GFile **files, |
65 | gint n_files, |
66 | const gchar *hint); |
67 | |
68 | int (* command_line) (GApplication *application, |
69 | GApplicationCommandLine *command_line); |
70 | |
71 | /* vfuncs */ |
72 | |
73 | /** |
74 | * GApplicationClass::local_command_line: |
75 | * @application: a #GApplication |
76 | * @arguments: (inout) (array zero-terminated=1): array of command line arguments |
77 | * @exit_status: (out): exit status to fill after processing the command line. |
78 | * |
79 | * This virtual function is always invoked in the local instance. It |
80 | * gets passed a pointer to a %NULL-terminated copy of @argv and is |
81 | * expected to remove arguments that it handled (shifting up remaining |
82 | * arguments). |
83 | * |
84 | * The last argument to local_command_line() is a pointer to the @status |
85 | * variable which can used to set the exit status that is returned from |
86 | * g_application_run(). |
87 | * |
88 | * See g_application_run() for more details on #GApplication startup. |
89 | * |
90 | * Returns: %TRUE if the commandline has been completely handled |
91 | */ |
92 | gboolean (* local_command_line) (GApplication *application, |
93 | gchar ***arguments, |
94 | int *exit_status); |
95 | |
96 | void (* before_emit) (GApplication *application, |
97 | GVariant *platform_data); |
98 | void (* after_emit) (GApplication *application, |
99 | GVariant *platform_data); |
100 | void (* add_platform_data) (GApplication *application, |
101 | GVariantBuilder *builder); |
102 | void (* quit_mainloop) (GApplication *application); |
103 | void (* run_mainloop) (GApplication *application); |
104 | void (* shutdown) (GApplication *application); |
105 | |
106 | gboolean (* dbus_register) (GApplication *application, |
107 | GDBusConnection *connection, |
108 | const gchar *object_path, |
109 | GError **error); |
110 | void (* dbus_unregister) (GApplication *application, |
111 | GDBusConnection *connection, |
112 | const gchar *object_path); |
113 | gint (* handle_local_options)(GApplication *application, |
114 | GVariantDict *options); |
115 | gboolean (* name_lost) (GApplication *application); |
116 | |
117 | /*< private >*/ |
118 | gpointer padding[7]; |
119 | }; |
120 | |
121 | GLIB_AVAILABLE_IN_ALL |
122 | GType g_application_get_type (void) G_GNUC_CONST; |
123 | |
124 | GLIB_AVAILABLE_IN_ALL |
125 | gboolean g_application_id_is_valid (const gchar *application_id); |
126 | |
127 | GLIB_AVAILABLE_IN_ALL |
128 | GApplication * g_application_new (const gchar *application_id, |
129 | GApplicationFlags flags); |
130 | |
131 | GLIB_AVAILABLE_IN_ALL |
132 | const gchar * g_application_get_application_id (GApplication *application); |
133 | GLIB_AVAILABLE_IN_ALL |
134 | void g_application_set_application_id (GApplication *application, |
135 | const gchar *application_id); |
136 | |
137 | GLIB_AVAILABLE_IN_2_34 |
138 | GDBusConnection * g_application_get_dbus_connection (GApplication *application); |
139 | GLIB_AVAILABLE_IN_2_34 |
140 | const gchar * g_application_get_dbus_object_path (GApplication *application); |
141 | |
142 | GLIB_AVAILABLE_IN_ALL |
143 | guint g_application_get_inactivity_timeout (GApplication *application); |
144 | GLIB_AVAILABLE_IN_ALL |
145 | void g_application_set_inactivity_timeout (GApplication *application, |
146 | guint inactivity_timeout); |
147 | |
148 | GLIB_AVAILABLE_IN_ALL |
149 | GApplicationFlags g_application_get_flags (GApplication *application); |
150 | GLIB_AVAILABLE_IN_ALL |
151 | void g_application_set_flags (GApplication *application, |
152 | GApplicationFlags flags); |
153 | |
154 | GLIB_AVAILABLE_IN_2_42 |
155 | const gchar * g_application_get_resource_base_path (GApplication *application); |
156 | GLIB_AVAILABLE_IN_2_42 |
157 | void g_application_set_resource_base_path (GApplication *application, |
158 | const gchar *resource_path); |
159 | |
160 | GLIB_DEPRECATED |
161 | void g_application_set_action_group (GApplication *application, |
162 | GActionGroup *action_group); |
163 | |
164 | GLIB_AVAILABLE_IN_2_40 |
165 | void g_application_add_main_option_entries (GApplication *application, |
166 | const GOptionEntry *entries); |
167 | |
168 | GLIB_AVAILABLE_IN_2_42 |
169 | void g_application_add_main_option (GApplication *application, |
170 | const char *long_name, |
171 | char short_name, |
172 | GOptionFlags flags, |
173 | GOptionArg arg, |
174 | const char *description, |
175 | const char *arg_description); |
176 | GLIB_AVAILABLE_IN_2_40 |
177 | void g_application_add_option_group (GApplication *application, |
178 | GOptionGroup *group); |
179 | GLIB_AVAILABLE_IN_2_56 |
180 | void g_application_set_option_context_parameter_string (GApplication *application, |
181 | const gchar *parameter_string); |
182 | GLIB_AVAILABLE_IN_2_56 |
183 | void g_application_set_option_context_summary (GApplication *application, |
184 | const gchar *summary); |
185 | GLIB_AVAILABLE_IN_2_56 |
186 | void g_application_set_option_context_description (GApplication *application, |
187 | const gchar *description); |
188 | GLIB_AVAILABLE_IN_ALL |
189 | gboolean g_application_get_is_registered (GApplication *application); |
190 | GLIB_AVAILABLE_IN_ALL |
191 | gboolean g_application_get_is_remote (GApplication *application); |
192 | |
193 | GLIB_AVAILABLE_IN_ALL |
194 | gboolean g_application_register (GApplication *application, |
195 | GCancellable *cancellable, |
196 | GError **error); |
197 | |
198 | GLIB_AVAILABLE_IN_ALL |
199 | void g_application_hold (GApplication *application); |
200 | GLIB_AVAILABLE_IN_ALL |
201 | void g_application_release (GApplication *application); |
202 | |
203 | GLIB_AVAILABLE_IN_ALL |
204 | void g_application_activate (GApplication *application); |
205 | |
206 | GLIB_AVAILABLE_IN_ALL |
207 | void g_application_open (GApplication *application, |
208 | GFile **files, |
209 | gint n_files, |
210 | const gchar *hint); |
211 | |
212 | GLIB_AVAILABLE_IN_ALL |
213 | int g_application_run (GApplication *application, |
214 | int argc, |
215 | char **argv); |
216 | |
217 | GLIB_AVAILABLE_IN_2_32 |
218 | void g_application_quit (GApplication *application); |
219 | |
220 | GLIB_AVAILABLE_IN_2_32 |
221 | GApplication * g_application_get_default (void); |
222 | GLIB_AVAILABLE_IN_2_32 |
223 | void g_application_set_default (GApplication *application); |
224 | |
225 | GLIB_AVAILABLE_IN_2_38 |
226 | void g_application_mark_busy (GApplication *application); |
227 | GLIB_AVAILABLE_IN_2_38 |
228 | void g_application_unmark_busy (GApplication *application); |
229 | GLIB_AVAILABLE_IN_2_44 |
230 | gboolean g_application_get_is_busy (GApplication *application); |
231 | |
232 | GLIB_AVAILABLE_IN_2_40 |
233 | void g_application_send_notification (GApplication *application, |
234 | const gchar *id, |
235 | GNotification *notification); |
236 | GLIB_AVAILABLE_IN_2_40 |
237 | void g_application_withdraw_notification (GApplication *application, |
238 | const gchar *id); |
239 | |
240 | GLIB_AVAILABLE_IN_2_44 |
241 | void g_application_bind_busy_property (GApplication *application, |
242 | gpointer object, |
243 | const gchar *property); |
244 | |
245 | GLIB_AVAILABLE_IN_2_44 |
246 | void g_application_unbind_busy_property (GApplication *application, |
247 | gpointer object, |
248 | const gchar *property); |
249 | |
250 | G_END_DECLS |
251 | |
252 | #endif /* __G_APPLICATION_H__ */ |
253 | |