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 = GDBusObjectSkeleton.html 27 * outPack = gio 28 * outFile = DBusObjectSkeleton 29 * strct = GDBusObjectSkeleton 30 * realStrct= 31 * ctorStrct= 32 * clss = DBusObjectSkeleton 33 * interf = 34 * class Code: Yes 35 * interface Code: No 36 * template for: 37 * extend = 38 * implements: 39 * - DBusObjectIF 40 * prefixes: 41 * - g_dbus_object_skeleton_ 42 * omit structs: 43 * omit prefixes: 44 * omit code: 45 * omit signals: 46 * imports: 47 * - glib.Str 48 * - gio.DBusInterfaceSkeleton 49 * - gio.DBusObjectT 50 * - gio.DBusObjectIF 51 * structWrap: 52 * - GDBusInterfaceSkeleton* -> DBusInterfaceSkeleton 53 * module aliases: 54 * local aliases: 55 * overrides: 56 */ 57 58 module gio.DBusObjectSkeleton; 59 60 public import gtkc.giotypes; 61 62 private import gtkc.gio; 63 private import glib.ConstructionException; 64 private import gobject.ObjectG; 65 66 private import gobject.Signals; 67 public import gtkc.gdktypes; 68 69 private import glib.Str; 70 private import gio.DBusInterfaceSkeleton; 71 private import gio.DBusObjectT; 72 private import gio.DBusObjectIF; 73 74 75 76 private import gobject.ObjectG; 77 78 /** 79 * A GDBusObjectSkeleton instance is essentially a group of D-Bus 80 * interfaces. The set of exported interfaces on the object may be 81 * dynamic and change at runtime. 82 * 83 * This type is intended to be used with GDBusObjectManager. 84 */ 85 public class DBusObjectSkeleton : ObjectG, DBusObjectIF 86 { 87 88 /** the main Gtk struct */ 89 protected GDBusObjectSkeleton* gDBusObjectSkeleton; 90 91 92 public GDBusObjectSkeleton* getDBusObjectSkeletonStruct() 93 { 94 return gDBusObjectSkeleton; 95 } 96 97 98 /** the main Gtk struct as a void* */ 99 protected override void* getStruct() 100 { 101 return cast(void*)gDBusObjectSkeleton; 102 } 103 104 /** 105 * Sets our main struct and passes it to the parent class 106 */ 107 public this (GDBusObjectSkeleton* gDBusObjectSkeleton) 108 { 109 super(cast(GObject*)gDBusObjectSkeleton); 110 this.gDBusObjectSkeleton = gDBusObjectSkeleton; 111 } 112 113 protected override void setStruct(GObject* obj) 114 { 115 super.setStruct(obj); 116 gDBusObjectSkeleton = cast(GDBusObjectSkeleton*)obj; 117 } 118 119 // add the DBusObject capabilities 120 mixin DBusObjectT!(GDBusObjectSkeleton); 121 122 /** 123 */ 124 int[string] connectedSignals; 125 126 bool delegate(DBusInterfaceSkeleton, GDBusMethodInvocation*, DBusObjectSkeleton)[] onAuthorizeMethodListeners; 127 /** 128 * Emitted when a method is invoked by a remote caller and used to 129 * determine if the method call is authorized. 130 * This signal is like GDBusInterfaceSkeleton's 131 * "g-authorize-method" signal, except that it is 132 * for the enclosing object. 133 * The default class handler just returns TRUE. 134 * TRUE if the call is authorized, FALSE otherwise. 135 * Since 2.30 136 */ 137 void addOnAuthorizeMethod(bool delegate(DBusInterfaceSkeleton, GDBusMethodInvocation*, DBusObjectSkeleton) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 138 { 139 if ( !("authorize-method" in connectedSignals) ) 140 { 141 Signals.connectData( 142 getStruct(), 143 "authorize-method", 144 cast(GCallback)&callBackAuthorizeMethod, 145 cast(void*)this, 146 null, 147 connectFlags); 148 connectedSignals["authorize-method"] = 1; 149 } 150 onAuthorizeMethodListeners ~= dlg; 151 } 152 extern(C) static gboolean callBackAuthorizeMethod(GDBusObjectSkeleton* objectStruct, GDBusInterfaceSkeleton* iface, GDBusMethodInvocation* invocation, DBusObjectSkeleton _dBusObjectSkeleton) 153 { 154 foreach ( bool delegate(DBusInterfaceSkeleton, GDBusMethodInvocation*, DBusObjectSkeleton) dlg ; _dBusObjectSkeleton.onAuthorizeMethodListeners ) 155 { 156 if ( dlg(ObjectG.getDObject!(DBusInterfaceSkeleton)(iface), invocation, _dBusObjectSkeleton) ) 157 { 158 return 1; 159 } 160 } 161 162 return 0; 163 } 164 165 166 /** 167 * Creates a new GDBusObjectSkeleton. 168 * Since 2.30 169 * Params: 170 * objectPath = An object path. 171 * Throws: ConstructionException GTK+ fails to create the object. 172 */ 173 public this (string objectPath) 174 { 175 // GDBusObjectSkeleton * g_dbus_object_skeleton_new (const gchar *object_path); 176 auto p = g_dbus_object_skeleton_new(Str.toStringz(objectPath)); 177 if(p is null) 178 { 179 throw new ConstructionException("null returned by g_dbus_object_skeleton_new(Str.toStringz(objectPath))"); 180 } 181 this(cast(GDBusObjectSkeleton*) p); 182 } 183 184 /** 185 * This method simply calls g_dbus_interface_skeleton_flush() on all 186 * interfaces belonging to object. See that method for when flushing 187 * is useful. 188 * Since 2.30 189 */ 190 public void flush() 191 { 192 // void g_dbus_object_skeleton_flush (GDBusObjectSkeleton *object); 193 g_dbus_object_skeleton_flush(gDBusObjectSkeleton); 194 } 195 196 /** 197 * Adds interface_ to object. 198 * If object already contains a GDBusInterfaceSkeleton with the same 199 * interface name, it is removed before interface_ is added. 200 * Note that object takes its own reference on interface_ and holds 201 * it until removed. 202 * Since 2.30 203 */ 204 public void addInterface(DBusInterfaceSkeleton iface) 205 { 206 // void g_dbus_object_skeleton_add_interface (GDBusObjectSkeleton *object, GDBusInterfaceSkeleton *interface_); 207 g_dbus_object_skeleton_add_interface(gDBusObjectSkeleton, (iface is null) ? null : iface.getDBusInterfaceSkeletonStruct()); 208 } 209 210 /** 211 * Removes interface_ from object. 212 * Since 2.30 213 */ 214 public void removeInterface(DBusInterfaceSkeleton iface) 215 { 216 // void g_dbus_object_skeleton_remove_interface (GDBusObjectSkeleton *object, GDBusInterfaceSkeleton *interface_); 217 g_dbus_object_skeleton_remove_interface(gDBusObjectSkeleton, (iface is null) ? null : iface.getDBusInterfaceSkeletonStruct()); 218 } 219 220 /** 221 * Removes the GDBusInterface with interface_name from object. 222 * If no D-Bus interface of the given interface exists, this function 223 * does nothing. 224 * Since 2.30 225 * Params: 226 * interfaceName = A D-Bus interface name. 227 */ 228 public void removeInterfaceByName(string interfaceName) 229 { 230 // void g_dbus_object_skeleton_remove_interface_by_name (GDBusObjectSkeleton *object, const gchar *interface_name); 231 g_dbus_object_skeleton_remove_interface_by_name(gDBusObjectSkeleton, Str.toStringz(interfaceName)); 232 } 233 234 /** 235 * Sets the object path for object. 236 * Since 2.30 237 * Params: 238 * object = A GDBusObjectSkeleton. 239 * objectPath = A valid D-Bus object path. 240 */ 241 public void setObjectPath(string objectPath) 242 { 243 // void g_dbus_object_skeleton_set_object_path (GDBusObjectSkeleton *object, const gchar *object_path); 244 g_dbus_object_skeleton_set_object_path(gDBusObjectSkeleton, Str.toStringz(objectPath)); 245 } 246 }