2 * Copyright © 2010 Codethink Limited
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published
6 * by the Free Software Foundation; either version 2 of the licence or (at
7 * your option) any later version.
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.
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/>.
17 * Authors: Ryan Lortie <desrt@desrt.ca>
20 #ifndef __G_APPLICATION_H__
21 #define __G_APPLICATION_H__
23 #if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
24 #error "Only <gio/gio.h> can be included directly."
27 #include <gio/giotypes.h>
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))
41 typedef struct _GApplicationPrivate GApplicationPrivate
;
42 typedef struct _GApplicationClass GApplicationClass
;
47 GObject parent_instance
;
49 GApplicationPrivate
*priv
;
52 struct _GApplicationClass
55 GObjectClass parent_class
;
59 void (* startup
) (GApplication
*application
);
61 void (* activate
) (GApplication
*application
);
63 void (* open
) (GApplication
*application
,
68 int (* command_line
) (GApplication
*application
,
69 GApplicationCommandLine
*command_line
);
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.
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
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().
88 * See g_application_run() for more details on #GApplication startup.
90 * Returns: %TRUE if the commandline has been completely handled
92 gboolean (* local_command_line
) (GApplication
*application
,
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
);
106 gboolean (* dbus_register
) (GApplication
*application
,
107 GDBusConnection
*connection
,
108 const gchar
*object_path
,
110 void (* dbus_unregister
) (GApplication
*application
,
111 GDBusConnection
*connection
,
112 const gchar
*object_path
);
113 gint (* handle_local_options
)(GApplication
*application
,
114 GVariantDict
*options
);
120 GLIB_AVAILABLE_IN_ALL
121 GType
g_application_get_type (void) G_GNUC_CONST
;
123 GLIB_AVAILABLE_IN_ALL
124 gboolean
g_application_id_is_valid (const gchar
*application_id
);
126 GLIB_AVAILABLE_IN_ALL
127 GApplication
* g_application_new (const gchar
*application_id
,
128 GApplicationFlags flags
);
130 GLIB_AVAILABLE_IN_ALL
131 const gchar
* g_application_get_application_id (GApplication
*application
);
132 GLIB_AVAILABLE_IN_ALL
133 void g_application_set_application_id (GApplication
*application
,
134 const gchar
*application_id
);
136 GLIB_AVAILABLE_IN_2_34
137 GDBusConnection
* g_application_get_dbus_connection (GApplication
*application
);
138 GLIB_AVAILABLE_IN_2_34
139 const gchar
* g_application_get_dbus_object_path (GApplication
*application
);
141 GLIB_AVAILABLE_IN_ALL
142 guint
g_application_get_inactivity_timeout (GApplication
*application
);
143 GLIB_AVAILABLE_IN_ALL
144 void g_application_set_inactivity_timeout (GApplication
*application
,
145 guint inactivity_timeout
);
147 GLIB_AVAILABLE_IN_ALL
148 GApplicationFlags
g_application_get_flags (GApplication
*application
);
149 GLIB_AVAILABLE_IN_ALL
150 void g_application_set_flags (GApplication
*application
,
151 GApplicationFlags flags
);
153 GLIB_AVAILABLE_IN_2_42
154 const gchar
* g_application_get_resource_base_path (GApplication
*application
);
155 GLIB_AVAILABLE_IN_2_42
156 void g_application_set_resource_base_path (GApplication
*application
,
157 const gchar
*resource_path
);
160 void g_application_set_action_group (GApplication
*application
,
161 GActionGroup
*action_group
);
163 GLIB_AVAILABLE_IN_2_40
164 void g_application_add_main_option_entries (GApplication
*application
,
165 const GOptionEntry
*entries
);
167 GLIB_AVAILABLE_IN_2_42
168 void g_application_add_main_option (GApplication
*application
,
169 const char *long_name
,
173 const char *description
,
174 const char *arg_description
);
175 GLIB_AVAILABLE_IN_2_40
176 void g_application_add_option_group (GApplication
*application
,
177 GOptionGroup
*group
);
179 GLIB_AVAILABLE_IN_ALL
180 gboolean
g_application_get_is_registered (GApplication
*application
);
181 GLIB_AVAILABLE_IN_ALL
182 gboolean
g_application_get_is_remote (GApplication
*application
);
184 GLIB_AVAILABLE_IN_ALL
185 gboolean
g_application_register (GApplication
*application
,
186 GCancellable
*cancellable
,
189 GLIB_AVAILABLE_IN_ALL
190 void g_application_hold (GApplication
*application
);
191 GLIB_AVAILABLE_IN_ALL
192 void g_application_release (GApplication
*application
);
194 GLIB_AVAILABLE_IN_ALL
195 void g_application_activate (GApplication
*application
);
197 GLIB_AVAILABLE_IN_ALL
198 void g_application_open (GApplication
*application
,
203 GLIB_AVAILABLE_IN_ALL
204 int g_application_run (GApplication
*application
,
208 GLIB_AVAILABLE_IN_2_32
209 void g_application_quit (GApplication
*application
);
211 GLIB_AVAILABLE_IN_2_32
212 GApplication
* g_application_get_default (void);
213 GLIB_AVAILABLE_IN_2_32
214 void g_application_set_default (GApplication
*application
);
216 GLIB_AVAILABLE_IN_2_38
217 void g_application_mark_busy (GApplication
*application
);
218 GLIB_AVAILABLE_IN_2_38
219 void g_application_unmark_busy (GApplication
*application
);
220 GLIB_AVAILABLE_IN_2_44
221 gboolean
g_application_get_is_busy (GApplication
*application
);
223 GLIB_AVAILABLE_IN_2_40
224 void g_application_send_notification (GApplication
*application
,
226 GNotification
*notification
);
227 GLIB_AVAILABLE_IN_2_40
228 void g_application_withdraw_notification (GApplication
*application
,
231 GLIB_AVAILABLE_IN_2_44
232 void g_application_bind_busy_property (GApplication
*application
,
234 const gchar
*property
);
236 GLIB_AVAILABLE_IN_2_44
237 void g_application_unbind_busy_property (GApplication
*application
,
239 const gchar
*property
);
243 #endif /* __G_APPLICATION_H__ */