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

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

Initial release

File size: 4.1 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.UnixCredentialsMessage;
22
23private import gi.gio;
24public  import gi.giotypes;
25private import gio.Credentials;
26private import gio.SocketControlMessage;
27private import glib.ConstructionException;
28private import gobject.ObjectG;
29
30
31/**
32 * This #GSocketControlMessage contains a #GCredentials instance.  It
33 * may be sent using g_socket_send_message() and received using
34 * g_socket_receive_message() over UNIX sockets (ie: sockets in the
35 * %G_SOCKET_FAMILY_UNIX family).
36 *
37 * For an easier way to send and receive credentials over
38 * stream-oriented UNIX sockets, see
39 * g_unix_connection_send_credentials() and
40 * g_unix_connection_receive_credentials(). To receive credentials of
41 * a foreign process connected to a socket, use
42 * g_socket_get_credentials().
43 *
44 * Since: 2.26
45 */
46public class UnixCredentialsMessage : SocketControlMessage
47{
48        /** the main Gtk struct */
49        protected GUnixCredentialsMessage* gUnixCredentialsMessage;
50
51        /** Get the main Gtk struct */
52        public GUnixCredentialsMessage* getUnixCredentialsMessageStruct()
53        {
54                return gUnixCredentialsMessage;
55        }
56
57        /** the main Gtk struct as a void* */
58        protected override void* getStruct()
59        {
60                return cast(void*)gUnixCredentialsMessage;
61        }
62
63        protected override void setStruct(GObject* obj)
64        {
65                gUnixCredentialsMessage = cast(GUnixCredentialsMessage*)obj;
66                super.setStruct(obj);
67        }
68
69        /**
70         * Sets our main struct and passes it to the parent class.
71         */
72        public this (GUnixCredentialsMessage* gUnixCredentialsMessage, bool ownedRef = false)
73        {
74                this.gUnixCredentialsMessage = gUnixCredentialsMessage;
75                super(cast(GSocketControlMessage*)gUnixCredentialsMessage, ownedRef);
76        }
77
78
79        /** */
80        public static GType getType()
81        {
82                return g_unix_credentials_message_get_type();
83        }
84
85        /**
86         * Creates a new #GUnixCredentialsMessage with credentials matching the current processes.
87         *
88         * Returns: a new #GUnixCredentialsMessage
89         *
90         * Since: 2.26
91         *
92         * Throws: ConstructionException GTK+ fails to create the object.
93         */
94        public this()
95        {
96                auto p = g_unix_credentials_message_new();
97               
98                if(p is null)
99                {
100                        throw new ConstructionException("null returned by new");
101                }
102               
103                this(cast(GUnixCredentialsMessage*) p, true);
104        }
105
106        /**
107         * Creates a new #GUnixCredentialsMessage holding @credentials.
108         *
109         * Params:
110         *     credentials = A #GCredentials object.
111         *
112         * Returns: a new #GUnixCredentialsMessage
113         *
114         * Since: 2.26
115         *
116         * Throws: ConstructionException GTK+ fails to create the object.
117         */
118        public this(Credentials credentials)
119        {
120                auto p = g_unix_credentials_message_new_with_credentials((credentials is null) ? null : credentials.getCredentialsStruct());
121               
122                if(p is null)
123                {
124                        throw new ConstructionException("null returned by new_with_credentials");
125                }
126               
127                this(cast(GUnixCredentialsMessage*) p, true);
128        }
129
130        /**
131         * Checks if passing #GCredentials on a #GSocket is supported on this platform.
132         *
133         * Returns: %TRUE if supported, %FALSE otherwise
134         *
135         * Since: 2.26
136         */
137        public static bool isSupported()
138        {
139                return g_unix_credentials_message_is_supported() != 0;
140        }
141
142        /**
143         * Gets the credentials stored in @message.
144         *
145         * Returns: A #GCredentials instance. Do not free, it is owned by @message.
146         *
147         * Since: 2.26
148         */
149        public Credentials getCredentials()
150        {
151                auto p = g_unix_credentials_message_get_credentials(gUnixCredentialsMessage);
152               
153                if(p is null)
154                {
155                        return null;
156                }
157               
158                return ObjectG.getDObject!(Credentials)(cast(GCredentials*) p);
159        }
160}
Note: See TracBrowser for help on using the repository browser.