Bug 621213 – GDBusProxy and well-known names
[platform/upstream/glib.git] / gio / gapplication.h
1 /* GIO - GLib Input, Output and Streaming Library
2  *
3  * Copyright © 2010 Red Hat, Inc
4  *
5  * This program is free software: you can redistribute it and/or modify
6  * it under the terms of the GNU Lesser General Public License as published
7  * by the Free Software Foundation; either version 2 of the licence or (at
8  * your option) any later version.
9  *
10  * This library 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 GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General
16  * Public License along with this library; if not, write to the
17  * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
18  * Boston, MA 02111-1307, USA.
19  *
20  * Authors: Colin Walters <walters@verbum.org>
21  *          Emmanuele Bassi <ebassi@linux.intel.com>
22  */
23
24 #if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
25 #error "Only <gio/gio.h> can be included directly."
26 #endif
27
28 #ifndef __G_APPLICATION_H__
29 #define __G_APPLICATION_H__
30
31 #include <glib-object.h>
32 #include <gio/giotypes.h>
33
34 G_BEGIN_DECLS
35
36 #define G_TYPE_APPLICATION              (g_application_get_type ())
37 #define G_APPLICATION(obj)              (G_TYPE_CHECK_INSTANCE_CAST ((obj), G_TYPE_APPLICATION, GApplication))
38 #define G_APPLICATION_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST ((klass), G_TYPE_APPLICATION, GApplicationClass))
39 #define G_IS_APPLICATION(obj)           (G_TYPE_CHECK_INSTANCE_TYPE ((obj), G_TYPE_APPLICATION))
40 #define G_IS_APPLICATION_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), G_TYPE_APPLICATION))
41 #define G_APPLICATION_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS ((obj), G_TYPE_APPLICATION, GApplicationClass))
42
43 typedef struct _GApplication            GApplication;
44 typedef struct _GApplicationPrivate     GApplicationPrivate;
45 typedef struct _GApplicationClass       GApplicationClass;
46
47 /**
48  * GApplication:
49  *
50  * The <structname>GApplication</structname> structure contains private
51  * data and should only be accessed using the provided API
52  *
53  * Since: 2.26
54  */
55 struct _GApplication
56 {
57   /*< private >*/
58   GObject parent_instance;
59
60   GApplicationPrivate *priv;
61 };
62
63 /**
64  * GApplicationClass:
65  * @action: class handler for the #GApplication::action signal
66  * @quit: class handler for the #GApplication::quit signal
67  * @prepare_activation: class handler for the #GApplication::prepare-activation signal
68  * @run: virtual function, called by g_application_run()
69  * @format_activation_data: virtual function, called by g_application_format_activation_data()
70  *
71  * The <structname>GApplicationClass</structname> structure contains
72  * private data only
73  *
74  * Since: 2.26
75  */
76 struct _GApplicationClass
77 {
78   /*< private >*/
79   GObjectClass parent_class;
80
81   /*< public >*/
82   /* signals */
83   void        (* action) (GApplication *application,
84                           const gchar  *action_name,
85                           guint         timestamp);
86   gboolean    (* quit)   (GApplication *application,
87                           guint         timestamp);
88   void        (* prepare_activation)   (GApplication  *application,
89                                         GVariant      *arguments,
90                                         GVariant      *platform_data);
91
92   /* vfuncs */
93   void        (* run)    (GApplication *application);
94   void        (*format_activation_data) (GApplication    *application,
95                                          GVariantBuilder *builder);
96
97   /*< private >*/
98   /* Padding for future expansion */
99   void (*_g_reserved1) (void);
100   void (*_g_reserved2) (void);
101   void (*_g_reserved3) (void);
102   void (*_g_reserved4) (void);
103   void (*_g_reserved5) (void);
104   void (*_g_reserved6) (void);
105 };
106 GType                   g_application_get_type                  (void) G_GNUC_CONST;
107
108 GApplication *          g_application_new                       (const gchar              *appid);
109
110 void                    g_application_register_with_data        (GApplication      *application,
111                                                                  gint               argc,
112                                                                  gchar            **argv,
113                                                                  GVariant          *platform_data);
114
115 GApplication *          g_application_new_and_register           (const gchar      *appid,
116                                                                   gint              argc,
117                                                                   gchar           **argv);
118
119 GApplication *          g_application_get_instance              (void);
120 G_CONST_RETURN gchar *  g_application_get_id                    (GApplication      *application);
121
122 void                    g_application_add_action                (GApplication      *application,
123                                                                  const gchar       *name,
124                                                                  const gchar       *description);
125 void                    g_application_remove_action             (GApplication      *application,
126                                                                  const gchar       *name);
127 gchar **                g_application_list_actions              (GApplication      *application);
128 void                    g_application_set_action_enabled        (GApplication      *application,
129                                                                  const gchar       *name,
130                                                                  gboolean           enabled);
131 gboolean                g_application_get_action_enabled        (GApplication      *application,
132                                                                  const gchar       *name);
133 G_CONST_RETURN gchar *  g_application_get_action_description    (GApplication *application,
134                                                                  const gchar  *name);
135 void                    g_application_invoke_action             (GApplication      *application,
136                                                                  const gchar       *name,
137                                                                  guint              timestamp);
138
139 void                    g_application_run                       (GApplication      *application);
140 gboolean                g_application_quit                      (GApplication      *app,
141                                                                  guint              timestamp);
142
143 gboolean                g_application_is_remote                 (GApplication      *application);
144
145 void                    g_application_format_activation_data    (GApplication      *app,
146                                                                  GVariantBuilder   *builder);
147
148
149 G_END_DECLS
150
151 #endif /* __G_APPLICATION_H__ */