Interface

Gio-2.0GioDBusNamespace

interface DBusNamespace {
    prototype: Gio.DBus;
    session: Gio.DBusConnection;
    system: Gio.DBusConnection;
    get(
        bus_type: Gio.BusType,
        cancellable?: Gio.Cancellable,
        callback?: AsyncReadyCallback<Gio.BusType>,
    ): void;
    get_finish(res: Gio.AsyncResult): Gio.DBusConnection;
    get_sync(
        bus_type: Gio.BusType,
        cancellable?: Gio.Cancellable,
    ): Gio.DBusConnection;
    own_name(
        bus_type: Gio.BusType,
        name: string,
        flags: Gio.BusNameOwnerFlags,
        bus_acquired_closure?: Closure<any, any>,
        name_acquired_closure?: Closure<any, any>,
        name_lost_closure?: Closure<any, any>,
    ): number;
    own_name_on_connection(
        connection: Gio.DBusConnection,
        name: string,
        flags: Gio.BusNameOwnerFlags,
        name_acquired_closure?: Closure<any, any>,
        name_lost_closure?: Closure<any, any>,
    ): number;
    unown_name(owner_id: number): void;
    unwatch_name(watcher_id: number): void;
    watch_name(
        bus_type: Gio.BusType,
        name: string,
        flags: Gio.BusNameWatcherFlags,
        name_appeared_closure?: Closure<any, any>,
        name_vanished_closure?: Closure<any, any>,
    ): number;
    watch_name_on_connection(
        connection: Gio.DBusConnection,
        name: string,
        flags: Gio.BusNameWatcherFlags,
        name_appeared_closure?: Closure<any, any>,
        name_vanished_closure?: Closure<any, any>,
    ): number;
}
Index

Properties

prototype: Gio.DBus

Methods

  • Synchronously connects to the message bus specified by bus_type. Note that the returned object may shared with other callers, e.g. if two separate parts of a process calls this function with the same bus_type, they will share the same object.

    This is a synchronous failable function. See g_bus_get() and g_bus_get_finish() for the asynchronous version.

    The returned object is a singleton, that is, shared with other callers of g_bus_get() and g_bus_get_sync() for bus_type. In the event that you need a private message bus connection, use g_dbus_address_get_for_bus_sync() and g_dbus_connection_new_for_address() with G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_CLIENT and G_DBUS_CONNECTION_FLAGS_MESSAGE_BUS_CONNECTION flags.

    Note that the returned Gio.DBusConnection object will (usually) have the Gio.DBusConnection.exit_on_close property set to true.

    Parameters

    Returns Gio.DBusConnection

  • Version of [func@Gio.bus_own_name using closures instead of callbacks for easier binding in other languages.

    Parameters

    • bus_type: Gio.BusType

      the type of bus to own a name on

    • name: string

      the well-known name to own

    • flags: Gio.BusNameOwnerFlags

      a set of flags with ownership options

    • Optionalbus_acquired_closure: Closure<any, any>

      closure to invoke when connected to the bus of type bus_type, or NULL to ignore

    • Optionalname_acquired_closure: Closure<any, any>

      closure to invoke when name is acquired, or NULL to ignore

    • Optionalname_lost_closure: Closure<any, any>

      closure to invoke when name is lost, or NULL to ignore

    Returns number

  • Stops watching a name.

    Note that there may still be D-Bus traffic to process (relating to watching and unwatching the name) in the current thread-default GLib.MainContext after this function has returned. You should continue to iterate the GLib.MainContext until the GLib.DestroyNotify function passed to g_bus_watch_name() is called, in order to avoid memory leaks through callbacks queued on the GLib.MainContext after it’s stopped being iterated.

    Parameters

    • watcher_id: number

      An identifier obtained from g_bus_watch_name()

    Returns void