libnm: add nm-plugin-missing property indicating NM device plugin not available

This commit is contained in:
Jiří Klimeš 2015-04-14 14:31:42 +02:00
parent fc6373bea9
commit 4c398ab03f
3 changed files with 43 additions and 0 deletions

View file

@ -847,6 +847,7 @@ local:
libnm_1_2_0 {
global:
nm_device_get_nm_plugin_missing;
nm_setting_802_1x_check_cert_scheme;
nm_setting_bridge_get_multicast_snooping;
nm_setting_wireless_get_powersave;

View file

@ -84,6 +84,7 @@ typedef struct {
NMDeviceCapabilities capabilities;
gboolean managed;
gboolean firmware_missing;
gboolean nm_plugin_missing;
gboolean autoconnect;
NMIPConfig *ip4_config;
NMDhcpConfig *dhcp4_config;
@ -116,6 +117,7 @@ enum {
PROP_MANAGED,
PROP_AUTOCONNECT,
PROP_FIRMWARE_MISSING,
PROP_NM_PLUGIN_MISSING,
PROP_IP4_CONFIG,
PROP_DHCP4_CONFIG,
PROP_IP6_CONFIG,
@ -183,6 +185,7 @@ init_dbus (NMObject *object)
{ NM_DEVICE_MANAGED, &priv->managed },
{ NM_DEVICE_AUTOCONNECT, &priv->autoconnect },
{ NM_DEVICE_FIRMWARE_MISSING, &priv->firmware_missing },
{ NM_DEVICE_NM_PLUGIN_MISSING, &priv->nm_plugin_missing },
{ NM_DEVICE_IP4_CONFIG, &priv->ip4_config, NULL, NM_TYPE_IP4_CONFIG },
{ NM_DEVICE_DHCP4_CONFIG, &priv->dhcp4_config, NULL, NM_TYPE_DHCP4_CONFIG },
{ NM_DEVICE_IP6_CONFIG, &priv->ip6_config, NULL, NM_TYPE_IP6_CONFIG },
@ -413,6 +416,9 @@ get_property (GObject *object,
case PROP_FIRMWARE_MISSING:
g_value_set_boolean (value, nm_device_get_firmware_missing (device));
break;
case PROP_NM_PLUGIN_MISSING:
g_value_set_boolean (value, nm_device_get_nm_plugin_missing (device));
break;
case PROP_IP4_CONFIG:
g_value_set_object (value, nm_device_get_ip4_config (device));
break;
@ -645,6 +651,21 @@ nm_device_class_init (NMDeviceClass *device_class)
G_PARAM_READABLE |
G_PARAM_STATIC_STRINGS));
/**
* NMDevice:nm-plugin-missing:
*
* When %TRUE indicates that the NetworkManager plugin for the device
* is not installed.
*
* Since: 1.2
**/
g_object_class_install_property
(object_class, PROP_NM_PLUGIN_MISSING,
g_param_spec_boolean (NM_DEVICE_NM_PLUGIN_MISSING, "", "",
FALSE,
G_PARAM_READABLE |
G_PARAM_STATIC_STRINGS));
/**
* NMDevice:ip4-config:
*
@ -1104,6 +1125,24 @@ nm_device_get_firmware_missing (NMDevice *device)
return NM_DEVICE_GET_PRIVATE (device)->firmware_missing;
}
/**
* nm_device_get_nm_plugin_missing:
* @device: a #NMDevice
*
* Indicates that the NetworkManager plugin for the device is not installed.
*
* Returns: %TRUE if the device plugin not installed.
*
* Since: 1.2
**/
gboolean
nm_device_get_nm_plugin_missing (NMDevice *device)
{
g_return_val_if_fail (NM_IS_DEVICE (device), FALSE);
return NM_DEVICE_GET_PRIVATE (device)->nm_plugin_missing;
}
/**
* nm_device_get_ip4_config:
* @device: a #NMDevice

View file

@ -48,6 +48,7 @@ G_BEGIN_DECLS
#define NM_DEVICE_MANAGED "managed"
#define NM_DEVICE_AUTOCONNECT "autoconnect"
#define NM_DEVICE_FIRMWARE_MISSING "firmware-missing"
#define NM_DEVICE_NM_PLUGIN_MISSING "nm-plugin-missing"
#define NM_DEVICE_IP4_CONFIG "ip4-config"
#define NM_DEVICE_DHCP4_CONFIG "dhcp4-config"
#define NM_DEVICE_IP6_CONFIG "ip6-config"
@ -104,6 +105,8 @@ gboolean nm_device_get_managed (NMDevice *device);
gboolean nm_device_get_autoconnect (NMDevice *device);
void nm_device_set_autoconnect (NMDevice *device, gboolean autoconnect);
gboolean nm_device_get_firmware_missing (NMDevice *device);
NM_AVAILABLE_IN_1_2
gboolean nm_device_get_nm_plugin_missing (NMDevice *device);
NMIPConfig * nm_device_get_ip4_config (NMDevice *device);
NMDhcpConfig * nm_device_get_dhcp4_config (NMDevice *device);
NMIPConfig * nm_device_get_ip6_config (NMDevice *device);