From 19d78821c530f20263337f13d3709c4e9feadf49 Mon Sep 17 00:00:00 2001 From: Dan Winship Date: Thu, 20 Nov 2014 15:42:35 -0500 Subject: libnm: post-process NM-1.0.gir to fix GPtrArray property types Only super-new gobject-introspection can properly annotate the Element-Type of a GPtrArray-valued property. So just do it manually with a perl script instead. NOTE: as of GNOME 3.12, this is pointless, because neither pygi nor gjs pays attention to the annotations anyway. --- .gitignore | 1 + libnm/Makefile.am | 6 ++++++ libnm/fix-gir.pl | 48 ++++++++++++++++++++++++++++++++++++++++++++ libnm/nm-active-connection.c | 2 -- libnm/nm-client.c | 6 ------ libnm/nm-device-bond.c | 2 -- libnm/nm-device-bridge.c | 2 -- libnm/nm-device-team.c | 2 -- libnm/nm-device-wifi.c | 2 -- libnm/nm-device-wimax.c | 2 -- libnm/nm-device.c | 2 -- 11 files changed, 55 insertions(+), 20 deletions(-) create mode 100755 libnm/fix-gir.pl diff --git a/.gitignore b/.gitignore index 89047a3442..077d43f71e 100644 --- a/.gitignore +++ b/.gitignore @@ -168,6 +168,7 @@ valgrind-*.log /libnm/nm-property-docs.xml /libnm/nm-setting-docs.xml /libnm/nm-setting-docs-overrides.xml +/libnm/NM-1.0.gir.fixup-stamp /libnm/tests/test-nm-client /libnm/tests/test-remote-settings-client /libnm/tests/test-secret-agent diff --git a/libnm/Makefile.am b/libnm/Makefile.am index e8915b4268..c3baf3d6c9 100644 --- a/libnm/Makefile.am +++ b/libnm/Makefile.am @@ -177,6 +177,12 @@ typelibdir = $(libdir)/girepository-1.0 typelib_DATA = $(INTROSPECTION_GIRS:.gir=.typelib) CLEANFILES += $(gir_DATA) $(typelib_DATA) + +NM-1.0.typelib: NM-1.0.gir.fixup-stamp + +NM-1.0.gir.fixup-stamp: NM-1.0.gir fix-gir.pl + @($(srcdir)/fix-gir.pl $< > $<.tmp && mv $<.tmp $< && touch $@) || rm -f $<.tmp + endif check-local: diff --git a/libnm/fix-gir.pl b/libnm/fix-gir.pl new file mode 100755 index 0000000000..f72d3b9eed --- /dev/null +++ b/libnm/fix-gir.pl @@ -0,0 +1,48 @@ +#!/usr/bin/perl +# vim: ft=perl ts=2 sts=2 sw=2 et ai +# -*- Mode: perl; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- + +# g-ir-scanner < 1.42 does not allow us to correctly annotate GArray-valued or +# GPtrArray-valued properties, so we need this... + +%fixups = ( 'NMActiveConnection:devices' => 'NMDevice', + 'NMClient:active-connections' => 'NMActiveConnection', + 'NMClient:connections' => 'NMRemoteConnection', + 'NMClient:devices' => 'NMDevice', + 'NMDevice:available-connections' => 'NMRemoteConnection', + 'NMDeviceBond:slaves' => 'NMDevice', + 'NMDeviceBridge:slaves' => 'NMDevice', + 'NMDeviceTeam:slaves' => 'NMDevice', + 'NMDeviceWifi:access-points' => 'NMAccessPoint', + 'NMDeviceWimax:nsps' => 'NMWimaxNsp', + 'NMSettingDcb:priority-bandwidth' => 'guint', + 'NMSettingDcb:priority-flow-control' => 'gboolean', + 'NMSettingDcb:priority-group-bandwidth' => 'guint', + 'NMSettingDcb:priority-group-id' => 'guint', + 'NMSettingDcb:priority-strict-bandwidth' => 'gboolean', + 'NMSettingDcb:priority-traffic-class' => 'guint', + 'NMSettingIPConfig:addresses' => 'NMIPAddress', + 'NMSettingIPConfig:routes' => 'NMIPRoute' + ); + +while (<>) { + if (//) { + $c_type = ''; + } + + if ($c_type && /