Commit c1768154 authored by Dan Williams's avatar Dan Williams

core: add Devices property to Manager

Helps other bindings.
parent 0c8b27ef
......@@ -320,6 +320,12 @@
</tp:docstring>
</property>
<property name="Devices" type="ao" access="read">
<tp:docstring>
List of network device object paths.
</tp:docstring>
</property>
<property name="PrimaryConnection" type="o" access="read">
<tp:docstring>
The object path of the "primary" active connection being used
......
......@@ -290,6 +290,7 @@ enum {
PROP_WIMAX_ENABLED,
PROP_WIMAX_HARDWARE_ENABLED,
PROP_ACTIVE_CONNECTIONS,
PROP_DEVICES,
PROP_CONNECTIVITY,
PROP_PRIMARY_CONNECTION,
PROP_ACTIVATING_CONNECTION,
......@@ -816,6 +817,7 @@ remove_device (NMManager *manager, NMDevice *device, gboolean quitting)
nm_settings_device_removed (priv->settings, device, quitting);
g_signal_emit (manager, signals[DEVICE_REMOVED], 0, device);
g_object_notify (G_OBJECT (manager), NM_MANAGER_DEVICES);
g_object_unref (device);
priv->devices = g_slist_remove (priv->devices, device);
......@@ -1879,6 +1881,7 @@ add_device (NMManager *self, NMDevice *device, gboolean generate_con)
nm_settings_device_added (priv->settings, device);
g_signal_emit (self, signals[DEVICE_ADDED], 0, device);
g_object_notify (G_OBJECT (self), NM_MANAGER_DEVICES);
/* New devices might be master interfaces for virtual interfaces; so we may
* need to create new virtual interfaces now.
......@@ -4766,7 +4769,7 @@ get_property (GObject *object, guint prop_id,
NMManager *self = NM_MANAGER (object);
NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE (self);
GSList *iter;
GPtrArray *active;
GPtrArray *array;
const char *path;
switch (prop_id) {
......@@ -4802,13 +4805,22 @@ get_property (GObject *object, guint prop_id,
g_value_set_boolean (value, priv->radio_states[RFKILL_TYPE_WIMAX].hw_enabled);
break;
case PROP_ACTIVE_CONNECTIONS:
active = g_ptr_array_sized_new (3);
array = g_ptr_array_sized_new (3);
for (iter = priv->active_connections; iter; iter = g_slist_next (iter)) {
path = nm_active_connection_get_path (NM_ACTIVE_CONNECTION (iter->data));
if (path)
g_ptr_array_add (active, g_strdup (path));
g_ptr_array_add (array, g_strdup (path));
}
g_value_take_boxed (value, active);
g_value_take_boxed (value, array);
break;
case PROP_DEVICES:
array = g_ptr_array_sized_new (3);
for (iter = priv->devices; iter; iter = g_slist_next (iter)) {
path = nm_device_get_path (NM_DEVICE (iter->data));
if (path)
g_ptr_array_add (array, g_strdup (path));
}
g_value_take_boxed (value, array);
break;
case PROP_CONNECTIVITY:
g_value_set_uint (value, nm_connectivity_get_state (priv->connectivity));
......@@ -5088,6 +5100,14 @@ nm_manager_class_init (NMManagerClass *manager_class)
DBUS_TYPE_G_ARRAY_OF_OBJECT_PATH,
G_PARAM_READABLE));
g_object_class_install_property
(object_class, PROP_DEVICES,
g_param_spec_boxed (NM_MANAGER_DEVICES,
"Network devices",
"Network devices",
DBUS_TYPE_G_ARRAY_OF_OBJECT_PATH,
G_PARAM_READABLE));
g_object_class_install_property
(object_class, PROP_CONNECTIVITY,
g_param_spec_uint (NM_MANAGER_CONNECTIVITY,
......
......@@ -62,6 +62,7 @@ typedef enum {
#define NM_MANAGER_WIMAX_ENABLED "wimax-enabled"
#define NM_MANAGER_WIMAX_HARDWARE_ENABLED "wimax-hardware-enabled"
#define NM_MANAGER_ACTIVE_CONNECTIONS "active-connections"
#define NM_MANAGER_DEVICES "devices"
#define NM_MANAGER_CONNECTIVITY "connectivity"
#define NM_MANAGER_PRIMARY_CONNECTION "primary-connection"
#define NM_MANAGER_ACTIVATING_CONNECTION "activating-connection"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment