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.DBusSignalInfo;
26 
27 private import gio.DBusAnnotationInfo;
28 private import gio.DBusArgInfo;
29 private import gio.c.functions;
30 public  import gio.c.types;
31 private import glib.MemorySlice;
32 private import glib.Str;
33 private import glib.c.functions;
34 private import gobject.ObjectG;
35 private import gtkd.Loader;
36 
37 
38 /**
39  * Information about a signal on a D-Bus interface.
40  *
41  * Since: 2.26
42  */
43 public final class DBusSignalInfo
44 {
45 	/** the main Gtk struct */
46 	protected GDBusSignalInfo* gDBusSignalInfo;
47 	protected bool ownedRef;
48 
49 	/** Get the main Gtk struct */
50 	public GDBusSignalInfo* getDBusSignalInfoStruct(bool transferOwnership = false)
51 	{
52 		if (transferOwnership)
53 			ownedRef = false;
54 		return gDBusSignalInfo;
55 	}
56 
57 	/** the main Gtk struct as a void* */
58 	protected void* getStruct()
59 	{
60 		return cast(void*)gDBusSignalInfo;
61 	}
62 
63 	/**
64 	 * Sets our main struct and passes it to the parent class.
65 	 */
66 	public this (GDBusSignalInfo* gDBusSignalInfo, bool ownedRef = false)
67 	{
68 		this.gDBusSignalInfo = gDBusSignalInfo;
69 		this.ownedRef = ownedRef;
70 	}
71 
72 	~this ()
73 	{
74 		if ( Linker.isLoaded(LIBRARY_GIO) && ownedRef )
75 			g_dbus_signal_info_unref(gDBusSignalInfo);
76 	}
77 
78 
79 	/**
80 	 * The reference count or -1 if statically allocated.
81 	 */
82 	public @property int refCount()
83 	{
84 		return gDBusSignalInfo.refCount;
85 	}
86 
87 	/** Ditto */
88 	public @property void refCount(int value)
89 	{
90 		gDBusSignalInfo.refCount = value;
91 	}
92 
93 	/**
94 	 * The name of the D-Bus signal, e.g. "NameOwnerChanged".
95 	 */
96 	public @property string name()
97 	{
98 		return Str.toString(gDBusSignalInfo.name);
99 	}
100 
101 	/** Ditto */
102 	public @property void name(string value)
103 	{
104 		gDBusSignalInfo.name = Str.toStringz(value);
105 	}
106 
107 	/**
108 	 * A pointer to a %NULL-terminated array of pointers to #GDBusArgInfo structures or %NULL if there are no arguments.
109 	 */
110 	public @property DBusArgInfo[] args()
111 	{
112 		DBusArgInfo[] arr = new DBusArgInfo[getArrayLength(gDBusSignalInfo.args)];
113 		for ( int i = 0; i < arr.length; i++ )
114 		{
115 			arr[i] = ObjectG.getDObject!(DBusArgInfo)(gDBusSignalInfo.args[i], false);
116 		}
117 
118 		return arr;
119 	}
120 
121 	/** Ditto */
122 	public @property void args(DBusArgInfo[] value)
123 	{
124 		GDBusArgInfo*[] arr = new GDBusArgInfo*[value.length+1];
125 		for ( int i = 0; i < value.length; i++ )
126 		{
127 			arr[i] = value[i].getDBusArgInfoStruct();
128 		}
129 		arr[value.length] = null;
130 
131 		gDBusSignalInfo.args = arr.ptr;
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(gDBusSignalInfo.annotations)];
140 		for ( int i = 0; i < arr.length; i++ )
141 		{
142 			arr[i] = ObjectG.getDObject!(DBusAnnotationInfo)(gDBusSignalInfo.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 		gDBusSignalInfo.annotations = arr.ptr;
159 	}
160 
161 	/** */
162 	public static GType getType()
163 	{
164 		return g_dbus_signal_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 DBusSignalInfo ref_()
177 	{
178 		auto __p = g_dbus_signal_info_ref(gDBusSignalInfo);
179 
180 		if(__p is null)
181 		{
182 			return null;
183 		}
184 
185 		return ObjectG.getDObject!(DBusSignalInfo)(cast(GDBusSignalInfo*) __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_signal_info_unref(gDBusSignalInfo);
198 	}
199 }