Class (GI Class)

NM-1.0NMClient

NMClient contains a cache of the objects of NetworkManager's D-Bus API. It uses GLib.MainContext and Gio.DBusConnection for that and registers to D-Bus signals. That means, when iterating the associated GLib.MainContext, D-Bus signals gets processed and the NM.Client instance updates and emits GObject.Object signals.

Hierarchy (View Summary)

Implements

Index

Constructors

Properties

Accessors

Methods

_init activate_connection_async activate_connection_finish add_and_activate_connection_async add_and_activate_connection_finish add_and_activate_connection2 add_and_activate_connection2_finish add_connection_async add_connection_finish add_connection2 add_connection2_finish bind_property bind_property_full block_signal_handler check_connectivity check_connectivity_async check_connectivity_finish checkpoint_adjust_rollback_timeout checkpoint_adjust_rollback_timeout_finish checkpoint_create checkpoint_create_finish checkpoint_destroy checkpoint_destroy_finish checkpoint_rollback checkpoint_rollback_finish connect connect_after connectivity_check_get_available connectivity_check_get_enabled connectivity_check_get_uri connectivity_check_set_enabled dbus_call dbus_call_finish dbus_set_property dbus_set_property_finish deactivate_connection deactivate_connection_async deactivate_connection_finish disconnect emit force_floating freeze_notify get_activating_connection get_active_connections get_all_devices get_capabilities get_checkpoints get_connection_by_id get_connection_by_path get_connection_by_uuid get_connections get_connectivity get_context_busy_watcher get_data get_dbus_connection get_dbus_name_owner get_device_by_iface get_device_by_path get_devices get_dns_configuration get_dns_mode get_dns_rc_manager get_instance_flags get_logging get_main_context get_metered get_nm_running get_object_by_path get_permission_result get_permissions_state get_primary_connection get_property get_qdata get_radio_flags get_startup get_state get_version get_version_info getv init init_async init_finish is_floating load_connections load_connections_async load_connections_finish networking_get_enabled networking_set_enabled new_finish notify notify_by_pspec ref ref_sink reload reload_connections reload_connections_async reload_connections_finish reload_finish run_dispose save_hostname save_hostname_async save_hostname_finish set set_data set_logging set_property steal_data steal_qdata stop_emission_by_name thaw_notify unblock_signal_handler unref vfunc_constructed vfunc_dispatch_properties_changed vfunc_dispose vfunc_finalize vfunc_get_property vfunc_init vfunc_init_async vfunc_init_finish vfunc_notify vfunc_set_property wait_shutdown watch_closure wimax_get_enabled wimax_hardware_get_enabled wimax_set_enabled wireless_get_enabled wireless_hardware_get_enabled wireless_set_enabled wwan_get_enabled wwan_hardware_get_enabled wwan_set_enabled new new_async new_finish wait_shutdown_finish

Methods - Inherited from GObject

Constructors

Properties

Compile-time signal type information.

This instance property is generated only for TypeScript type checking. It is not defined at runtime and should not be accessed in JS code.

$gtype: GType<NM.Client>

