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.DBusObjectProxy;
26 
27 private import gio.DBusConnection;
28 private import gio.DBusObjectIF;
29 private import gio.DBusObjectT;
30 private import gio.c.functions;
31 public  import gio.c.types;
32 private import glib.ConstructionException;
33 private import glib.Str;
34 private import gobject.ObjectG;
35 public  import gtkc.giotypes;
36 
37 
38 /**
39  * A #GDBusObjectProxy is an object used to represent a remote object
40  * with one or more D-Bus interfaces. Normally, you don't instantiate
41  * a #GDBusObjectProxy yourself - typically #GDBusObjectManagerClient
42  * is used to obtain it.
43  *
44  * Since: 2.30
45  */
46 public class DBusObjectProxy : ObjectG, DBusObjectIF
47 {
48 	/** the main Gtk struct */
49 	protected GDBusObjectProxy* gDBusObjectProxy;
50 
51 	/** Get the main Gtk struct */
52 	public GDBusObjectProxy* getDBusObjectProxyStruct(bool transferOwnership = false)
53 	{
54 		if (transferOwnership)
55 			ownedRef = false;
56 		return gDBusObjectProxy;
57 	}
58 
59 	/** the main Gtk struct as a void* */
60 	protected override void* getStruct()
61 	{
62 		return cast(void*)gDBusObjectProxy;
63 	}
64 
65 	protected override void setStruct(GObject* obj)
66 	{
67 		gDBusObjectProxy = cast(GDBusObjectProxy*)obj;
68 		super.setStruct(obj);
69 	}
70 
71 	/**
72 	 * Sets our main struct and passes it to the parent class.
73 	 */
74 	public this (GDBusObjectProxy* gDBusObjectProxy, bool ownedRef = false)
75 	{
76 		this.gDBusObjectProxy = gDBusObjectProxy;
77 		super(cast(GObject*)gDBusObjectProxy, ownedRef);
78 	}
79 
80 	// add the DBusObject capabilities
81 	mixin DBusObjectT!(GDBusObjectProxy);
82 
83 
84 	/** */
85 	public static GType getType()
86 	{
87 		return g_dbus_object_proxy_get_type();
88 	}
89 
90 	/**
91 	 * Creates a new #GDBusObjectProxy for the given connection and
92 	 * object path.
93 	 *
94 	 * Params:
95 	 *     connection = a #GDBusConnection
96 	 *     objectPath = the object path
97 	 *
98 	 * Returns: a new #GDBusObjectProxy
99 	 *
100 	 * Since: 2.30
101 	 *
102 	 * Throws: ConstructionException GTK+ fails to create the object.
103 	 */
104 	public this(DBusConnection connection, string objectPath)
105 	{
106 		auto p = g_dbus_object_proxy_new((connection is null) ? null : connection.getDBusConnectionStruct(), Str.toStringz(objectPath));
107 
108 		if(p is null)
109 		{
110 			throw new ConstructionException("null returned by new");
111 		}
112 
113 		this(cast(GDBusObjectProxy*) p, true);
114 	}
115 
116 	/**
117 	 * Gets the connection that @proxy is for.
118 	 *
119 	 * Returns: A #GDBusConnection. Do not free, the
120 	 *     object is owned by @proxy.
121 	 *
122 	 * Since: 2.30
123 	 */
124 	public DBusConnection getConnection()
125 	{
126 		auto p = g_dbus_object_proxy_get_connection(gDBusObjectProxy);
127 
128 		if(p is null)
129 		{
130 			return null;
131 		}
132 
133 		return ObjectG.getDObject!(DBusConnection)(cast(GDBusConnection*) p);
134 	}
135 }