libnm: add NM_CLIENT_DBUS_NAME_OWNER property
It's not yet implemented. But obviously it's interesting to get the name owner to which the NMClient is currently connected. Note only that: the name-owner property really says whether NM is currently running or not.
This commit is contained in:
@@ -1632,6 +1632,7 @@ global:
|
||||
libnm_1_22_0 {
|
||||
global:
|
||||
nm_client_get_dbus_connection;
|
||||
nm_client_get_dbus_name_owner;
|
||||
nm_client_reload;
|
||||
nm_client_reload_finish;
|
||||
nm_manager_reload_flags_get_type;
|
||||
|
@@ -90,6 +90,7 @@ typedef struct {
|
||||
|
||||
NM_GOBJECT_PROPERTIES_DEFINE (NMClient,
|
||||
PROP_DBUS_CONNECTION,
|
||||
PROP_DBUS_NAME_OWNER,
|
||||
PROP_VERSION,
|
||||
PROP_STATE,
|
||||
PROP_STARTUP,
|
||||
@@ -234,6 +235,23 @@ nm_client_get_dbus_connection (NMClient *client)
|
||||
return NM_CLIENT_GET_PRIVATE (client)->dbus_connection;
|
||||
}
|
||||
|
||||
/**
|
||||
* nm_client_get_dbus_name_owner:
|
||||
* @client: a #NMClient
|
||||
*
|
||||
* Returns: (transfer none): the current name owner of the D-Bus service of NetworkManager.
|
||||
*
|
||||
* Since: 1.22
|
||||
**/
|
||||
const char *
|
||||
nm_client_get_dbus_name_owner (NMClient *client)
|
||||
{
|
||||
g_return_val_if_fail (NM_IS_CLIENT (client), NULL);
|
||||
|
||||
/* FIXME(release-blocker): not yet implemented. */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* nm_client_get_version:
|
||||
* @client: a #NMClient
|
||||
@@ -3478,7 +3496,9 @@ get_property (GObject *object, guint prop_id,
|
||||
case PROP_DBUS_CONNECTION:
|
||||
g_value_set_object (value, priv->dbus_connection);
|
||||
break;
|
||||
|
||||
case PROP_DBUS_NAME_OWNER:
|
||||
g_value_set_string (value, nm_client_get_dbus_name_owner (self));
|
||||
break;
|
||||
case PROP_NM_RUNNING:
|
||||
g_value_set_boolean (value, nm_client_get_nm_running (self));
|
||||
break;
|
||||
@@ -3883,6 +3903,19 @@ nm_client_class_init (NMClientClass *client_class)
|
||||
G_PARAM_CONSTRUCT_ONLY |
|
||||
G_PARAM_STATIC_STRINGS);
|
||||
|
||||
/**
|
||||
* NMClient:dbus-name-owner:
|
||||
*
|
||||
* The name owner of the NetworkManager D-Bus service.
|
||||
*
|
||||
* Since: 1.22
|
||||
**/
|
||||
obj_properties[PROP_DBUS_NAME_OWNER] =
|
||||
g_param_spec_string (NM_CLIENT_DBUS_NAME_OWNER, "", "",
|
||||
NULL,
|
||||
G_PARAM_READABLE |
|
||||
G_PARAM_STATIC_STRINGS);
|
||||
|
||||
/**
|
||||
* NMClient:version:
|
||||
*
|
||||
|
@@ -27,6 +27,7 @@ G_BEGIN_DECLS
|
||||
#define NM_CLIENT_STARTUP "startup"
|
||||
#define NM_CLIENT_NM_RUNNING "nm-running"
|
||||
#define NM_CLIENT_DBUS_CONNECTION "dbus-connection"
|
||||
#define NM_CLIENT_DBUS_NAME_OWNER "dbus-name-owner"
|
||||
|
||||
_NM_DEPRECATED_SYNC_WRITABLE_PROPERTY
|
||||
#define NM_CLIENT_NETWORKING_ENABLED "networking-enabled"
|
||||
@@ -234,6 +235,9 @@ NMClient *nm_client_new_finish (GAsyncResult *result,
|
||||
NM_AVAILABLE_IN_1_22
|
||||
GDBusConnection *nm_client_get_dbus_connection (NMClient *client);
|
||||
|
||||
NM_AVAILABLE_IN_1_22
|
||||
const char *nm_client_get_dbus_name_owner (NMClient *client);
|
||||
|
||||
const char *nm_client_get_version (NMClient *client);
|
||||
NMState nm_client_get_state (NMClient *client);
|
||||
gboolean nm_client_get_startup (NMClient *client);
|
||||
|
Reference in New Issue
Block a user