mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-21 06:20:06 +01:00
libnm: fix NMActiveConnection object-path-valued properties
NMActiveConnection:connection was an object path rather than an NMRemoteConnection because in the past the NMObject property system wasn't capable of handling NMRemoteConnection-valued properties. NMActiveConnection:master was an object path rather than an NMDevice entirely by accident. Fix both. NMActiveConnection:specific-object can't currently be converted to an object, because we don't know ahead of time what object type it is, and NMObject can't deal with that. Instead, we rename it to :specific-object-path (and likewise for its get function), both to emphasize that it doesn't behave like other properties, and to leave the old name open for an actual object-valued property later on.
This commit is contained in:
parent
8c3d6f734b
commit
677314c540
5 changed files with 115 additions and 139 deletions
|
|
@ -594,7 +594,7 @@ get_ac_device_string (NMActiveConnection *active)
|
||||||
static NMActiveConnection *
|
static NMActiveConnection *
|
||||||
get_ac_for_connection (const GPtrArray *active_cons, NMConnection *connection)
|
get_ac_for_connection (const GPtrArray *active_cons, NMConnection *connection)
|
||||||
{
|
{
|
||||||
const char *con_path;
|
const char *con_path, *ac_con_path;
|
||||||
int i;
|
int i;
|
||||||
NMActiveConnection *ac = NULL;
|
NMActiveConnection *ac = NULL;
|
||||||
|
|
||||||
|
|
@ -602,8 +602,11 @@ get_ac_for_connection (const GPtrArray *active_cons, NMConnection *connection)
|
||||||
con_path = nm_connection_get_path (connection);
|
con_path = nm_connection_get_path (connection);
|
||||||
for (i = 0; i < active_cons->len; i++) {
|
for (i = 0; i < active_cons->len; i++) {
|
||||||
NMActiveConnection *candidate = g_ptr_array_index (active_cons, i);
|
NMActiveConnection *candidate = g_ptr_array_index (active_cons, i);
|
||||||
|
NMRemoteConnection *con;
|
||||||
|
|
||||||
if (!g_strcmp0 (nm_active_connection_get_connection (candidate), con_path)) {
|
con = nm_active_connection_get_connection (candidate);
|
||||||
|
ac_con_path = nm_connection_get_path (NM_CONNECTION (con));
|
||||||
|
if (!g_strcmp0 (ac_con_path, con_path)) {
|
||||||
ac = candidate;
|
ac = candidate;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -611,24 +614,6 @@ get_ac_for_connection (const GPtrArray *active_cons, NMConnection *connection)
|
||||||
return ac;
|
return ac;
|
||||||
}
|
}
|
||||||
|
|
||||||
static NMConnection *
|
|
||||||
get_connection_for_active (const GSList *con_list, NMActiveConnection *active)
|
|
||||||
{
|
|
||||||
const GSList *iter;
|
|
||||||
const char *path;
|
|
||||||
|
|
||||||
path = nm_active_connection_get_connection (active);
|
|
||||||
g_return_val_if_fail (path != NULL, NULL);
|
|
||||||
|
|
||||||
for (iter = con_list; iter; iter = g_slist_next (iter)) {
|
|
||||||
NMConnection *candidate = NM_CONNECTION (iter->data);
|
|
||||||
|
|
||||||
if (strcmp (nm_connection_get_path (candidate), path) == 0)
|
|
||||||
return candidate;
|
|
||||||
}
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
nmc_connection_profile_details (NMConnection *connection, NmCli *nmc)
|
nmc_connection_profile_details (NMConnection *connection, NmCli *nmc)
|
||||||
{
|
{
|
||||||
|
|
@ -713,15 +698,15 @@ find_active_connection (const GPtrArray *active_cons,
|
||||||
for (i = start; i < active_cons->len; i++) {
|
for (i = start; i < active_cons->len; i++) {
|
||||||
NMActiveConnection *candidate = g_ptr_array_index (active_cons, i);
|
NMActiveConnection *candidate = g_ptr_array_index (active_cons, i);
|
||||||
|
|
||||||
path = nm_active_connection_get_connection (candidate);
|
con = NM_CONNECTION (nm_active_connection_get_connection (candidate));
|
||||||
|
id = nm_connection_get_id (con);
|
||||||
|
|
||||||
|
path = nm_connection_get_path (con);
|
||||||
a_path = nm_object_get_path (NM_OBJECT (candidate));
|
a_path = nm_object_get_path (NM_OBJECT (candidate));
|
||||||
uuid = nm_active_connection_get_uuid (candidate);
|
uuid = nm_active_connection_get_uuid (candidate);
|
||||||
path_num = path ? strrchr (path, '/') + 1 : NULL;
|
path_num = path ? strrchr (path, '/') + 1 : NULL;
|
||||||
a_path_num = a_path ? strrchr (a_path, '/') + 1 : NULL;
|
a_path_num = a_path ? strrchr (a_path, '/') + 1 : NULL;
|
||||||
|
|
||||||
con = get_connection_for_active (cons, candidate);
|
|
||||||
id = nm_connection_get_id (con);
|
|
||||||
|
|
||||||
/* When filter_type is NULL, compare connection ID (filter_val)
|
/* When filter_type is NULL, compare connection ID (filter_val)
|
||||||
* against all types. Otherwise, only compare against the specific
|
* against all types. Otherwise, only compare against the specific
|
||||||
* type. If 'path' or 'apath' filter types are specified, comparison
|
* type. If 'path' or 'apath' filter types are specified, comparison
|
||||||
|
|
@ -813,21 +798,25 @@ fill_output_active_connection (NMActiveConnection *active,
|
||||||
gboolean with_group,
|
gboolean with_group,
|
||||||
guint32 o_flags)
|
guint32 o_flags)
|
||||||
{
|
{
|
||||||
GSList *iter;
|
NMConnection *con;
|
||||||
const char *active_path;
|
|
||||||
NMSettingConnection *s_con;
|
NMSettingConnection *s_con;
|
||||||
const GPtrArray *devices;
|
const GPtrArray *devices;
|
||||||
GString *dev_str;
|
GString *dev_str;
|
||||||
NMActiveConnectionState state;
|
NMActiveConnectionState state;
|
||||||
|
NMDevice *master;
|
||||||
int i;
|
int i;
|
||||||
GSList *con_list = nmc->connections;
|
|
||||||
NmcOutputField *tmpl, *arr;
|
NmcOutputField *tmpl, *arr;
|
||||||
size_t tmpl_len;
|
size_t tmpl_len;
|
||||||
int idx_start = with_group ? 0 : 1;
|
int idx_start = with_group ? 0 : 1;
|
||||||
|
|
||||||
active_path = nm_active_connection_get_connection (active);
|
con = NM_CONNECTION (nm_active_connection_get_connection (active));
|
||||||
|
s_con = nm_connection_get_setting_connection (con);
|
||||||
|
g_assert (s_con != NULL);
|
||||||
|
|
||||||
state = nm_active_connection_get_state (active);
|
state = nm_active_connection_get_state (active);
|
||||||
|
|
||||||
|
master = nm_active_connection_get_master (active);
|
||||||
|
|
||||||
/* Get devices of the active connection */
|
/* Get devices of the active connection */
|
||||||
dev_str = g_string_new (NULL);
|
dev_str = g_string_new (NULL);
|
||||||
devices = nm_active_connection_get_devices (active);
|
devices = nm_active_connection_get_devices (active);
|
||||||
|
|
@ -854,35 +843,19 @@ fill_output_active_connection (NMActiveConnection *active,
|
||||||
arr = nmc_dup_fields_array (tmpl, tmpl_len, o_flags);
|
arr = nmc_dup_fields_array (tmpl, tmpl_len, o_flags);
|
||||||
if (with_group)
|
if (with_group)
|
||||||
set_val_strc (arr, 0, nmc_fields_con_active_details_groups[0].name);
|
set_val_strc (arr, 0, nmc_fields_con_active_details_groups[0].name);
|
||||||
set_val_strc (arr, 1-idx_start, _("N/A"));
|
set_val_strc (arr, 1-idx_start, nm_setting_connection_get_id (s_con));
|
||||||
set_val_strc (arr, 2-idx_start, nm_active_connection_get_uuid (active));
|
set_val_strc (arr, 2-idx_start, nm_active_connection_get_uuid (active));
|
||||||
set_val_str (arr, 3-idx_start, dev_str->str);
|
set_val_str (arr, 3-idx_start, dev_str->str);
|
||||||
set_val_strc (arr, 4-idx_start, active_connection_state_to_string (state));
|
set_val_strc (arr, 4-idx_start, active_connection_state_to_string (state));
|
||||||
set_val_strc (arr, 5-idx_start, nm_active_connection_get_default (active) ? _("yes") : _("no"));
|
set_val_strc (arr, 5-idx_start, nm_active_connection_get_default (active) ? _("yes") : _("no"));
|
||||||
set_val_strc (arr, 6-idx_start, nm_active_connection_get_default6 (active) ? _("yes") : _("no"));
|
set_val_strc (arr, 6-idx_start, nm_active_connection_get_default6 (active) ? _("yes") : _("no"));
|
||||||
set_val_strc (arr, 7-idx_start, nm_active_connection_get_specific_object (active));
|
set_val_strc (arr, 7-idx_start, nm_active_connection_get_specific_object_path (active));
|
||||||
set_val_strc (arr, 8-idx_start, NM_IS_VPN_CONNECTION (active) ? _("yes") : _("no"));
|
set_val_strc (arr, 8-idx_start, NM_IS_VPN_CONNECTION (active) ? _("yes") : _("no"));
|
||||||
set_val_strc (arr, 9-idx_start, nm_object_get_path (NM_OBJECT (active)));
|
set_val_strc (arr, 9-idx_start, nm_object_get_path (NM_OBJECT (active)));
|
||||||
set_val_strc (arr, 10-idx_start, nm_active_connection_get_connection (active));
|
set_val_strc (arr, 10-idx_start, nm_connection_get_path (con));
|
||||||
set_val_strc (arr, 11-idx_start, _("N/A"));
|
|
||||||
set_val_strc (arr, 12-idx_start, nm_active_connection_get_master (active));
|
|
||||||
|
|
||||||
for (iter = con_list; iter; iter = g_slist_next (iter)) {
|
|
||||||
NMConnection *connection = (NMConnection *) iter->data;
|
|
||||||
const char *con_path = nm_connection_get_path (connection);
|
|
||||||
|
|
||||||
if (!strcmp (active_path, con_path)) {
|
|
||||||
/* This connection is active */
|
|
||||||
s_con = nm_connection_get_setting_connection (connection);
|
|
||||||
g_assert (s_con != NULL);
|
|
||||||
|
|
||||||
/* Fill field values that depend on NMConnection */
|
|
||||||
set_val_strc (arr, 1-idx_start, nm_setting_connection_get_id (s_con));
|
|
||||||
set_val_strc (arr, 11-idx_start, nm_setting_connection_get_zone (s_con));
|
set_val_strc (arr, 11-idx_start, nm_setting_connection_get_zone (s_con));
|
||||||
|
set_val_strc (arr, 12-idx_start, master ? nm_object_get_path (NM_OBJECT (master)) : NULL);
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
g_ptr_array_add (nmc->output_data, arr);
|
g_ptr_array_add (nmc->output_data, arr);
|
||||||
|
|
||||||
g_string_free (dev_str, FALSE);
|
g_string_free (dev_str, FALSE);
|
||||||
|
|
@ -1097,7 +1070,7 @@ nmc_active_connection_details (NMActiveConnection *acon, NmCli *nmc)
|
||||||
char **vpn_data_array = NULL;
|
char **vpn_data_array = NULL;
|
||||||
guint32 items_num;
|
guint32 items_num;
|
||||||
|
|
||||||
con = get_connection_for_active (nmc->connections, acon);
|
con = NM_CONNECTION (nm_active_connection_get_connection (acon));
|
||||||
|
|
||||||
s_con = nm_connection_get_setting_connection (con);
|
s_con = nm_connection_get_setting_connection (con);
|
||||||
g_assert (s_con != NULL);
|
g_assert (s_con != NULL);
|
||||||
|
|
@ -1350,7 +1323,7 @@ do_connections_show (NmCli *nmc, gboolean active_only, int argc, char **argv)
|
||||||
if (!con) {
|
if (!con) {
|
||||||
acon = find_active_connection (active_cons, nmc->connections, selector, *argv, NULL);
|
acon = find_active_connection (active_cons, nmc->connections, selector, *argv, NULL);
|
||||||
if (acon)
|
if (acon)
|
||||||
con = get_connection_for_active (nmc->connections, acon);
|
con = NM_CONNECTION (nm_active_connection_get_connection (acon));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Print connection details */
|
/* Print connection details */
|
||||||
|
|
|
||||||
|
|
@ -445,15 +445,14 @@ connection_find_ac (NMConnection *conn,
|
||||||
const GPtrArray *acs)
|
const GPtrArray *acs)
|
||||||
{
|
{
|
||||||
NMActiveConnection *ac;
|
NMActiveConnection *ac;
|
||||||
const char *path, *ac_path;
|
NMRemoteConnection *ac_conn;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
path = nm_connection_get_path (conn);
|
|
||||||
for (i = 0; i < acs->len; i++) {
|
for (i = 0; i < acs->len; i++) {
|
||||||
ac = acs->pdata[i];
|
ac = acs->pdata[i];
|
||||||
ac_path = nm_active_connection_get_connection (ac);
|
ac_conn = nm_active_connection_get_connection (ac);
|
||||||
|
|
||||||
if (!g_strcmp0 (path, ac_path))
|
if (conn == NM_CONNECTION (ac_conn))
|
||||||
return ac;
|
return ac;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ global:
|
||||||
nm_active_connection_get_ip4_config;
|
nm_active_connection_get_ip4_config;
|
||||||
nm_active_connection_get_ip6_config;
|
nm_active_connection_get_ip6_config;
|
||||||
nm_active_connection_get_master;
|
nm_active_connection_get_master;
|
||||||
nm_active_connection_get_specific_object;
|
nm_active_connection_get_specific_object_path;
|
||||||
nm_active_connection_get_state;
|
nm_active_connection_get_state;
|
||||||
nm_active_connection_get_type;
|
nm_active_connection_get_type;
|
||||||
nm_active_connection_get_uuid;
|
nm_active_connection_get_uuid;
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,7 @@
|
||||||
#include "nm-dhcp6-config.h"
|
#include "nm-dhcp6-config.h"
|
||||||
#include "nm-ip4-config.h"
|
#include "nm-ip4-config.h"
|
||||||
#include "nm-ip6-config.h"
|
#include "nm-ip6-config.h"
|
||||||
|
#include "nm-remote-connection.h"
|
||||||
|
|
||||||
static GType _nm_active_connection_decide_type (GVariant *value);
|
static GType _nm_active_connection_decide_type (GVariant *value);
|
||||||
|
|
||||||
|
|
@ -48,11 +49,11 @@ G_DEFINE_TYPE_WITH_CODE (NMActiveConnection, nm_active_connection, NM_TYPE_OBJEC
|
||||||
#define NM_ACTIVE_CONNECTION_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_ACTIVE_CONNECTION, NMActiveConnectionPrivate))
|
#define NM_ACTIVE_CONNECTION_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_ACTIVE_CONNECTION, NMActiveConnectionPrivate))
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
char *connection;
|
NMRemoteConnection *connection;
|
||||||
char *id;
|
char *id;
|
||||||
char *uuid;
|
char *uuid;
|
||||||
char *type;
|
char *type;
|
||||||
char *specific_object;
|
char *specific_object_path;
|
||||||
GPtrArray *devices;
|
GPtrArray *devices;
|
||||||
NMActiveConnectionState state;
|
NMActiveConnectionState state;
|
||||||
gboolean is_default;
|
gboolean is_default;
|
||||||
|
|
@ -62,7 +63,7 @@ typedef struct {
|
||||||
NMIP6Config *ip6_config;
|
NMIP6Config *ip6_config;
|
||||||
NMDhcp6Config *dhcp6_config;
|
NMDhcp6Config *dhcp6_config;
|
||||||
gboolean is_vpn;
|
gboolean is_vpn;
|
||||||
char *master;
|
NMDevice *master;
|
||||||
} NMActiveConnectionPrivate;
|
} NMActiveConnectionPrivate;
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
|
|
@ -71,7 +72,7 @@ enum {
|
||||||
PROP_ID,
|
PROP_ID,
|
||||||
PROP_UUID,
|
PROP_UUID,
|
||||||
PROP_TYPE,
|
PROP_TYPE,
|
||||||
PROP_SPECIFIC_OBJECT,
|
PROP_SPECIFIC_OBJECT_PATH,
|
||||||
PROP_DEVICES,
|
PROP_DEVICES,
|
||||||
PROP_STATE,
|
PROP_STATE,
|
||||||
PROP_DEFAULT,
|
PROP_DEFAULT,
|
||||||
|
|
@ -100,15 +101,12 @@ _nm_active_connection_decide_type (GVariant *value)
|
||||||
* nm_active_connection_get_connection:
|
* nm_active_connection_get_connection:
|
||||||
* @connection: a #NMActiveConnection
|
* @connection: a #NMActiveConnection
|
||||||
*
|
*
|
||||||
* Gets the #NMConnection's DBus object path. This is often used with
|
* Gets the #NMRemoteConnection associated with @connection.
|
||||||
* nm_remote_settings_get_connection_by_path() to retrieve the
|
|
||||||
* #NMRemoteConnection object that describes the connection.
|
|
||||||
*
|
*
|
||||||
* Returns: the object path of the #NMConnection which this #NMActiveConnection
|
* Returns: (transfer none): the #NMRemoteConnection which this
|
||||||
* is an active instance of. This is the internal string used by the
|
* #NMActiveConnection is an active instance of.
|
||||||
* connection, and must not be modified.
|
|
||||||
**/
|
**/
|
||||||
const char *
|
NMRemoteConnection *
|
||||||
nm_active_connection_get_connection (NMActiveConnection *connection)
|
nm_active_connection_get_connection (NMActiveConnection *connection)
|
||||||
{
|
{
|
||||||
g_return_val_if_fail (NM_IS_ACTIVE_CONNECTION (connection), NULL);
|
g_return_val_if_fail (NM_IS_ACTIVE_CONNECTION (connection), NULL);
|
||||||
|
|
@ -168,20 +166,26 @@ nm_active_connection_get_connection_type (NMActiveConnection *connection)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* nm_active_connection_get_specific_object:
|
* nm_active_connection_get_specific_object_path:
|
||||||
* @connection: a #NMActiveConnection
|
* @connection: a #NMActiveConnection
|
||||||
*
|
*
|
||||||
* Gets the "specific object" used at the activation.
|
* Gets the path of the "specific object" used at activation.
|
||||||
*
|
*
|
||||||
* Returns: the specific object's DBus path. This is the internal string used by the
|
* Currently there is no single method that will allow you to automatically turn
|
||||||
* connection, and must not be modified.
|
* this into an appropriate #NMObject; you need to know what kind of object it
|
||||||
|
* is based on other information. (Eg, if @connection corresponds to a Wi-Fi
|
||||||
|
* connection, then the specific object will be an #NMAccessPoint, and you can
|
||||||
|
* resolve it with nm_device_wifi_get_access_point_by_path().)
|
||||||
|
*
|
||||||
|
* Returns: the specific object's D-Bus path. This is the internal string used
|
||||||
|
* by the connection, and must not be modified.
|
||||||
**/
|
**/
|
||||||
const char *
|
const char *
|
||||||
nm_active_connection_get_specific_object (NMActiveConnection *connection)
|
nm_active_connection_get_specific_object_path (NMActiveConnection *connection)
|
||||||
{
|
{
|
||||||
g_return_val_if_fail (NM_IS_ACTIVE_CONNECTION (connection), NULL);
|
g_return_val_if_fail (NM_IS_ACTIVE_CONNECTION (connection), NULL);
|
||||||
|
|
||||||
return NM_ACTIVE_CONNECTION_GET_PRIVATE (connection)->specific_object;
|
return NM_ACTIVE_CONNECTION_GET_PRIVATE (connection)->specific_object_path;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -345,12 +349,11 @@ nm_active_connection_get_vpn (NMActiveConnection *connection)
|
||||||
* nm_active_connection_get_master:
|
* nm_active_connection_get_master:
|
||||||
* @connection: a #NMActiveConnection
|
* @connection: a #NMActiveConnection
|
||||||
*
|
*
|
||||||
* Gets the path to the master #NMDevice of the connection.
|
* Gets the master #NMDevice of the connection.
|
||||||
*
|
*
|
||||||
* Returns: the path of the master #NMDevice of the #NMActiveConnection.
|
* Returns: (transfer none): the master #NMDevice of the #NMActiveConnection.
|
||||||
* This is the internal string used by the connection, and must not be modified.
|
|
||||||
**/
|
**/
|
||||||
const char *
|
NMDevice *
|
||||||
nm_active_connection_get_master (NMActiveConnection *connection)
|
nm_active_connection_get_master (NMActiveConnection *connection)
|
||||||
{
|
{
|
||||||
g_return_val_if_fail (NM_IS_ACTIVE_CONNECTION (connection), NULL);
|
g_return_val_if_fail (NM_IS_ACTIVE_CONNECTION (connection), NULL);
|
||||||
|
|
@ -370,6 +373,8 @@ dispose (GObject *object)
|
||||||
|
|
||||||
g_clear_pointer (&priv->devices, g_ptr_array_unref);
|
g_clear_pointer (&priv->devices, g_ptr_array_unref);
|
||||||
|
|
||||||
|
g_clear_object (&priv->connection);
|
||||||
|
g_clear_object (&priv->master);
|
||||||
g_clear_object (&priv->ip4_config);
|
g_clear_object (&priv->ip4_config);
|
||||||
g_clear_object (&priv->dhcp4_config);
|
g_clear_object (&priv->dhcp4_config);
|
||||||
g_clear_object (&priv->ip6_config);
|
g_clear_object (&priv->ip6_config);
|
||||||
|
|
@ -383,12 +388,10 @@ finalize (GObject *object)
|
||||||
{
|
{
|
||||||
NMActiveConnectionPrivate *priv = NM_ACTIVE_CONNECTION_GET_PRIVATE (object);
|
NMActiveConnectionPrivate *priv = NM_ACTIVE_CONNECTION_GET_PRIVATE (object);
|
||||||
|
|
||||||
g_free (priv->connection);
|
|
||||||
g_free (priv->id);
|
g_free (priv->id);
|
||||||
g_free (priv->uuid);
|
g_free (priv->uuid);
|
||||||
g_free (priv->type);
|
g_free (priv->type);
|
||||||
g_free (priv->specific_object);
|
g_free (priv->specific_object_path);
|
||||||
g_free (priv->master);
|
|
||||||
|
|
||||||
G_OBJECT_CLASS (nm_active_connection_parent_class)->finalize (object);
|
G_OBJECT_CLASS (nm_active_connection_parent_class)->finalize (object);
|
||||||
}
|
}
|
||||||
|
|
@ -403,7 +406,7 @@ get_property (GObject *object,
|
||||||
|
|
||||||
switch (prop_id) {
|
switch (prop_id) {
|
||||||
case PROP_CONNECTION:
|
case PROP_CONNECTION:
|
||||||
g_value_set_string (value, nm_active_connection_get_connection (self));
|
g_value_set_object (value, nm_active_connection_get_connection (self));
|
||||||
break;
|
break;
|
||||||
case PROP_ID:
|
case PROP_ID:
|
||||||
g_value_set_string (value, nm_active_connection_get_id (self));
|
g_value_set_string (value, nm_active_connection_get_id (self));
|
||||||
|
|
@ -414,8 +417,8 @@ get_property (GObject *object,
|
||||||
case PROP_TYPE:
|
case PROP_TYPE:
|
||||||
g_value_set_string (value, nm_active_connection_get_connection_type (self));
|
g_value_set_string (value, nm_active_connection_get_connection_type (self));
|
||||||
break;
|
break;
|
||||||
case PROP_SPECIFIC_OBJECT:
|
case PROP_SPECIFIC_OBJECT_PATH:
|
||||||
g_value_set_boxed (value, nm_active_connection_get_specific_object (self));
|
g_value_set_string (value, nm_active_connection_get_specific_object_path (self));
|
||||||
break;
|
break;
|
||||||
case PROP_DEVICES:
|
case PROP_DEVICES:
|
||||||
g_value_take_boxed (value, _nm_utils_copy_object_array (nm_active_connection_get_devices (self)));
|
g_value_take_boxed (value, _nm_utils_copy_object_array (nm_active_connection_get_devices (self)));
|
||||||
|
|
@ -445,7 +448,7 @@ get_property (GObject *object,
|
||||||
g_value_set_boolean (value, nm_active_connection_get_vpn (self));
|
g_value_set_boolean (value, nm_active_connection_get_vpn (self));
|
||||||
break;
|
break;
|
||||||
case PROP_MASTER:
|
case PROP_MASTER:
|
||||||
g_value_set_string (value, nm_active_connection_get_master (self));
|
g_value_set_object (value, nm_active_connection_get_master (self));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
|
|
@ -458,11 +461,11 @@ init_dbus (NMObject *object)
|
||||||
{
|
{
|
||||||
NMActiveConnectionPrivate *priv = NM_ACTIVE_CONNECTION_GET_PRIVATE (object);
|
NMActiveConnectionPrivate *priv = NM_ACTIVE_CONNECTION_GET_PRIVATE (object);
|
||||||
const NMPropertiesInfo property_info[] = {
|
const NMPropertiesInfo property_info[] = {
|
||||||
{ NM_ACTIVE_CONNECTION_CONNECTION, &priv->connection },
|
{ NM_ACTIVE_CONNECTION_CONNECTION, &priv->connection, NULL, NM_TYPE_REMOTE_CONNECTION },
|
||||||
{ NM_ACTIVE_CONNECTION_ID, &priv->id },
|
{ NM_ACTIVE_CONNECTION_ID, &priv->id },
|
||||||
{ NM_ACTIVE_CONNECTION_UUID, &priv->uuid },
|
{ NM_ACTIVE_CONNECTION_UUID, &priv->uuid },
|
||||||
{ NM_ACTIVE_CONNECTION_TYPE, &priv->type },
|
{ NM_ACTIVE_CONNECTION_TYPE, &priv->type },
|
||||||
{ NM_ACTIVE_CONNECTION_SPECIFIC_OBJECT, &priv->specific_object },
|
{ NM_ACTIVE_CONNECTION_SPECIFIC_OBJECT_PATH, &priv->specific_object_path },
|
||||||
{ NM_ACTIVE_CONNECTION_DEVICES, &priv->devices, NULL, NM_TYPE_DEVICE },
|
{ NM_ACTIVE_CONNECTION_DEVICES, &priv->devices, NULL, NM_TYPE_DEVICE },
|
||||||
{ NM_ACTIVE_CONNECTION_STATE, &priv->state },
|
{ NM_ACTIVE_CONNECTION_STATE, &priv->state },
|
||||||
{ NM_ACTIVE_CONNECTION_DEFAULT, &priv->is_default },
|
{ NM_ACTIVE_CONNECTION_DEFAULT, &priv->is_default },
|
||||||
|
|
@ -472,7 +475,7 @@ init_dbus (NMObject *object)
|
||||||
{ NM_ACTIVE_CONNECTION_IP6_CONFIG, &priv->ip6_config, NULL, NM_TYPE_IP6_CONFIG },
|
{ NM_ACTIVE_CONNECTION_IP6_CONFIG, &priv->ip6_config, NULL, NM_TYPE_IP6_CONFIG },
|
||||||
{ NM_ACTIVE_CONNECTION_DHCP6_CONFIG, &priv->dhcp6_config, NULL, NM_TYPE_DHCP6_CONFIG },
|
{ NM_ACTIVE_CONNECTION_DHCP6_CONFIG, &priv->dhcp6_config, NULL, NM_TYPE_DHCP6_CONFIG },
|
||||||
{ NM_ACTIVE_CONNECTION_VPN, &priv->is_vpn },
|
{ NM_ACTIVE_CONNECTION_VPN, &priv->is_vpn },
|
||||||
{ NM_ACTIVE_CONNECTION_MASTER, &priv->master },
|
{ NM_ACTIVE_CONNECTION_MASTER, &priv->master, NULL, NM_TYPE_DEVICE },
|
||||||
|
|
||||||
{ NULL },
|
{ NULL },
|
||||||
};
|
};
|
||||||
|
|
@ -507,12 +510,12 @@ nm_active_connection_class_init (NMActiveConnectionClass *ap_class)
|
||||||
/**
|
/**
|
||||||
* NMActiveConnection:connection:
|
* NMActiveConnection:connection:
|
||||||
*
|
*
|
||||||
* The connection's path of the active connection.
|
* The connection that this is an active instance of.
|
||||||
**/
|
**/
|
||||||
g_object_class_install_property
|
g_object_class_install_property
|
||||||
(object_class, PROP_CONNECTION,
|
(object_class, PROP_CONNECTION,
|
||||||
g_param_spec_string (NM_ACTIVE_CONNECTION_CONNECTION, "", "",
|
g_param_spec_object (NM_ACTIVE_CONNECTION_CONNECTION, "", "",
|
||||||
NULL,
|
NM_TYPE_REMOTE_CONNECTION,
|
||||||
G_PARAM_READABLE |
|
G_PARAM_READABLE |
|
||||||
G_PARAM_STATIC_STRINGS));
|
G_PARAM_STATIC_STRINGS));
|
||||||
|
|
||||||
|
|
@ -553,13 +556,14 @@ nm_active_connection_class_init (NMActiveConnectionClass *ap_class)
|
||||||
G_PARAM_STATIC_STRINGS));
|
G_PARAM_STATIC_STRINGS));
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* NMActiveConnection:specific-object:
|
* NMActiveConnection:specific-object-path:
|
||||||
*
|
*
|
||||||
* The specific object's path of the active connection.
|
* The path to the "specific object" of the active connection; see
|
||||||
|
* nm_active_connection_get_specific_object_path() for more details.
|
||||||
**/
|
**/
|
||||||
g_object_class_install_property
|
g_object_class_install_property
|
||||||
(object_class, PROP_SPECIFIC_OBJECT,
|
(object_class, PROP_SPECIFIC_OBJECT_PATH,
|
||||||
g_param_spec_string (NM_ACTIVE_CONNECTION_SPECIFIC_OBJECT, "", "",
|
g_param_spec_string (NM_ACTIVE_CONNECTION_SPECIFIC_OBJECT_PATH, "", "",
|
||||||
NULL,
|
NULL,
|
||||||
G_PARAM_READABLE |
|
G_PARAM_READABLE |
|
||||||
G_PARAM_STATIC_STRINGS));
|
G_PARAM_STATIC_STRINGS));
|
||||||
|
|
@ -678,12 +682,12 @@ nm_active_connection_class_init (NMActiveConnectionClass *ap_class)
|
||||||
/**
|
/**
|
||||||
* NMActiveConnection:master:
|
* NMActiveConnection:master:
|
||||||
*
|
*
|
||||||
* The path of the master device if one exists.
|
* The master device if one exists.
|
||||||
**/
|
**/
|
||||||
g_object_class_install_property
|
g_object_class_install_property
|
||||||
(object_class, PROP_MASTER,
|
(object_class, PROP_MASTER,
|
||||||
g_param_spec_string (NM_ACTIVE_CONNECTION_MASTER, "", "",
|
g_param_spec_object (NM_ACTIVE_CONNECTION_MASTER, "", "",
|
||||||
NULL,
|
NM_TYPE_DEVICE,
|
||||||
G_PARAM_READABLE |
|
G_PARAM_READABLE |
|
||||||
G_PARAM_STATIC_STRINGS));
|
G_PARAM_STATIC_STRINGS));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,7 @@ G_BEGIN_DECLS
|
||||||
#define NM_ACTIVE_CONNECTION_ID "id"
|
#define NM_ACTIVE_CONNECTION_ID "id"
|
||||||
#define NM_ACTIVE_CONNECTION_UUID "uuid"
|
#define NM_ACTIVE_CONNECTION_UUID "uuid"
|
||||||
#define NM_ACTIVE_CONNECTION_TYPE "type"
|
#define NM_ACTIVE_CONNECTION_TYPE "type"
|
||||||
#define NM_ACTIVE_CONNECTION_SPECIFIC_OBJECT "specific-object"
|
#define NM_ACTIVE_CONNECTION_SPECIFIC_OBJECT_PATH "specific-object-path"
|
||||||
#define NM_ACTIVE_CONNECTION_DEVICES "devices"
|
#define NM_ACTIVE_CONNECTION_DEVICES "devices"
|
||||||
#define NM_ACTIVE_CONNECTION_STATE "state"
|
#define NM_ACTIVE_CONNECTION_STATE "state"
|
||||||
#define NM_ACTIVE_CONNECTION_DEFAULT "default"
|
#define NM_ACTIVE_CONNECTION_DEFAULT "default"
|
||||||
|
|
@ -66,14 +66,14 @@ typedef struct {
|
||||||
|
|
||||||
GType nm_active_connection_get_type (void);
|
GType nm_active_connection_get_type (void);
|
||||||
|
|
||||||
const char * nm_active_connection_get_connection (NMActiveConnection *connection);
|
NMRemoteConnection *nm_active_connection_get_connection (NMActiveConnection *connection);
|
||||||
const char *nm_active_connection_get_id (NMActiveConnection *connection);
|
const char *nm_active_connection_get_id (NMActiveConnection *connection);
|
||||||
const char *nm_active_connection_get_uuid (NMActiveConnection *connection);
|
const char *nm_active_connection_get_uuid (NMActiveConnection *connection);
|
||||||
const char *nm_active_connection_get_connection_type (NMActiveConnection *connection);
|
const char *nm_active_connection_get_connection_type (NMActiveConnection *connection);
|
||||||
const char * nm_active_connection_get_specific_object (NMActiveConnection *connection);
|
const char *nm_active_connection_get_specific_object_path (NMActiveConnection *connection);
|
||||||
const GPtrArray *nm_active_connection_get_devices (NMActiveConnection *connection);
|
const GPtrArray *nm_active_connection_get_devices (NMActiveConnection *connection);
|
||||||
NMActiveConnectionState nm_active_connection_get_state (NMActiveConnection *connection);
|
NMActiveConnectionState nm_active_connection_get_state (NMActiveConnection *connection);
|
||||||
const char * nm_active_connection_get_master (NMActiveConnection *connection);
|
NMDevice *nm_active_connection_get_master (NMActiveConnection *connection);
|
||||||
gboolean nm_active_connection_get_default (NMActiveConnection *connection);
|
gboolean nm_active_connection_get_default (NMActiveConnection *connection);
|
||||||
NMIP4Config *nm_active_connection_get_ip4_config (NMActiveConnection *connection);
|
NMIP4Config *nm_active_connection_get_ip4_config (NMActiveConnection *connection);
|
||||||
NMDhcp4Config *nm_active_connection_get_dhcp4_config (NMActiveConnection *connection);
|
NMDhcp4Config *nm_active_connection_get_dhcp4_config (NMActiveConnection *connection);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue