| 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 = GDBusMessage.html |
|---|
| 27 |
* outPack = gio |
|---|
| 28 |
* outFile = DBusMessage |
|---|
| 29 |
* strct = GDBusMessage |
|---|
| 30 |
* realStrct= |
|---|
| 31 |
* ctorStrct= |
|---|
| 32 |
* clss = DBusMessage |
|---|
| 33 |
* interf = |
|---|
| 34 |
* class Code: No |
|---|
| 35 |
* interface Code: No |
|---|
| 36 |
* template for: |
|---|
| 37 |
* extend = |
|---|
| 38 |
* implements: |
|---|
| 39 |
* prefixes: |
|---|
| 40 |
* - g_dbus_message_ |
|---|
| 41 |
* omit structs: |
|---|
| 42 |
* omit prefixes: |
|---|
| 43 |
* omit code: |
|---|
| 44 |
* omit signals: |
|---|
| 45 |
* imports: |
|---|
| 46 |
* - glib.Str |
|---|
| 47 |
* - glib.ErrorG |
|---|
| 48 |
* - glib.GException |
|---|
| 49 |
* - glib.Variant |
|---|
| 50 |
* - gio.UnixFDList |
|---|
| 51 |
* structWrap: |
|---|
| 52 |
* - GDBusMessage* -> DBusMessage |
|---|
| 53 |
* - GError* -> ErrorG |
|---|
| 54 |
* - GUnixFDList* -> UnixFDList |
|---|
| 55 |
* - GVariant* -> Variant |
|---|
| 56 |
* module aliases: |
|---|
| 57 |
* local aliases: |
|---|
| 58 |
* - body -> bod |
|---|
| 59 |
* overrides: |
|---|
| 60 |
*/ |
|---|
| 61 |
|
|---|
| 62 |
module gio.DBusMessage; |
|---|
| 63 |
|
|---|
| 64 |
public import gtkc.giotypes; |
|---|
| 65 |
|
|---|
| 66 |
private import gtkc.gio; |
|---|
| 67 |
private import glib.ConstructionException; |
|---|
| 68 |
|
|---|
| 69 |
|
|---|
| 70 |
private import glib.Str; |
|---|
| 71 |
private import glib.ErrorG; |
|---|
| 72 |
private import glib.GException; |
|---|
| 73 |
private import glib.Variant; |
|---|
| 74 |
private import gio.UnixFDList; |
|---|
| 75 |
|
|---|
| 76 |
|
|---|
| 77 |
|
|---|
| 78 |
private import gobject.ObjectG; |
|---|
| 79 |
|
|---|
| 80 |
/** |
|---|
| 81 |
* Description |
|---|
| 82 |
* A type for representing D-Bus messages that can be sent or received |
|---|
| 83 |
* on a GDBusConnection. |
|---|
| 84 |
*/ |
|---|
| 85 |
public class DBusMessage : ObjectG |
|---|
| 86 |
{ |
|---|
| 87 |
|
|---|
| 88 |
/** the main Gtk struct */ |
|---|
| 89 |
protected GDBusMessage* gDBusMessage; |
|---|
| 90 |
|
|---|
| 91 |
|
|---|
| 92 |
public GDBusMessage* getDBusMessageStruct() |
|---|
| 93 |
{ |
|---|
| 94 |
return gDBusMessage; |
|---|
| 95 |
} |
|---|
| 96 |
|
|---|
| 97 |
|
|---|
| 98 |
/** the main Gtk struct as a void* */ |
|---|
| 99 |
protected override void* getStruct() |
|---|
| 100 |
{ |
|---|
| 101 |
return cast(void*)gDBusMessage; |
|---|
| 102 |
} |
|---|
| 103 |
|
|---|
| 104 |
/** |
|---|
| 105 |
* Sets our main struct and passes it to the parent class |
|---|
| 106 |
*/ |
|---|
| 107 |
public this (GDBusMessage* gDBusMessage) |
|---|
| 108 |
{ |
|---|
| 109 |
if(gDBusMessage is null) |
|---|
| 110 |
{ |
|---|
| 111 |
this = null; |
|---|
| 112 |
return; |
|---|
| 113 |
} |
|---|
| 114 |
//Check if there already is a D object for this gtk struct |
|---|
| 115 |
void* ptr = getDObject(cast(GObject*)gDBusMessage); |
|---|
| 116 |
if( ptr !is null ) |
|---|
| 117 |
{ |
|---|
| 118 |
this = cast(DBusMessage)ptr; |
|---|
| 119 |
return; |
|---|
| 120 |
} |
|---|
| 121 |
super(cast(GObject*)gDBusMessage); |
|---|
| 122 |
this.gDBusMessage = gDBusMessage; |
|---|
| 123 |
} |
|---|
| 124 |
|
|---|
| 125 |
protected override void setStruct(GObject* obj) |
|---|
| 126 |
{ |
|---|
| 127 |
super.setStruct(obj); |
|---|
| 128 |
gDBusMessage = cast(GDBusMessage*)obj; |
|---|
| 129 |
} |
|---|
| 130 |
|
|---|
| 131 |
/** |
|---|
| 132 |
*/ |
|---|
| 133 |
|
|---|
| 134 |
/** |
|---|
| 135 |
* Creates a new empty GDBusMessage. |
|---|
| 136 |
* Since 2.26 |
|---|
| 137 |
* Throws: ConstructionException GTK+ fails to create the object. |
|---|
| 138 |
*/ |
|---|
| 139 |
public this () |
|---|
| 140 |
{ |
|---|
| 141 |
// GDBusMessage * g_dbus_message_new (void); |
|---|
| 142 |
auto p = g_dbus_message_new(); |
|---|
| 143 |
if(p is null) |
|---|
| 144 |
{ |
|---|
| 145 |
throw new ConstructionException("null returned by g_dbus_message_new()"); |
|---|
| 146 |
} |
|---|
| 147 |
this(cast(GDBusMessage*) p); |
|---|
| 148 |
} |
|---|
| 149 |
|
|---|
| 150 |
/** |
|---|
| 151 |
* Creates a new GDBusMessage for a signal emission. |
|---|
| 152 |
* Since 2.26 |
|---|
| 153 |
* Params: |
|---|
| 154 |
* path = A valid object path. |
|---|
| 155 |
* signal = A valid signal name. |
|---|
| 156 |
* Throws: ConstructionException GTK+ fails to create the object. |
|---|
| 157 |
*/ |
|---|
| 158 |
public this (string path, string intrface, string signal) |
|---|
| 159 |
{ |
|---|
| 160 |
// GDBusMessage * g_dbus_message_new_signal (const gchar *path, const gchar *interface_, const gchar *signal); |
|---|
| 161 |
auto p = g_dbus_message_new_signal(Str.toStringz(path), Str.toStringz(intrface), Str.toStringz(signal)); |
|---|
| 162 |
if(p is null) |
|---|
| 163 |
{ |
|---|
| 164 |
throw new ConstructionException("null returned by g_dbus_message_new_signal(Str.toStringz(path), Str.toStringz(intrface), Str.toStringz(signal))"); |
|---|
| 165 |
} |
|---|
| 166 |
this(cast(GDBusMessage*) p); |
|---|
| 167 |
} |
|---|
| 168 |
|
|---|
| 169 |
/** |
|---|
| 170 |
* Creates a new GDBusMessage for a method call. |
|---|
| 171 |
* Since 2.26 |
|---|
| 172 |
* Params: |
|---|
| 173 |
* name = A valid D-Bus name or NULL. |
|---|
| 174 |
* path = A valid object path. |
|---|
| 175 |
* method = A valid method name. |
|---|
| 176 |
* Throws: ConstructionException GTK+ fails to create the object. |
|---|
| 177 |
*/ |
|---|
| 178 |
public this (string name, string path, string intrface, string method) |
|---|
| 179 |
{ |
|---|
| 180 |
// GDBusMessage * g_dbus_message_new_method_call (const gchar *name, const gchar *path, const gchar *interface_, const gchar *method); |
|---|
| 181 |
auto p = g_dbus_message_new_method_call(Str.toStringz(name), Str.toStringz(path), Str.toStringz(intrface), Str.toStringz(method)); |
|---|
| 182 |
if(p is null) |
|---|
| 183 |
{ |
|---|
| 184 |
throw new ConstructionException("null returned by g_dbus_message_new_method_call(Str.toStringz(name), Str.toStringz(path), Str.toStringz(intrface), Str.toStringz(method))"); |
|---|
| 185 |
} |
|---|
| 186 |
this(cast(GDBusMessage*) p); |
|---|
| 187 |
} |
|---|
| 188 |
|
|---|
| 189 |
/** |
|---|
| 190 |
* Creates a new GDBusMessage that is a reply to method_call_message. |
|---|
| 191 |
* Since 2.26 |
|---|
| 192 |
* Params: |
|---|
| 193 |
* methodCallMessage = A message of type G_DBUS_MESSAGE_TYPE_METHOD_CALL to |
|---|
| 194 |
* create a reply message to. |
|---|
| 195 |
* Throws: ConstructionException GTK+ fails to create the object. |
|---|
| 196 |
*/ |
|---|
| 197 |
public this (DBusMessage methodCallMessage) |
|---|
| 198 |
{ |
|---|
| 199 |
// GDBusMessage * g_dbus_message_new_method_reply (GDBusMessage *method_call_message); |
|---|
| 200 |
auto p = g_dbus_message_new_method_reply((methodCallMessage is null) ? null : methodCallMessage.getDBusMessageStruct()); |
|---|
| 201 |
if(p is null) |
|---|
| 202 |
{ |
|---|
| 203 |
throw new ConstructionException("null returned by g_dbus_message_new_method_reply((methodCallMessage is null) ? null : methodCallMessage.getDBusMessageStruct())"); |
|---|
| 204 |
} |
|---|
| 205 |
this(cast(GDBusMessage*) p); |
|---|
| 206 |
} |
|---|
| 207 |
|
|---|
| 208 |
/** |
|---|
| 209 |
* Like g_dbus_message_new_method_error() but intended for language bindings. |
|---|
| 210 |
* Since 2.26 |
|---|
| 211 |
* Params: |
|---|
| 212 |
* methodCallMessage = A message of type G_DBUS_MESSAGE_TYPE_METHOD_CALL to |
|---|
| 213 |
* create a reply message to. |
|---|
| 214 |
* errorName = A valid D-Bus error name. |
|---|
| 215 |
* errorMessageFormat = The D-Bus error message in a printf() format. |
|---|
| 216 |
* varArgs = Arguments for error_message_format. |
|---|
| 217 |
* Throws: ConstructionException GTK+ fails to create the object. |
|---|
| 218 |
*/ |
|---|
| 219 |
public this (DBusMessage methodCallMessage, string errorName, string errorMessageFormat, void* varArgs) |
|---|
| 220 |
{ |
|---|
| 221 |
// GDBusMessage * g_dbus_message_new_method_error_valist (GDBusMessage *method_call_message, const gchar *error_name, const gchar *error_message_format, va_list var_args); |
|---|
| 222 |
auto p = g_dbus_message_new_method_error_valist((methodCallMessage is null) ? null : methodCallMessage.getDBusMessageStruct(), Str.toStringz(errorName), Str.toStringz(errorMessageFormat), varArgs); |
|---|
| 223 |
if(p is null) |
|---|
| 224 |
{ |
|---|
| 225 |
throw new ConstructionException("null returned by g_dbus_message_new_method_error_valist((methodCallMessage is null) ? null : methodCallMessage.getDBusMessageStruct(), Str.toStringz(errorName), Str.toStringz(errorMessageFormat), varArgs)"); |
|---|
| 226 |
} |
|---|
| 227 |
this(cast(GDBusMessage*) p); |
|---|
| 228 |
} |
|---|
| 229 |
|
|---|
| 230 |
/** |
|---|
| 231 |
* Creates a new GDBusMessage that is an error reply to method_call_message. |
|---|
| 232 |
* Since 2.26 |
|---|
| 233 |
* Params: |
|---|
| 234 |
* methodCallMessage = A message of type G_DBUS_MESSAGE_TYPE_METHOD_CALL to |
|---|
| 235 |
* create a reply message to. |
|---|
| 236 |
* errorName = A valid D-Bus error name. |
|---|
| 237 |
* errorMessage = The D-Bus error message. |
|---|
| 238 |
* Throws: ConstructionException GTK+ fails to create the object. |
|---|
| 239 |
*/ |
|---|
| 240 |
public this (DBusMessage methodCallMessage, string errorName, string errorMessage) |
|---|
| 241 |
{ |
|---|
| 242 |
// GDBusMessage * g_dbus_message_new_method_error_literal (GDBusMessage *method_call_message, const gchar *error_name, const gchar *error_message); |
|---|
| 243 |
auto p = g_dbus_message_new_method_error_literal((methodCallMessage is null) ? null : methodCallMessage.getDBusMessageStruct(), Str.toStringz(errorName), Str.toStringz(errorMessage)); |
|---|
| 244 |
if(p is null) |
|---|
| 245 |
{ |
|---|
| 246 |
throw new ConstructionException("null returned by g_dbus_message_new_method_error_literal((methodCallMessage is null) ? null : methodCallMessage.getDBusMessageStruct(), Str.toStringz(errorName), Str.toStringz(errorMessage))"); |
|---|
| 247 |
} |
|---|
| 248 |
this(cast(GDBusMessage*) p); |
|---|
| 249 |
} |
|---|
| 250 |
|
|---|
| 251 |
/** |
|---|
| 252 |
* Produces a human-readable multi-line description of message. |
|---|
| 253 |
* The contents of the description has no ABI guarantees, the contents |
|---|
| 254 |
* and formatting is subject to change at any time. Typical output |
|---|
| 255 |
* Since 2.26 |
|---|
| 256 |
* Params: |
|---|
| 257 |
* indent = Indentation level. |
|---|
| 258 |
* Returns: A string that should be freed with g_free(). |
|---|
| 259 |
*/ |
|---|
| 260 |
public string print(uint indent) |
|---|
| 261 |
{ |
|---|
| 262 |
// gchar * g_dbus_message_print (GDBusMessage *message, guint indent); |
|---|
| 263 |
return Str.toString(g_dbus_message_print(gDBusMessage, indent)); |
|---|
| 264 |
} |
|---|
| 265 |
|
|---|
| 266 |
/** |
|---|
| 267 |
* Checks whether message is locked. To monitor changes to this |
|---|
| 268 |
* value, conncet to the "notify" signal to listen for changes |
|---|
| 269 |
* on the "locked" property. |
|---|
| 270 |
* Since 2.26 |
|---|
| 271 |
* Returns: TRUE if message is locked, FALSE otherwise. |
|---|
| 272 |
*/ |
|---|
| 273 |
public int getLocked() |
|---|
| 274 |
{ |
|---|
| 275 |
// gboolean g_dbus_message_get_locked (GDBusMessage *message); |
|---|
| 276 |
return g_dbus_message_get_locked(gDBusMessage); |
|---|
| 277 |
} |
|---|
| 278 |
|
|---|
| 279 |
/** |
|---|
| 280 |
* If message is locked, does nothing. Otherwise locks the message. |
|---|
| 281 |
* Since 2.26 |
|---|
| 282 |
*/ |
|---|
| 283 |
public void lock() |
|---|
| 284 |
{ |
|---|
| 285 |
// void g_dbus_message_lock (GDBusMessage *message); |
|---|
| 286 |
g_dbus_message_lock(gDBusMessage); |
|---|
| 287 |
} |
|---|
| 288 |
|
|---|
| 289 |
/** |
|---|
| 290 |
* Copies message. The copy is a deep copy and the returned |
|---|
| 291 |
* GDBusMessage is completely identical except that it is guaranteed |
|---|
| 292 |
* to not be locked. |
|---|
| 293 |
* This operation can fail if e.g. message contains file descriptors |
|---|
| 294 |
* and the per-process or system-wide open files limit is reached. |
|---|
| 295 |
* Since 2.26 |
|---|
| 296 |
* Returns: A new GDBusMessage or NULL if error is set. Free with g_object_unref(). [transfer full] |
|---|
| 297 |
* Throws: GException on failure. |
|---|
| 298 |
*/ |
|---|
| 299 |
public DBusMessage copy() |
|---|
| 300 |
{ |
|---|
| 301 |
// GDBusMessage * g_dbus_message_copy (GDBusMessage *message, GError **error); |
|---|
| 302 |
GError* err = null; |
|---|
| 303 |
|
|---|
| 304 |
auto p = g_dbus_message_copy(gDBusMessage, &err); |
|---|
| 305 |
|
|---|
| 306 |
if (err !is null) |
|---|
| 307 |
{ |
|---|
| 308 |
throw new GException( new ErrorG(err) ); |
|---|
| 309 |
} |
|---|
| 310 |
|
|---|
| 311 |
if(p is null) |
|---|
| 312 |
{ |
|---|
| 313 |
return null; |
|---|
| 314 |
} |
|---|
| 315 |
return new DBusMessage(cast(GDBusMessage*) p); |
|---|
| 316 |
} |
|---|
| 317 |
|
|---|
| 318 |
/** |
|---|
| 319 |
* Gets the byte order of message. |
|---|
| 320 |
* Returns: The byte order. |
|---|
| 321 |
*/ |
|---|
| 322 |
public GDBusMessageByteOrder getByteOrder() |
|---|
| 323 |
{ |
|---|
| 324 |
// GDBusMessageByteOrder g_dbus_message_get_byte_order (GDBusMessage *message); |
|---|
| 325 |
return g_dbus_message_get_byte_order(gDBusMessage); |
|---|
| 326 |
} |
|---|
| 327 |
|
|---|
| 328 |
/** |
|---|
| 329 |
* Sets the byte order of message. |
|---|
| 330 |
* Params: |
|---|
| 331 |
* byteOrder = The byte order. |
|---|
| 332 |
*/ |
|---|
| 333 |
public void setByteOrder(GDBusMessageByteOrder byteOrder) |
|---|
| 334 |
{ |
|---|
| 335 |
// void g_dbus_message_set_byte_order (GDBusMessage *message, GDBusMessageByteOrder byte_order); |
|---|
| 336 |
g_dbus_message_set_byte_order(gDBusMessage, byteOrder); |
|---|
| 337 |
} |
|---|
| 338 |
|
|---|
| 339 |
/** |
|---|
| 340 |
* Gets the type of message. |
|---|
| 341 |
* Since 2.26 |
|---|
| 342 |
* Returns: A 8-bit unsigned integer (typically a value from the GDBusMessageType enumeration). |
|---|
| 343 |
*/ |
|---|
| 344 |
public GDBusMessageType getMessageType() |
|---|
| 345 |
{ |
|---|
| 346 |
// GDBusMessageType g_dbus_message_get_message_type (GDBusMessage *message); |
|---|
| 347 |
return g_dbus_message_get_message_type(gDBusMessage); |
|---|
| 348 |
} |
|---|
| 349 |
|
|---|
| 350 |
/** |
|---|
| 351 |
* Sets message to be of type. |
|---|
| 352 |
* Since 2.26 |
|---|
| 353 |
* Params: |
|---|
| 354 |
* type = A 8-bit unsigned integer (typically a value from the GDBusMessageType enumeration). |
|---|
| 355 |
*/ |
|---|
| 356 |
public void setMessageType(GDBusMessageType type) |
|---|
| 357 |
{ |
|---|
| 358 |
// void g_dbus_message_set_message_type (GDBusMessage *message, GDBusMessageType type); |
|---|
| 359 |
g_dbus_message_set_message_type(gDBusMessage, type); |
|---|
| 360 |
} |
|---|
| 361 |
|
|---|
| 362 |
/** |
|---|
| 363 |
* Gets the serial for message. |
|---|
| 364 |
* Since 2.26 |
|---|
| 365 |
* Returns: A guint32. |
|---|
| 366 |
*/ |
|---|
| 367 |
public uint getSerial() |
|---|
| 368 |
{ |
|---|
| 369 |
// guint32 g_dbus_message_get_serial (GDBusMessage *message); |
|---|
| 370 |
return g_dbus_message_get_serial(gDBusMessage); |
|---|
| 371 |
} |
|---|
| 372 |
|
|---|
| 373 |
/** |
|---|
| 374 |
* Sets the serial for message. |
|---|
| 375 |
* Since 2.26 |
|---|
| 376 |
* Params: |
|---|
| 377 |
* serial = A guint32. |
|---|
| 378 |
*/ |
|---|
| 379 |
public void setSerial(uint serial) |
|---|
| 380 |
{ |
|---|
| 381 |
// void g_dbus_message_set_serial (GDBusMessage *message, guint32 serial); |
|---|
| 382 |
g_dbus_message_set_serial(gDBusMessage, serial); |
|---|
| 383 |
} |
|---|
| 384 |
|
|---|
| 385 |
/** |
|---|
| 386 |
* Gets the flags for message. |
|---|
| 387 |
* Since 2.26 |
|---|
| 388 |
* Returns: Flags that are set (typically values from the GDBusMessageFlags enumeration bitwise ORed together). |
|---|
| 389 |
*/ |
|---|
| 390 |
public GDBusMessageFlags getFlags() |
|---|
| 391 |
{ |
|---|
| 392 |
// GDBusMessageFlags g_dbus_message_get_flags (GDBusMessage *message); |
|---|
| 393 |
return g_dbus_message_get_flags(gDBusMessage); |
|---|
| 394 |
} |
|---|
| 395 |
|
|---|
| 396 |
/** |
|---|
| 397 |
* Sets the flags to set on message. |
|---|
| 398 |
* Since 2.26 |
|---|
| 399 |
* Params: |
|---|
| 400 |
* flags = Flags for message that are set (typically values from the GDBusMessageFlags |
|---|
| 401 |
* enumeration bitwise ORed together). |
|---|
| 402 |
*/ |
|---|
| 403 |
public void setFlags(GDBusMessageFlags flags) |
|---|
| 404 |
{ |
|---|
| 405 |
// void g_dbus_message_set_flags (GDBusMessage *message, GDBusMessageFlags flags); |
|---|
| 406 |
g_dbus_message_set_flags(gDBusMessage, flags); |
|---|
| 407 |
} |
|---|
| 408 |
|
|---|
| 409 |
/** |
|---|
| 410 |
* Gets the body of a message. |
|---|
| 411 |
* Since 2.26 |
|---|
| 412 |
* Returns: A GVariant or NULL if the body is empty. Do not free, it is owned by message. |
|---|
| 413 |
*/ |
|---|
| 414 |
public Variant getBody() |
|---|
| 415 |
{ |
|---|
| 416 |
// GVariant * g_dbus_message_get_body (GDBusMessage *message); |
|---|
| 417 |
auto p = g_dbus_message_get_body(gDBusMessage); |
|---|
| 418 |
if(p is null) |
|---|
| 419 |
{ |
|---|
| 420 |
return null; |
|---|
| 421 |
} |
|---|
| 422 |
return new Variant(cast(GVariant*) p); |
|---|
| 423 |
} |
|---|
| 424 |
|
|---|
| 425 |
/** |
|---|
| 426 |
* Sets the body message. As a side-effect the |
|---|
| 427 |
* G_DBUS_MESSAGE_HEADER_FIELD_SIGNATURE header field is set to the |
|---|
| 428 |
* type string of body (or cleared if body is NULL). |
|---|
| 429 |
* If body is floating, message assumes ownership of body. |
|---|
| 430 |
* Since 2.26 |
|---|
| 431 |
*/ |
|---|
| 432 |
public void setBody(Variant bod) |
|---|
| 433 |
{ |
|---|
| 434 |
// void g_dbus_message_set_body (GDBusMessage *message, GVariant *body); |
|---|
| 435 |
g_dbus_message_set_body(gDBusMessage, (bod is null) ? null : bod.getVariantStruct()); |
|---|
| 436 |
} |
|---|
| 437 |
|
|---|
| 438 |
/** |
|---|
| 439 |
* Gets the UNIX file descriptors associated with message, if any. |
|---|
| 440 |
* This method is only available on UNIX. |
|---|
| 441 |
* Since 2.26 |
|---|
| 442 |
* Returns: A GUnixFDList or NULL if no file descriptors are associated. Do not free, this object is owned by message. [transfer none] |
|---|
| 443 |
*/ |
|---|
| 444 |
public UnixFDList getUnixFdList() |
|---|
| 445 |
{ |
|---|
| 446 |
// GUnixFDList * g_dbus_message_get_unix_fd_list (GDBusMessage *message); |
|---|
| 447 |
auto p = g_dbus_message_get_unix_fd_list(gDBusMessage); |
|---|
| 448 |
if(p is null) |
|---|
| 449 |
{ |
|---|
| 450 |
return null; |
|---|
| 451 |
} |
|---|
| 452 |
return new UnixFDList(cast(GUnixFDList*) p); |
|---|
| 453 |
} |
|---|
| 454 |
|
|---|
| 455 |
/** |
|---|
| 456 |
* Sets the UNIX file descriptors associated with message. As a |
|---|
| 457 |
* side-effect the G_DBUS_MESSAGE_HEADER_FIELD_NUM_UNIX_FDS header |
|---|
| 458 |
* field is set to the number of fds in fd_list (or cleared if |
|---|
| 459 |
* fd_list is NULL). |
|---|
| 460 |
* This method is only available on UNIX. |
|---|
| 461 |
* Since 2.26 |
|---|
| 462 |
* Params: |
|---|
| 463 |
* fdList = A GUnixFDList or NULL. [allow-none] |
|---|
| 464 |
*/ |
|---|
| 465 |
public void setUnixFdList(UnixFDList fdList) |
|---|
| 466 |
{ |
|---|
| 467 |
// void g_dbus_message_set_unix_fd_list (GDBusMessage *message, GUnixFDList *fd_list); |
|---|
| 468 |
g_dbus_message_set_unix_fd_list(gDBusMessage, (fdList is null) ? null : fdList.getUnixFDListStruct()); |
|---|
| 469 |
} |
|---|
| 470 |
|
|---|
| 471 |
/** |
|---|
| 472 |
* Convenience getter for the G_DBUS_MESSAGE_HEADER_FIELD_NUM_UNIX_FDS header field. |
|---|
| 473 |
* Since 2.26 |
|---|
| 474 |
* Returns: The value. |
|---|
| 475 |
*/ |
|---|
| 476 |
public uint getNumUnixFds() |
|---|
| 477 |
{ |
|---|
| 478 |
// guint32 g_dbus_message_get_num_unix_fds (GDBusMessage *message); |
|---|
| 479 |
return g_dbus_message_get_num_unix_fds(gDBusMessage); |
|---|
| 480 |
} |
|---|
| 481 |
|
|---|
| 482 |
/** |
|---|
| 483 |
* Convenience setter for the G_DBUS_MESSAGE_HEADER_FIELD_NUM_UNIX_FDS header field. |
|---|
| 484 |
* Since 2.26 |
|---|
| 485 |
* Params: |
|---|
| 486 |
* value = The value to set. |
|---|
| 487 |
*/ |
|---|
| 488 |
public void setNumUnixFds(uint value) |
|---|
| 489 |
{ |
|---|
| 490 |
// void g_dbus_message_set_num_unix_fds (GDBusMessage *message, guint32 value); |
|---|
| 491 |
g_dbus_message_set_num_unix_fds(gDBusMessage, value); |
|---|
| 492 |
} |
|---|
| 493 |
|
|---|
| 494 |
/** |
|---|
| 495 |
* Gets an array of all header fields on message that are set. |
|---|
| 496 |
* Since 2.26 |
|---|
| 497 |
* Returns: An array of header fields terminated by G_DBUS_MESSAGE_HEADER_FIELD_INVALID. Each element is a guchar. Free with g_free(). |
|---|
| 498 |
*/ |
|---|
| 499 |
public char* getHeaderFields() |
|---|
| 500 |
{ |
|---|
| 501 |
// guchar * g_dbus_message_get_header_fields (GDBusMessage *message); |
|---|
| 502 |
return g_dbus_message_get_header_fields(gDBusMessage); |
|---|
| 503 |
} |
|---|
| 504 |
|
|---|
| 505 |
/** |
|---|
| 506 |
* Gets a header field on message. |
|---|
| 507 |
* Since 2.26 |
|---|
| 508 |
* Params: |
|---|
| 509 |
* headerField = A 8-bit unsigned integer (typically a value from the GDBusMessageHeaderField enumeration) |
|---|
| 510 |
* Returns: A GVariant with the value if the header was found, NULL otherwise. Do not free, it is owned by message. |
|---|
| 511 |
*/ |
|---|
| 512 |
public Variant getHeader(GDBusMessageHeaderField headerField) |
|---|
| 513 |
{ |
|---|
| 514 |
// GVariant * g_dbus_message_get_header (GDBusMessage *message, GDBusMessageHeaderField header_field); |
|---|
| 515 |
auto p = g_dbus_message_get_header(gDBusMessage, headerField); |
|---|
| 516 |
if(p is null) |
|---|
| 517 |
{ |
|---|
| 518 |
return null; |
|---|
| 519 |
} |
|---|
| 520 |
return new Variant(cast(GVariant*) p); |
|---|
| 521 |
} |
|---|
| 522 |
|
|---|
| 523 |
/** |
|---|
| 524 |
* Sets a header field on message. |
|---|
| 525 |
* If value is floating, message assumes ownership of value. |
|---|
| 526 |
* Since 2.26 |
|---|
| 527 |
* Params: |
|---|
| 528 |
* headerField = A 8-bit unsigned integer (typically a value from the GDBusMessageHeaderField enumeration) |
|---|
| 529 |
* value = A GVariant to set the header field or NULL to clear the header field. |
|---|
| 530 |
*/ |
|---|
| 531 |
public void setHeader(GDBusMessageHeaderField headerField, Variant value) |
|---|
| 532 |
{ |
|---|
| 533 |
// void g_dbus_message_set_header (GDBusMessage *message, GDBusMessageHeaderField header_field, GVariant *value); |
|---|
| 534 |
g_dbus_message_set_header(gDBusMessage, headerField, (value is null) ? null : value.getVariantStruct()); |
|---|
| 535 |
} |
|---|
| 536 |
|
|---|
| 537 |
/** |
|---|
| 538 |
* Convenience getter for the G_DBUS_MESSAGE_HEADER_FIELD_DESTINATION header field. |
|---|
| 539 |
* Since 2.26 |
|---|
| 540 |
* Returns: The value. |
|---|
| 541 |
*/ |
|---|
| 542 |
public string getDestination() |
|---|
| 543 |
{ |
|---|
| 544 |
// const gchar * g_dbus_message_get_destination (GDBusMessage *message); |
|---|
| 545 |
return Str.toString(g_dbus_message_get_destination(gDBusMessage)); |
|---|
| 546 |
} |
|---|
| 547 |
|
|---|
| 548 |
/** |
|---|
| 549 |
* Convenience setter for the G_DBUS_MESSAGE_HEADER_FIELD_DESTINATION header field. |
|---|
| 550 |
* Since 2.26 |
|---|
| 551 |
* Params: |
|---|
| 552 |
* value = The value to set. |
|---|
| 553 |
*/ |
|---|
| 554 |
public void setDestination(string value) |
|---|
| 555 |
{ |
|---|
| 556 |
// void g_dbus_message_set_destination (GDBusMessage *message, const gchar *value); |
|---|
| 557 |
g_dbus_message_set_destination(gDBusMessage, Str.toStringz(value)); |
|---|
| 558 |
} |
|---|
| 559 |
|
|---|
| 560 |
/** |
|---|
| 561 |
* Convenience getter for the G_DBUS_MESSAGE_HEADER_FIELD_ERROR_NAME header field. |
|---|
| 562 |
* Since 2.26 |
|---|
| 563 |
* Returns: The value. |
|---|
| 564 |
*/ |
|---|
| 565 |
public string getErrorName() |
|---|
| 566 |
{ |
|---|
| 567 |
// const gchar * g_dbus_message_get_error_name (GDBusMessage *message); |
|---|
| 568 |
return Str.toString(g_dbus_message_get_error_name(gDBusMessage)); |
|---|
| 569 |
} |
|---|
| 570 |
|
|---|
| 571 |
/** |
|---|
| 572 |
* Convenience setter for the G_DBUS_MESSAGE_HEADER_FIELD_ERROR_NAME header field. |
|---|
| 573 |
* Since 2.26 |
|---|
| 574 |
* Params: |
|---|
| 575 |
* value = The value to set. |
|---|
| 576 |
*/ |
|---|
| 577 |
public void setErrorName(string value) |
|---|
| 578 |
{ |
|---|
| 579 |
// void g_dbus_message_set_error_name (GDBusMessage *message, const gchar *value); |
|---|
| 580 |
g_dbus_message_set_error_name(gDBusMessage, Str.toStringz(value)); |
|---|
| 581 |
} |
|---|
| 582 |
|
|---|
| 583 |
/** |
|---|
| 584 |
* Convenience getter for the G_DBUS_MESSAGE_HEADER_FIELD_INTERFACE header field. |
|---|
| 585 |
* Since 2.26 |
|---|
| 586 |
* Returns: The value. |
|---|
| 587 |
*/ |
|---|
| 588 |
public string getInterface() |
|---|
| 589 |
{ |
|---|
| 590 |
// const gchar * g_dbus_message_get_interface (GDBusMessage *message); |
|---|
| 591 |
return Str.toString(g_dbus_message_get_interface(gDBusMessage)); |
|---|
| 592 |
} |
|---|
| 593 |
|
|---|
| 594 |
/** |
|---|
| 595 |
* Convenience setter for the G_DBUS_MESSAGE_HEADER_FIELD_INTERFACE header field. |
|---|
| 596 |
* Since 2.26 |
|---|
| 597 |
* Params: |
|---|
| 598 |
* value = The value to set. |
|---|
| 599 |
*/ |
|---|
| 600 |
public void setInterface(string value) |
|---|
| 601 |
{ |
|---|
| 602 |
// void g_dbus_message_set_interface (GDBusMessage *message, const gchar *value); |
|---|
| 603 |
g_dbus_message_set_interface(gDBusMessage, Str.toStringz(value)); |
|---|
| 604 |
} |
|---|
| 605 |
|
|---|
| 606 |
/** |
|---|
| 607 |
* Convenience getter for the G_DBUS_MESSAGE_HEADER_FIELD_MEMBER header field. |
|---|
| 608 |
* Since 2.26 |
|---|
| 609 |
* Returns: The value. |
|---|
| 610 |
*/ |
|---|
| 611 |
public string getMember() |
|---|
| 612 |
{ |
|---|
| 613 |
// const gchar * g_dbus_message_get_member (GDBusMessage *message); |
|---|
| 614 |
return Str.toString(g_dbus_message_get_member(gDBusMessage)); |
|---|
| 615 |
} |
|---|
| 616 |
|
|---|
| 617 |
/** |
|---|
| 618 |
* Convenience setter for the G_DBUS_MESSAGE_HEADER_FIELD_MEMBER header field. |
|---|
| 619 |
* Since 2.26 |
|---|
| 620 |
* Params: |
|---|
| 621 |
* value = The value to set. |
|---|
| 622 |
*/ |
|---|
| 623 |
public void setMember(string value) |
|---|
| 624 |
{ |
|---|
| 625 |
// void g_dbus_message_set_member (GDBusMessage *message, const gchar *value); |
|---|
| 626 |
g_dbus_message_set_member(gDBusMessage, Str.toStringz(value)); |
|---|
| 627 |
} |
|---|
| 628 |
|
|---|
| 629 |
/** |
|---|
| 630 |
* Convenience getter for the G_DBUS_MESSAGE_HEADER_FIELD_PATH header field. |
|---|
| 631 |
* Since 2.26 |
|---|
| 632 |
* Returns: The value. |
|---|
| 633 |
*/ |
|---|
| 634 |
public string getPath() |
|---|
| 635 |
{ |
|---|
| 636 |
// const gchar * g_dbus_message_get_path (GDBusMessage *message); |
|---|
| 637 |
return Str.toString(g_dbus_message_get_path(gDBusMessage)); |
|---|
| 638 |
} |
|---|
| 639 |
|
|---|
| 640 |
/** |
|---|
| 641 |
* Convenience setter for the G_DBUS_MESSAGE_HEADER_FIELD_PATH header field. |
|---|
| 642 |
* Since 2.26 |
|---|
| 643 |
* Params: |
|---|
| 644 |
* value = The value to set. |
|---|
| 645 |
*/ |
|---|
| 646 |
public void setPath(string value) |
|---|
| 647 |
{ |
|---|
| 648 |
// void g_dbus_message_set_path (GDBusMessage *message, const gchar *value); |
|---|
| 649 |
g_dbus_message_set_path(gDBusMessage, Str.toStringz(value)); |
|---|
| 650 |
} |
|---|
| 651 |
|
|---|
| 652 |
/** |
|---|
| 653 |
* Convenience getter for the G_DBUS_MESSAGE_HEADER_FIELD_REPLY_SERIAL header field. |
|---|
| 654 |
* Since 2.26 |
|---|
| 655 |
* Returns: The value. |
|---|
| 656 |
*/ |
|---|
| 657 |
public uint getReplySerial() |
|---|
| 658 |
{ |
|---|
| 659 |
// guint32 g_dbus_message_get_reply_serial (GDBusMessage *message); |
|---|
| 660 |
return g_dbus_message_get_reply_serial(gDBusMessage); |
|---|
| 661 |
} |
|---|
| 662 |
|
|---|
| 663 |
/** |
|---|
| 664 |
* Convenience setter for the G_DBUS_MESSAGE_HEADER_FIELD_REPLY_SERIAL header field. |
|---|
| 665 |
* Since 2.26 |
|---|
| 666 |
* Params: |
|---|
| 667 |
* value = The value to set. |
|---|
| 668 |
*/ |
|---|
| 669 |
public void setReplySerial(uint value) |
|---|
| 670 |
{ |
|---|
| 671 |
// void g_dbus_message_set_reply_serial (GDBusMessage *message, guint32 value); |
|---|
| 672 |
g_dbus_message_set_reply_serial(gDBusMessage, value); |
|---|
| 673 |
} |
|---|
| 674 |
|
|---|
| 675 |
/** |
|---|
| 676 |
* Convenience getter for the G_DBUS_MESSAGE_HEADER_FIELD_SENDER header field. |
|---|
| 677 |
* Since 2.26 |
|---|
| 678 |
* Returns: The value. |
|---|
| 679 |
*/ |
|---|
| 680 |
public string getSender() |
|---|
| 681 |
{ |
|---|
| 682 |
// const gchar * g_dbus_message_get_sender (GDBusMessage *message); |
|---|
| 683 |
return Str.toString(g_dbus_message_get_sender(gDBusMessage)); |
|---|
| 684 |
} |
|---|
| 685 |
|
|---|
| 686 |
/** |
|---|
| 687 |
* Convenience setter for the G_DBUS_MESSAGE_HEADER_FIELD_SENDER header field. |
|---|
| 688 |
* Since 2.26 |
|---|
| 689 |
* Params: |
|---|
| 690 |
* value = The value to set. |
|---|
| 691 |
*/ |
|---|
| 692 |
public void setSender(string value) |
|---|
| 693 |
{ |
|---|
| 694 |
// void g_dbus_message_set_sender (GDBusMessage *message, const gchar *value); |
|---|
| 695 |
g_dbus_message_set_sender(gDBusMessage, Str.toStringz(value)); |
|---|
| 696 |
} |
|---|
| 697 |
|
|---|
| 698 |
/** |
|---|
| 699 |
* Convenience getter for the G_DBUS_MESSAGE_HEADER_FIELD_SIGNATURE header field. |
|---|
| 700 |
* Since 2.26 |
|---|
| 701 |
* Returns: The value. |
|---|
| 702 |
*/ |
|---|
| 703 |
public string getSignature() |
|---|
| 704 |
{ |
|---|
| 705 |
// const gchar * g_dbus_message_get_signature (GDBusMessage *message); |
|---|
| 706 |
return Str.toString(g_dbus_message_get_signature(gDBusMessage)); |
|---|
| 707 |
} |
|---|
| 708 |
|
|---|
| 709 |
/** |
|---|
| 710 |
* Convenience setter for the G_DBUS_MESSAGE_HEADER_FIELD_SIGNATURE header field. |
|---|
| 711 |
* Since 2.26 |
|---|
| 712 |
* Params: |
|---|
| 713 |
* value = The value to set. |
|---|
| 714 |
*/ |
|---|
| 715 |
public void setSignature(string value) |
|---|
| 716 |
{ |
|---|
| 717 |
// void g_dbus_message_set_signature (GDBusMessage *message, const gchar *value); |
|---|
| 718 |
g_dbus_message_set_signature(gDBusMessage, Str.toStringz(value)); |
|---|
| 719 |
} |
|---|
| 720 |
|
|---|
| 721 |
/** |
|---|
| 722 |
* Convenience to get the first item in the body of message. |
|---|
| 723 |
* Since 2.26 |
|---|
| 724 |
* Returns: The string item or NULL if the first item in the body of message is not a string. |
|---|
| 725 |
*/ |
|---|
| 726 |
public string getArg0() |
|---|
| 727 |
{ |
|---|
| 728 |
// const gchar * g_dbus_message_get_arg0 (GDBusMessage *message); |
|---|
| 729 |
return Str.toString(g_dbus_message_get_arg0(gDBusMessage)); |
|---|
| 730 |
} |
|---|
| 731 |
|
|---|
| 732 |
/** |
|---|
| 733 |
* Serializes message to a blob. The byte order returned by |
|---|
| 734 |
* g_dbus_message_get_byte_order() will be used. |
|---|
| 735 |
* Since 2.26 |
|---|
| 736 |
* Params: |
|---|
| 737 |
* capabilities = A GDBusCapabilityFlags describing what protocol features are supported. |
|---|
| 738 |
* Returns: A pointer to a valid binary D-Bus message of out_size bytes generated by message or NULL if error is set. Free with g_free(). |
|---|
| 739 |
* Throws: GException on failure. |
|---|
| 740 |
*/ |
|---|
| 741 |
public char[] toBlob(GDBusCapabilityFlags capabilities) |
|---|
| 742 |
{ |
|---|
| 743 |
// guchar * g_dbus_message_to_blob (GDBusMessage *message, gsize *out_size, GDBusCapabilityFlags capabilities, GError **error); |
|---|
| 744 |
gsize outSize; |
|---|
| 745 |
GError* err = null; |
|---|
| 746 |
|
|---|
| 747 |
auto p = g_dbus_message_to_blob(gDBusMessage, &outSize, capabilities, &err); |
|---|
| 748 |
|
|---|
| 749 |
if (err !is null) |
|---|
| 750 |
{ |
|---|
| 751 |
throw new GException( new ErrorG(err) ); |
|---|
| 752 |
} |
|---|
| 753 |
|
|---|
| 754 |
return p[0 .. outSize]; |
|---|
| 755 |
} |
|---|
| 756 |
|
|---|
| 757 |
/** |
|---|
| 758 |
* Utility function to calculate how many bytes are needed to |
|---|
| 759 |
* completely deserialize the D-Bus message stored at blob. |
|---|
| 760 |
* Since 2.26 |
|---|
| 761 |
* Params: |
|---|
| 762 |
* blob = A blob represent a binary D-Bus message. |
|---|
| 763 |
* Returns: Number of bytes needed or -1 if error is set (e.g. if blob contains invalid data or not enough data is available to determine the size). |
|---|
| 764 |
* Throws: GException on failure. |
|---|
| 765 |
*/ |
|---|
| 766 |
public static gssize bytesNeeded(char[] blob) |
|---|
| 767 |
{ |
|---|
| 768 |
// gssize g_dbus_message_bytes_needed (guchar *blob, gsize blob_len, GError **error); |
|---|
| 769 |
GError* err = null; |
|---|
| 770 |
|
|---|
| 771 |
auto p = g_dbus_message_bytes_needed(blob.ptr, cast(int) blob.length, &err); |
|---|
| 772 |
|
|---|
| 773 |
if (err !is null) |
|---|
| 774 |
{ |
|---|
| 775 |
throw new GException( new ErrorG(err) ); |
|---|
| 776 |
} |
|---|
| 777 |
|
|---|
| 778 |
return p; |
|---|
| 779 |
} |
|---|
| 780 |
|
|---|
| 781 |
/** |
|---|
| 782 |
* Creates a new GDBusMessage from the data stored at blob. The byte |
|---|
| 783 |
* order that the message was in can be retrieved using |
|---|
| 784 |
* g_dbus_message_get_byte_order(). |
|---|
| 785 |
* Since 2.26 |
|---|
| 786 |
* Params: |
|---|
| 787 |
* blob = A blob represent a binary D-Bus message. |
|---|
| 788 |
* capabilities = A GDBusCapabilityFlags describing what protocol features are supported. |
|---|
| 789 |
* Throws: GException on failure. |
|---|
| 790 |
* Throws: ConstructionException GTK+ fails to create the object. |
|---|
| 791 |
*/ |
|---|
| 792 |
public this (char[] blob, GDBusCapabilityFlags capabilities) |
|---|
| 793 |
{ |
|---|
| 794 |
// GDBusMessage * g_dbus_message_new_from_blob (guchar *blob, gsize blob_len, GDBusCapabilityFlags capabilities, GError **error); |
|---|
| 795 |
GError* err = null; |
|---|
| 796 |
|
|---|
| 797 |
auto p = g_dbus_message_new_from_blob(blob.ptr, cast(int) blob.length, capabilities, &err); |
|---|
| 798 |
|
|---|
| 799 |
if (err !is null) |
|---|
| 800 |
{ |
|---|
| 801 |
throw new GException( new ErrorG(err) ); |
|---|
| 802 |
} |
|---|
| 803 |
|
|---|
| 804 |
if(p is null) |
|---|
| 805 |
{ |
|---|
| 806 |
throw new ConstructionException("null returned by g_dbus_message_new_from_blob(blob.ptr, cast(int) blob.length, capabilities, &err)"); |
|---|
| 807 |
} |
|---|
| 808 |
this(cast(GDBusMessage*) p); |
|---|
| 809 |
} |
|---|
| 810 |
|
|---|
| 811 |
/** |
|---|
| 812 |
* If message is not of type G_DBUS_MESSAGE_TYPE_ERROR does |
|---|
| 813 |
* nothing and returns FALSE. |
|---|
| 814 |
* Otherwise this method encodes the error in message as a GError |
|---|
| 815 |
* using g_dbus_error_set_dbus_error() using the information in the |
|---|
| 816 |
* G_DBUS_MESSAGE_HEADER_FIELD_ERROR_NAME header field of message as |
|---|
| 817 |
* well as the first string item in message's body. |
|---|
| 818 |
* Since 2.26 |
|---|
| 819 |
* Params: |
|---|
| 820 |
* error = The GError to set. |
|---|
| 821 |
* Returns: TRUE if error was set, FALSE otherwise. |
|---|
| 822 |
*/ |
|---|
| 823 |
public int toGerror(out ErrorG error) |
|---|
| 824 |
{ |
|---|
| 825 |
// gboolean g_dbus_message_to_gerror (GDBusMessage *message, GError **error); |
|---|
| 826 |
GError* outerror = null; |
|---|
| 827 |
|
|---|
| 828 |
auto p = g_dbus_message_to_gerror(gDBusMessage, &outerror); |
|---|
| 829 |
|
|---|
| 830 |
error = new ErrorG(outerror); |
|---|
| 831 |
return p; |
|---|
| 832 |
} |
|---|
| 833 |
} |
|---|