xdgmime: plug a small leak
[platform/upstream/glib.git] / gio / gapplication.h
1 /*
2  * Copyright © 2010 Codethink Limited
3  *
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.
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, write to the
16  * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
17  * Boston, MA 02111-1307, USA.
18  *
19  * Authors: Ryan Lortie <desrt@desrt.ca>
20  */
21
22 #if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
23 #error "Only <gio/gio.h> can be included directly."
24 #endif
25
26 #ifndef __G_APPLICATION_H__
27 #define __G_APPLICATION_H__
28
29 #include <gio/giotypes.h>
30
31 G_BEGIN_DECLS
32
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))
42
43 typedef struct _GApplicationPrivate                         GApplicationPrivate;
44 typedef struct _GApplicationClass                           GApplicationClass;
45
46 /**
47  * GApplication:
48  *
49  * Since: 2.28
50  */
51 struct _GApplication
52 {
53   /*< private >*/
54   GObject parent_instance;
55
56   GApplicationPrivate *priv;
57 };
58
59 struct _GApplicationClass
60 {
61   /*< private >*/
62   GObjectClass parent_class;
63
64   /*< public >*/
65   /* signals */
66   void                      (* startup)             (GApplication              *application);
67
68   void                      (* activate)            (GApplication              *application);
69
70   void                      (* open)                (GApplication              *application,
71                                                      GFile                    **files,
72                                                      gint                       n_files,
73                                                      const gchar               *hint);
74
75   int                       (* command_line)        (GApplication              *application,
76                                                      GApplicationCommandLine   *command_line);
77
78   /* vfuncs */
79   gboolean                  (* local_command_line)  (GApplication              *application,
80                                                      gchar                   ***arguments,
81                                                      int                       *exit_status);
82
83   void                      (* before_emit)         (GApplication              *application,
84                                                      GVariant                  *platform_data);
85   void                      (* after_emit)          (GApplication              *application,
86                                                      GVariant                  *platform_data);
87   void                      (* add_platform_data)   (GApplication              *application,
88                                                      GVariantBuilder           *builder);
89   void                      (* quit_mainloop)       (GApplication              *application);
90   void                      (* run_mainloop)        (GApplication              *application);
91   void                      (* shutdown)            (GApplication              *application);
92
93   gboolean                  (* dbus_register)       (GApplication              *application,
94                                                      GDBusConnection           *connection,
95                                                      const gchar               *object_path,
96                                                      GError                   **error);
97   void                      (* dbus_unregister)     (GApplication              *application,
98                                                      GDBusConnection           *connection,
99                                                      const gchar               *object_path);
100
101   /*< private >*/
102   gpointer padding[9];
103 };
104
105 GType                   g_application_get_type                          (void) G_GNUC_CONST;
106
107 gboolean                g_application_id_is_valid                       (const gchar              *application_id);
108
109 GApplication *          g_application_new                               (const gchar              *application_id,
110                                                                          GApplicationFlags         flags);
111
112 const gchar *           g_application_get_application_id                (GApplication             *application);
113 void                    g_application_set_application_id                (GApplication             *application,
114                                                                          const gchar              *application_id);
115
116 GLIB_AVAILABLE_IN_2_34
117 GDBusConnection *       g_application_get_dbus_connection               (GApplication             *application);
118 GLIB_AVAILABLE_IN_2_34
119 const gchar *           g_application_get_dbus_object_path              (GApplication             *application);
120
121 guint                   g_application_get_inactivity_timeout            (GApplication             *application);
122 void                    g_application_set_inactivity_timeout            (GApplication             *application,
123                                                                          guint                     inactivity_timeout);
124
125 GApplicationFlags       g_application_get_flags                         (GApplication             *application);
126 void                    g_application_set_flags                         (GApplication             *application,
127                                                                          GApplicationFlags         flags);
128
129 GLIB_DEPRECATED
130 void                    g_application_set_action_group                  (GApplication             *application,
131                                                                          GActionGroup             *action_group);
132
133 gboolean                g_application_get_is_registered                 (GApplication             *application);
134 gboolean                g_application_get_is_remote                     (GApplication             *application);
135
136 gboolean                g_application_register                          (GApplication             *application,
137                                                                          GCancellable             *cancellable,
138                                                                          GError                  **error);
139
140 void                    g_application_hold                              (GApplication             *application);
141 void                    g_application_release                           (GApplication             *application);
142
143 void                    g_application_activate                          (GApplication             *application);
144
145 void                    g_application_open                              (GApplication             *application,
146                                                                          GFile                   **files,
147                                                                          gint                      n_files,
148                                                                          const gchar              *hint);
149
150 int                     g_application_run                               (GApplication             *application,
151                                                                          int                       argc,
152                                                                          char                    **argv);
153
154 void                    g_application_quit                              (GApplication             *application);
155
156 GLIB_AVAILABLE_IN_2_32
157 GApplication *          g_application_get_default                       (void);
158 GLIB_AVAILABLE_IN_2_32
159 void                    g_application_set_default                       (GApplication             *application);
160
161 G_END_DECLS
162
163 #endif /* __G_APPLICATION_H__ */