GNOME Bugzilla – Bug 702762
libnm-util/libnm-glib property types and return values
Last modified: 2014-01-02 21:12:09 UTC
If we ever break API/ABI, we should redo all the GObject property types and harmonize them with return values of various functions. Right now, for example, we have 3 different GTypes for SSIDs: GByteArray* - nm_ap_get_ssid() (boxed type G_TYPE_BYTE_ARRAY) NM_TYPE_SSID - NMAccessPoint "SSID" property type DBUS_G_TYPE_UCHAR_ARRAY - NMSettingWireless "SSID" property type All these types wrap GByteArray in a boxed type, but the boxed types are all different. They all have their reasons, and they are all historical, but we have the same problem with all of the GObject properties in libnm-glib and libnm-util.
For example, you can't do this in python: from gi.repository import GObject, NetworkManager, NMClient ap = None for d in NMClient.Client.new().get_devices(): if d.get_property('device-type') == 2: ap = d.get_access_points()[0] break if ap: break s_wifi = NetworkManager.SettingWireless() # this will fail because set_property() wants a DBUS_G_TYPE_UCHAR_ARRAY # but ap.get_ssid() returns GByteArray* s_wifi.set_property('ssid', ap.get_ssid()) # this will also fail because set_property() wants a DBUS_G_TYPE_UCHAR_ARRAY # but get_property() returns a NM_TYPE_SSID ssid = ap.get_property('ssid') s_wifi.set_property('ssid', ssid) but this really ought to work.
dup'ing to the "break ABI" bug *** This bug has been marked as a duplicate of bug 680675 ***