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