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  = GTlsPassword.html
27  * outPack = gio
28  * outFile = TlsPassword
29  * strct   = GTlsPassword
30  * realStrct=
31  * ctorStrct=
32  * clss    = TlsPassword
33  * interf  = 
34  * class Code: No
35  * interface Code: No
36  * template for:
37  * extend  = 
38  * implements:
39  * prefixes:
40  * 	- g_tls_password_
41  * omit structs:
42  * omit prefixes:
43  * omit code:
44  * omit signals:
45  * imports:
46  * 	- glib.Str
47  * structWrap:
48  * module aliases:
49  * local aliases:
50  * overrides:
51  */
52 
53 module gio.TlsPassword;
54 
55 public  import gtkc.giotypes;
56 
57 private import gtkc.gio;
58 private import glib.ConstructionException;
59 private import gobject.ObjectG;
60 
61 
62 private import glib.Str;
63 
64 
65 
66 private import gobject.ObjectG;
67 
68 /**
69  * Holds a password used in TLS.
70  */
71 public class TlsPassword : ObjectG
72 {
73 	
74 	/** the main Gtk struct */
75 	protected GTlsPassword* gTlsPassword;
76 	
77 	
78 	public GTlsPassword* getTlsPasswordStruct()
79 	{
80 		return gTlsPassword;
81 	}
82 	
83 	
84 	/** the main Gtk struct as a void* */
85 	protected override void* getStruct()
86 	{
87 		return cast(void*)gTlsPassword;
88 	}
89 	
90 	/**
91 	 * Sets our main struct and passes it to the parent class
92 	 */
93 	public this (GTlsPassword* gTlsPassword)
94 	{
95 		super(cast(GObject*)gTlsPassword);
96 		this.gTlsPassword = gTlsPassword;
97 	}
98 	
99 	protected override void setStruct(GObject* obj)
100 	{
101 		super.setStruct(obj);
102 		gTlsPassword = cast(GTlsPassword*)obj;
103 	}
104 	
105 	/**
106 	 */
107 	
108 	/**
109 	 * Create a new GTlsPassword object.
110 	 * Params:
111 	 * flags = the password flags
112 	 * description = description of what the password is for
113 	 * Throws: ConstructionException GTK+ fails to create the object.
114 	 */
115 	public this (GTlsPasswordFlags flags, string description)
116 	{
117 		// GTlsPassword * g_tls_password_new (GTlsPasswordFlags flags,  const gchar *description);
118 		auto p = g_tls_password_new(flags, Str.toStringz(description));
119 		if(p is null)
120 		{
121 			throw new ConstructionException("null returned by g_tls_password_new(flags, Str.toStringz(description))");
122 		}
123 		this(cast(GTlsPassword*) p);
124 	}
125 	
126 	/**
127 	 * Get the password value. If length is not NULL then it will be
128 	 * filled in with the length of the password value. (Note that the
129 	 * password value is not nul-terminated, so you can only pass NULL
130 	 * for length in contexts where you know the password will have a
131 	 * certain fixed length.)
132 	 * Since 2.30
133 	 * Returns: The password value (owned by the password object).
134 	 */
135 	public char[] getValue()
136 	{
137 		// const guchar * g_tls_password_get_value (GTlsPassword *password,  gsize *length);
138 		gsize length;
139 		auto p = g_tls_password_get_value(gTlsPassword, &length);
140 		
141 		if(p is null)
142 		{
143 			return null;
144 		}
145 		
146 		return p[0 .. length];
147 	}
148 	
149 	/**
150 	 * Set the value for this password. The value will be copied by the password
151 	 * object.
152 	 * Specify the length, for a non-nul-terminated password. Pass -1 as
153 	 * length if using a nul-terminated password, and length will be
154 	 * calculated automatically. (Note that the terminating nul is not
155 	 * considered part of the password in this case.)
156 	 * Since 2.30
157 	 * Params:
158 	 * value = the new password value
159 	 */
160 	public void setValue(char[] value)
161 	{
162 		// void g_tls_password_set_value (GTlsPassword *password,  const guchar *value,  gssize length);
163 		g_tls_password_set_value(gTlsPassword, value.ptr, cast(int) value.length);
164 	}
165 	
166 	/**
167 	 * Provide the value for this password.
168 	 * The value will be owned by the password object, and later freed using
169 	 * the destroy function callback.
170 	 * Specify the length, for a non-nul-terminated password. Pass -1 as
171 	 * length if using a nul-terminated password, and length will be
172 	 * calculated automatically. (Note that the terminating nul is not
173 	 * considered part of the password in this case.)
174 	 * Virtual: set_value
175 	 * Since 2.30
176 	 * Params:
177 	 * value = the value for the password
178 	 * destroy = a function to use to free the password. [allow-none]
179 	 */
180 	public void setValueFull(char[] value, GDestroyNotify destroy)
181 	{
182 		// void g_tls_password_set_value_full (GTlsPassword *password,  guchar *value,  gssize length,  GDestroyNotify destroy);
183 		g_tls_password_set_value_full(gTlsPassword, value.ptr, cast(int) value.length, destroy);
184 	}
185 	
186 	/**
187 	 * Get a description string about what the password will be used for.
188 	 * Since 2.30
189 	 * Returns: The description of the password.
190 	 */
191 	public string getDescription()
192 	{
193 		// const gchar * g_tls_password_get_description (GTlsPassword *password);
194 		return Str.toString(g_tls_password_get_description(gTlsPassword));
195 	}
196 	
197 	/**
198 	 * Set a description string about what the password will be used for.
199 	 * Since 2.30
200 	 * Params:
201 	 * description = The description of the password
202 	 */
203 	public void setDescription(string description)
204 	{
205 		// void g_tls_password_set_description (GTlsPassword *password,  const gchar *description);
206 		g_tls_password_set_description(gTlsPassword, Str.toStringz(description));
207 	}
208 	
209 	/**
210 	 * Get flags about the password.
211 	 * Since 2.30
212 	 * Returns: The flags about the password.
213 	 */
214 	public GTlsPasswordFlags getFlags()
215 	{
216 		// GTlsPasswordFlags g_tls_password_get_flags (GTlsPassword *password);
217 		return g_tls_password_get_flags(gTlsPassword);
218 	}
219 	
220 	/**
221 	 * Set flags about the password.
222 	 * Since 2.30
223 	 * Params:
224 	 * flags = The flags about the password
225 	 */
226 	public void setFlags(GTlsPasswordFlags flags)
227 	{
228 		// void g_tls_password_set_flags (GTlsPassword *password,  GTlsPasswordFlags flags);
229 		g_tls_password_set_flags(gTlsPassword, flags);
230 	}
231 	
232 	/**
233 	 * Get a user readable translated warning. Usually this warning is a
234 	 * representation of the password flags returned from
235 	 * g_tls_password_get_flags().
236 	 * Since 2.30
237 	 * Returns: The warning.
238 	 */
239 	public string getWarning()
240 	{
241 		// const gchar * g_tls_password_get_warning (GTlsPassword *password);
242 		return Str.toString(g_tls_password_get_warning(gTlsPassword));
243 	}
244 	
245 	/**
246 	 * Set a user readable translated warning. Usually this warning is a
247 	 * representation of the password flags returned from
248 	 * g_tls_password_get_flags().
249 	 * Since 2.30
250 	 * Params:
251 	 * warning = The user readable warning
252 	 */
253 	public void setWarning(string warning)
254 	{
255 		// void g_tls_password_set_warning (GTlsPassword *password,  const gchar *warning);
256 		g_tls_password_set_warning(gTlsPassword, Str.toStringz(warning));
257 	}
258 }