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 = GDBusObjectManagerServer.html 27 * outPack = gio 28 * outFile = DBusObjectManagerServer 29 * strct = GDBusObjectManagerServer 30 * realStrct= 31 * ctorStrct= 32 * clss = DBusObjectManagerServer 33 * interf = 34 * class Code: Yes 35 * interface Code: No 36 * template for: 37 * extend = 38 * implements: 39 * - DBusObjectManagerIF 40 * prefixes: 41 * - g_dbus_object_manager_server_ 42 * omit structs: 43 * omit prefixes: 44 * omit code: 45 * omit signals: 46 * imports: 47 * - glib.Str 48 * - gio.DBusConnection 49 * - gio.DBusObjectSkeleton 50 * - gio.DBusObjectManagerT 51 * - gio.DBusObjectManagerIF 52 * structWrap: 53 * - GDBusConnection* -> DBusConnection 54 * - GDBusObjectSkeleton* -> DBusObjectSkeleton 55 * module aliases: 56 * local aliases: 57 * overrides: 58 */ 59 60 module gio.DBusObjectManagerServer; 61 62 public import gtkc.giotypes; 63 64 private import gtkc.gio; 65 private import glib.ConstructionException; 66 private import gobject.ObjectG; 67 68 69 private import glib.Str; 70 private import gio.DBusConnection; 71 private import gio.DBusObjectSkeleton; 72 private import gio.DBusObjectManagerT; 73 private import gio.DBusObjectManagerIF; 74 75 76 77 private import gobject.ObjectG; 78 79 /** 80 * GDBusObjectManagerServer is used to export GDBusObject instances using 81 * the standardized org.freedesktop.DBus.ObjectManager 82 * interface. For example, remote D-Bus clients can get all objects 83 * and properties in a single call. Additionally, any change in the 84 * object hierarchy is broadcast using signals. This means that D-Bus 85 * clients can keep caches up to date by only listening to D-Bus 86 * signals. 87 * 88 * See GDBusObjectManagerClient for the client-side code that is 89 * intended to be used with GDBusObjectManagerServer or any D-Bus 90 * object implementing the org.freedesktop.DBus.ObjectManager 91 * interface. 92 */ 93 public class DBusObjectManagerServer : ObjectG, DBusObjectManagerIF 94 { 95 96 /** the main Gtk struct */ 97 protected GDBusObjectManagerServer* gDBusObjectManagerServer; 98 99 100 public GDBusObjectManagerServer* getDBusObjectManagerServerStruct() 101 { 102 return gDBusObjectManagerServer; 103 } 104 105 106 /** the main Gtk struct as a void* */ 107 protected override void* getStruct() 108 { 109 return cast(void*)gDBusObjectManagerServer; 110 } 111 112 /** 113 * Sets our main struct and passes it to the parent class 114 */ 115 public this (GDBusObjectManagerServer* gDBusObjectManagerServer) 116 { 117 super(cast(GObject*)gDBusObjectManagerServer); 118 this.gDBusObjectManagerServer = gDBusObjectManagerServer; 119 } 120 121 protected override void setStruct(GObject* obj) 122 { 123 super.setStruct(obj); 124 gDBusObjectManagerServer = cast(GDBusObjectManagerServer*)obj; 125 } 126 127 // add the DBusObjectManager capabilities 128 mixin DBusObjectManagerT!(GDBusObjectManagerServer); 129 130 /** 131 */ 132 133 /** 134 * Creates a new GDBusObjectManagerServer object. 135 * The returned server isn't yet exported on any connection. To do so, 136 * use g_dbus_object_manager_server_set_connection(). Normally you 137 * want to export all of your objects before doing so to avoid InterfacesAdded 138 * signals being emitted. 139 * Since 2.30 140 * Params: 141 * objectPath = The object path to export the manager object at. 142 * Throws: ConstructionException GTK+ fails to create the object. 143 */ 144 public this (string objectPath) 145 { 146 // GDBusObjectManagerServer * g_dbus_object_manager_server_new (const gchar *object_path); 147 auto p = g_dbus_object_manager_server_new(Str.toStringz(objectPath)); 148 if(p is null) 149 { 150 throw new ConstructionException("null returned by g_dbus_object_manager_server_new(Str.toStringz(objectPath))"); 151 } 152 this(cast(GDBusObjectManagerServer*) p); 153 } 154 155 /** 156 * Gets the GDBusConnection used by manager. 157 * Since 2.30 158 * Returns: A GDBusConnection object or NULL if manager isn't exported on a connection. The returned object should be freed with g_object_unref(). [transfer full] 159 */ 160 public DBusConnection getConnection() 161 { 162 // GDBusConnection * g_dbus_object_manager_server_get_connection (GDBusObjectManagerServer *manager); 163 auto p = g_dbus_object_manager_server_get_connection(gDBusObjectManagerServer); 164 165 if(p is null) 166 { 167 return null; 168 } 169 170 return ObjectG.getDObject!(DBusConnection)(cast(GDBusConnection*) p); 171 } 172 173 /** 174 * Exports all objects managed by manager on connection. If 175 * connection is NULL, stops exporting objects. 176 * Params: 177 * connection = A GDBusConnection or NULL. [allow-none] 178 */ 179 public void setConnection(DBusConnection connection) 180 { 181 // void g_dbus_object_manager_server_set_connection (GDBusObjectManagerServer *manager, GDBusConnection *connection); 182 g_dbus_object_manager_server_set_connection(gDBusObjectManagerServer, (connection is null) ? null : connection.getDBusConnectionStruct()); 183 } 184 185 /** 186 * Exports object on manager. 187 * If there is already a GDBusObject exported at the object path, 188 * then the old object is removed. 189 * The object path for object must be in the hierarchy rooted by the 190 * object path for manager. 191 * Note that manager will take a reference on object for as long as 192 * it is exported. 193 * Since 2.30 194 * Params: 195 * object = A GDBusObjectSkeleton. 196 */ 197 public void expor(DBusObjectSkeleton object) 198 { 199 // void g_dbus_object_manager_server_export (GDBusObjectManagerServer *manager, GDBusObjectSkeleton *object); 200 g_dbus_object_manager_server_export(gDBusObjectManagerServer, (object is null) ? null : object.getDBusObjectSkeletonStruct()); 201 } 202 203 /** 204 * Like g_dbus_object_manager_server_export() but appends a string of 205 * the form _N (with N being a natural number) to 206 * object's object path if an object with the given path 207 * already exists. As such, the "g-object-path" property 208 * of object may be modified. 209 * Since 2.30 210 * Params: 211 * object = An object. 212 */ 213 public void exportUniquely(DBusObjectSkeleton object) 214 { 215 // void g_dbus_object_manager_server_export_uniquely (GDBusObjectManagerServer *manager, GDBusObjectSkeleton *object); 216 g_dbus_object_manager_server_export_uniquely(gDBusObjectManagerServer, (object is null) ? null : object.getDBusObjectSkeletonStruct()); 217 } 218 219 /** 220 * Returns whether object is currently exported on manager. 221 * Since 2.34 222 * Params: 223 * object = An object. 224 * Returns: TRUE if object is exported 225 */ 226 public int isExported(DBusObjectSkeleton object) 227 { 228 // gboolean g_dbus_object_manager_server_is_exported (GDBusObjectManagerServer *manager, GDBusObjectSkeleton *object); 229 return g_dbus_object_manager_server_is_exported(gDBusObjectManagerServer, (object is null) ? null : object.getDBusObjectSkeletonStruct()); 230 } 231 232 /** 233 * If manager has an object at path, removes the object. Otherwise 234 * does nothing. 235 * Note that object_path must be in the hierarchy rooted by the 236 * object path for manager. 237 * Since 2.30 238 * Params: 239 * objectPath = An object path. 240 * Returns: TRUE if object at object_path was removed, FALSE otherwise. 241 */ 242 public int unexport(string objectPath) 243 { 244 // gboolean g_dbus_object_manager_server_unexport (GDBusObjectManagerServer *manager, const gchar *object_path); 245 return g_dbus_object_manager_server_unexport(gDBusObjectManagerServer, Str.toStringz(objectPath)); 246 } 247 }