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, write to the
16 * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
17 * Boston, MA 02111-1307, USA.
19 * Authors: Ryan Lortie <desrt@desrt.ca>
22 #ifndef __G_APPLICATION_H__
23 #define __G_APPLICATION_H__
25 #if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
26 #error "Only <gio/gio.h> can be included directly."
29 #include <gio/giotypes.h>
33 #define G_TYPE_APPLICATION (g_application_get_type ())
34 #define G_APPLICATION(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), \
35 G_TYPE_APPLICATION, GApplication))
36 #define G_APPLICATION_CLASS(class) (G_TYPE_CHECK_CLASS_CAST ((class), \
37 G_TYPE_APPLICATION, GApplicationClass))
38 #define G_IS_APPLICATION(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), G_TYPE_APPLICATION))
39 #define G_IS_APPLICATION_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), G_TYPE_APPLICATION))
40 #define G_APPLICATION_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), \
41 G_TYPE_APPLICATION, GApplicationClass))
43 typedef struct _GApplicationPrivate GApplicationPrivate
;
44 typedef struct _GApplicationClass GApplicationClass
;
54 GObject parent_instance
;
56 GApplicationPrivate
*priv
;
59 struct _GApplicationClass
62 GObjectClass parent_class
;
66 void (* startup
) (GApplication
*application
);
68 void (* activate
) (GApplication
*application
);
70 void (* open
) (GApplication
*application
,
75 int (* command_line
) (GApplication
*application
,
76 GApplicationCommandLine
*command_line
);
81 * GApplicationClass::local_command_line:
82 * @application: a #GApplication
83 * @arguments: (inout) (array zero-terminated=1): array of command line arguments
84 * @exit_status: (out): exit status to fill after processing the command line.
86 * This virtual function is always invoked in the local instance. It
87 * gets passed a pointer to a %NULL-terminated copy of @argv and is
88 * expected to remove arguments that it handled (shifting up remaining
91 * The last argument to local_command_line() is a pointer to the @status
92 * variable which can used to set the exit status that is returned from
93 * g_application_run().
95 * See g_application_run() for more details on #GApplication startup.
97 * Returns: %TRUE if the commandline has been completely handled
99 gboolean (* local_command_line
) (GApplication
*application
,
103 void (* before_emit
) (GApplication
*application
,
104 GVariant
*platform_data
);
105 void (* after_emit
) (GApplication
*application
,
106 GVariant
*platform_data
);
107 void (* add_platform_data
) (GApplication
*application
,
108 GVariantBuilder
*builder
);
109 void (* quit_mainloop
) (GApplication
*application
);
110 void (* run_mainloop
) (GApplication
*application
);
111 void (* shutdown
) (GApplication
*application
);
113 gboolean (* dbus_register
) (GApplication
*application
,
114 GDBusConnection
*connection
,
115 const gchar
*object_path
,
117 void (* dbus_unregister
) (GApplication
*application
,
118 GDBusConnection
*connection
,
119 const gchar
*object_path
);
125 GLIB_AVAILABLE_IN_ALL
126 GType
g_application_get_type (void) G_GNUC_CONST
;
128 GLIB_AVAILABLE_IN_ALL
129 gboolean
g_application_id_is_valid (const gchar
*application_id
);
131 GLIB_AVAILABLE_IN_ALL
132 GApplication
* g_application_new (const gchar
*application_id
,
133 GApplicationFlags flags
);
135 GLIB_AVAILABLE_IN_ALL
136 const gchar
* g_application_get_application_id (GApplication
*application
);
137 GLIB_AVAILABLE_IN_ALL
138 void g_application_set_application_id (GApplication
*application
,
139 const gchar
*application_id
);
141 GLIB_AVAILABLE_IN_2_34
142 GDBusConnection
* g_application_get_dbus_connection (GApplication
*application
);
143 GLIB_AVAILABLE_IN_2_34
144 const gchar
* g_application_get_dbus_object_path (GApplication
*application
);
146 GLIB_AVAILABLE_IN_ALL
147 guint
g_application_get_inactivity_timeout (GApplication
*application
);
148 GLIB_AVAILABLE_IN_ALL
149 void g_application_set_inactivity_timeout (GApplication
*application
,
150 guint inactivity_timeout
);
152 GLIB_AVAILABLE_IN_ALL
153 GApplicationFlags
g_application_get_flags (GApplication
*application
);
154 GLIB_AVAILABLE_IN_ALL
155 void g_application_set_flags (GApplication
*application
,
156 GApplicationFlags flags
);
159 void g_application_set_action_group (GApplication
*application
,
160 GActionGroup
*action_group
);
162 GLIB_AVAILABLE_IN_ALL
163 gboolean
g_application_get_is_registered (GApplication
*application
);
164 GLIB_AVAILABLE_IN_ALL
165 gboolean
g_application_get_is_remote (GApplication
*application
);
167 GLIB_AVAILABLE_IN_ALL
168 gboolean
g_application_register (GApplication
*application
,
169 GCancellable
*cancellable
,
172 GLIB_AVAILABLE_IN_ALL
173 void g_application_hold (GApplication
*application
);
174 GLIB_AVAILABLE_IN_ALL
175 void g_application_release (GApplication
*application
);
177 GLIB_AVAILABLE_IN_ALL
178 void g_application_activate (GApplication
*application
);
180 GLIB_AVAILABLE_IN_ALL
181 void g_application_open (GApplication
*application
,
186 GLIB_AVAILABLE_IN_ALL
187 int g_application_run (GApplication
*application
,
191 GLIB_AVAILABLE_IN_2_32
192 void g_application_quit (GApplication
*application
);
194 GLIB_AVAILABLE_IN_2_32
195 GApplication
* g_application_get_default (void);
196 GLIB_AVAILABLE_IN_2_32
197 void g_application_set_default (GApplication
*application
);
199 GLIB_AVAILABLE_IN_2_38
200 void g_application_mark_busy (GApplication
*application
);
201 GLIB_AVAILABLE_IN_2_38
202 void g_application_unmark_busy (GApplication
*application
);
204 GLIB_AVAILABLE_IN_2_40
205 void g_application_send_notification (GApplication
*application
,
207 GNotification
*notification
);
208 GLIB_AVAILABLE_IN_2_40
209 void g_application_withdraw_notification (GApplication
*application
,
214 #endif /* __G_APPLICATION_H__ */