Commit 5293683e authored by Dan Williams's avatar Dan Williams

libnm/libnm-util: add Wi-Fi 'powersave' property

parent 7bdc6f5d
......@@ -60,6 +60,7 @@ typedef struct {
guint32 mtu;
GSList *seen_bssids;
gboolean hidden;
guint32 powersave;
} NMSettingWirelessPrivate;
enum {
......@@ -77,6 +78,7 @@ enum {
PROP_MTU,
PROP_SEEN_BSSIDS,
PROP_HIDDEN,
PROP_POWERSAVE,
LAST_PROP
};
......@@ -601,6 +603,22 @@ nm_setting_wireless_get_hidden (NMSettingWireless *setting)
return NM_SETTING_WIRELESS_GET_PRIVATE (setting)->hidden;
}
/**
* nm_setting_wireless_get_powersave:
* @setting: the #NMSettingWireless
*
* Returns: the #NMSettingWireless:powersave property of the setting
*
* Since: 1.2
**/
guint32
nm_setting_wireless_get_powersave (NMSettingWireless *setting)
{
g_return_val_if_fail (NM_IS_SETTING_WIRELESS (setting), 0);
return NM_SETTING_WIRELESS_GET_PRIVATE (setting)->powersave;
}
/**
* nm_setting_wireless_add_seen_bssid:
* @setting: the #NMSettingWireless
......@@ -916,6 +934,9 @@ set_property (GObject *object, guint prop_id,
case PROP_HIDDEN:
priv->hidden = g_value_get_boolean (value);
break;
case PROP_POWERSAVE:
priv->powersave = g_value_get_uint (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
......@@ -969,6 +990,9 @@ get_property (GObject *object, guint prop_id,
case PROP_HIDDEN:
g_value_set_boolean (value, nm_setting_wireless_get_hidden (setting));
break;
case PROP_POWERSAVE:
g_value_set_uint (value, nm_setting_wireless_get_powersave (setting));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
......@@ -1315,6 +1339,23 @@ nm_setting_wireless_class_init (NMSettingWirelessClass *setting_class)
G_PARAM_READWRITE |
G_PARAM_STATIC_STRINGS));
/**
* NMSettingWireless:powersave:
*
* If set to %FALSE, Wi-Fi power saving behavior is disabled. If set to
* %TRUE, Wi-Fi power saving behavior is enabled. All other values are
* reserved. Note that even though only boolean values are allowed, the
* property type is an unsigned integer to allow for future expansion.
*
* Since: 1.2
**/
g_object_class_install_property
(object_class, PROP_POWERSAVE,
g_param_spec_uint (NM_SETTING_WIRELESS_POWERSAVE, "", "",
0, G_MAXUINT32, 0,
G_PARAM_READWRITE |
G_PARAM_STATIC_STRINGS));
/* Compatibility for deprecated property */
/* ---ifcfg-rh---
* property: security
......
......@@ -55,6 +55,7 @@ G_BEGIN_DECLS
#define NM_SETTING_WIRELESS_MTU "mtu"
#define NM_SETTING_WIRELESS_SEEN_BSSIDS "seen-bssids"
#define NM_SETTING_WIRELESS_HIDDEN "hidden"
#define NM_SETTING_WIRELESS_POWERSAVE "powersave"
/**
* NM_SETTING_WIRELESS_MODE_ADHOC:
......@@ -118,6 +119,8 @@ void nm_setting_wireless_clear_mac_blacklist_items (NMSettingWire
guint32 nm_setting_wireless_get_mtu (NMSettingWireless *setting);
gboolean nm_setting_wireless_get_hidden (NMSettingWireless *setting);
NM_AVAILABLE_IN_1_2
guint32 nm_setting_wireless_get_powersave (NMSettingWireless *setting);
gboolean nm_setting_wireless_add_seen_bssid (NMSettingWireless *setting,
const char *bssid);
......
......@@ -562,6 +562,7 @@ global:
nm_setting_wireless_get_mtu;
nm_setting_wireless_get_num_mac_blacklist_items;
nm_setting_wireless_get_num_seen_bssids;
nm_setting_wireless_get_powersave;
nm_setting_wireless_get_rate;
nm_setting_wireless_get_security;
nm_setting_wireless_get_seen_bssid;
......
......@@ -87,6 +87,7 @@ typedef struct {
GSList *seen_bssids;
char *security;
gboolean hidden;
guint32 powersave;
} NMSettingWirelessPrivate;
enum {
......@@ -105,6 +106,7 @@ enum {
PROP_SEEN_BSSIDS,
PROP_SEC,
PROP_HIDDEN,
PROP_POWERSAVE,
LAST_PROP
};
......@@ -661,6 +663,22 @@ nm_setting_wireless_get_hidden (NMSettingWireless *setting)
return NM_SETTING_WIRELESS_GET_PRIVATE (setting)->hidden;
}
/**
* nm_setting_wireless_get_powersave:
* @setting: the #NMSettingWireless
*
* Returns: the #NMSettingWireless:powersave property of the setting
*
* Since: 1.2
**/
guint32
nm_setting_wireless_get_powersave (NMSettingWireless *setting)
{
g_return_val_if_fail (NM_IS_SETTING_WIRELESS (setting), 0);
return NM_SETTING_WIRELESS_GET_PRIVATE (setting)->powersave;
}
/**
* nm_setting_wireless_add_seen_bssid:
* @setting: the #NMSettingWireless
......@@ -953,6 +971,9 @@ set_property (GObject *object, guint prop_id,
case PROP_HIDDEN:
priv->hidden = g_value_get_boolean (value);
break;
case PROP_POWERSAVE:
priv->powersave = g_value_get_uint (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
......@@ -1008,6 +1029,9 @@ get_property (GObject *object, guint prop_id,
case PROP_HIDDEN:
g_value_set_boolean (value, nm_setting_wireless_get_hidden (setting));
break;
case PROP_POWERSAVE:
g_value_set_uint (value, nm_setting_wireless_get_powersave (setting));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
......@@ -1244,4 +1268,21 @@ nm_setting_wireless_class_init (NMSettingWirelessClass *setting_class)
FALSE,
G_PARAM_READWRITE |
G_PARAM_STATIC_STRINGS));
/**
* NMSettingWireless:powersave:
*
* If set to %FALSE, Wi-Fi power saving behavior is disabled. If set to
* %TRUE, Wi-Fi power saving behavior is enabled. All other values are
* reserved. Note that even though only boolean values are allowed, the
* property type is an unsigned integer to allow for future expansion.
*
* Since: 1.2
**/
g_object_class_install_property
(object_class, PROP_POWERSAVE,
g_param_spec_uint (NM_SETTING_WIRELESS_POWERSAVE, "", "",
0, G_MAXUINT32, 0,
G_PARAM_READWRITE |
G_PARAM_STATIC_STRINGS));
}
......@@ -73,6 +73,7 @@ GQuark nm_setting_wireless_error_quark (void);
#define NM_SETTING_WIRELESS_MTU "mtu"
#define NM_SETTING_WIRELESS_SEEN_BSSIDS "seen-bssids"
#define NM_SETTING_WIRELESS_HIDDEN "hidden"
#define NM_SETTING_WIRELESS_POWERSAVE "powersave"
/* Deprecated */
#define NM_SETTING_WIRELESS_SEC "security"
......@@ -150,6 +151,8 @@ void nm_setting_wireless_clear_mac_blacklist_items (NMSettingWire
guint32 nm_setting_wireless_get_mtu (NMSettingWireless *setting);
gboolean nm_setting_wireless_get_hidden (NMSettingWireless *setting);
NM_AVAILABLE_IN_1_2
guint32 nm_setting_wireless_get_powersave (NMSettingWireless *setting);
gboolean nm_setting_wireless_add_seen_bssid (NMSettingWireless *setting,
const char *bssid);
......
......@@ -705,6 +705,7 @@ global:
nm_setting_wireless_get_mtu;
nm_setting_wireless_get_num_mac_blacklist_items;
nm_setting_wireless_get_num_seen_bssids;
nm_setting_wireless_get_powersave;
nm_setting_wireless_get_rate;
nm_setting_wireless_get_seen_bssid;
nm_setting_wireless_get_ssid;
......
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