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 module gio.DBusPropertyInfo;
26 
27 private import gio.DBusAnnotationInfo;
28 private import gio.c.functions;
29 public  import gio.c.types;
30 private import glib.MemorySlice;
31 private import glib.Str;
32 private import glib.c.functions;
33 private import gobject.ObjectG;
34 private import gtkd.Loader;
35 
36 
37 /**
38  * Information about a D-Bus property on a D-Bus interface.
39  *
40  * Since: 2.26
41  */
42 public final class DBusPropertyInfo
43 {
44 	/** the main Gtk struct */
45 	protected GDBusPropertyInfo* gDBusPropertyInfo;
46 	protected bool ownedRef;
47 
48 	/** Get the main Gtk struct */
49 	public GDBusPropertyInfo* getDBusPropertyInfoStruct(bool transferOwnership = false)
50 	{
51 		if (transferOwnership)
52 			ownedRef = false;
53 		return gDBusPropertyInfo;
54 	}
55 
56 	/** the main Gtk struct as a void* */
57 	protected void* getStruct()
58 	{
59 		return cast(void*)gDBusPropertyInfo;
60 	}
61 
62 	/**
63 	 * Sets our main struct and passes it to the parent class.
64 	 */
65 	public this (GDBusPropertyInfo* gDBusPropertyInfo, bool ownedRef = false)
66 	{
67 		this.gDBusPropertyInfo = gDBusPropertyInfo;
68 		this.ownedRef = ownedRef;
69 	}
70 
71 	~this ()
72 	{
73 		if ( Linker.isLoaded(LIBRARY_GIO) && ownedRef )
74 			g_dbus_property_info_unref(gDBusPropertyInfo);
75 	}
76 
77 
78 	/**
79 	 * The reference count or -1 if statically allocated.
80 	 */
81 	public @property int refCount()
82 	{
83 		return gDBusPropertyInfo.refCount;
84 	}
85 
86 	/** Ditto */
87 	public @property void refCount(int value)
88 	{
89 		gDBusPropertyInfo.refCount = value;
90 	}
91 
92 	/**
93 	 * The name of the D-Bus property, e.g. "SupportedFilesystems".
94 	 */
95 	public @property string name()
96 	{
97 		return Str.toString(gDBusPropertyInfo.name);
98 	}
99 
100 	/** Ditto */
101 	public @property void name(string value)
102 	{
103 		gDBusPropertyInfo.name = Str.toStringz(value);
104 	}
105 
106 	/**
107 	 * The D-Bus signature of the property (a single complete type).
108 	 */
109 	public @property string signature()
110 	{
111 		return Str.toString(gDBusPropertyInfo.signature);
112 	}
113 
114 	/** Ditto */
115 	public @property void signature(string value)
116 	{
117 		gDBusPropertyInfo.signature = Str.toStringz(value);
118 	}
119 
120 	/**
121 	 * Access control flags for the property.
122 	 */
123 	public @property GDBusPropertyInfoFlags flags()
124 	{
125 		return gDBusPropertyInfo.flags;
126 	}
127 
128 	/** Ditto */
129 	public @property void flags(GDBusPropertyInfoFlags value)
130 	{
131 		gDBusPropertyInfo.flags = value;
132 	}
133 
134 	/**
135 	 * A pointer to a %NULL-terminated array of pointers to #GDBusAnnotationInfo structures or %NULL if there are no annotations.
136 	 */
137 	public @property DBusAnnotationInfo[] annotations()
138 	{
139 		DBusAnnotationInfo[] arr = new DBusAnnotationInfo[getArrayLength(gDBusPropertyInfo.annotations)];
140 		for ( int i = 0; i < arr.length; i++ )
141 		{
142 			arr[i] = ObjectG.getDObject!(DBusAnnotationInfo)(gDBusPropertyInfo.annotations[i], false);
143 		}
144 
145 		return arr;
146 	}
147 
148 	/** Ditto */
149 	public @property void annotations(DBusAnnotationInfo[] value)
150 	{
151 		GDBusAnnotationInfo*[] arr = new GDBusAnnotationInfo*[value.length+1];
152 		for ( int i = 0; i < value.length; i++ )
153 		{
154 			arr[i] = value[i].getDBusAnnotationInfoStruct();
155 		}
156 		arr[value.length] = null;
157 
158 		gDBusPropertyInfo.annotations = arr.ptr;
159 	}
160 
161 	/** */
162 	public static GType getType()
163 	{
164 		return g_dbus_property_info_get_type();
165 	}
166 
167 	alias doref = ref_;
168 	/**
169 	 * If @info is statically allocated does nothing. Otherwise increases
170 	 * the reference count.
171 	 *
172 	 * Returns: The same @info.
173 	 *
174 	 * Since: 2.26
175 	 */
176 	public DBusPropertyInfo ref_()
177 	{
178 		auto __p = g_dbus_property_info_ref(gDBusPropertyInfo);
179 
180 		if(__p is null)
181 		{
182 			return null;
183 		}
184 
185 		return ObjectG.getDObject!(DBusPropertyInfo)(cast(GDBusPropertyInfo*) __p, true);
186 	}
187 
188 	/**
189 	 * If @info is statically allocated, does nothing. Otherwise decreases
190 	 * the reference count of @info. When its reference count drops to 0,
191 	 * the memory used is freed.
192 	 *
193 	 * Since: 2.26
194 	 */
195 	public void unref()
196 	{
197 		g_dbus_property_info_unref(gDBusPropertyInfo);
198 	}
199 }