root/trunk/src/gio/UnixCredentialsMessage.d

Revision 938, 5.3 kB (checked in by Mike Wey, 3 months ago)

Update Gio to 2.28.

Line 
1 /*
2  * This file is part of gtkD.
3  *
4  * gtkD is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License
6  * as published by the Free Software Foundation; either version 3
7  * of the License, or (at your option) any later version, with
8  * some exceptions, please read the COPYING file.
9  *
10  * gtkD 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
13  * GNU Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with gtkD; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
18  */
19  
20 // generated automatically - do not change
21 // find conversion definition on APILookup.txt
22 // implement new conversion functionalities on the wrap.utils pakage
23
24 /*
25  * Conversion parameters:
26  * inFile  = GUnixCredentialsMessage.html
27  * outPack = gio
28  * outFile = UnixCredentialsMessage
29  * strct   = GUnixCredentialsMessage
30  * realStrct=
31  * ctorStrct=GSocketControlMessage
32  * clss    = UnixCredentialsMessage
33  * interf  =
34  * class Code: No
35  * interface Code: No
36  * template for:
37  * extend  =
38  * implements:
39  * prefixes:
40  *  - g_unix_credentials_message_
41  * omit structs:
42  * omit prefixes:
43  * omit code:
44  * omit signals:
45  * imports:
46  *  - gio.Credentials
47  * structWrap:
48  *  - GCredentials* -> Credentials
49  * module aliases:
50  * local aliases:
51  * overrides:
52  */
53
54 module gio.UnixCredentialsMessage;
55
56 public  import gtkc.giotypes;
57
58 private import gtkc.gio;
59 private import glib.ConstructionException;
60
61
62 private import gio.Credentials;
63
64
65
66 private import gio.SocketControlMessage;
67
68 /**
69  * Description
70  * This GSocketControlMessage contains a GCredentials instance. It
71  * may be sent using g_socket_send_message() and received using
72  * g_socket_receive_message() over UNIX sockets (ie: sockets in the
73  * G_SOCKET_FAMILY_UNIX family).
74  * For an easier way to send and receive credentials over
75  * stream-oriented UNIX sockets, see
76  * g_unix_connection_send_credentials() and
77  * g_unix_connection_receive_credentials(). To receive credentials of
78  * a foreign process connected to a socket, use
79  * g_socket_get_credentials().
80  */
81 public class UnixCredentialsMessage : SocketControlMessage
82 {
83    
84     /** the main Gtk struct */
85     protected GUnixCredentialsMessage* gUnixCredentialsMessage;
86    
87    
88     public GUnixCredentialsMessage* getUnixCredentialsMessageStruct()
89     {
90         return gUnixCredentialsMessage;
91     }
92    
93    
94     /** the main Gtk struct as a void* */
95     protected override void* getStruct()
96     {
97         return cast(void*)gUnixCredentialsMessage;
98     }
99    
100     /**
101      * Sets our main struct and passes it to the parent class
102      */
103     public this (GUnixCredentialsMessage* gUnixCredentialsMessage)
104     {
105         if(gUnixCredentialsMessage is null)
106         {
107             this = null;
108             return;
109         }
110         //Check if there already is a D object for this gtk struct
111         void* ptr = getDObject(cast(GObject*)gUnixCredentialsMessage);
112         if( ptr !is null )
113         {
114             this = cast(UnixCredentialsMessage)ptr;
115             return;
116         }
117         super(cast(GSocketControlMessage*)gUnixCredentialsMessage);
118         this.gUnixCredentialsMessage = gUnixCredentialsMessage;
119     }
120    
121     protected override void setStruct(GObject* obj)
122     {
123         super.setStruct(obj);
124         gUnixCredentialsMessage = cast(GUnixCredentialsMessage*)obj;
125     }
126    
127     /**
128      */
129    
130     /**
131      * Creates a new GUnixCredentialsMessage with credentials matching the current processes.
132      * Since 2.26
133      * Throws: ConstructionException GTK+ fails to create the object.
134      */
135     public this ()
136     {
137         // GSocketControlMessage * g_unix_credentials_message_new (void);
138         auto p = g_unix_credentials_message_new();
139         if(p is null)
140         {
141             throw new ConstructionException("null returned by g_unix_credentials_message_new()");
142         }
143         this(cast(GUnixCredentialsMessage*) p);
144     }
145    
146     /**
147      * Creates a new GUnixCredentialsMessage holding credentials.
148      * Since 2.26
149      * Params:
150      * credentials = A GCredentials object.
151      * Throws: ConstructionException GTK+ fails to create the object.
152      */
153     public this (Credentials credentials)
154     {
155         // GSocketControlMessage * g_unix_credentials_message_new_with_credentials  (GCredentials *credentials);
156         auto p = g_unix_credentials_message_new_with_credentials((credentials is null) ? null : credentials.getCredentialsStruct());
157         if(p is null)
158         {
159             throw new ConstructionException("null returned by g_unix_credentials_message_new_with_credentials((credentials is null) ? null : credentials.getCredentialsStruct())");
160         }
161         this(cast(GUnixCredentialsMessage*) p);
162     }
163    
164     /**
165      * Gets the credentials stored in message.
166      * Since 2.26
167      * Returns: A GCredentials instance. Do not free, it is owned by message. [transfer none]
168      */
169     public Credentials getCredentials()
170     {
171         // GCredentials * g_unix_credentials_message_get_credentials  (GUnixCredentialsMessage *message);
172         auto p = g_unix_credentials_message_get_credentials(gUnixCredentialsMessage);
173         if(p is null)
174         {
175             return null;
176         }
177         return new Credentials(cast(GCredentials*) p);
178     }
179    
180     /**
181      * Checks if passing a GCredential on a GSocket is supported on this platform.
182      * Since 2.26
183      * Returns: TRUE if supported, FALSE otherwise
184      */
185     public static int isSupported()
186     {
187         // gboolean g_unix_credentials_message_is_supported  (void);
188         return g_unix_credentials_message_is_supported();
189     }
190 }
Note: See TracBrowser for help on using the browser.