### Function

# Gio bus_watch_name_on_connection

since: 2.26

#### Declaration [src]

    guint
    g_bus_watch_name_on_connection (
      GDBusConnection* connection,
      const gchar* name,
      GBusNameWatcherFlags flags,
      GBusNameAppearedCallback name_appeared_handler,
      GBusNameVanishedCallback name_vanished_handler,
      gpointer user_data,
      GDestroyNotify user_data_free_func
    )

#### Description [src]

Like `g_bus_watch_name()` but takes a `GDBusConnection` instead of a `GBusType`.

Available since: 2.26

The implementation of this function is provided by `g_bus_watch_name_on_connection_with_closures()` in language bindings.

#### Parameters

`connection`

  Type: `GDBusConnection`

  A `GDBusConnection`.

  The data is owned by the caller of the function.

`name`

  Type: `const gchar*`

  The name (well-known or unique) to watch.

  The data is owned by the caller of the function.
  The value is a NUL terminated UTF-8 string.

`flags`

  Type: `GBusNameWatcherFlags`

  Flags from the `GBusNameWatcherFlags` enumeration.

`name_appeared_handler`

  Type: `GBusNameAppearedCallback`

  Handler to invoke when `name` is known to exist or `NULL`.

  The argument can be `NULL`.

`name_vanished_handler`

  Type: `GBusNameVanishedCallback`

  Handler to invoke when `name` is known to not exist or `NULL`.

  The argument can be `NULL`.

`user_data`

  Type: `gpointer`

  User data to pass to handlers.

  The argument can be `NULL`.
  The data is owned by the caller of the function.

`user_data_free_func`

  Type: `GDestroyNotify`

  Function for freeing `user_data` or `NULL`.

  The argument can be `NULL`.

#### Return value

Type: `guint`

An identifier (never 0) that can be used with `g_bus_unwatch_name()` to stop watching the name.