source: appstream-generator/build/girepo/gio/DBusMethodInvocation.d @ 4841

Last change on this file since 4841 was 4841, checked in by Juanma, 2 years ago

Initial release

File size: 10.6 KB
Line 
1/*
2 * Licensed under the GNU Lesser General Public License Version 3
3 *
4 * This library is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation, either version 3 of the license, or
7 * (at your option) any later version.
8 *
9 * This software 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
12 * GNU Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with this library.  If not, see <http://www.gnu.org/licenses/>.
16 */
17
18// generated automatically - do not change
19
20
21module gio.DBusMethodInvocation;
22
23private import gi.gio;
24public  import gi.giotypes;
25private import gio.DBusConnection;
26private import gio.DBusMessage;
27private import gio.DBusMethodInfo;
28private import gio.DBusPropertyInfo;
29private import gio.UnixFDList;
30private import glib.ErrorG;
31private import glib.Str;
32private import glib.Variant;
33private import gobject.ObjectG;
34
35
36/**
37 * Instances of the #GDBusMethodInvocation class are used when
38 * handling D-Bus method calls. It provides a way to asynchronously
39 * return results and errors.
40 *
41 * The normal way to obtain a #GDBusMethodInvocation object is to receive
42 * it as an argument to the handle_method_call() function in a
43 * #GDBusInterfaceVTable that was passed to g_dbus_connection_register_object().
44 *
45 * Since: 2.26
46 */
47public class DBusMethodInvocation : ObjectG
48{
49        /** the main Gtk struct */
50        protected GDBusMethodInvocation* gDBusMethodInvocation;
51
52        /** Get the main Gtk struct */
53        public GDBusMethodInvocation* getDBusMethodInvocationStruct()
54        {
55                return gDBusMethodInvocation;
56        }
57
58        /** the main Gtk struct as a void* */
59        protected override void* getStruct()
60        {
61                return cast(void*)gDBusMethodInvocation;
62        }
63
64        protected override void setStruct(GObject* obj)
65        {
66                gDBusMethodInvocation = cast(GDBusMethodInvocation*)obj;
67                super.setStruct(obj);
68        }
69
70        /**
71         * Sets our main struct and passes it to the parent class.
72         */
73        public this (GDBusMethodInvocation* gDBusMethodInvocation, bool ownedRef = false)
74        {
75                this.gDBusMethodInvocation = gDBusMethodInvocation;
76                super(cast(GObject*)gDBusMethodInvocation, ownedRef);
77        }
78
79
80        /** */
81        public static GType getType()
82        {
83                return g_dbus_method_invocation_get_type();
84        }
85
86        /**
87         * Gets the #GDBusConnection the method was invoked on.
88         *
89         * Returns: A #GDBusConnection. Do not free, it is owned by @invocation.
90         *
91         * Since: 2.26
92         */
93        public DBusConnection getConnection()
94        {
95                auto p = g_dbus_method_invocation_get_connection(gDBusMethodInvocation);
96               
97                if(p is null)
98                {
99                        return null;
100                }
101               
102                return ObjectG.getDObject!(DBusConnection)(cast(GDBusConnection*) p);
103        }
104
105        /**
106         * Gets the name of the D-Bus interface the method was invoked on.
107         *
108         * If this method call is a property Get, Set or GetAll call that has
109         * been redirected to the method call handler then
110         * "org.freedesktop.DBus.Properties" will be returned.  See
111         * #GDBusInterfaceVTable for more information.
112         *
113         * Returns: A string. Do not free, it is owned by @invocation.
114         *
115         * Since: 2.26
116         */
117        public string getInterfaceName()
118        {
119                return Str.toString(g_dbus_method_invocation_get_interface_name(gDBusMethodInvocation));
120        }
121
122        /**
123         * Gets the #GDBusMessage for the method invocation. This is useful if
124         * you need to use low-level protocol features, such as UNIX file
125         * descriptor passing, that cannot be properly expressed in the
126         * #GVariant API.
127         *
128         * See this [server][gdbus-server] and [client][gdbus-unix-fd-client]
129         * for an example of how to use this low-level API to send and receive
130         * UNIX file descriptors.
131         *
132         * Returns: #GDBusMessage. Do not free, it is owned by @invocation.
133         *
134         * Since: 2.26
135         */
136        public DBusMessage getMessage()
137        {
138                auto p = g_dbus_method_invocation_get_message(gDBusMethodInvocation);
139               
140                if(p is null)
141                {
142                        return null;
143                }
144               
145                return ObjectG.getDObject!(DBusMessage)(cast(GDBusMessage*) p);
146        }
147
148        /**
149         * Gets information about the method call, if any.
150         *
151         * If this method invocation is a property Get, Set or GetAll call that
152         * has been redirected to the method call handler then %NULL will be
153         * returned.  See g_dbus_method_invocation_get_property_info() and
154         * #GDBusInterfaceVTable for more information.
155         *
156         * Returns: A #GDBusMethodInfo or %NULL. Do not free, it is owned by @invocation.
157         *
158         * Since: 2.26
159         */
160        public DBusMethodInfo getMethodInfo()
161        {
162                auto p = g_dbus_method_invocation_get_method_info(gDBusMethodInvocation);
163               
164                if(p is null)
165                {
166                        return null;
167                }
168               
169                return ObjectG.getDObject!(DBusMethodInfo)(cast(GDBusMethodInfo*) p);
170        }
171
172        /**
173         * Gets the name of the method that was invoked.
174         *
175         * Returns: A string. Do not free, it is owned by @invocation.
176         *
177         * Since: 2.26
178         */
179        public string getMethodName()
180        {
181                return Str.toString(g_dbus_method_invocation_get_method_name(gDBusMethodInvocation));
182        }
183
184        /**
185         * Gets the object path the method was invoked on.
186         *
187         * Returns: A string. Do not free, it is owned by @invocation.
188         *
189         * Since: 2.26
190         */
191        public string getObjectPath()
192        {
193                return Str.toString(g_dbus_method_invocation_get_object_path(gDBusMethodInvocation));
194        }
195
196        /**
197         * Gets the parameters of the method invocation. If there are no input
198         * parameters then this will return a GVariant with 0 children rather than NULL.
199         *
200         * Returns: A #GVariant tuple. Do not unref this because it is owned by @invocation.
201         *
202         * Since: 2.26
203         */
204        public Variant getParameters()
205        {
206                auto p = g_dbus_method_invocation_get_parameters(gDBusMethodInvocation);
207               
208                if(p is null)
209                {
210                        return null;
211                }
212               
213                return new Variant(cast(GVariant*) p);
214        }
215
216        /**
217         * Gets information about the property that this method call is for, if
218         * any.
219         *
220         * This will only be set in the case of an invocation in response to a
221         * property Get or Set call that has been directed to the method call
222         * handler for an object on account of its property_get() or
223         * property_set() vtable pointers being unset.
224         *
225         * See #GDBusInterfaceVTable for more information.
226         *
227         * If the call was GetAll, %NULL will be returned.
228         *
229         * Returns: a #GDBusPropertyInfo or %NULL
230         *
231         * Since: 2.38
232         */
233        public DBusPropertyInfo getPropertyInfo()
234        {
235                auto p = g_dbus_method_invocation_get_property_info(gDBusMethodInvocation);
236               
237                if(p is null)
238                {
239                        return null;
240                }
241               
242                return ObjectG.getDObject!(DBusPropertyInfo)(cast(GDBusPropertyInfo*) p);
243        }
244
245        /**
246         * Gets the bus name that invoked the method.
247         *
248         * Returns: A string. Do not free, it is owned by @invocation.
249         *
250         * Since: 2.26
251         */
252        public string getSender()
253        {
254                return Str.toString(g_dbus_method_invocation_get_sender(gDBusMethodInvocation));
255        }
256
257        /**
258         * Gets the @user_data #gpointer passed to g_dbus_connection_register_object().
259         *
260         * Returns: A #gpointer.
261         *
262         * Since: 2.26
263         */
264        public void* getUserData()
265        {
266                return g_dbus_method_invocation_get_user_data(gDBusMethodInvocation);
267        }
268
269        /**
270         * Finishes handling a D-Bus method call by returning an error.
271         *
272         * This method will free @invocation, you cannot use it afterwards.
273         *
274         * Params:
275         *     errorName = A valid D-Bus error name.
276         *     errorMessage = A valid D-Bus error message.
277         *
278         * Since: 2.26
279         */
280        public void returnDbusError(string errorName, string errorMessage)
281        {
282                g_dbus_method_invocation_return_dbus_error(gDBusMethodInvocation, Str.toStringz(errorName), Str.toStringz(errorMessage));
283        }
284
285        /**
286         * Like g_dbus_method_invocation_return_error() but without printf()-style formatting.
287         *
288         * This method will free @invocation, you cannot use it afterwards.
289         *
290         * Params:
291         *     domain = A #GQuark for the #GError error domain.
292         *     code = The error code.
293         *     message = The error message.
294         *
295         * Since: 2.26
296         */
297        public void returnErrorLiteral(GQuark domain, int code, string message)
298        {
299                g_dbus_method_invocation_return_error_literal(gDBusMethodInvocation, domain, code, Str.toStringz(message));
300        }
301
302        /**
303         * Like g_dbus_method_invocation_return_error() but intended for
304         * language bindings.
305         *
306         * This method will free @invocation, you cannot use it afterwards.
307         *
308         * Params:
309         *     domain = A #GQuark for the #GError error domain.
310         *     code = The error code.
311         *     format = printf()-style format.
312         *     varArgs = #va_list of parameters for @format.
313         *
314         * Since: 2.26
315         */
316        public void returnErrorValist(GQuark domain, int code, string format, void* varArgs)
317        {
318                g_dbus_method_invocation_return_error_valist(gDBusMethodInvocation, domain, code, Str.toStringz(format), varArgs);
319        }
320
321        /**
322         * Like g_dbus_method_invocation_return_error() but takes a #GError
323         * instead of the error domain, error code and message.
324         *
325         * This method will free @invocation, you cannot use it afterwards.
326         *
327         * Params:
328         *     error = A #GError.
329         *
330         * Since: 2.26
331         */
332        public void returnGerror(ErrorG error)
333        {
334                g_dbus_method_invocation_return_gerror(gDBusMethodInvocation, (error is null) ? null : error.getErrorGStruct());
335        }
336
337        /**
338         * Finishes handling a D-Bus method call by returning @parameters.
339         * If the @parameters GVariant is floating, it is consumed.
340         *
341         * It is an error if @parameters is not of the right format.
342         *
343         * This method will free @invocation, you cannot use it afterwards.
344         *
345         * Params:
346         *     parameters = A #GVariant tuple with out parameters for the method or %NULL if not passing any parameters.
347         *
348         * Since: 2.26
349         */
350        public void returnValue(Variant parameters)
351        {
352                g_dbus_method_invocation_return_value(gDBusMethodInvocation, (parameters is null) ? null : parameters.getVariantStruct());
353        }
354
355        /**
356         * Like g_dbus_method_invocation_return_value() but also takes a #GUnixFDList.
357         *
358         * This method is only available on UNIX.
359         *
360         * This method will free @invocation, you cannot use it afterwards.
361         *
362         * Params:
363         *     parameters = A #GVariant tuple with out parameters for the method or %NULL if not passing any parameters.
364         *     fdList = A #GUnixFDList or %NULL.
365         *
366         * Since: 2.30
367         */
368        public void returnValueWithUnixFdList(Variant parameters, UnixFDList fdList)
369        {
370                g_dbus_method_invocation_return_value_with_unix_fd_list(gDBusMethodInvocation, (parameters is null) ? null : parameters.getVariantStruct(), (fdList is null) ? null : fdList.getUnixFDListStruct());
371        }
372
373        /**
374         * Like g_dbus_method_invocation_return_gerror() but takes ownership
375         * of @error so the caller does not need to free it.
376         *
377         * This method will free @invocation, you cannot use it afterwards.
378         *
379         * Params:
380         *     error = A #GError.
381         *
382         * Since: 2.30
383         */
384        public void takeError(ErrorG error)
385        {
386                g_dbus_method_invocation_take_error(gDBusMethodInvocation, (error is null) ? null : error.getErrorGStruct());
387        }
388}
Note: See TracBrowser for help on using the repository browser.