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