Accessors

  • get can_modify(): boolean

    If true, adding and modifying connections is supported.

    Returns boolean

  • get canModify(): boolean

    If true, adding and modifying connections is supported.

    Returns boolean

  • get capabilities(): number[]

    The list of capabilities numbers as guint32 or null if there are no capabilities. The numeric value correspond to %NMCapability enum.

    Returns number[]

    1.24

  • get connections(): NM.RemoteConnection[]

    The list of configured connections that are available to the user. (Note that this differs from the underlying D-Bus property, which may also contain the object paths of connections that the user does not have permission to read the details of.)

    Returns NM.RemoteConnection[]

  • get connectivity_check_uri(): string

    The used URI for connectivity checking.

    Returns string

    1.22

  • get connectivityCheckUri(): string

    The used URI for connectivity checking.

    Returns string

    1.22

  • get dbus_name_owner(): string

    The name owner of the NetworkManager D-Bus service.

    Returns string

    1.22

  • get dbusNameOwner(): string

    The name owner of the NetworkManager D-Bus service.

    Returns string

    1.22

  • get dns_rc_manager(): string

    The current resolv.conf management mode.

    Returns string

    1.6

  • get dnsRcManager(): string

    The current resolv.conf management mode.

    Returns string

    1.6

  • get hostname(): string

    The machine hostname stored in persistent configuration. This can be modified by calling nm_client_save_hostname().

    Returns string

  • get metered(): number

    Whether the connectivity is metered.

    Returns number

    1.2

  • get networking_enabled(): boolean

    Whether networking is enabled.

    The property setter is a synchronous D-Bus call. This is deprecated since 1.22.

    Returns boolean

  • set networking_enabled(val: boolean): void

    Parameters

    • val: boolean

    Returns void

  • get networkingEnabled(): boolean

    Whether networking is enabled.

    The property setter is a synchronous D-Bus call. This is deprecated since 1.22.

    Returns boolean

  • set networkingEnabled(val: boolean): void

    Parameters

    • val: boolean

    Returns void

  • get permissions_state(): NM.Ternary

    The state of the cached permissions. The value NM.Ternary.DEFAULT means that no permissions are yet received (or not yet requested). NM.Ternary.TRUE means that permissions are received, cached and up to date. NM.Ternary.FALSE means that permissions were received and are cached, but in the meantime a "CheckPermissions" signal was received that invalidated the cached permissions. Note that NMClient will always emit a notify::permissions-state signal when a "CheckPermissions" signal got received or after new permissions got received (that is regardless whether the value of the permission state actually changed). With this you can watch the permissions-state property to know whether the permissions are ready. Note that while NMClient has no D-Bus name owner, no permissions are fetched (and this property won't change).

    Returns NM.Ternary

    1.24

  • get permissionsState(): NM.Ternary

    The state of the cached permissions. The value NM.Ternary.DEFAULT means that no permissions are yet received (or not yet requested). NM.Ternary.TRUE means that permissions are received, cached and up to date. NM.Ternary.FALSE means that permissions were received and are cached, but in the meantime a "CheckPermissions" signal was received that invalidated the cached permissions. Note that NMClient will always emit a notify::permissions-state signal when a "CheckPermissions" signal got received or after new permissions got received (that is regardless whether the value of the permission state actually changed). With this you can watch the permissions-state property to know whether the permissions are ready. Note that while NMClient has no D-Bus name owner, no permissions are fetched (and this property won't change).

    Returns NM.Ternary

    1.24

  • get version_info(): number[]

    Expose version info and capabilities of NetworkManager. If non-empty, the first element is NM_VERSION, which encodes the version of the daemon as "(major << 16 | minor << 8 | micro)". The following elements is a bitfields of %NMVersionInfoCapabilities. If a bit is set, then the running NetworkManager has the respective capability.

    Returns number[]

    1.42

  • get versionInfo(): number[]

    Expose version info and capabilities of NetworkManager. If non-empty, the first element is NM_VERSION, which encodes the version of the daemon as "(major << 16 | minor << 8 | micro)". The following elements is a bitfields of %NMVersionInfoCapabilities. If a bit is set, then the running NetworkManager has the respective capability.

    Returns number[]

    1.42

  • get wimax_enabled(): boolean

    Whether WiMAX functionality is enabled.

    Returns boolean

    since 1.22: WiMAX is no longer supported and this always returns FALSE. The setter has no effect.

  • set wimax_enabled(val: boolean): void

    Parameters

    • val: boolean

    Returns void

  • get wimax_hardware_enabled(): boolean

    Whether the WiMAX hardware is enabled.

    Returns boolean

    since 1.22: WiMAX is no longer supported and this always returns FALSE.

  • get wimaxEnabled(): boolean

    Whether WiMAX functionality is enabled.

    Returns boolean

    since 1.22: WiMAX is no longer supported and this always returns FALSE. The setter has no effect.

  • set wimaxEnabled(val: boolean): void

    Parameters

    • val: boolean

    Returns void

  • get wimaxHardwareEnabled(): boolean

    Whether the WiMAX hardware is enabled.

    Returns boolean

    since 1.22: WiMAX is no longer supported and this always returns FALSE.

  • get wireless_enabled(): boolean

    Whether wireless is enabled.

    The property setter is a synchronous D-Bus call. This is deprecated since 1.22.

    Returns boolean

  • set wireless_enabled(val: boolean): void

    Parameters

    • val: boolean

    Returns void

  • get wireless_hardware_enabled(): boolean

    Whether the wireless hardware is enabled.

    Returns boolean

  • get wirelessEnabled(): boolean

    Whether wireless is enabled.

    The property setter is a synchronous D-Bus call. This is deprecated since 1.22.

    Returns boolean

  • set wirelessEnabled(val: boolean): void

    Parameters

    • val: boolean

    Returns void

  • get wirelessHardwareEnabled(): boolean

    Whether the wireless hardware is enabled.

    Returns boolean

  • get wwan_enabled(): boolean

    Whether WWAN functionality is enabled.

    The property setter is a synchronous D-Bus call. This is deprecated since 1.22.

    Returns boolean

  • set wwan_enabled(val: boolean): void

    Parameters

    • val: boolean

    Returns void

  • get wwan_hardware_enabled(): boolean

    Whether the WWAN hardware is enabled.

    Returns boolean

  • get wwanEnabled(): boolean

    Whether WWAN functionality is enabled.

    The property setter is a synchronous D-Bus call. This is deprecated since 1.22.

    Returns boolean

  • set wwanEnabled(val: boolean): void

    Parameters

    • val: boolean

    Returns void

  • get wwanHardwareEnabled(): boolean

    Whether the WWAN hardware is enabled.

    Returns boolean

Methods

  • Asynchronously starts a connection to a particular network using the configuration settings from connection and the network device device. Certain connection types also take a "specific object" which is the object path of a connection- specific object, like an NM.AccessPoint for Wi-Fi connections, or an NM.WimaxNsp for WiMAX connections, to which you wish to connect. If the specific object is not given, NetworkManager can, in some cases, automatically determine which network to connect to given the settings in connection.

    If connection is not given for a device-based activation, NetworkManager picks the best available connection for the device and activates it.

    Note that the callback is invoked when NetworkManager has started activating the new connection, not when it finishes. You can use the returned NM.ActiveConnection object (in particular, NM.ActiveConnection.state) to track the activation to its completion.

    Parameters

    • Optionalconnection: NM.Connection
    • Optionaldevice: NM.Device
    • Optionalspecific_object: string

      the object path of a connection-type-specific object this activation should use. This parameter is currently ignored for wired and mobile broadband connections, and the value of null should be used (ie, no specific object). For Wi-Fi or WiMAX connections, pass the object path of a NM.AccessPoint or NM.WimaxNsp owned by device, which you can get using nm_object_get_path(), and which will be used to complete the details of the newly added connection.

    • Optionalcancellable: Gio.Cancellable

      a Gio.Cancellable, or null

    Returns Promise<NM.ActiveConnection>

  • Asynchronously starts a connection to a particular network using the configuration settings from connection and the network device device. Certain connection types also take a "specific object" which is the object path of a connection- specific object, like an NM.AccessPoint for Wi-Fi connections, or an NM.WimaxNsp for WiMAX connections, to which you wish to connect. If the specific object is not given, NetworkManager can, in some cases, automatically determine which network to connect to given the settings in connection.

    If connection is not given for a device-based activation, NetworkManager picks the best available connection for the device and activates it.

    Note that the callback is invoked when NetworkManager has started activating the new connection, not when it finishes. You can use the returned NM.ActiveConnection object (in particular, NM.ActiveConnection.state) to track the activation to its completion.

    Parameters

    • connection: NM.Connection
    • device: NM.Device
    • specific_object: string

      the object path of a connection-type-specific object this activation should use. This parameter is currently ignored for wired and mobile broadband connections, and the value of null should be used (ie, no specific object). For Wi-Fi or WiMAX connections, pass the object path of a NM.AccessPoint or NM.WimaxNsp owned by device, which you can get using nm_object_get_path(), and which will be used to complete the details of the newly added connection.

    • cancellable: Gio.Cancellable

      a Gio.Cancellable, or null

    • callback: AsyncReadyCallback<NM.Client>

      callback to be called when the activation has started

    Returns void

  • Asynchronously starts a connection to a particular network using the configuration settings from connection and the network device device. Certain connection types also take a "specific object" which is the object path of a connection- specific object, like an NM.AccessPoint for Wi-Fi connections, or an NM.WimaxNsp for WiMAX connections, to which you wish to connect. If the specific object is not given, NetworkManager can, in some cases, automatically determine which network to connect to given the settings in connection.

    If connection is not given for a device-based activation, NetworkManager picks the best available connection for the device and activates it.

    Note that the callback is invoked when NetworkManager has started activating the new connection, not when it finishes. You can use the returned NM.ActiveConnection object (in particular, NM.ActiveConnection.state) to track the activation to its completion.

    Parameters

    • Optionalconnection: NM.Connection
    • Optionaldevice: NM.Device
    • Optionalspecific_object: string

      the object path of a connection-type-specific object this activation should use. This parameter is currently ignored for wired and mobile broadband connections, and the value of null should be used (ie, no specific object). For Wi-Fi or WiMAX connections, pass the object path of a NM.AccessPoint or NM.WimaxNsp owned by device, which you can get using nm_object_get_path(), and which will be used to complete the details of the newly added connection.

    • Optionalcancellable: Gio.Cancellable

      a Gio.Cancellable, or null

    • Optionalcallback: AsyncReadyCallback<NM.Client>

      callback to be called when the activation has started

    Returns void | Promise<NM.ActiveConnection>

  • Adds a new connection using the given details (if any) as a template, automatically filling in missing settings with the capabilities of the given device and specific object. The new connection is then asynchronously activated as with nm_client_activate_connection_async(). Cannot be used for VPN connections at this time.

    Note that the callback is invoked when NetworkManager has started activating the new connection, not when it finishes. You can used the returned NM.ActiveConnection object (in particular, NM.ActiveConnection.state) to track the activation to its completion.

    Parameters

    • Optionalpartial: NM.Connection

      an NM.Connection to add; the connection may be partially filled (or even null) and will be completed by NetworkManager using the given device and specific_object before being added

    • Optionaldevice: NM.Device
    • Optionalspecific_object: string

      the object path of a connection-type-specific object this activation should use. This parameter is currently ignored for wired and mobile broadband connections, and the value of null should be used (ie, no specific object). For Wi-Fi or WiMAX connections, pass the object path of a NM.AccessPoint or NM.WimaxNsp owned by device, which you can get using nm_object_get_path(), and which will be used to complete the details of the newly added connection. If the variant is floating, it will be consumed.

    • Optionalcancellable: Gio.Cancellable

      a Gio.Cancellable, or null

    Returns Promise<NM.ActiveConnection>

  • Adds a new connection using the given details (if any) as a template, automatically filling in missing settings with the capabilities of the given device and specific object. The new connection is then asynchronously activated as with nm_client_activate_connection_async(). Cannot be used for VPN connections at this time.

    Note that the callback is invoked when NetworkManager has started activating the new connection, not when it finishes. You can used the returned NM.ActiveConnection object (in particular, NM.ActiveConnection.state) to track the activation to its completion.

    Parameters

    • partial: NM.Connection

      an NM.Connection to add; the connection may be partially filled (or even null) and will be completed by NetworkManager using the given device and specific_object before being added

    • device: NM.Device
    • specific_object: string

      the object path of a connection-type-specific object this activation should use. This parameter is currently ignored for wired and mobile broadband connections, and the value of null should be used (ie, no specific object). For Wi-Fi or WiMAX connections, pass the object path of a NM.AccessPoint or NM.WimaxNsp owned by device, which you can get using nm_object_get_path(), and which will be used to complete the details of the newly added connection. If the variant is floating, it will be consumed.

    • cancellable: Gio.Cancellable

      a Gio.Cancellable, or null

    • callback: AsyncReadyCallback<NM.Client>

      callback to be called when the activation has started

    Returns void

  • Adds a new connection using the given details (if any) as a template, automatically filling in missing settings with the capabilities of the given device and specific object. The new connection is then asynchronously activated as with nm_client_activate_connection_async(). Cannot be used for VPN connections at this time.

    Note that the callback is invoked when NetworkManager has started activating the new connection, not when it finishes. You can used the returned NM.ActiveConnection object (in particular, NM.ActiveConnection.state) to track the activation to its completion.

    Parameters

    • Optionalpartial: NM.Connection

      an NM.Connection to add; the connection may be partially filled (or even null) and will be completed by NetworkManager using the given device and specific_object before being added

    • Optionaldevice: NM.Device
    • Optionalspecific_object: string

      the object path of a connection-type-specific object this activation should use. This parameter is currently ignored for wired and mobile broadband connections, and the value of null should be used (ie, no specific object). For Wi-Fi or WiMAX connections, pass the object path of a NM.AccessPoint or NM.WimaxNsp owned by device, which you can get using nm_object_get_path(), and which will be used to complete the details of the newly added connection. If the variant is floating, it will be consumed.

    • Optionalcancellable: Gio.Cancellable

      a Gio.Cancellable, or null

    • Optionalcallback: AsyncReadyCallback<NM.Client>

      callback to be called when the activation has started

    Returns void | Promise<NM.ActiveConnection>

  • Adds a new connection using the given details (if any) as a template, automatically filling in missing settings with the capabilities of the given device and specific object. The new connection is then asynchronously activated as with nm_client_activate_connection_async(). Cannot be used for VPN connections at this time.

    Note that the callback is invoked when NetworkManager has started activating the new connection, not when it finishes. You can used the returned NM.ActiveConnection object (in particular, NM.ActiveConnection.state) to track the activation to its completion.

    This is identical to nm_client_add_and_activate_connection_async() but takes a further options parameter. Currently, the following options are supported by the daemon:

    • "persist": A string describing how the connection should be stored. The default is "disk", but it can be modified to "memory" (until the daemon quits) or "volatile" (will be deleted on disconnect).
    • "bind-activation": Bind the connection lifetime to something. The default is "none", meaning an explicit disconnect is needed. The value "dbus-client" means the connection will automatically be deactivated when the calling D-Bus client disappears from the system bus.

    Parameters

    • partial: NM.Connection

      an NM.Connection to add; the connection may be partially filled (or even null) and will be completed by NetworkManager using the given device and specific_object before being added

    • device: NM.Device
    • specific_object: string

      the object path of a connection-type-specific object this activation should use. This parameter is currently ignored for wired and mobile broadband connections, and the value of null should be used (i.e., no specific object). For Wi-Fi or WiMAX connections, pass the object path of a NM.AccessPoint or NM.WimaxNsp owned by device, which you can get using nm_object_get_path(), and which will be used to complete the details of the newly added connection.

    • options: GLib.Variant

      a GLib.Variant containing a dictionary with options, or null

    • Optionalcancellable: Gio.Cancellable

      a Gio.Cancellable, or null

    Returns Promise<[NM.ActiveConnection, GLib.Variant<any>]>

  • Adds a new connection using the given details (if any) as a template, automatically filling in missing settings with the capabilities of the given device and specific object. The new connection is then asynchronously activated as with nm_client_activate_connection_async(). Cannot be used for VPN connections at this time.

    Note that the callback is invoked when NetworkManager has started activating the new connection, not when it finishes. You can used the returned NM.ActiveConnection object (in particular, NM.ActiveConnection.state) to track the activation to its completion.

    This is identical to nm_client_add_and_activate_connection_async() but takes a further options parameter. Currently, the following options are supported by the daemon:

    • "persist": A string describing how the connection should be stored. The default is "disk", but it can be modified to "memory" (until the daemon quits) or "volatile" (will be deleted on disconnect).
    • "bind-activation": Bind the connection lifetime to something. The default is "none", meaning an explicit disconnect is needed. The value "dbus-client" means the connection will automatically be deactivated when the calling D-Bus client disappears from the system bus.

    Parameters

    • partial: NM.Connection

      an NM.Connection to add; the connection may be partially filled (or even null) and will be completed by NetworkManager using the given device and specific_object before being added

    • device: NM.Device
    • specific_object: string

      the object path of a connection-type-specific object this activation should use. This parameter is currently ignored for wired and mobile broadband connections, and the value of null should be used (i.e., no specific object). For Wi-Fi or WiMAX connections, pass the object path of a NM.AccessPoint or NM.WimaxNsp owned by device, which you can get using nm_object_get_path(), and which will be used to complete the details of the newly added connection.

    • options: GLib.Variant

      a GLib.Variant containing a dictionary with options, or null

    • cancellable: Gio.Cancellable

      a Gio.Cancellable, or null

    • callback: AsyncReadyCallback<NM.Client>

      callback to be called when the activation has started

    Returns void

  • Adds a new connection using the given details (if any) as a template, automatically filling in missing settings with the capabilities of the given device and specific object. The new connection is then asynchronously activated as with nm_client_activate_connection_async(). Cannot be used for VPN connections at this time.

    Note that the callback is invoked when NetworkManager has started activating the new connection, not when it finishes. You can used the returned NM.ActiveConnection object (in particular, NM.ActiveConnection.state) to track the activation to its completion.

    This is identical to nm_client_add_and_activate_connection_async() but takes a further options parameter. Currently, the following options are supported by the daemon:

    • "persist": A string describing how the connection should be stored. The default is "disk", but it can be modified to "memory" (until the daemon quits) or "volatile" (will be deleted on disconnect).
    • "bind-activation": Bind the connection lifetime to something. The default is "none", meaning an explicit disconnect is needed. The value "dbus-client" means the connection will automatically be deactivated when the calling D-Bus client disappears from the system bus.

    Parameters

    • partial: NM.Connection

      an NM.Connection to add; the connection may be partially filled (or even null) and will be completed by NetworkManager using the given device and specific_object before being added

    • device: NM.Device
    • specific_object: string

      the object path of a connection-type-specific object this activation should use. This parameter is currently ignored for wired and mobile broadband connections, and the value of null should be used (i.e., no specific object). For Wi-Fi or WiMAX connections, pass the object path of a NM.AccessPoint or NM.WimaxNsp owned by device, which you can get using nm_object_get_path(), and which will be used to complete the details of the newly added connection.

    • options: GLib.Variant

      a GLib.Variant containing a dictionary with options, or null

    • Optionalcancellable: Gio.Cancellable

      a Gio.Cancellable, or null

    • Optionalcallback: AsyncReadyCallback<NM.Client>

      callback to be called when the activation has started

    Returns void | Promise<[NM.ActiveConnection, GLib.Variant<any>]>

  • Requests that the remote settings service add the given settings to a new connection. If save_to_disk is true, the connection is immediately written to disk; otherwise it is initially only stored in memory, but may be saved later by calling the connection's nm_remote_connection_commit_changes() method.

    connection is untouched by this function and only serves as a template of the settings to add. The NM.RemoteConnection object that represents what NetworkManager actually added is returned to callback when the addition operation is complete.

    Note that the NM.RemoteConnection returned in callback may not contain identical settings to connection as NetworkManager may perform automatic completion and/or normalization of connection properties.

    Parameters

    • connection: NM.Connection

      the connection to add. Note that this object's settings will be added, not the object itself

    • save_to_disk: boolean

      whether to immediately save the connection to disk

    • Optionalcancellable: Gio.Cancellable

      a Gio.Cancellable, or null

    Returns Promise<NM.RemoteConnection>

  • Requests that the remote settings service add the given settings to a new connection. If save_to_disk is true, the connection is immediately written to disk; otherwise it is initially only stored in memory, but may be saved later by calling the connection's nm_remote_connection_commit_changes() method.

    connection is untouched by this function and only serves as a template of the settings to add. The NM.RemoteConnection object that represents what NetworkManager actually added is returned to callback when the addition operation is complete.

    Note that the NM.RemoteConnection returned in callback may not contain identical settings to connection as NetworkManager may perform automatic completion and/or normalization of connection properties.

    Parameters

    • connection: NM.Connection

      the connection to add. Note that this object's settings will be added, not the object itself

    • save_to_disk: boolean

      whether to immediately save the connection to disk

    • cancellable: Gio.Cancellable

      a Gio.Cancellable, or null

    • callback: AsyncReadyCallback<NM.Client>

      callback to be called when the add operation completes

    Returns void

  • Requests that the remote settings service add the given settings to a new connection. If save_to_disk is true, the connection is immediately written to disk; otherwise it is initially only stored in memory, but may be saved later by calling the connection's nm_remote_connection_commit_changes() method.

    connection is untouched by this function and only serves as a template of the settings to add. The NM.RemoteConnection object that represents what NetworkManager actually added is returned to callback when the addition operation is complete.

    Note that the NM.RemoteConnection returned in callback may not contain identical settings to connection as NetworkManager may perform automatic completion and/or normalization of connection properties.

    Parameters

    • connection: NM.Connection

      the connection to add. Note that this object's settings will be added, not the object itself

    • save_to_disk: boolean

      whether to immediately save the connection to disk

    • Optionalcancellable: Gio.Cancellable

      a Gio.Cancellable, or null

    • Optionalcallback: AsyncReadyCallback<NM.Client>

      callback to be called when the add operation completes

    Returns void | Promise<NM.RemoteConnection>

  • Creates a binding between source_property on source and target_property on target.

    Whenever the source_property is changed the target_property is updated using the same value. For instance:

      g_object_bind_property (action, "active", widget, "sensitive", 0);
    

    Will result in the "sensitive" property of the widget GObject.Object instance to be updated with the same value of the "active" property of the action GObject.Object instance.

    If flags contains GObject.BindingFlags.BIDIRECTIONAL then the binding will be mutual: if target_property on target changes then the source_property on source will be updated as well.

    The binding will automatically be removed when either the source or the target instances are finalized. To remove the binding without affecting the source and the target you can just call g_object_unref() on the returned GObject.Binding instance.

    Removing the binding by calling g_object_unref() on it must only be done if the binding, source and target are only used from a single thread and it is clear that both source and target outlive the binding. Especially it is not safe to rely on this if the binding, source or target can be finalized from different threads. Keep another reference to the binding and use g_binding_unbind() instead to be on the safe side.

    A GObject.Object can have multiple bindings.

    Parameters

    Returns GObject.Binding

    the GObject.Binding instance representing the binding between the two GObject.Object instances. The binding is released whenever the GObject.Binding reference count reaches zero.

  • Complete version of g_object_bind_property().

    Creates a binding between source_property on source and target_property on target, allowing you to set the transformation functions to be used by the binding.

    If flags contains GObject.BindingFlags.BIDIRECTIONAL then the binding will be mutual: if target_property on target changes then the source_property on source will be updated as well. The transform_from function is only used in case of bidirectional bindings, otherwise it will be ignored

    The binding will automatically be removed when either the source or the target instances are finalized. This will release the reference that is being held on the GObject.Binding instance; if you want to hold on to the GObject.Binding instance, you will need to hold a reference to it.

    To remove the binding, call g_binding_unbind().

    A GObject.Object can have multiple bindings.

    The same user_data parameter will be used for both transform_to and transform_from transformation functions; the notify function will be called once, when the binding is removed. If you need different data for each transformation function, please use g_object_bind_property_with_closures() instead.

    Parameters

    • source_property: string

      the property on source to bind

    • target: GObject.Object

      the target GObject.Object

    • target_property: string

      the property on target to bind

    • flags: GObject.BindingFlags

      flags to pass to GObject.Binding

    • Optionaltransform_to: BindingTransformFunc

      the transformation function from the source to the target, or null to use the default

    • Optionaltransform_from: BindingTransformFunc

      the transformation function from the target to the source, or null to use the default

    • Optionalnotify: DestroyNotify

      a function to call when disposing the binding, to free resources used by the transformation functions, or null if not required

    Returns GObject.Binding

    the GObject.Binding instance representing the binding between the two GObject.Object instances. The binding is released whenever the GObject.Binding reference count reaches zero.

  • Creates a binding between source_property on source and target_property on target, allowing you to set the transformation functions to be used by the binding.

    This function is the language bindings friendly version of g_object_bind_property_full(), using GClosures instead of function pointers.

    Parameters

    • ...args: never[]

      the property on source to bind

    Returns any

    the GObject.Binding instance representing the binding between the two GObject.Object instances. The binding is released whenever the GObject.Binding reference count reaches zero.

  • Resets the timeout for the checkpoint with path checkpoint_path to timeout_add.

    Parameters

    • checkpoint_path: string

      a D-Bus path to a checkpoint

    • add_timeout: number

      the timeout in seconds counting from now. Set to zero, to disable the timeout.

    • Optionalcancellable: Gio.Cancellable

      a Gio.Cancellable, or null

    Returns Promise<boolean>

  • Resets the timeout for the checkpoint with path checkpoint_path to timeout_add.

    Parameters

    • checkpoint_path: string

      a D-Bus path to a checkpoint

    • add_timeout: number

      the timeout in seconds counting from now. Set to zero, to disable the timeout.

    • cancellable: Gio.Cancellable

      a Gio.Cancellable, or null

    • callback: AsyncReadyCallback<NM.Client>

      callback to be called when the add operation completes

    Returns void

  • Resets the timeout for the checkpoint with path checkpoint_path to timeout_add.

    Parameters

    • checkpoint_path: string

      a D-Bus path to a checkpoint

    • add_timeout: number

      the timeout in seconds counting from now. Set to zero, to disable the timeout.

    • Optionalcancellable: Gio.Cancellable

      a Gio.Cancellable, or null

    • Optionalcallback: AsyncReadyCallback<NM.Client>

      callback to be called when the add operation completes

    Returns void | Promise<boolean>

  • Determine whether connectivity checking is available. This requires that the URI of a connectivity service has been set in the configuration file.

    Returns boolean

    true if connectivity checking is available.

  • Determine whether connectivity checking is enabled.

    Returns boolean

    true if connectivity checking is enabled.

  • Get the URI that will be queried to determine if there is internet connectivity.

    Returns string

    the connectivity URI in use

  • Enable or disable connectivity checking. Note that if a connectivity checking URI has not been configured, this will not have any effect.

    Parameters

    • enabled: boolean

      true to enable connectivity checking

    Returns void

  • Call g_dbus_connection_call() on the current name owner with the specified arguments. Most importantly, this invokes g_dbus_connection_call() with the client's GLib.MainContext, so that the response is always in order with other events D-Bus events. Of course, the call uses Gio.Task and will invoke the callback on the current g_main_context_get_thread_default().

    This API is merely a convenient wrapper for g_dbus_connection_call(). You can also use g_dbus_connection_call() directly, with the same effect.

    Parameters

    • object_path: string

      path of remote object

    • interface_name: string

      D-Bus interface to invoke method on

    • method_name: string

      the name of the method to invoke

    • parameters: GLib.Variant<any>

      a GLib.Variant tuple with parameters for the method or null if not passing parameters

    • reply_type: GLib.VariantType<any>

      the expected type of the reply (which will be a tuple), or null

    • timeout_msec: number

      the timeout in milliseconds, -1 to use the default timeout or G_MAXINT for no timeout

    • Optionalcancellable: Gio.Cancellable

      a Gio.Cancellable or null

    Returns Promise<GLib.Variant<any>>

  • Call g_dbus_connection_call() on the current name owner with the specified arguments. Most importantly, this invokes g_dbus_connection_call() with the client's GLib.MainContext, so that the response is always in order with other events D-Bus events. Of course, the call uses Gio.Task and will invoke the callback on the current g_main_context_get_thread_default().

    This API is merely a convenient wrapper for g_dbus_connection_call(). You can also use g_dbus_connection_call() directly, with the same effect.

    Parameters

    • object_path: string

      path of remote object

    • interface_name: string

      D-Bus interface to invoke method on

    • method_name: string

      the name of the method to invoke

    • parameters: GLib.Variant<any>

      a GLib.Variant tuple with parameters for the method or null if not passing parameters

    • reply_type: GLib.VariantType<any>

      the expected type of the reply (which will be a tuple), or null

    • timeout_msec: number

      the timeout in milliseconds, -1 to use the default timeout or G_MAXINT for no timeout

    • cancellable: Gio.Cancellable

      a Gio.Cancellable or null

    • callback: AsyncReadyCallback<NM.Client>

      a Gio.AsyncReadyCallback to call when the request is satisfied or null if you don't care about the result of the method invocation

    Returns void

  • Call g_dbus_connection_call() on the current name owner with the specified arguments. Most importantly, this invokes g_dbus_connection_call() with the client's GLib.MainContext, so that the response is always in order with other events D-Bus events. Of course, the call uses Gio.Task and will invoke the callback on the current g_main_context_get_thread_default().

    This API is merely a convenient wrapper for g_dbus_connection_call(). You can also use g_dbus_connection_call() directly, with the same effect.

    Parameters

    • object_path: string

      path of remote object

    • interface_name: string

      D-Bus interface to invoke method on

    • method_name: string

      the name of the method to invoke

    • parameters: GLib.Variant<any>

      a GLib.Variant tuple with parameters for the method or null if not passing parameters

    • reply_type: GLib.VariantType<any>

      the expected type of the reply (which will be a tuple), or null

    • timeout_msec: number

      the timeout in milliseconds, -1 to use the default timeout or G_MAXINT for no timeout

    • Optionalcancellable: Gio.Cancellable

      a Gio.Cancellable or null

    • Optionalcallback: AsyncReadyCallback<NM.Client>

      a Gio.AsyncReadyCallback to call when the request is satisfied or null if you don't care about the result of the method invocation

    Returns void | Promise<GLib.Variant<any>>

  • Like nm_client_dbus_call() but calls "Set" on the standard "org.freedesktop.DBus.Properties" D-Bus interface.

    Parameters

    • object_path: string

      path of remote object

    • interface_name: string

      D-Bus interface for the property to set.

    • property_name: string

      the name of the property to set

    • value: GLib.Variant

      a GLib.Variant with the value to set.

    • timeout_msec: number

      the timeout in milliseconds, -1 to use the default timeout or G_MAXINT for no timeout

    • Optionalcancellable: Gio.Cancellable

      a Gio.Cancellable or null

    Returns Promise<boolean>

  • Like nm_client_dbus_call() but calls "Set" on the standard "org.freedesktop.DBus.Properties" D-Bus interface.

    Parameters

    • object_path: string

      path of remote object

    • interface_name: string

      D-Bus interface for the property to set.

    • property_name: string

      the name of the property to set

    • value: GLib.Variant

      a GLib.Variant with the value to set.

    • timeout_msec: number

      the timeout in milliseconds, -1 to use the default timeout or G_MAXINT for no timeout

    • cancellable: Gio.Cancellable

      a Gio.Cancellable or null

    • callback: AsyncReadyCallback<NM.Client>

      a Gio.AsyncReadyCallback to call when the request is satisfied or null if you don't care about the result of the method invocation

    Returns void

  • Like nm_client_dbus_call() but calls "Set" on the standard "org.freedesktop.DBus.Properties" D-Bus interface.

    Parameters

    • object_path: string

      path of remote object

    • interface_name: string

      D-Bus interface for the property to set.

    • property_name: string

      the name of the property to set

    • value: GLib.Variant

      a GLib.Variant with the value to set.

    • timeout_msec: number

      the timeout in milliseconds, -1 to use the default timeout or G_MAXINT for no timeout

    • Optionalcancellable: Gio.Cancellable

      a Gio.Cancellable or null

    • Optionalcallback: AsyncReadyCallback<NM.Client>

      a Gio.AsyncReadyCallback to call when the request is satisfied or null if you don't care about the result of the method invocation

    Returns void | Promise<boolean>

  • Disconnects a handler from an instance so it will not be called during any future or currently ongoing emissions of the signal it has been connected to.

    Parameters

    • id: number

      Handler ID of the handler to be disconnected

    Returns void

  • This function is intended for GObject.Object implementations to re-enforce a [floating][floating-ref] object reference. Doing this is seldom required: all GInitiallyUnowneds are created with a floating reference which usually just needs to be sunken by calling g_object_ref_sink().

    Returns void

  • Increases the freeze count on object. If the freeze count is non-zero, the emission of "notify" signals on object is stopped. The signals are queued until the freeze count is decreased to zero. Duplicate notifications are squashed so that at most one GObject.Object::notify signal is emitted for each property modified while the object is frozen.

    This is necessary for accessors that modify multiple properties to prevent premature notification while the object is still being modified.

    Returns void

  • Gets both real devices and device placeholders (eg, software devices which do not currently exist, but could be created automatically by NetworkManager if one of their NMDevice::ActivatableConnections was activated). Use nm_device_is_real() to determine whether each device is a real device or a placeholder.

    Use nm_device_get_type() or the NM_IS_DEVICE_XXXX() functions to determine what kind of device each member of the returned array is, and then you may use device-specific methods such as nm_device_ethernet_get_hw_address().

    Returns NM.Device[]

    a GLib.PtrArray containing all the NMDevices. The returned array is owned by the NM.Client object and should not be modified.

  • Returns number[]

    the list of capabilities reported by the server or null if the capabilities are unknown. The numeric values correspond to NM.Capability enum. The array is terminated by a numeric zero sentinel at position length.

  • Returns the first matching %NMRemoteConnection matching a given id.

    Parameters

    • id: string

      the id of the remote connection

    Returns NM.RemoteConnection

    the remote connection object on success, or null if no matching object was found. The connection is as received from D-Bus and might not validate according to nm_connection_verify().

  • Returns the %NMRemoteConnection representing the connection at path.

    Parameters

    • path: string

      the D-Bus object path of the remote connection

    Returns NM.RemoteConnection

    the remote connection object on success, or null if the object was not known The connection is as received from D-Bus and might not validate according to nm_connection_verify().

  • Returns the %NMRemoteConnection identified by uuid.

    Parameters

    • uuid: string

      the UUID of the remote connection

    Returns NM.RemoteConnection

    the remote connection object on success, or null if the object was not known The connection is as received from D-Bus and might not validate according to nm_connection_verify().

  • Returns NM.RemoteConnection[]

    an array containing all connections provided by the remote settings service. The returned array is owned by the NM.Client object and should not be modified. The connections are as received from D-Bus and might not validate according to nm_connection_verify().

  • Gets the current network connectivity state. Contrast nm_client_check_connectivity() and nm_client_check_connectivity_async(), which re-check the connectivity state first before returning any information.

    Returns NM.ConnectivityState

    the current connectivity state

  • Type Parameters

    Returns T

    a GObject that stays alive as long as there are pending D-Bus operations. NMClient will schedule asynchronous D-Bus requests which will complete on the GMainContext associated with the instance. When destroying the NMClient instance, those requests are cancelled right away, however their pending requests are still outstanding and queued in the GMainContext. These outstanding callbacks keep the GMainContext alive. In order to fully release all resources, the user must keep iterating the main context until all these callbacks are handled. Of course, at this point no more actual callbacks will be invoked for the user, those are all cancelled internally. This just leaves one problem: how long does the user need to keep the GMainContext running to ensure everything is cleaned up? The answer is this GObject. Subscribe a weak reference to the returned object and keep iterating the main context until the object got unreferenced. Note that after the NMClient instance gets destroyed, all outstanding operations will be cancelled right away. That means, the user needs to iterate the GLib.MainContext a bit longer, but it is guaranteed that the cleanup happens soon after. The way of using the context-busy-watch, is by registering a weak pointer to see when it gets destroyed. That means, user code should not take additional references on this object to not keep it alive longer. If you plan to exit the program after releasing the NMClient instance you may not need to worry about these "leaks". Also, if you anyway plan to continue iterating the GLib.MainContext afterwards, then you don't need to care when exactly NMClient is gone completely.

  • Gets a named field from the objects table of associations (see g_object_set_data()).

    Parameters

    • key: string

      name of the key for that association

    Returns any

    the data if found, or null if no such data exists.

  • Gets the %GDBusConnection of the instance. This can be either passed when constructing the instance (as "dbus-connection" property), or it will be automatically initialized during async/sync init.

    Returns Gio.DBusConnection

    the D-Bus connection of the client, or null if none is set.

  • Returns string

    the current name owner of the D-Bus service of NetworkManager.

  • Gets all the known network devices. Use nm_device_get_type() or the NM_IS_DEVICE_XXXX functions to determine what kind of device member of the returned array is, and then you may use device-specific methods such as nm_device_ethernet_get_hw_address().

    Returns NM.Device[]

    a GLib.PtrArray containing all the NMDevices. The returned array is owned by the NM.Client object and should not be modified.

  • Gets the current DNS processing mode.

    Returns string

    the DNS processing mode, or null in case the value is not available.

  • Gets the current DNS resolv.conf manager.

    Returns string

    the resolv.conf manager or null in case the value is not available.

  • Gets NetworkManager current logging level and domains.

    Returns [boolean, string, string]

    true on success, false otherwise

  • The NM.Client instance is permanently associated with the current thread default GLib.MainContext, referenced the time when the instance was created. To receive events, the user must iterate this context and can use it to synchronize access to the client.

    Note that even after NM.Client instance got destroyed, there might still be pending sources registered in the context. That means, to fully clean up, the user must continue iterating the context as long as the nm_client_get_context_busy_watcher() object is alive.

    Returns GLib.MainContext

    the GLib.MainContext of the client.

  • Determines whether the daemon is running.

    Returns boolean

    true if the daemon is running

  • Parameters

    • dbus_path: string

      the D-Bus path of the object to look up

    Returns NM.Object

    the NM.Object instance that is cached under dbus_path, or null if no such object exists.

  • Gets the NM.ActiveConnection corresponding to the primary active network device.

    In particular, when there is no VPN active, or the VPN does not have the default route, this returns the active connection that has the default route. If there is a VPN active with the default route, then this function returns the active connection that contains the route to the VPN endpoint.

    If there is no default route, or the default route is over a non-NetworkManager-recognized device, this will return null.

    Returns NM.ActiveConnection

    the appropriate NM.ActiveConnection, if any

  • Gets a property of an object.

    The value can be:

    • an empty GObject.Value initialized by G_VALUE_INIT, which will be automatically initialized with the expected type of the property (since GLib 2.60)
    • a GObject.Value initialized with the expected type of the property
    • a GObject.Value initialized with a type to which the expected type of the property can be transformed

    In general, a copy is made of the property contents and the caller is responsible for freeing the memory by calling GObject.Value.unset.

    Note that GObject.Object.get_property is really intended for language bindings, GObject.Object.get is much more convenient for C programming.

    Parameters

    • property_name: string

      The name of the property to get

    • value: any

      Return location for the property value. Can be an empty GObject.Value initialized by G_VALUE_INIT (auto-initialized with expected type since GLib 2.60), a GObject.Value initialized with the expected property type, or a GObject.Value initialized with a transformable type

    Returns any

  • Tests whether the daemon is still in the process of activating connections at startup.

    Returns boolean

    whether the daemon is still starting up

  • Gets NetworkManager version.

    Returns string

    string with the version (or null if NetworkManager is not running)

  • If available, the first element in the array is NM_VERSION which encodes the daemon version as "(major << 16 | minor << 8 | micro)". The following elements are a bitfield of %NMVersionInfoCapabilities that indicate that the daemon supports a certain capability.

    Returns number[]

    the list of capabilities reported by the server or null if the capabilities are unknown.

  • Gets n_properties properties for an object. Obtained properties will be set to values. All properties must be valid. Warnings will be emitted and undefined behaviour may result if invalid properties are passed in.

    Parameters

    • names: string[]

      the names of each property to get

    • values: any[]

      the values of each property to get

    Returns void

  • Initializes the object implementing the interface.

    This method is intended for language bindings. If writing in C, g_initable_new() should typically be used instead.

    The object must be initialized before any real use after initial construction, either with this function or g_async_initable_init_async().

    Implementations may also support cancellation. If cancellable is not null, then initialization can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error Gio.IOErrorEnum.CANCELLED will be returned. If cancellable is not null and the object doesn't support cancellable initialization the error Gio.IOErrorEnum.NOT_SUPPORTED will be returned.

    If the object is not initialized, or initialization returns with an error, then all operations on the object except g_object_ref() and g_object_unref() are considered to be invalid, and have undefined behaviour. See the [description][iface@Gio.Initable#description] for more details.

    Callers should not assume that a class which implements Gio.Initable can be initialized multiple times, unless the class explicitly documents itself as supporting this. Generally, a class’ implementation of init() can assume (and assert) that it will only be called once. Previously, this documentation recommended all Gio.Initable implementations should be idempotent; that recommendation was relaxed in GLib 2.54.

    If a class explicitly supports being initialized multiple times, it is recommended that the method is idempotent: multiple calls with the same arguments should return the same results. Only the first call initializes the object; further calls return the result of the first call.

    One reason why a class might need to support idempotent initialization is if it is designed to be used via the singleton pattern, with a GObject.ObjectClass.constructor that sometimes returns an existing instance. In this pattern, a caller would expect to be able to call g_initable_init() on the result of g_object_new(), regardless of whether it is in fact a new instance.

    Parameters

    Returns boolean

    true if successful. If an error has occurred, this function will return false and set error appropriately if present.

  • Starts asynchronous initialization of the object implementing the interface. This must be done before any real use of the object after initial construction. If the object also implements Gio.Initable you can optionally call g_initable_init() instead.

    This method is intended for language bindings. If writing in C, g_async_initable_new_async() should typically be used instead.

    When the initialization is finished, callback will be called. You can then call g_async_initable_init_finish() to get the result of the initialization.

    Implementations may also support cancellation. If cancellable is not null, then initialization can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error Gio.IOErrorEnum.CANCELLED will be returned. If cancellable is not null, and the object doesn't support cancellable initialization, the error Gio.IOErrorEnum.NOT_SUPPORTED will be returned.

    As with Gio.Initable, if the object is not initialized, or initialization returns with an error, then all operations on the object except g_object_ref() and g_object_unref() are considered to be invalid, and have undefined behaviour. They will often fail with g_critical() or g_warning(), but this must not be relied on.

    Callers should not assume that a class which implements Gio.AsyncInitable can be initialized multiple times; for more information, see g_initable_init(). If a class explicitly supports being initialized multiple times, implementation requires yielding all subsequent calls to init_async() on the results of the first call.

    For classes that also support the Gio.Initable interface, the default implementation of this method will run the g_initable_init() function in a thread, so if you want to support asynchronous initialization via threads, just implement the Gio.AsyncInitable interface without overriding any interface methods.

    Parameters

    Returns Promise<boolean>

  • Starts asynchronous initialization of the object implementing the interface. This must be done before any real use of the object after initial construction. If the object also implements Gio.Initable you can optionally call g_initable_init() instead.

    This method is intended for language bindings. If writing in C, g_async_initable_new_async() should typically be used instead.

    When the initialization is finished, callback will be called. You can then call g_async_initable_init_finish() to get the result of the initialization.

    Implementations may also support cancellation. If cancellable is not null, then initialization can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error Gio.IOErrorEnum.CANCELLED will be returned. If cancellable is not null, and the object doesn't support cancellable initialization, the error Gio.IOErrorEnum.NOT_SUPPORTED will be returned.

    As with Gio.Initable, if the object is not initialized, or initialization returns with an error, then all operations on the object except g_object_ref() and g_object_unref() are considered to be invalid, and have undefined behaviour. They will often fail with g_critical() or g_warning(), but this must not be relied on.

    Callers should not assume that a class which implements Gio.AsyncInitable can be initialized multiple times; for more information, see g_initable_init(). If a class explicitly supports being initialized multiple times, implementation requires yielding all subsequent calls to init_async() on the results of the first call.

    For classes that also support the Gio.Initable interface, the default implementation of this method will run the g_initable_init() function in a thread, so if you want to support asynchronous initialization via threads, just implement the Gio.AsyncInitable interface without overriding any interface methods.

    Parameters

    Returns void

  • Starts asynchronous initialization of the object implementing the interface. This must be done before any real use of the object after initial construction. If the object also implements Gio.Initable you can optionally call g_initable_init() instead.

    This method is intended for language bindings. If writing in C, g_async_initable_new_async() should typically be used instead.

    When the initialization is finished, callback will be called. You can then call g_async_initable_init_finish() to get the result of the initialization.

    Implementations may also support cancellation. If cancellable is not null, then initialization can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error Gio.IOErrorEnum.CANCELLED will be returned. If cancellable is not null, and the object doesn't support cancellable initialization, the error Gio.IOErrorEnum.NOT_SUPPORTED will be returned.

    As with Gio.Initable, if the object is not initialized, or initialization returns with an error, then all operations on the object except g_object_ref() and g_object_unref() are considered to be invalid, and have undefined behaviour. They will often fail with g_critical() or g_warning(), but this must not be relied on.

    Callers should not assume that a class which implements Gio.AsyncInitable can be initialized multiple times; for more information, see g_initable_init(). If a class explicitly supports being initialized multiple times, implementation requires yielding all subsequent calls to init_async() on the results of the first call.

    For classes that also support the Gio.Initable interface, the default implementation of this method will run the g_initable_init() function in a thread, so if you want to support asynchronous initialization via threads, just implement the Gio.AsyncInitable interface without overriding any interface methods.

    Parameters

    Returns void | Promise<boolean>

  • Requests that the remote settings service load or reload the given files, adding or updating the connections described within.

    The changes to the indicated files will not yet be reflected in client's connections array when the function returns.

    If all of the indicated files were successfully loaded, the function will return true, and failures will be set to null. If NetworkManager tried to load the files, but some (or all) failed, then failures will be set to a null-terminated array of the filenames that failed to load.

    Parameters

    Returns [boolean, string]

    true on success. Warning: before libnm 1.22, the boolean return value was inconsistent. That is made worse, because when running against certain server versions before 1.20, the server would return wrong values for success/failure. This means, if you use this function in libnm before 1.22, you are advised to ignore the boolean return value and only look at failures and error. With libnm >= 1.22, the boolean return value corresponds to whether error was set. Note that even in the success case, you might have individual failures. With 1.22, the return value is consistent with nm_client_load_connections_finish().

  • Requests that the remote settings service asynchronously load or reload the given files, adding or updating the connections described within.

    See nm_client_load_connections() for more details.

    Parameters

    Returns Promise<string[]>

  • Requests that the remote settings service asynchronously load or reload the given files, adding or updating the connections described within.

    See nm_client_load_connections() for more details.

    Parameters

    Returns void

  • Requests that the remote settings service asynchronously load or reload the given files, adding or updating the connections described within.

    See nm_client_load_connections() for more details.

    Parameters

    Returns void | Promise<string[]>

  • Gets the result of an nm_client_load_connections_async() call.

    See nm_client_load_connections() for more details.

    Parameters

    Returns [boolean, string[]]

    true on success. Note that even in the success case, you might have individual failures.

  • Whether networking is enabled or disabled.

    Returns boolean

    true if networking is enabled, false if networking is disabled

  • Enables or disables networking. When networking is disabled, all controlled interfaces are disconnected and deactivated. When networking is enabled, all controlled interfaces are available for activation.

    Parameters

    • enabled: boolean

      true to set networking enabled, false to set networking disabled

    Returns boolean

    true on success, false otherwise

  • Emits a "notify" signal for the property property_name on object.

    When possible, eg. when signaling a property change from within the class that registered the property, you should use g_object_notify_by_pspec() instead.

    Note that emission of the notify signal may be blocked with g_object_freeze_notify(). In this case, the signal emissions are queued and will be emitted (in reverse order) when g_object_thaw_notify() is called.

    Parameters

    • property_name: string

      the name of a property installed on the class of object.

    Returns void

  • Emits a "notify" signal for the property specified by pspec on object.

    This function omits the property name lookup, hence it is faster than g_object_notify().

    One way to avoid using g_object_notify() from within the class that registered the properties, and using g_object_notify_by_pspec() instead, is to store the GParamSpec used with g_object_class_install_property() inside a static array, e.g.:

      typedef enum
    {
    PROP_FOO = 1,
    PROP_LAST
    } MyObjectProperty;

    static GParamSpec *properties[PROP_LAST];

    static void
    my_object_class_init (MyObjectClass *klass)
    {
    properties[PROP_FOO] = g_param_spec_int ("foo", NULL, NULL,
    0, 100,
    50,
    G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
    g_object_class_install_property (gobject_class,
    PROP_FOO,
    properties[PROP_FOO]);
    }

    and then notify a change on the "foo" property with:

      g_object_notify_by_pspec (self, properties[PROP_FOO]);
    

    Parameters

    Returns void

  • Increases the reference count of object.

    Since GLib 2.56, if GLIB_VERSION_MAX_ALLOWED is 2.56 or greater, the type of object will be propagated to the return type (using the GCC typeof() extension), so any casting the caller needs to do on the return type must be explicit.

    Returns GObject.Object

    the same object

  • Increase the reference count of object, and possibly remove the [floating][floating-ref] reference, if object has a floating reference.

    In other words, if the object is floating, then this call "assumes ownership" of the floating reference, converting it to a normal reference by clearing the floating flag while leaving the reference count unchanged. If the object is not floating, then this call adds a new normal reference increasing the reference count by one.

    Since GLib 2.56, the type of object will be propagated to the return type under the same conditions as for g_object_ref().

    Returns GObject.Object

    object

  • Reload NetworkManager's configuration and perform certain updates, like flushing caches or rewriting external state to disk. This is similar to sending SIGHUP to NetworkManager but it allows for more fine-grained control over what to reload (see flags). It also allows non-root access via PolicyKit and contrary to signals it is synchronous.

    Parameters

    Returns Promise<boolean>

  • Reload NetworkManager's configuration and perform certain updates, like flushing caches or rewriting external state to disk. This is similar to sending SIGHUP to NetworkManager but it allows for more fine-grained control over what to reload (see flags). It also allows non-root access via PolicyKit and contrary to signals it is synchronous.

    Parameters

    Returns void

  • Reload NetworkManager's configuration and perform certain updates, like flushing caches or rewriting external state to disk. This is similar to sending SIGHUP to NetworkManager but it allows for more fine-grained control over what to reload (see flags). It also allows non-root access via PolicyKit and contrary to signals it is synchronous.

    Parameters

    Returns void | Promise<boolean>

  • Requests that the remote settings service reload all connection files from disk, adding, updating, and removing connections until the in-memory state matches the on-disk state.

    Parameters

    Returns boolean

    true on success, false on failure

  • Requests that the machine's persistent hostname be set to the specified value or cleared.

    Parameters

    • Optionalhostname: string

      the new persistent hostname to set, or null to clear any existing persistent hostname

    • Optionalcancellable: Gio.Cancellable

      a Gio.Cancellable, or null

    Returns boolean

    true if the request was successful, false if it failed

  • Requests that the machine's persistent hostname be set to the specified value or cleared.

    Parameters

    • Optionalhostname: string

      the new persistent hostname to set, or null to clear any existing persistent hostname

    • Optionalcancellable: Gio.Cancellable

      a Gio.Cancellable, or null

    Returns Promise<boolean>

  • Requests that the machine's persistent hostname be set to the specified value or cleared.

    Parameters

    Returns void

  • Requests that the machine's persistent hostname be set to the specified value or cleared.

    Parameters

    Returns void | Promise<boolean>

  • Sets multiple properties of an object at once. The properties argument should be a dictionary mapping property names to values.

    Parameters

    • properties: { [key: string]: any }

      Object containing the properties to set

    Returns void

  • Each object carries around a table of associations from strings to pointers. This function lets you set an association.

    If the object already had an association with that name, the old association will be destroyed.

    Internally, the key is converted to a GLib.Quark using g_quark_from_string(). This means a copy of key is kept permanently (even after object has been finalized) — so it is recommended to only use a small, bounded set of values for key in your program, to avoid the GLib.Quark storage growing unbounded.

    Parameters

    • key: string

      name of the key

    • Optionaldata: any

      data to associate with that key

    Returns void

  • Sets NetworkManager logging level and/or domains.

    Parameters

    • Optionallevel: string

      logging level to set (null or an empty string for no change)

    • Optionaldomains: string

      logging domains to set. The string should be a list of log domains separated by ",". (null or an empty string for no change)

    Returns boolean

    true on success, false otherwise

  • Remove a specified datum from the object's data associations, without invoking the association's destroy handler.

    Parameters

    • key: string

      name of the key

    Returns any

    the data if found, or null if no such data exists.

  • This function gets back user data pointers stored via g_object_set_qdata() and removes the data from object without invoking its destroy() function (if any was set). Usually, calling this function is only required to update user data pointers with a destroy notifier, for example:

    void
    object_add_to_user_list (GObject *object,
    const gchar *new_string)
    {
    // the quark, naming the object data
    GQuark quark_string_list = g_quark_from_static_string ("my-string-list");
    // retrieve the old string list
    GList *list = g_object_steal_qdata (object, quark_string_list);

    // prepend new string
    list = g_list_prepend (list, g_strdup (new_string));
    // this changed 'list', so we need to set it again
    g_object_set_qdata_full (object, quark_string_list, list, free_string_list);
    }
    static void
    free_string_list (gpointer data)
    {
    GList *node, *list = data;

    for (node = list; node; node = node->next)
    g_free (node->data);
    g_list_free (list);
    }

    Using g_object_get_qdata() in the above example, instead of g_object_steal_qdata() would have left the destroy function set, and thus the partial string list would have been freed upon g_object_set_qdata_full().

    Parameters

    • quark: number

      A GLib.Quark, naming the user data pointer

    Returns any

    The user data pointer set, or null

  • Reverts the effect of a previous call to g_object_freeze_notify(). The freeze count is decreased on object and when it reaches zero, queued "notify" signals are emitted.

    Duplicate notifications for each property are squashed so that at most one GObject.Object::notify signal is emitted for each property, in the reverse order in which they have been queued.

    It is an error to call this function when the freeze count is zero.

    Returns void

  • Decreases the reference count of object. When its reference count drops to 0, the object is finalized (i.e. its memory is freed).

    If the pointer to the GObject.Object may be reused in future (for example, if it is an instance variable of another object), it is recommended to clear the pointer to null rather than retain a dangling pointer to a potentially invalid GObject.Object instance. Use g_clear_object() for this.

    Returns void

  • the constructed function is called by g_object_new() as the final step of the object creation process. At the point of the call, all construction properties have been set on the object. The purpose of this call is to allow for object initialisation steps that can only be performed after construction properties have been set. constructed implementors should chain up to the constructed call of their parent class to allow it to complete its initialisation.

    Returns void

  • the dispose function is supposed to drop all references to other objects, but keep the instance otherwise intact, so that client method invocations still work. It may be run multiple times (due to reference loops). Before returning, dispose should chain up to the dispose method of the parent class.

    Returns void

  • Initializes the object implementing the interface.

    This method is intended for language bindings. If writing in C, g_initable_new() should typically be used instead.

    The object must be initialized before any real use after initial construction, either with this function or g_async_initable_init_async().

    Implementations may also support cancellation. If cancellable is not null, then initialization can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error Gio.IOErrorEnum.CANCELLED will be returned. If cancellable is not null and the object doesn't support cancellable initialization the error Gio.IOErrorEnum.NOT_SUPPORTED will be returned.

    If the object is not initialized, or initialization returns with an error, then all operations on the object except g_object_ref() and g_object_unref() are considered to be invalid, and have undefined behaviour. See the [description][iface@Gio.Initable#description] for more details.

    Callers should not assume that a class which implements Gio.Initable can be initialized multiple times, unless the class explicitly documents itself as supporting this. Generally, a class’ implementation of init() can assume (and assert) that it will only be called once. Previously, this documentation recommended all Gio.Initable implementations should be idempotent; that recommendation was relaxed in GLib 2.54.

    If a class explicitly supports being initialized multiple times, it is recommended that the method is idempotent: multiple calls with the same arguments should return the same results. Only the first call initializes the object; further calls return the result of the first call.

    One reason why a class might need to support idempotent initialization is if it is designed to be used via the singleton pattern, with a GObject.ObjectClass.constructor that sometimes returns an existing instance. In this pattern, a caller would expect to be able to call g_initable_init() on the result of g_object_new(), regardless of whether it is in fact a new instance.

    Parameters

    Returns boolean

  • Starts asynchronous initialization of the object implementing the interface. This must be done before any real use of the object after initial construction. If the object also implements Gio.Initable you can optionally call g_initable_init() instead.

    This method is intended for language bindings. If writing in C, g_async_initable_new_async() should typically be used instead.

    When the initialization is finished, callback will be called. You can then call g_async_initable_init_finish() to get the result of the initialization.

    Implementations may also support cancellation. If cancellable is not null, then initialization can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error Gio.IOErrorEnum.CANCELLED will be returned. If cancellable is not null, and the object doesn't support cancellable initialization, the error Gio.IOErrorEnum.NOT_SUPPORTED will be returned.

    As with Gio.Initable, if the object is not initialized, or initialization returns with an error, then all operations on the object except g_object_ref() and g_object_unref() are considered to be invalid, and have undefined behaviour. They will often fail with g_critical() or g_warning(), but this must not be relied on.

    Callers should not assume that a class which implements Gio.AsyncInitable can be initialized multiple times; for more information, see g_initable_init(). If a class explicitly supports being initialized multiple times, implementation requires yielding all subsequent calls to init_async() on the results of the first call.

    For classes that also support the Gio.Initable interface, the default implementation of this method will run the g_initable_init() function in a thread, so if you want to support asynchronous initialization via threads, just implement the Gio.AsyncInitable interface without overriding any interface methods.

    Parameters

    Returns void

  • Emits a "notify" signal for the property property_name on object.

    When possible, eg. when signaling a property change from within the class that registered the property, you should use g_object_notify_by_pspec() instead.

    Note that emission of the notify signal may be blocked with g_object_freeze_notify(). In this case, the signal emissions are queued and will be emitted (in reverse order) when g_object_thaw_notify() is called.

    Parameters

    Returns void

  • the generic setter for all properties of this type. Should be overridden for every type with properties. If implementations of set_property don't emit property change notification explicitly, this will be done implicitly by the type system. However, if the notify signal is emitted explicitly, the type system will not emit it a second time.

    Parameters

    Returns void

  • The way to stop NM.Client is by unrefing it. That will cancel all internally pending async operations. However, as async operations in NMClient use GTask, hence they cannot complete right away. Instead, their (internal) result callback still needs to be dispatched by iterating the client's main context.

    You thus cannot stop iterating the client's main context until everything is wrapped up. nm_client_get_context_busy_watcher() helps to watch how long that will be.

    This function automates that waiting. Like all glib async operations this honors the current g_main_context_get_thread_default().

    In any case, to complete the shutdown, nm_client_get_main_context() must be iterated. If the current g_main_context_get_thread_default() is the same as nm_client_get_main_context(), then integrate_maincontext is ignored. In that case, the caller is required to iterate the context for shutdown to complete. Otherwise, if g_main_context_get_thread_default() differs from nm_client_get_main_context() and integrate_maincontext is false, the caller must make sure that both contexts are iterated until completion. Otherwise, if integrate_maincontext is true, then nm_client_get_main_context() will be integrated in g_main_context_get_thread_default(). This means, the caller gives nm_client_get_main_context() up until the waiting completes, the function will acquire the context and hook it into g_main_context_get_thread_default(). It is a bug to request integrate_maincontext while having nm_client_get_main_context() acquired or iterated otherwise because a context can only be acquired once at a time.

    Shutdown can only complete after all references to client were released.

    It is possible to call this function multiple times for the same client. But note that with integrate_maincontext the client's context is acquired, which can only be done once at a time.

    It is permissible to start waiting before the objects is fully initialized.

    The function really allows two separate things. To get a notification (callback) when shutdown is complete, and to integrate the client's context in another context. The latter case is useful if the client has a separate context and you hand it over to another GMainContext to wrap up.

    The main use is to have a NMClient and a separate GMainContext on a worker thread. When being done, you can hand over the cleanup of the context to g_main_context_default(), assuming that the main thread iterates the default context. In that case, you don't need to care about passing a callback to know when shutdown completed.

    Parameters

    • integrate_maincontext: boolean

      whether to hook the client's maincontext in the current thread default. Otherwise, you must ensure that the client's maincontext gets iterated so that it can complete. By integrating the maincontext in the current thread default, you may instead only iterate the latter.

    • Optionalcancellable: Gio.Cancellable

      the Gio.Cancellable to abort the shutdown.

    • Optionalcallback: AsyncReadyCallback<NM.Client>

      a Gio.AsyncReadyCallback to call when the request is satisfied or null if you don't care about the result of the method invocation.

    Returns void

  • This function essentially limits the life time of the closure to the life time of the object. That is, when the object is finalized, the closure is invalidated by calling g_closure_invalidate() on it, in order to prevent invocations of the closure with a finalized (nonexisting) object. Also, g_object_ref() and g_object_unref() are added as marshal guards to the closure, to ensure that an extra reference count is held on object during invocation of the closure. Usually, this function will be called on closures that use this object as closure data.

    Parameters

    Returns void

  • Determines whether WiMAX is enabled.

    Returns boolean

    true if WiMAX is enabled

  • Determines whether the WiMAX hardware is enabled.

    Returns boolean

    true if the WiMAX hardware is enabled

  • Enables or disables WiMAX devices.

    Parameters

    • enabled: boolean

      true to enable WiMAX

    Returns void

  • Determines whether the wireless is enabled.

    Returns boolean

    true if wireless is enabled

  • Determines whether the wireless hardware is enabled.

    Returns boolean

    true if the wireless hardware is enabled

  • Enables or disables wireless devices.

    Parameters

    • enabled: boolean

      true to enable wireless

    Returns void

  • Determines whether WWAN is enabled.

    Returns boolean

    true if WWAN is enabled

  • Determines whether the WWAN hardware is enabled.

    Returns boolean

    true if the WWAN hardware is enabled

  • Enables or disables WWAN devices.

    Parameters

    • enabled: boolean

      true to enable WWAN

    Returns void

  • Creates a new NM.Client asynchronously. callback will be called when it is done. Use nm_client_new_finish() to get the result.

    This does nothing beside calling g_async_initable_new_async(). You are free to call g_async_initable_new_async() or g_object_new()/g_async_initable_init_async() directly for more control, to set GObject properties or get access to the NMClient instance while it is still initializing.

    Creating an NM.Client instance can only fail for two reasons. First, if you didn't provide a NM_CLIENT_DBUS_CONNECTION and the call to g_bus_get() fails. You can avoid that by using g_async_initable_new_async() directly and set a D-Bus connection. Second, if you cancelled the creation. If you do that, then note that after the failure there might still be idle actions pending which keep nm_client_get_main_context() alive. That means, in that case you must continue iterating the context to avoid leaks. See nm_client_get_context_busy_watcher().

    Creating an NM.Client instance when NetworkManager is not running does not cause a failure.

    Parameters

    Returns void

Methods - Inherited from GObject

  • Add a property to an interface; this is only useful for interfaces that are added to GObject-derived types. Adding a property to an interface forces all objects classes with that interface to have a compatible property. The compatible property could be a newly created GObject.ParamSpec, but normally g_object_class_override_property() will be used so that the object class only needs to provide an implementation and inherits the property description, default value, bounds, and so forth from the interface property.

    This function is meant to be called from the interface's default vtable initialization function (the class_init member of GObject.TypeInfo.) It must not be called after after class_init has been called for any object types implementing this interface.

    If pspec is a floating reference, it will be consumed.

    Parameters

    Returns void

  • Parameters

    • property_id: number

      the new property ID

    • name: string

      the name of a property registered in a parent class or in an interface of this class.

    Returns void

Interfaces

ConstructorProps
SignalSignatures