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.DBusObjectSkeleton; 26 27 private import gio.DBusInterfaceSkeleton; 28 private import gio.DBusMethodInvocation; 29 private import gio.DBusObjectIF; 30 private import gio.DBusObjectT; 31 private import gio.c.functions; 32 public import gio.c.types; 33 private import glib.ConstructionException; 34 private import glib.Str; 35 private import gobject.ObjectG; 36 private import gobject.Signals; 37 public import gtkc.giotypes; 38 private import std.algorithm; 39 40 41 /** 42 * A #GDBusObjectSkeleton instance is essentially a group of D-Bus 43 * interfaces. The set of exported interfaces on the object may be 44 * dynamic and change at runtime. 45 * 46 * This type is intended to be used with #GDBusObjectManager. 47 * 48 * Since: 2.30 49 */ 50 public class DBusObjectSkeleton : ObjectG, DBusObjectIF 51 { 52 /** the main Gtk struct */ 53 protected GDBusObjectSkeleton* gDBusObjectSkeleton; 54 55 /** Get the main Gtk struct */ 56 public GDBusObjectSkeleton* getDBusObjectSkeletonStruct(bool transferOwnership = false) 57 { 58 if (transferOwnership) 59 ownedRef = false; 60 return gDBusObjectSkeleton; 61 } 62 63 /** the main Gtk struct as a void* */ 64 protected override void* getStruct() 65 { 66 return cast(void*)gDBusObjectSkeleton; 67 } 68 69 /** 70 * Sets our main struct and passes it to the parent class. 71 */ 72 public this (GDBusObjectSkeleton* gDBusObjectSkeleton, bool ownedRef = false) 73 { 74 this.gDBusObjectSkeleton = gDBusObjectSkeleton; 75 super(cast(GObject*)gDBusObjectSkeleton, ownedRef); 76 } 77 78 // add the DBusObject capabilities 79 mixin DBusObjectT!(GDBusObjectSkeleton); 80 81 82 /** */ 83 public static GType getType() 84 { 85 return g_dbus_object_skeleton_get_type(); 86 } 87 88 /** 89 * Creates a new #GDBusObjectSkeleton. 90 * 91 * Params: 92 * objectPath = An object path. 93 * 94 * Returns: A #GDBusObjectSkeleton. Free with g_object_unref(). 95 * 96 * Since: 2.30 97 * 98 * Throws: ConstructionException GTK+ fails to create the object. 99 */ 100 public this(string objectPath) 101 { 102 auto __p = g_dbus_object_skeleton_new(Str.toStringz(objectPath)); 103 104 if(__p is null) 105 { 106 throw new ConstructionException("null returned by new"); 107 } 108 109 this(cast(GDBusObjectSkeleton*) __p, true); 110 } 111 112 /** 113 * Adds @interface_ to @object. 114 * 115 * If @object already contains a #GDBusInterfaceSkeleton with the same 116 * interface name, it is removed before @interface_ is added. 117 * 118 * Note that @object takes its own reference on @interface_ and holds 119 * it until removed. 120 * 121 * Params: 122 * interface_ = A #GDBusInterfaceSkeleton. 123 * 124 * Since: 2.30 125 */ 126 public void addInterface(DBusInterfaceSkeleton interface_) 127 { 128 g_dbus_object_skeleton_add_interface(gDBusObjectSkeleton, (interface_ is null) ? null : interface_.getDBusInterfaceSkeletonStruct()); 129 } 130 131 /** 132 * This method simply calls g_dbus_interface_skeleton_flush() on all 133 * interfaces belonging to @object. See that method for when flushing 134 * is useful. 135 * 136 * Since: 2.30 137 */ 138 public void flush() 139 { 140 g_dbus_object_skeleton_flush(gDBusObjectSkeleton); 141 } 142 143 /** 144 * Removes @interface_ from @object. 145 * 146 * Params: 147 * interface_ = A #GDBusInterfaceSkeleton. 148 * 149 * Since: 2.30 150 */ 151 public void removeInterface(DBusInterfaceSkeleton interface_) 152 { 153 g_dbus_object_skeleton_remove_interface(gDBusObjectSkeleton, (interface_ is null) ? null : interface_.getDBusInterfaceSkeletonStruct()); 154 } 155 156 /** 157 * Removes the #GDBusInterface with @interface_name from @object. 158 * 159 * If no D-Bus interface of the given interface exists, this function 160 * does nothing. 161 * 162 * Params: 163 * interfaceName = A D-Bus interface name. 164 * 165 * Since: 2.30 166 */ 167 public void removeInterfaceByName(string interfaceName) 168 { 169 g_dbus_object_skeleton_remove_interface_by_name(gDBusObjectSkeleton, Str.toStringz(interfaceName)); 170 } 171 172 /** 173 * Sets the object path for @object. 174 * 175 * Params: 176 * objectPath = A valid D-Bus object path. 177 * 178 * Since: 2.30 179 */ 180 public void setObjectPath(string objectPath) 181 { 182 g_dbus_object_skeleton_set_object_path(gDBusObjectSkeleton, Str.toStringz(objectPath)); 183 } 184 185 /** 186 * Emitted when a method is invoked by a remote caller and used to 187 * determine if the method call is authorized. 188 * 189 * This signal is like #GDBusInterfaceSkeleton's 190 * #GDBusInterfaceSkeleton::g-authorize-method signal, 191 * except that it is for the enclosing object. 192 * 193 * The default class handler just returns %TRUE. 194 * 195 * Params: 196 * interface_ = The #GDBusInterfaceSkeleton that @invocation is for. 197 * invocation = A #GDBusMethodInvocation. 198 * 199 * Returns: %TRUE if the call is authorized, %FALSE otherwise. 200 * 201 * Since: 2.30 202 */ 203 gulong addOnAuthorizeMethod(bool delegate(DBusInterfaceSkeleton, DBusMethodInvocation, DBusObjectSkeleton) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 204 { 205 return Signals.connect(this, "authorize-method", dlg, connectFlags ^ ConnectFlags.SWAPPED); 206 } 207 }