After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 702762 - libnm-util/libnm-glib property types and return values
libnm-util/libnm-glib property types and return values
Status: RESOLVED DUPLICATE of bug 680675
Product: NetworkManager
Classification: Platform
Component: general
unspecified
Other Linux
: Normal normal
: ---
Assigned To: NetworkManager maintainer(s)
NetworkManager maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2013-06-20 17:26 UTC by Dan Williams
Modified: 2014-01-02 21:12 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Dan Williams 2013-06-20 17:26:07 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.
Comment 1 Dan Williams 2013-06-20 17:55:23 UTC
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.
Comment 2 Dan Winship 2014-01-02 21:12:09 UTC
dup'ing to the "break ABI" bug

*** This bug has been marked as a duplicate of bug 680675 ***