Re: [PATCH 1/4 v2] libnm-core: add wake-on-wlan configuration items



On Wed, 2017-01-18 at 17:32 +0100, Simon Fels wrote:
---
+     /**
+      * NMSettingWireless:wake-on-wlan:
+      *
+      * The #NMSettingWirelessWakeOnWLan options to enable. Not
all devices support all options.
+      *
+      * Since: 1.2
+      **/
+     g_object_class_install_property
+             (object_class, PROP_WAKE_ON_WLAN,
+              g_param_spec_uint
(NM_SETTING_WIRELESS_WAKE_ON_WLAN, "", "",
+                                 0, G_MAXUINT32, 

let's use G_MAXINT32. We use guint type for the property (instead of
enum) to have the libnm API extendable later. We use an excessive range
of numeric values here to be forward compatible. But let's catch
negative values with the gobject range check:

  NMSettingWirelessWakeOnWLan v;

  v = (NMSettingWirelessWakeOnWLan) -1;
  g_object_set (setting,
                NM_SETTING_WIRELESS_WAKE_ON_WLAN,
                (guint) v,
                NULL);

would result in an assertion failure.


NM_SETTING_WIRELESS_WAKE_ON_WLAN_DEFAULT,
+                                 G_PARAM_CONSTRUCT |
+                                 G_PARAM_READWRITE |
+                                 G_PARAM_STATIC_STRINGS));

Attachment: signature.asc
Description: This is a digitally signed message part



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]