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