Basics

Guides

API Reference

Menu

Basics

Guides

API Reference

class: DBusMessage

[14:7] extends: object

A type for representing D-Bus messages that can be sent or received on a [class@Gio.DBusConnection].

Members

  • handleObj
  • lib
  • retainedCallbacks
  • signalHandlerNames
  • signalSetterHandlers

Methods

  • DBusMessage ()

    Creates a new empty #GDBusMessage.

  • toNativeHandle (Source)

    Normalizes a constructor argument into a raw pointer carrier. Accepts a raw NativeHandle, a raw NativeBuffer returned from fn.call(...), another generated wrapper exposing handle(), or null. Returns null when the argument carries no pointer.

    • @p Source is the raw handle, raw buffer, wrapper, or null.
    • @r A raw pointer carrier or null when no pointer is present.
  • getLib ()

    Returns the opened native library for this generated wrapper.

    • @r The opened native library.
  • handle ()

    Returns the wrapped NativeHandle.

    • @r The wrapped NativeHandle.
  • isNull ()

    Returns true when the wrapped handle is null.

    • @r A bool.
  • describe ()

    Returns a small string for debugging generated wrappers.

    • @r A string.
  • asObject ()

    Wraps this handle as Object.

    • @r A Object object.
  • copy ()

    Copies @message. The copy is a deep copy and the returned #GDBusMessage is completely identical except that it is guaranteed to not be locked. This operation can fail if e.g. @message contains file descriptors and the per-process or system-wide open files limit is reached.

  • get_arg0 ()

    Convenience to get the first item in the body of @message. See [method@Gio.DBusMessage.get_arg0_path] for returning object-path-typed arg0 values.

  • get_arg0_path ()

    Convenience to get the first item in the body of @message. See [method@Gio.DBusMessage.get_arg0] for returning string-typed arg0 values.

  • get_body ()

    Gets the body of a message.

  • get_byte_order ()

    Gets the byte order of @message.

  • get_destination ()

    Convenience getter for the %G_DBUS_MESSAGE_HEADER_FIELD_DESTINATION header field.

  • get_error_name ()

    Convenience getter for the %G_DBUS_MESSAGE_HEADER_FIELD_ERROR_NAME header field.

  • get_flags ()

    Gets the flags for @message.

  • get_header (string header_field)

    Gets a header field on @message. The caller is responsible for checking the type of the returned #GVariant matches what is expected.

    • @p header_field is A 8-bit unsigned integer (typically a value from the #GDBusMessageHeaderField enumeration).
  • get_interface ()

    Convenience getter for the %G_DBUS_MESSAGE_HEADER_FIELD_INTERFACE header field.

  • get_locked ()

    Checks whether @message is locked. To monitor changes to this value, connect to the #GObject::notify signal to listen for changes on the #GDBusMessage:locked property.

  • get_member ()

    Convenience getter for the %G_DBUS_MESSAGE_HEADER_FIELD_MEMBER header field.

  • get_message_type ()

    Gets the type of @message.

  • get_path ()

    Convenience getter for the %G_DBUS_MESSAGE_HEADER_FIELD_PATH header field.

  • get_sender ()

    Convenience getter for the %G_DBUS_MESSAGE_HEADER_FIELD_SENDER header field.

  • get_signature ()

    Convenience getter for the %G_DBUS_MESSAGE_HEADER_FIELD_SIGNATURE header field. This will always be non-%NULL, but may be an empty string.

  • get_unix_fd_list ()

    Gets the UNIX file descriptors associated with @message, if any. This method is only available on UNIX. The file descriptors normally correspond to %G_VARIANT_TYPE_HANDLE values in the body of the message. For example, if g_variant_get_handle() returns 5, that is intended to be a reference to the file descriptor that can be accessed by g_unix_fd_list_get (list, 5, ...).

  • lock ()

    If @message is locked, does nothing. Otherwise locks the message.

    • @r None.
  • new_method_error_literal (string error_name, string error_message)

    Creates a new #GDBusMessage that is an error reply to

    • @method_call_message. ``
    • @p error_name is A valid D-Bus error name..
    • @p error_message is The D-Bus error message..
  • new_method_reply ()

    Creates a new #GDBusMessage that is a reply to @method_call_message.

  • print (int indent)

    Produces a human-readable multi-line description of @message. The contents of the description has no ABI guarantees, the contents and formatting is subject to change at any time. Typical output looks something like this: Flags: none Version: 0 Serial: 4 Headers: path -> objectpath '/org/gtk/GDBus/TestObject' interface -> 'org.gtk.GDBus.TestInterface' member -> 'GimmeStdout' destination -> ':1.146' Body: () UNIX File Descriptors: (none) or Flags: no-reply-expected Version: 0 Serial: 477 Headers: reply-serial -> uint32 4 destination -> ':1.159' sender -> ':1.146' num-unix-fds -> uint32 1 Body: () UNIX File Descriptors: fd 12: dev=0:10,mode=020620,ino=5,uid=500,gid=5,rdev=136:2,size=0,atime=1273085037,mtime=1273085851,ctime=1272982635

    • @p indent is Indentation level..
  • set_body (object body)

    Sets the body @message. As a side-effect the %G_DBUS_MESSAGE_HEADER_FIELD_SIGNATURE header field is set to the type string of @body (or cleared if @body is %NULL). If @body is floating,

    • @message assumes ownership of @body.
    • @p body is Either %NULL or a #GVariant that is a tuple..
    • @r None.
  • set_byte_order (string byte_order)

    Sets the byte order of @message.

    • @p byte_order is The byte order..
    • @r None.
  • set_destination (string value)

    Convenience setter for the %G_DBUS_MESSAGE_HEADER_FIELD_DESTINATION header field.

    • @p value is The value to set..
    • @r None.
  • set_error_name (string value)

    Convenience setter for the %G_DBUS_MESSAGE_HEADER_FIELD_ERROR_NAME header field.

    • @p value is The value to set..
    • @r None.
  • set_flags (string flags)

    Sets the flags to set on @message.

    • @p flags is Flags for @message that are set (typically values from the #GDBusMessageFlags enumeration bitwise ORed together)..
    • @r None.
  • set_header (string header_field, object value)

    Sets a header field on @message. If @value is floating, @message assumes ownership of @value.

    • @p header_field is A 8-bit unsigned integer (typically a value from the #GDBusMessageHeaderField enumeration).
    • @p value is A #GVariant to set the header field or %NULL to clear the header field..
    • @r None.
  • set_interface (string value)

    Convenience setter for the %G_DBUS_MESSAGE_HEADER_FIELD_INTERFACE header field.

    • @p value is The value to set..
    • @r None.
  • set_member (string value)

    Convenience setter for the %G_DBUS_MESSAGE_HEADER_FIELD_MEMBER header field.

    • @p value is The value to set..
    • @r None.
  • set_message_type (string type)

    Sets @message to be of @type.

    • @p type is A 8-bit unsigned integer (typically a value from the #GDBusMessageType enumeration)..
    • @r None.
  • set_path (string value)

    Convenience setter for the %G_DBUS_MESSAGE_HEADER_FIELD_PATH header field.

    • @p value is The value to set..
    • @r None.
  • set_sender (string value)

    Convenience setter for the %G_DBUS_MESSAGE_HEADER_FIELD_SENDER header field.

    • @p value is The value to set..
    • @r None.
  • set_signature (string value)

    Convenience setter for the %G_DBUS_MESSAGE_HEADER_FIELD_SIGNATURE header field.

    • @p value is The value to set..
    • @r None.
  • set_unix_fd_list (object fd_list)

    Sets the UNIX file descriptors associated with @message. As a side-effect the %G_DBUS_MESSAGE_HEADER_FIELD_NUM_UNIX_FDS header field is set to the number of fds in @fd_list (or cleared if @fd_list is %NULL). This method is only available on UNIX. When designing D-Bus APIs that are intended to be interoperable, please note that non-GDBus implementations of D-Bus can usually only access file descriptors if they are referenced by a value of type %G_VARIANT_TYPE_HANDLE in the body of the message.

    • @p fd_list is A #GUnixFDList or %NULL..
    • @r None.
  • to_gerror ()

    If @message is not of type %G_DBUS_MESSAGE_TYPE_ERROR does nothing and returns %FALSE. Otherwise this method encodes the error in @message as a #GError using g_dbus_error_set_dbus_error() using the information in the %G_DBUS_MESSAGE_HEADER_FIELD_ERROR_NAME header field of @message as well as the first string item in @message's body.

class: DBusMessageMeta

[554:14] static extends: object

Generated metadata helpers for DBusMessage class surfaces.

Methods

  • properties ()

    Returns property metadata for DBusMessage.

    • @r A list.

class: DBusMessageCtors

[507:14] static extends: object

Alternate constructors for DBusMessage. Usage: DBusMessageCtors.<name>(...). The primary constructor lives directly on DBusMessage.

Methods

  • newMethodCall (string name, string path, string interface_, string method)

    Creates a new #GDBusMessage for a method call.

    • @p name is A valid D-Bus name or %NULL..
    • @p path is A valid object path..
    • @p interface_ is A valid D-Bus interface name or %NULL..
    • @p method is A valid method name..
    • @r A new DBusMessage.
  • newSignal (string path, string interface_, string signal)

    Creates a new #GDBusMessage for a signal emission.

    • @p path is A valid object path..
    • @p interface_ is A valid D-Bus interface name..
    • @p signal is A valid signal name..
    • @r A new DBusMessage.