diff options
author | Giovanni Campagna <scampa.giovanni@gmail.com> | 2011-01-21 14:46:09 -0600 |
---|---|---|
committer | Dan Williams <dcbw@redhat.com> | 2011-01-21 14:46:09 -0600 |
commit | 3ebecd2a295b40081321d1b3f26fb1204fe5d4c4 (patch) | |
tree | bc6c3f4cbda8086fb2d2fe7b614fe9bce1af79c8 | |
parent | 9067356856f56a949ef8af5838e3dc4acf506256 (diff) | |
download | NetworkManager-3ebecd2a295b40081321d1b3f26fb1204fe5d4c4.tar.gz |
introspection: add GObject introspection support (bgo #637032)
Add the necessary annotations (the mininum required, that is those
on return values. NULL parameters or container types may require
more), and the Autotools stuff to get a NetworkManager GIR for
libnm-util and a NMClient for libnm-glib.
31 files changed, 370 insertions, 149 deletions
diff --git a/.gitignore b/.gitignore index b87df2330d..cd8aa6a879 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,8 @@ *.lo *.la *.bz2 +*.gir +*.typelib Makefile Makefile.in* configure diff --git a/Makefile.am b/Makefile.am index c3eb4e1511..78924ab7da 100644 --- a/Makefile.am +++ b/Makefile.am @@ -29,7 +29,8 @@ DISTCHECK_CONFIGURE_FLAGS = \ --with-tests=yes \ --with-docs=yes \ --with-udev-dir=$$dc_install_base/lib/udev \ - --with-systemdsystemunitdir=$$dc_install_base/$(systemdsystemunitdir) + --with-systemdsystemunitdir=$$dc_install_base/$(systemdsystemunitdir) \ + --enable-wimax=no DISTCLEANFILES = intltool-extract intltool-merge intltool-update diff --git a/configure.ac b/configure.ac index a7b8b1a965..05fde82a4b 100644 --- a/configure.ac +++ b/configure.ac @@ -241,6 +241,8 @@ PKG_CHECK_MODULES(GIO, gio-2.0) AC_SUBST(GIO_CFLAGS) AC_SUBST(GIO_LIBS) +GOBJECT_INTROSPECTION_CHECK([0.9.6]) + AC_ARG_WITH(udev-dir, AS_HELP_STRING([--with-udev-dir=DIR], [where the udev base directory is])) if test -n "$with_udev_dir" ; then UDEV_BASE_DIR="$with_udev_dir" diff --git a/libnm-glib/Makefile.am b/libnm-glib/Makefile.am index bedc9805b6..40e43f89da 100644 --- a/libnm-glib/Makefile.am +++ b/libnm-glib/Makefile.am @@ -47,6 +47,9 @@ libdeprecated_nm_glib_la_LIBADD = \ $(DBUS_LIBS) \ $(GLIB_LIBS) +libdeprecateddir = $(includedir)/libnm-glib +libdeprecated_HEADERS = libnm_glib.h + ##################################################### # Real libnm-glib stuff ##################################################### @@ -59,9 +62,9 @@ libnm_glib_la_CFLAGS = \ $(GUDEV_CFLAGS) libnmincludedir = $(includedir)/libnm-glib +libnmvpndir = $(includedir)/libnm-glib libnminclude_HEADERS = \ - libnm_glib.h \ nm-object.h \ nm-client.h \ nm-device.h \ @@ -74,8 +77,6 @@ libnminclude_HEADERS = \ nm-cdma-device.h \ nm-serial-device.h \ nm-vpn-connection.h \ - nm-vpn-plugin.h \ - nm-vpn-plugin-ui-interface.h \ nm-types.h \ nm-active-connection.h \ nm-dhcp4-config.h \ @@ -87,14 +88,15 @@ libnminclude_HEADERS = \ nm-device-wimax.h \ nm-wimax-nsp.h -libnm_glib_la_SOURCES = \ +libnmvpn_HEADERS = \ + nm-vpn-plugin.h \ + nm-vpn-plugin-ui-interface.h + +libnm_glib_la_csources = \ nm-object.c \ - nm-object-private.h \ nm-client.c \ nm-dbus-utils.c \ - nm-dbus-utils.h \ nm-device.c \ - nm-device-private.h \ nm-device-ethernet.c \ nm-device-wifi.c \ nm-device-bt.c \ @@ -105,20 +107,29 @@ libnm_glib_la_SOURCES = \ nm-serial-device.c \ nm-vpn-connection.c \ nm-types.c \ - nm-types-private.h \ nm-object-cache.c \ - nm-object-cache.h \ nm-active-connection.c \ nm-dhcp4-config.c \ nm-ip6-config.c \ nm-dhcp6-config.c \ nm-remote-connection.c \ - nm-remote-connection-private.h \ nm-remote-settings.c \ nm-secret-agent.c \ nm-device-wimax.c \ nm-wimax-nsp.c +libnm_glib_la_private_headers = \ + nm-object-private.h \ + nm-dbus-utils.h \ + nm-device-private.h \ + nm-types-private.h \ + nm-object-cache.h \ + nm-remote-connection-private.h + +libnm_glib_la_SOURCES = \ + $(libnm_glib_la_csources) \ + $(libnm_glib_la_private_headers) + libnm_glib_la_LIBADD = \ $(top_builddir)/libnm-util/libnm-util.la \ $(top_builddir)/marshallers/libmarshallers.la \ @@ -128,7 +139,7 @@ libnm_glib_la_LIBADD = \ $(GUDEV_LIBS) libnm_glib_la_LDFLAGS = -Wl,--version-script=$(srcdir)/libnm-glib.ver \ - -version-info "6:2:4" + -version-info "7:0:5" noinst_PROGRAMS = libnm-glib-test @@ -225,3 +236,28 @@ DISTCLEANFILES = libnm-glib.pc libnm-glib.pc EXTRA_DIST = libnm-glib.pc.in libnm-glib-vpn.pc.in libnm-glib.ver libnm-glib-vpn.ver CLEANFILES = $(BUILT_SOURCES) + +-include $(INTROSPECTION_MAKEFILE) +INTROSPECTION_GIRS = +INTROSPECTION_COMPILER_ARGS = --includedir=$(top_builddir)/libnm-util + +if HAVE_INTROSPECTION +introspection_sources = $(libnminclude_HEADERS) $(libnm_glib_la_csources) + +NMClient-1.0.gir: libnm-glib.la +NMClient_1_0_gir_INCLUDES = GObject-2.0 DBusGLib-1.0 +NMClient_1_0_gir_PACKAGES = gobject-2.0 dbus-glib-1 gudev-1.0 +NMClient_1_0_gir_CFLAGS = $(INCLUDES) +NMClient_1_0_gir_LIBS = libnm-glib.la +NMClient_1_0_gir_FILES = $(introspection_sources) +NMClient_1_0_gir_SCANNERFLAGS = --warn-all --identifier-prefix=NM --symbol-prefix=nm_ --include-uninstalled=$(top_builddir)/libnm-util/NetworkManager-1.0.gir +INTROSPECTION_GIRS += NMClient-1.0.gir + +girdir = $(datadir)/gir-1.0 +gir_DATA = $(INTROSPECTION_GIRS) + +typelibdir = $(libdir)/girepository-1.0 +typelib_DATA = $(INTROSPECTION_GIRS:.gir=.typelib) + +CLEANFILES += $(gir_DATA) $(typelib_DATA) +endif diff --git a/libnm-glib/libnm-glib.pc.in b/libnm-glib/libnm-glib.pc.in index 5c3471b16e..a1010baabf 100644 --- a/libnm-glib/libnm-glib.pc.in +++ b/libnm-glib/libnm-glib.pc.in @@ -6,7 +6,7 @@ includedir=@includedir@ Name: libnm-glib Description: Convenience library for clients of NetworkManager Version: @VERSION@ -Requires: NetworkManager >= 0.7.999 glib-2.0 dbus-glib-1 +Requires: NetworkManager >= 0.7.999 gobject-2.0 dbus-glib-1 Cflags: -I${includedir}/libnm-glib Libs: -L${libdir} -lnm-glib diff --git a/libnm-glib/nm-active-connection.c b/libnm-glib/nm-active-connection.c index f9e8adbf14..46ca12f5c0 100644 --- a/libnm-glib/nm-active-connection.c +++ b/libnm-glib/nm-active-connection.c @@ -149,7 +149,7 @@ nm_active_connection_get_specific_object (NMActiveConnection *connection) * * Gets the #NMDevice<!-- -->s used for the active connections. * - * Returns: the #GPtrArray containing #NMDevice<!-- -->s. + * Returns: (element-type NMClient.Device): the #GPtrArray containing #NMDevice<!-- -->s. * This is the internal copy used by the connection, and must not be modified. **/ const GPtrArray * @@ -301,7 +301,7 @@ get_property (GObject *object, switch (prop_id) { case PROP_CONNECTION: - g_value_set_boxed (value, nm_active_connection_get_connection (self)); + g_value_set_string (value, nm_active_connection_get_connection (self)); break; case PROP_SPECIFIC_OBJECT: g_value_set_boxed (value, nm_active_connection_get_specific_object (self)); diff --git a/libnm-glib/nm-client.c b/libnm-glib/nm-client.c index ff8b999e6c..cfb6a48b11 100644 --- a/libnm-glib/nm-client.c +++ b/libnm-glib/nm-client.c @@ -664,7 +664,7 @@ get_property (GObject *object, g_value_set_boolean (value, priv->manager_running); break; case PROP_NETWORKING_ENABLED: - g_value_set_boolean (value, priv->networking_enabled); + g_value_set_boolean (value, nm_client_networking_get_enabled (self)); break; case PROP_WIRELESS_ENABLED: g_value_set_boolean (value, priv->wireless_enabled); @@ -829,6 +829,7 @@ nm_client_class_init (NMClientClass *client_class) * NMClient::active-connections: * * The active connections. + * Type: GPtrArray<NMClient.ActiveConnection> **/ g_object_class_install_property (object_class, PROP_ACTIVE_CONNECTIONS, @@ -843,7 +844,7 @@ nm_client_class_init (NMClientClass *client_class) /** * NMClient::device-added: * @client: the client that received the signal - * @device: the new device + * @device: (type NMClient.Device): the new device * * Notifies that a #NMDevice is added. **/ @@ -860,7 +861,7 @@ nm_client_class_init (NMClientClass *client_class) /** * NMClient::device-removed: * @widget: the client that received the signal - * @device: the removed device + * @device: (type NMClient.Device): the removed device * * Notifies that a #NMDevice is removed. **/ @@ -1012,7 +1013,7 @@ client_device_removed_proxy (DBusGProxy *proxy, char *path, gpointer user_data) * * Gets all the detected devices. * - * Returns: a #GPtrArray containing all the #NMDevice<!-- -->s. + * Returns: (transfer none) (element-type NMClient.Device): a #GPtrArray containing all the #NMDevice<!-- -->s. * The returned array is owned by the client and should not be modified. **/ const GPtrArray * @@ -1052,7 +1053,7 @@ nm_client_get_devices (NMClient *client) * * Gets a #NMDevice from a #NMClient. * - * Returns: the #NMDevice for the given @object_path or %NULL if none is found. + * Returns: (transfer none): the #NMDevice for the given @object_path or %NULL if none is found. **/ NMDevice * nm_client_get_device_by_path (NMClient *client, const char *object_path) @@ -1109,7 +1110,7 @@ activate_cb (DBusGProxy *proxy, * @device: the #NMDevice * @specific_object: the device specific object (currently used only for * activating wireless devices and should be the #NMAccessPoint<!-- -->'s path. - * @callback: the function to call when the call is done + * @callback: (scope async): the function to call when the call is done * @user_data: user data to pass to the callback function * * Activates a connection with the given #NMDevice. @@ -1165,14 +1166,14 @@ add_activate_cb (DBusGProxy *proxy, * and will be completed by NetworkManager using the given @device and * @specific_object before being added * @device: the #NMDevice - * @specific_object: the object path of a connection-type-specific object this - * activation should use. This parameter is currently ignored for wired and - * mobile broadband connections, and the value of NULL should be used (ie, no - * specific object). For WiFi connections, pass the object path of a specific - * AP from the card's scan list, which will be used to complete the details of - * the newly added connection. - * @callback: the function to call when the call is done - * @user_data: user data to pass to the callback function + * @specific_object: (allow-none): the object path of a connection-type-specific + * object this activation should use. This parameter is currently ignored for + * wired and mobile broadband connections, and the value of NULL should be used + * (ie, no specific object). For WiFi connections, pass the object path of a + * specific AP from the card's scan list, which will be used to complete the + * details of the newly added connection. + * @callback: (scope async): the function to call when the call is done + * @user_data: (closure): user data to pass to the callback function * * Adds a new connection using the given details (if any) as a template * (automatically filling in missing settings with the capabilities of the @@ -1243,7 +1244,8 @@ nm_client_deactivate_connection (NMClient *client, NMActiveConnection *active) * * Gets the active connections. * - * Returns: a #GPtrArray containing all the active #NMActiveConnection<!-- -->s. + * Returns: (transfer none) (element-type NMClient.ActiveConnection): a #GPtrArray +* containing all the active #NMActiveConnection<!-- -->s. * The returned array is owned by the client and should not be modified. **/ const GPtrArray * diff --git a/libnm-glib/nm-device-wifi.c b/libnm-glib/nm-device-wifi.c index 3d17023950..be5b987693 100644 --- a/libnm-glib/nm-device-wifi.c +++ b/libnm-glib/nm-device-wifi.c @@ -252,7 +252,7 @@ nm_device_wifi_get_capabilities (NMDeviceWifi *device) * * Gets the active #NMAccessPoint. * - * Returns: the access point or %NULL if none is active + * Returns: (transfer none): the access point or %NULL if none is active **/ NMAccessPoint * nm_device_wifi_get_active_access_point (NMDeviceWifi *device) @@ -302,7 +302,8 @@ nm_device_wifi_get_active_access_point (NMDeviceWifi *device) * * Gets all the scanned access points of the #NMDeviceWifi. * - * Returns: a #GPtrArray containing all the scanned #NMAccessPoint<!-- -->s. + * Returns: (element-type NMClient.AccessPoint): a #GPtrArray containing all the + * scanned #NMAccessPoint<!-- -->s. * The returned array is owned by the client and should not be modified. **/ const GPtrArray * @@ -342,7 +343,7 @@ nm_device_wifi_get_access_points (NMDeviceWifi *device) * * Gets a #NMAccessPoint by path. * - * Returns: the access point or %NULL if none is found. + * Returns: (transfer none): the access point or %NULL if none is found. **/ NMAccessPoint * nm_device_wifi_get_access_point_by_path (NMDeviceWifi *device, diff --git a/libnm-glib/nm-device-wimax.c b/libnm-glib/nm-device-wimax.c index bdab0eb743..4e7ebe8d84 100644 --- a/libnm-glib/nm-device-wimax.c +++ b/libnm-glib/nm-device-wimax.c @@ -108,12 +108,12 @@ nm_device_wimax_new (DBusGConnection *connection, const char *path) /** * nm_device_wimax_get_hw_address: - * @device: a #NMDeviceWimax + * @wimax: a #NMDeviceWimax * * Gets the hardware (MAC) address of the #NMDeviceWimax * * Returns: the hardware address. This is the internal string used by the - * device, and must not be modified. + * device, and must not be modified. **/ const char * nm_device_wimax_get_hw_address (NMDeviceWimax *wimax) @@ -138,7 +138,7 @@ nm_device_wimax_get_hw_address (NMDeviceWimax *wimax) * * Gets the active #NMWimaxNsp. * - * Returns: the access point or %NULL if none is active + * Returns: (transfer full): the access point or %NULL if none is active **/ NMWimaxNsp * nm_device_wimax_get_active_nsp (NMDeviceWimax *wimax) @@ -188,7 +188,8 @@ nm_device_wimax_get_active_nsp (NMDeviceWimax *wimax) * * Gets all the scanned NSPs of the #NMDeviceWimax. * - * Returns: a #GPtrArray containing all the scanned #NMWimaxNsp<!-- -->s. + * Returns: (element-type NMClient.WimaxNsp): a #GPtrArray containing + * all the scanned #NMWimaxNsp<!-- -->s. * The returned array is owned by the client and should not be modified. **/ const GPtrArray * @@ -228,7 +229,7 @@ nm_device_wimax_get_nsps (NMDeviceWimax *wimax) * * Gets a #NMWimaxNsp by path. * - * Returns: the access point or %NULL if none is found. + * Returns: (transfer none): the access point or %NULL if none is found. **/ NMWimaxNsp * nm_device_wimax_get_nsp_by_path (NMDeviceWimax *wimax, @@ -339,7 +340,7 @@ clean_up_nsps (NMDeviceWimax *self, gboolean notify) /** * nm_device_wimax_get_center_frequency: - * @device: a #NMDeviceWimax + * @self: a #NMDeviceWimax * * Gets the center frequency (in KHz) of the radio channel the device is using * to communicate with the network when connected. Has no meaning when the @@ -348,15 +349,15 @@ clean_up_nsps (NMDeviceWimax *self, gboolean notify) * Returns: the center frequency in KHz, or 0 **/ guint -nm_device_wimax_get_center_frequency (NMDeviceWimax *wimax) +nm_device_wimax_get_center_frequency (NMDeviceWimax *self) { NMDeviceWimaxPrivate *priv; - g_return_val_if_fail (NM_IS_DEVICE_WIMAX (wimax), 0); + g_return_val_if_fail (NM_IS_DEVICE_WIMAX (self), 0); - priv = NM_DEVICE_WIMAX_GET_PRIVATE (wimax); + priv = NM_DEVICE_WIMAX_GET_PRIVATE (self); if (!priv->center_freq) { - priv->center_freq = _nm_object_get_uint_property (NM_OBJECT (wimax), + priv->center_freq = _nm_object_get_uint_property (NM_OBJECT (self), NM_DBUS_INTERFACE_DEVICE_WIMAX, DBUS_PROP_CENTER_FREQUENCY); } @@ -365,7 +366,7 @@ nm_device_wimax_get_center_frequency (NMDeviceWimax *wimax) /** * nm_device_wimax_get_rssi: - * @device: a #NMDeviceWimax + * @self: a #NMDeviceWimax * * Gets the RSSI of the current radio link in dBm. This value indicates how * strong the raw received RF signal from the base station is, but does not @@ -375,15 +376,15 @@ nm_device_wimax_get_center_frequency (NMDeviceWimax *wimax) * Returns: the RSSI in dBm, or 0 **/ gint -nm_device_wimax_get_rssi (NMDeviceWimax *wimax) +nm_device_wimax_get_rssi (NMDeviceWimax *self) { NMDeviceWimaxPrivate *priv; - g_return_val_if_fail (NM_IS_DEVICE_WIMAX (wimax), 0); + g_return_val_if_fail (NM_IS_DEVICE_WIMAX (self), 0); - priv = NM_DEVICE_WIMAX_GET_PRIVATE (wimax); + priv = NM_DEVICE_WIMAX_GET_PRIVATE (self); if (!priv->rssi) { - priv->rssi = _nm_object_get_int_property (NM_OBJECT (wimax), + priv->rssi = _nm_object_get_int_property (NM_OBJECT (self), NM_DBUS_INTERFACE_DEVICE_WIMAX, DBUS_PROP_RSSI); } @@ -392,7 +393,7 @@ nm_device_wimax_get_rssi (NMDeviceWimax *wimax) /** * nm_device_wimax_get_cinr: - * @device: a #NMDeviceWimax + * @self: a #NMDeviceWimax * * Gets the CINR (Carrier to Interference + Noise Ratio) of the current radio * link in dB. CINR is a more accurate measure of radio link quality. Has no @@ -401,15 +402,15 @@ nm_device_wimax_get_rssi (NMDeviceWimax *wimax) * Returns: the CINR in dB, or 0 **/ gint -nm_device_wimax_get_cinr (NMDeviceWimax *wimax) +nm_device_wimax_get_cinr (NMDeviceWimax *self) { NMDeviceWimaxPrivate *priv; - g_return_val_if_fail (NM_IS_DEVICE_WIMAX (wimax), 0); + g_return_val_if_fail (NM_IS_DEVICE_WIMAX (self), 0); - priv = NM_DEVICE_WIMAX_GET_PRIVATE (wimax); + priv = NM_DEVICE_WIMAX_GET_PRIVATE (self); if (!priv->cinr) { - priv->cinr = _nm_object_get_int_property (NM_OBJECT (wimax), + priv->cinr = _nm_object_get_int_property (NM_OBJECT (self), NM_DBUS_INTERFACE_DEVICE_WIMAX, DBUS_PROP_CINR); } @@ -418,7 +419,7 @@ nm_device_wimax_get_cinr (NMDeviceWimax *wimax) /** * nm_device_wimax_get_tx_power: - * @device: a #NMDeviceWimax + * @self: a #NMDeviceWimax * * Average power of the last burst transmitted by the device, in units of * 0.5 dBm. i.e. a TxPower of -11 represents an actual device TX power of @@ -427,15 +428,15 @@ nm_device_wimax_get_cinr (NMDeviceWimax *wimax) * Returns: the TX power in dBm, or 0 **/ gint -nm_device_wimax_get_tx_power (NMDeviceWimax *wimax) +nm_device_wimax_get_tx_power (NMDeviceWimax *self) { NMDeviceWimaxPrivate *priv; - g_return_val_if_fail (NM_IS_DEVICE_WIMAX (wimax), 0); + g_return_val_if_fail (NM_IS_DEVICE_WIMAX (self), 0); - priv = NM_DEVICE_WIMAX_GET_PRIVATE (wimax); + priv = NM_DEVICE_WIMAX_GET_PRIVATE (self); if (!priv->tx_power) { - priv->tx_power = _nm_object_get_int_property (NM_OBJECT (wimax), + priv->tx_power = _nm_object_get_int_property (NM_OBJECT (self), NM_DBUS_INTERFACE_DEVICE_WIMAX, DBUS_PROP_TX_POWER); } @@ -444,22 +445,22 @@ nm_device_wimax_get_tx_power (NMDeviceWimax *wimax) /** * nm_device_wimax_get_bsid: - * @device: a #NMDeviceWimax + * @self: a #NMDeviceWimax * * Gets the ID of the serving Base Station when the device is connected. * * Returns: the ID of the serving Base Station, or NULL **/ const char * -nm_device_wimax_get_bsid (NMDeviceWimax *wimax) +nm_device_wimax_get_bsid (NMDeviceWimax *self) { NMDeviceWimaxPrivate *priv; - g_return_val_if_fail (NM_IS_DEVICE_WIMAX (wimax), NULL); + g_return_val_if_fail (NM_IS_DEVICE_WIMAX (self), NULL); - priv = NM_DEVICE_WIMAX_GET_PRIVATE (wimax); + priv = NM_DEVICE_WIMAX_GET_PRIVATE (self); if (!priv->bsid) { - priv->bsid = _nm_object_get_string_property (NM_OBJECT (wimax), + priv->bsid = _nm_object_get_string_property (NM_OBJECT (self), NM_DBUS_INTERFACE_DEVICE_WIMAX, DBUS_PROP_BSID); } diff --git a/libnm-glib/nm-device.c b/libnm-glib/nm-device.c index b494749ada..6a39c77fdf 100644 --- a/libnm-glib/nm-device.c +++ b/libnm-glib/nm-device.c @@ -934,7 +934,7 @@ nm_device_get_firmware_missing (NMDevice *device) * * Gets the current #NMIP4Config associated with the #NMDevice. * - * Returns: the #NMIP4Config or %NULL if the device is not activated. + * Returns: (transfer none): the #NMIP4Config or %NULL if the device is not activated. **/ NMIP4Config * nm_device_get_ip4_config (NMDevice *device) @@ -968,7 +968,7 @@ nm_device_get_ip4_config (NMDevice *device) * * Gets the current #NMDHCP4Config associated with the #NMDevice. * - * Returns: the #NMDHCPConfig or %NULL if the device is not activated or not + * Returns: (transfer none): the #NMDHCPConfig or %NULL if the device is not activated or not * using DHCP. **/ NMDHCP4Config * @@ -1003,7 +1003,7 @@ nm_device_get_dhcp4_config (NMDevice *device) * * Gets the current #NMIP6Config associated with the #NMDevice. * - * Returns: the #NMIP6Config or %NULL if the device is not activated. + * Returns: (transfer none): the #NMIP6Config or %NULL if the device is not activated. **/ NMIP6Config * nm_device_get_ip6_config (NMDevice *device) @@ -1037,7 +1037,7 @@ nm_device_get_ip6_config (NMDevice *device) * * Gets the current #NMDHCP6Config associated with the #NMDevice. * - * Returns: the #NMDHCPConfig or %NULL if the device is not activated or not + * Returns: (transfer none): the #NMDHCPConfig or %NULL if the device is not activated or not * using DHCP. **/ NMDHCP6Config * @@ -1317,7 +1317,7 @@ deactivate_cb (DBusGProxy *proxy, /** * nm_device_disconnect: * @device: a #NMDevice - * @callback: callback to be called when disconnect operation completes + * @callback: (scope async): callback to be called when disconnect operation completes * @user_data: caller-specific data passed to @callback * * Disconnects the device if currently connected, and prevents the device from diff --git a/libnm-glib/nm-dhcp4-config.c b/libnm-glib/nm-dhcp4-config.c index 442d19d192..45d48345c0 100644 --- a/libnm-glib/nm-dhcp4-config.c +++ b/libnm-glib/nm-dhcp4-config.c @@ -203,7 +203,7 @@ nm_dhcp4_config_new (DBusGConnection *connection, const char *object_path) * * Gets all the options contained in the configuration. * - * Returns: the #GHashTable containing strings for keys and values. + * Returns: (transfer none) (element-type utf8 GObject.Value): the #GHashTable containing strings for keys and values. * This is the internal copy used by the configuration, and must not be modified. **/ GHashTable * diff --git a/libnm-glib/nm-dhcp6-config.c b/libnm-glib/nm-dhcp6-config.c index 3792867207..dbcf4c682e 100644 --- a/libnm-glib/nm-dhcp6-config.c +++ b/libnm-glib/nm-dhcp6-config.c @@ -203,7 +203,7 @@ nm_dhcp6_config_new (DBusGConnection *connection, const char *object_path) * * Gets all the options contained in the configuration. * - * Returns: the #GHashTable containing strings for keys and values. + * Returns: (transfer none) (element-type utf8 GObject.Value): the #GHashTable containing strings for keys and values. * This is the internal copy used by the configuration, and must not be modified. **/ GHashTable * diff --git a/libnm-glib/nm-ip4-config.c b/libnm-glib/nm-ip4-config.c index 4bedc7a1a7..bc93a2c121 100644 --- a/libnm-glib/nm-ip4-config.c +++ b/libnm-glib/nm-ip4-config.c @@ -337,8 +337,8 @@ nm_ip4_config_new (DBusGConnection *connection, const char *object_path) * * Gets the IP4 addresses (containing the address, prefix, and gateway). * - * Returns: the #GSList containing #NMSettingIP4Address<!-- -->es. This is the internal copy - * used by the configuration and must not be modified. + * Returns: (element-type NetworkManager.IP4Address): the #GSList containing #NMIP4Address<!-- -->es. + * This is the internal copy used by the configuration and must not be modified. **/ const GSList * nm_ip4_config_get_addresses (NMIP4Config *config) @@ -366,7 +366,7 @@ nm_ip4_config_get_addresses (NMIP4Config *config) } /** - * nm_ip4_config_get_hostname: + * nm_ip4_config_get_hostname: (skip): * @config: a #NMIP4Config * * DEPRECATED. Don't use. @@ -385,7 +385,7 @@ nm_ip4_config_get_hostname (NMIP4Config *config) * * Gets the domain name servers (DNS). * - * Returns: the #GArray containing %guint32<!-- -->s. This is the internal copy used by the + * Returns: (element-type guint32): the #GArray containing %guint32<!-- -->s. This is the internal copy used by the * configuration and must not be modified. **/ const GArray * @@ -421,7 +421,7 @@ nm_ip4_config_get_nameservers (NMIP4Config *config) * * Gets the domain names. * - * Returns: the #GPtrArray containing domains as strings. This is the + * Returns: (element-type utf8): the #GPtrArray containing domains as strings. This is the * internal copy used by the configuration, and must not be modified. **/ const GPtrArray * @@ -460,8 +460,8 @@ nm_ip4_config_get_domains (NMIP4Config *config) * * Gets the Windows Internet Name Service servers (WINS). * - * Returns: the #GArray containing %guint32<!-- -->s. This is the internal copy used by the - * configuration and must not be modified. + * Returns: (element-type guint32): the #GArray containing %guint32<!-- -->s. + * This is the internal copy used by the configuration and must not be modified. **/ const GArray * nm_ip4_config_get_wins_servers (NMIP4Config *config) @@ -496,8 +496,9 @@ nm_ip4_config_get_wins_servers (NMIP4Config *config) * * Gets the routes. * - * Returns: the #GSList containing #NMSettingIP4Route<!-- -->s. This is the - * internal copy used by the configuration, and must not be modified. + * Returns: (element-type NetworkManager.IP4Route): the #GSList containing + * #NMIP4Route<!-- -->s. This is the internal copy used by the configuration, + * and must not be modified. **/ const GSList * nm_ip4_config_get_routes (NMIP4Config *config) diff --git a/libnm-glib/nm-ip6-config.c b/libnm-glib/nm-ip6-config.c index fe71c1b8d3..fce6430e47 100644 --- a/libnm-glib/nm-ip6-config.c +++ b/libnm-glib/nm-ip6-config.c @@ -146,8 +146,9 @@ register_for_property_changed (NMIP6Config *config) * * Gets the IP6 addresses (containing the address, prefix, and gateway). * - * Returns: the #GSList containing #NMSettingIP6Address<!-- -->es. This is the internal copy - * used by the configuration and must not be modified. + * Returns: (element-type NetworkManager.IP6Address): the #GSList containing + * #NMIP6Address<!-- -->es. This is the internal copy used by the configuration + * and must not be modified. **/ const GSList * nm_ip6_config_get_addresses (NMIP6Config *config) @@ -174,15 +175,16 @@ nm_ip6_config_get_addresses (NMIP6Config *config) return priv->addresses; } +/* FIXME: like in libnm_util, in6_addr is not introspectable, so skipping here */ /** - * nm_ip6_config_get_nameservers: + * nm_ip6_config_get_nameservers: (skip) * @config: a #NMIP6Config * * Gets the domain name servers (DNS). * - * Returns: a #GSList containing elements of type 'struct in6_addr' which contain - * the addresses of nameservers of the configuration. This is the internal copy - * used by the configuration and must not be modified. + * Returns: (element-type Posix.in6_addr): a #GSList containing elements of type + * 'struct in6_addr' which contain the addresses of nameservers of the configuration. + * This is the internal copy used by the configuration and must not be modified. **/ const GSList * nm_ip6_config_get_nameservers (NMIP6Config *config) @@ -217,8 +219,8 @@ nm_ip6_config_get_nameservers (NMIP6Config *config) * * Gets the domain names. * - * Returns: the #GPtrArray containing domains as strings. This is the - * internal copy used by the configuration, and must not be modified. + * Returns: (element-type utf8): the #GPtrArray containing domains as strings. + * This is the internal copy used by the configuration, and must not be modified. **/ const GPtrArray * nm_ip6_config_get_domains (NMIP6Config *config) @@ -251,8 +253,9 @@ nm_ip6_config_get_domains (NMIP6Config *config) * * Gets the routes. * - * Returns: the #GSList containing #NMSettingIP6Route<!-- -->s. This is the - * internal copy used by the configuration, and must not be modified. + * Returns: (element-type NetworkManager.IP6Route): the #GSList containing + * #NMIP6Route<!-- -->s. This is the internal copy used by the configuration, + * and must not be modified. **/ const GSList * nm_ip6_config_get_routes (NMIP6Config *config) diff --git a/libnm-glib/nm-object.c b/libnm-glib/nm-object.c index 85cb6b78ab..78b46388a4 100644 --- a/libnm-glib/nm-object.c +++ b/libnm-glib/nm-object.c @@ -223,7 +223,7 @@ nm_object_class_init (NMObjectClass *nm_object_class) * * Gets the #NMObject's DBusGConnection. * - * Returns: the connection + * Returns: (transfer none): the connection **/ DBusGConnection * nm_object_get_connection (NMObject *object) diff --git a/libnm-glib/nm-remote-connection.c b/libnm-glib/nm-remote-connection.c index 0887b725f2..f11d10021e 100644 --- a/libnm-glib/nm-remote-connection.c +++ b/libnm-glib/nm-remote-connection.c @@ -101,7 +101,7 @@ update_cb (DBusGProxy *proxy, GError *error, gpointer user_data) /** * nm_remote_connection_commit_changes: * @connection: the #NMRemoteConnection - * @callback: a function to be called when the commit completes + * @callback: (scope async): a function to be called when the commit completes * @user_data: caller-specific data to be passed to @callback * * Save any local changes to the settings and properties of this connection and @@ -153,7 +153,7 @@ delete_cb (DBusGProxy *proxy, GError *error, gpointer user_data) /** * nm_remote_connection_delete: * @connection: the #NMRemoteConnection - * @callback: a function to be called when the delete completes + * @callback: (scope async): a function to be called when the delete completes * @user_data: caller-specific data to be passed to @callback * * Delete the connection. @@ -202,7 +202,7 @@ get_secrets_cb (DBusGProxy *proxy, GHashTable *secrets, GError *error, gpointer * @hints: #NMSetting key names to get secrets for (optional) * @request_new: hint that new secrets (instead of cached or stored secrets) * should be returned - * @callback: a function to be called when the update completes + * @callback: (scope async): a function to be called when the update completes * @user_data: caller-specific data to be passed to @callback * * Request the connection's secrets. @@ -483,8 +483,8 @@ nm_remote_connection_class_init (NMRemoteConnectionClass *remote_class) G_SIGNAL_RUN_FIRST, G_STRUCT_OFFSET (NMRemoteConnectionClass, updated), NULL, NULL, - g_cclosure_marshal_VOID__BOXED, - G_TYPE_NONE, 1, DBUS_TYPE_G_MAP_OF_MAP_OF_VARIANT); + g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, 0); signals[REMOVED] = g_signal_new (NM_REMOTE_CONNECTION_REMOVED, @@ -494,5 +494,4 @@ nm_remote_connection_class_init (NMRemoteConnectionClass *remote_class) NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); - } diff --git a/libnm-glib/nm-remote-settings.c b/libnm-glib/nm-remote-settings.c index e4b0bc55bb..630e0cef16 100644 --- a/libnm-glib/nm-remote-settings.c +++ b/libnm-glib/nm-remote-settings.c @@ -168,7 +168,7 @@ add_connection_info_complete (NMRemoteSettings *self, * * Returns the %NMRemoteConnection representing the connection at @path. * - * Returns: the remote connection object on success, or NULL if the object was + * Returns: (transfer none): the remote connection object on success, or NULL if the object was * not known **/ NMRemoteConnection * @@ -366,7 +366,7 @@ fetch_connections (gpointer user_data) * nm_remote_settings_list_connections: * @settings: the %NMRemoteSettings * - * Returns: all connections in the remote settings service, represented as + * Returns: (transfer container) (element-type NMClient.RemoteConnection): all connections in the remote settings service, represented as * %NMRemoteConnection instances **/ GSList * @@ -407,12 +407,13 @@ add_connection_done (DBusGProxy *proxy, g_free (path); } + /** * nm_remote_settings_add_connection: * @settings: the %NMRemoteSettings * @connection: the connection to add. Note that this object's settings will be * added, not the object itself - * @callback: callback to be called when the add operation completes + * @callback: (scope async): callback to be called when the add operation completes * @user_data: caller-specific data passed to @callback * * Requests that the remote settings service add the given settings to a new @@ -513,7 +514,7 @@ save_hostname_cb (DBusGProxy *proxy, * @settings: the %NMRemoteSettings * @hostname: the new persistent hostname to set, or NULL to clear any existing * persistent hostname - * @callback: callback to be called when the hostname operation completes + * @callback: (scope async): callback to be called when the hostname operation completes * @user_data: caller-specific data passed to @callback * * Requests that the machine's persistent hostname be set to the specified value @@ -637,7 +638,7 @@ get_all_cb (DBusGProxy *proxy, /** * nm_remote_settings_new: - * @bus: a valid and connected D-Bus connection + * @bus: (allow-none): a valid and connected D-Bus connection * * Creates a new object representing the remote settings service. * @@ -646,7 +647,8 @@ get_all_cb (DBusGProxy *proxy, NMRemoteSettings * nm_remote_settings_new (DBusGConnection *bus) { - g_return_val_if_fail (bus != NULL, NULL); + if (bus == NULL) + bus = dbus_g_bus_get (DBUS_BUS_SYSTEM, NULL); return (NMRemoteSettings *) g_object_new (NM_TYPE_REMOTE_SETTINGS, NM_REMOTE_SETTINGS_BUS, bus, diff --git a/libnm-glib/nm-remote-settings.h b/libnm-glib/nm-remote-settings.h index b38266d9d2..2bf748a6eb 100644 --- a/libnm-glib/nm-remote-settings.h +++ b/libnm-glib/nm-remote-settings.h @@ -115,7 +115,7 @@ GSList * nm_remote_settings_list_connections (NMRemoteSettings *settings); NMRemoteConnection * nm_remote_settings_get_connection_by_path (NMRemoteSettings *settings, const char *path); -gboolean nm_remote_settings_add_connection (NMRemoteSettings *self, +gboolean nm_remote_settings_add_connection (NMRemoteSettings *settings, NMConnection *connection, NMRemoteSettingsAddConnectionFunc callback, gpointer user_data); diff --git a/libnm-glib/nm-types.c b/libnm-glib/nm-types.c index cf9e084c77..923c436b18 100644 --- a/libnm-glib/nm-types.c +++ b/libnm-glib/nm-types.c @@ -52,7 +52,7 @@ nm_ssid_get_type (void) static GType our_type = 0; if (our_type == 0) - our_type = g_boxed_type_register_static (g_intern_static_string ("nm-ssid"), + our_type = g_boxed_type_register_static (g_intern_static_string ("NMSsid"), (GBoxedCopyFunc) nm_ssid_copy, (GBoxedFreeFunc) nm_ssid_free); return our_type; @@ -105,7 +105,7 @@ nm_uint_array_get_type (void) static GType our_type = 0; if (our_type == 0) - our_type = g_boxed_type_register_static (g_intern_static_string ("nm-uint-array"), + our_type = g_boxed_type_register_static (g_intern_static_string ("NMUintArray"), (GBoxedCopyFunc) nm_uint_array_copy, (GBoxedFreeFunc) nm_uint_array_free); return our_type; @@ -163,7 +163,7 @@ nm_string_array_get_type (void) static GType our_type = 0; if (our_type == 0) - our_type = g_boxed_type_register_static (g_intern_static_string ("nm-string-array"), + our_type = g_boxed_type_register_static (g_intern_static_string ("NMStringArray"), (GBoxedCopyFunc) nm_string_array_copy, (GBoxedFreeFunc) nm_string_array_free); return our_type; @@ -224,7 +224,7 @@ nm_object_array_get_type (void) static GType our_type = 0; if (our_type == 0) - our_type = g_boxed_type_register_static (g_intern_static_string ("nm-object-array"), + our_type = g_boxed_type_register_static (g_intern_static_string ("NMObjectArray"), (GBoxedCopyFunc) nm_object_array_copy, (GBoxedFreeFunc) nm_object_array_free); return our_type; @@ -306,7 +306,7 @@ nm_ip6_address_object_array_get_type (void) static GType our_type = 0; if (our_type == 0) - our_type = g_boxed_type_register_static (g_intern_static_string ("nm-ip6-address-object-array"), + our_type = g_boxed_type_register_static (g_intern_static_string ("NMIP6AddressObjectArray"), (GBoxedCopyFunc) nm_ip6_address_object_array_copy, (GBoxedFreeFunc) nm_ip6_address_object_array_free); return our_type; @@ -348,7 +348,7 @@ nm_ip6_address_array_get_type (void) static GType our_type = 0; if (our_type == 0) - our_type = g_boxed_type_register_static (g_intern_static_string ("nm-ip6-address-array"), + our_type = g_boxed_type_register_static (g_intern_static_string ("NMIP6AddressArray"), (GBoxedCopyFunc) nm_ip6_address_array_copy, (GBoxedFreeFunc) nm_ip6_address_array_free); return our_type; @@ -415,7 +415,7 @@ nm_ip6_route_object_array_get_type (void) static GType our_type = 0; if (our_type == 0) - our_type = g_boxed_type_register_static (g_intern_static_string ("nm-ip6-route-object-array"), + our_type = g_boxed_type_register_static (g_intern_static_string ("NMIP6RouteObjectArray"), (GBoxedCopyFunc) nm_ip6_route_object_array_copy, (GBoxedFreeFunc) nm_ip6_route_object_array_free); return our_type; diff --git a/libnm-util/Makefile.am b/libnm-util/Makefile.am index fdadc7517f..38109c0a51 100644 --- a/libnm-util/Makefile.am +++ b/libnm-util/Makefile.am @@ -31,12 +31,15 @@ libnm_util_include_HEADERS = \ nm-setting-vpn.h \ nm-utils.h -libnm_util_la_SOURCES= \ - crypto.c \ +libnm_util_la_private_headers = \ crypto.h \ + nm-param-spec-specialized.h \ + nm-utils-private.h + +libnm_util_la_csources = \ + crypto.c \ nm-connection.c \ nm-param-spec-specialized.c \ - nm-param-spec-specialized.h \ nm-setting.c \ nm-setting-8021x.c \ nm-setting-bluetooth.c \ @@ -54,14 +57,16 @@ libnm_util_la_SOURCES= \ nm-setting-wireless.c \ nm-setting-wireless-security.c \ nm-setting-vpn.c \ - nm-utils.c \ - nm-utils-private.h \ - $(libnm_util_include_HEADERS) + nm-utils.c + +libnm_util_la_SOURCES = \ + $(libnm_util_la_csources) \ + $(libnm_util_la_private_headers) libnm_util_la_LIBADD = $(GLIB_LIBS) $(DBUS_LIBS) $(UUID_LIBS) libnm_util_la_LDFLAGS = -Wl,--version-script=$(srcdir)/libnm-util.ver \ - -version-info "7:0:6" + -version-info "8:0:7" if WITH_GNUTLS libnm_util_la_SOURCES += crypto_gnutls.c @@ -104,12 +109,36 @@ libtest_crypto_la_CPPFLAGS += $(NSS_CFLAGS) libtest_crypto_la_LIBADD += $(NSS_LIBS) endif - - pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = libnm-util.pc DISTCLEANFILES = libnm-util.pc +CLEANFILES = EXTRA_DIST = libnm-util.pc.in libnm-util.ver +-include $(INTROSPECTION_MAKEFILE) +INTROSPECTION_GIRS = +INTROSPECTION_SCANNER_ARGS = --add-include-path=$(srcdir) +INTROSPECTION_COMPILER_ARGS = --includedir=$(srcdir) + +if HAVE_INTROSPECTION +introspection_sources = $(libnm_util_include_HEADERS) $(libnm_util_la_csources) $(top_srcdir)/include/NetworkManager.h $(top_srcdir)/include/NetworkManagerVPN.h + +NetworkManager-1.0.gir: libnm-util.la +NetworkManager_1_0_gir_INCLUDES = GObject-2.0 DBusGLib-1.0 +NetworkManager_1_0_gir_PACKAGES = gobject-2.0 dbus-glib-1 +NetworkManager_1_0_gir_CFLAGS = $(INCLUDES) +NetworkManager_1_0_gir_LIBS = libnm-util.la +NetworkManager_1_0_gir_FILES = $(introspection_sources) +NetworkManager_1_0_gir_SCANNERFLAGS = --warn-all --identifier-prefix=NM --symbol-prefix=nm_ +INTROSPECTION_GIRS += NetworkManager-1.0.gir + +girdir = $(datadir)/gir-1.0 +gir_DATA = $(INTROSPECTION_GIRS) + +typelibdir = $(libdir)/girepository-1.0 +typelib_DATA = $(INTROSPECTION_GIRS:.gir=.typelib) + +CLEANFILES += $(gir_DATA) $(typelib_DATA) +endif diff --git a/libnm-util/libnm-util.ver b/libnm-util/libnm-util.ver index 2a8181beeb..2c71f37de7 100644 --- a/libnm-util/libnm-util.ver +++ b/libnm-util/libnm-util.ver @@ -170,6 +170,7 @@ global: nm_setting_ip4_config_get_dhcp_send_hostname; nm_setting_ip4_config_get_never_default; nm_setting_ip4_config_get_may_fail; + nm_ip6_address_get_type; nm_ip6_address_new; nm_ip6_address_dup; nm_ip6_address_ref; @@ -181,6 +182,7 @@ global: nm_ip6_address_set_gateway; nm_ip6_address_get_prefix; nm_ip6_address_set_prefix; + nm_ip6_route_get_type; nm_ip6_route_new; nm_ip6_route_dup; nm_ip6_route_ref; @@ -388,8 +390,9 @@ global: nm_ip4_address_compare; nm_ip4_address_dup; nm_ip4_address_get_address; - nm_ip4_address_get_prefix; nm_ip4_address_get_gateway; + nm_ip4_address_get_prefix; + nm_ip4_address_get_type; nm_ip4_address_new; nm_ip4_address_ref; nm_ip4_address_set_address; @@ -402,6 +405,7 @@ global: nm_ip4_route_get_prefix; nm_ip4_route_get_next_hop; nm_ip4_route_get_metric; + nm_ip4_route_get_type; nm_ip4_route_new; nm_ip4_route_ref; nm_ip4_route_unref; diff --git a/libnm-util/nm-connection.c b/libnm-util/nm-connection.c index 3aa10c6a04..39766285a3 100644 --- a/libnm-util/nm-connection.c +++ b/libnm-util/nm-connection.c @@ -350,7 +350,7 @@ nm_connection_lookup_setting_type_by_quark (GQuark error_quark) * * Create a new #NMSetting object of the desired type, given a setting name. * - * Returns: the new setting object, or NULL if the setting name was unknown + * Returns: (transfer full): the new setting object, or NULL if the setting name was unknown **/ NMSetting * nm_connection_create_setting (const char *name) @@ -384,7 +384,7 @@ parse_one_setting (gpointer key, gpointer value, gpointer user_data) /** * nm_connection_add_setting: * @connection: a #NMConnection - * @setting: the #NMSetting to add to the connection object + * @setting: (transfer full): the #NMSetting to add to the connection object * * Adds a #NMSetting to the connection, replacing any previous #NMSetting of the * same name which has previously been added to the #NMConnection. The @@ -426,7 +426,7 @@ nm_connection_remove_setting (NMConnection *connection, GType setting_type) * Gets the #NMSetting with the given #GType, if one has been previously added * to the #NMConnection. * - * Returns: the #NMSetting, or NULL if no setting of that type was previously + * Returns: (transfer none): the #NMSetting, or NULL if no setting of that type was previously * added to the #NMConnection **/ NMSetting * @@ -447,7 +447,7 @@ nm_connection_get_setting (NMConnection *connection, GType setting_type) * Gets the #NMSetting with the given name, if one has been previously added * the the #NMConnection. * - * Returns: the #NMSetting, or NULL if no setting with that name was previously + * Returns: (transfer none): the #NMSetting, or NULL if no setting with that name was previously * added to the #NMConnection **/ NMSetting * @@ -493,7 +493,7 @@ validate_permissions_type (GHashTable *hash, GError **error) /** * nm_connection_replace_settings: * @connection: a #NMConnection - * @new_settings: a #GHashTable of settings + * @new_settings: (element-type utf8 GLib.HashTable): a #GHashTable of settings * @error: location to store error, or %NULL * * Returns: %TRUE if the settings were valid and added to the connection, %FALSE @@ -651,7 +651,7 @@ nm_connection_verify (NMConnection *connection, GError **error) * nm_connection_update_secrets: * @connection: the #NMConnection * @setting_name: the setting object name to which the secrets apply - * @secrets: a #GHashTable mapping string:#GValue of setting property names and + * @secrets: (element-type utf8 GObject.Value): a #GHashTable mapping string:#GValue of setting property names and * secrets * @error: location to store error, or %NULL * @@ -826,9 +826,10 @@ add_one_setting_to_hash (gpointer key, gpointer data, gpointer user_data) * are #GHashTables mapping string:GValue, each of which represents the * properties of the #NMSetting object. * - * Returns: a new #GHashTable describing the connection, its settings, and - * each setting's properties. The caller owns the hash table and must unref - * the hash table with g_hash_table_unref() when it is no longer needed. + * Returns: (transfer full) (element-type utf8 GLib.HashTable): a new + * #GHashTable describing the connection, its settings, and each setting's + * properties. The caller owns the hash table and must unref the hash table + * with g_hash_table_unref() when it is no longer needed. **/ GHashTable * nm_connection_to_hash (NMConnection *connection) @@ -869,7 +870,7 @@ for_each_setting (gpointer key, gpointer value, gpointer user_data) /** * nm_connection_for_each_setting_value: * @connection: the #NMConnection - * @func: user-supplied function called for each setting's property + * @func: (scope call): user-supplied function called for each setting's property * @user_data: user data passed to @func at each invocation * * Iterates over the properties of each #NMSetting object in the #NMConnection, @@ -994,7 +995,8 @@ nm_connection_new (void) /** * nm_connection_new_from_hash: - * @hash: the #GHashTable describing the connection + * @hash: (element-type utf8 GLib.HashTable): the #GHashTable describing + * the connection * @error: on unsuccessful return, an error * * Creates a new #NMConnection from a hash table describing the connection. See @@ -1037,7 +1039,7 @@ duplicate_cb (gpointer key, gpointer value, gpointer user_data) * * Duplicates a #NMConnection. * - * Returns: a new #NMConnection containing the same settings and properties + * Returns: (transfer full): a new #NMConnection containing the same settings and properties * as the source #NMConnection **/ NMConnection * diff --git a/libnm-util/nm-setting-ip4-config.c b/libnm-util/nm-setting-ip4-config.c index 186e41e243..be124d926d 100644 --- a/libnm-util/nm-setting-ip4-config.c +++ b/libnm-util/nm-setting-ip4-config.c @@ -66,6 +66,8 @@ nm_setting_ip4_config_error_get_type (void) return etype; } +G_DEFINE_BOXED_TYPE (NMIP4Address, nm_ip4_address, nm_ip4_address_dup, nm_ip4_address_unref) +G_DEFINE_BOXED_TYPE (NMIP4Route, nm_ip4_route, nm_ip4_route_dup, nm_ip4_route_unref) G_DEFINE_TYPE (NMSettingIP4Config, nm_setting_ip4_config, NM_TYPE_SETTING) diff --git a/libnm-util/nm-setting-ip4-config.h b/libnm-util/nm-setting-ip4-config.h index 80ddd4758e..91cf0ea6d7 100644 --- a/libnm-util/nm-setting-ip4-config.h +++ b/libnm-util/nm-setting-ip4-config.h @@ -74,6 +74,8 @@ GQuark nm_setting_ip4_config_error_quark (void); typedef struct NMIP4Address NMIP4Address; +GType nm_ip4_address_get_type (void); + NMIP4Address * nm_ip4_address_new (void); NMIP4Address * nm_ip4_address_dup (NMIP4Address *source); void nm_ip4_address_ref (NMIP4Address *address); @@ -95,6 +97,8 @@ void nm_ip4_address_set_gateway (NMIP4Address *address, typedef struct NMIP4Route NMIP4Route; +GType nm_ip4_route_get_type (void); + NMIP4Route * nm_ip4_route_new (void); NMIP4Route * nm_ip4_route_dup (NMIP4Route *route); void nm_ip4_route_ref (NMIP4Route *route); diff --git a/libnm-util/nm-setting-ip6-config.c b/libnm-util/nm-setting-ip6-config.c index e8af058041..10fe3ccd6d 100644 --- a/libnm-util/nm-setting-ip6-config.c +++ b/libnm-util/nm-setting-ip6-config.c @@ -65,6 +65,8 @@ nm_setting_ip6_config_error_get_type (void) return etype; } +G_DEFINE_BOXED_TYPE (NMIP6Address, nm_ip6_address, nm_ip6_address_dup, nm_ip6_address_unref) +G_DEFINE_BOXED_TYPE (NMIP6Route, nm_ip6_route, nm_ip6_route_dup, nm_ip6_route_unref) G_DEFINE_TYPE (NMSettingIP6Config, nm_setting_ip6_config, NM_TYPE_SETTING) diff --git a/libnm-util/nm-setting-ip6-config.h b/libnm-util/nm-setting-ip6-config.h index e3e286e684..b9733b4ac1 100644 --- a/libnm-util/nm-setting-ip6-config.h +++ b/libnm-util/nm-setting-ip6-config.h @@ -74,6 +74,8 @@ GQuark nm_setting_ip6_config_error_quark (void); typedef struct NMIP6Address NMIP6Address; +GType nm_ip6_address_get_type (void); + NMIP6Address * nm_ip6_address_new (void); NMIP6Address * nm_ip6_address_dup (NMIP6Address *source); void nm_ip6_address_ref (NMIP6Address *address); @@ -95,6 +97,8 @@ void nm_ip6_address_set_gateway (NMIP6Address *address, typedef struct NMIP6Route NMIP6Route; +GType nm_ip6_route_get_type (void); + NMIP6Route * nm_ip6_route_new (void); NMIP6Route * nm_ip6_route_dup (NMIP6Route *route); void nm_ip6_route_ref (NMIP6Route *route); diff --git a/libnm-util/nm-setting-vpn.c b/libnm-util/nm-setting-vpn.c index 53b609e2d8..4b8a1dc9cb 100644 --- a/libnm-util/nm-setting-vpn.c +++ b/libnm-util/nm-setting-vpn.c @@ -158,9 +158,17 @@ nm_setting_vpn_remove_data_item (NMSettingVPN *setting, const char *key) g_hash_table_remove (NM_SETTING_VPN_GET_PRIVATE (setting)->data, key); } +/** + * nm_setting_vpn_foreach_data_item: + * @setting: a #NMSettingVPN + * @func: (scope call): an user provided function + * @user_data: + * + * Iterates all data items stored in this setting + */ void nm_setting_vpn_foreach_data_item (NMSettingVPN *setting, - VPNIterFunc func, + NMVPNIterFunc func, gpointer user_data) { g_return_if_fail (NM_IS_SETTING_VPN (setting)); @@ -200,9 +208,17 @@ nm_setting_vpn_remove_secret (NMSettingVPN *setting, const char *key) g_hash_table_remove (NM_SETTING_VPN_GET_PRIVATE (setting)->secrets, key); } +/** + * nm_setting_vpn_foreach_secret: + * @setting: a #NMSettingVPN + * @func: (scope call): an user provided function + * @user_data: + * + * Iterates all secrets stored in this setting. + */ void nm_setting_vpn_foreach_secret (NMSettingVPN *setting, - VPNIterFunc func, + NMVPNIterFunc func, gpointer user_data) { g_return_if_fail (NM_IS_SETTING_VPN (setting)); diff --git a/libnm-util/nm-setting-vpn.h b/libnm-util/nm-setting-vpn.h index 9c684bbf11..c848696a33 100644 --- a/libnm-util/nm-setting-vpn.h +++ b/libnm-util/nm-setting-vpn.h @@ -71,7 +71,9 @@ typedef struct { void (*_reserved4) (void); } NMSettingVPNClass; -typedef void (*VPNIterFunc) (const char *key, const char *value, gpointer user_data); +typedef void (*NMVPNIterFunc) (const char *key, const char *value, gpointer user_data); +/* For backward compatibility */ +typedef NMVPNIterFunc VPNIterFunc; GType nm_setting_vpn_get_type (void); @@ -87,7 +89,7 @@ const char * nm_setting_vpn_get_data_item (NMSettingVPN *setting, void nm_setting_vpn_remove_data_item (NMSettingVPN *setting, const char *key); void nm_setting_vpn_foreach_data_item (NMSettingVPN *setting, - VPNIterFunc func, + NMVPNIterFunc func, gpointer user_data); void nm_setting_vpn_add_secret (NMSettingVPN *setting, @@ -98,7 +100,7 @@ const char * nm_setting_vpn_get_secret (NMSettingVPN *setting, void nm_setting_vpn_remove_secret (NMSettingVPN *setting, const char *key); void nm_setting_vpn_foreach_secret (NMSettingVPN *setting, - VPNIterFunc func, + NMVPNIterFunc func, gpointer user_data); G_END_DECLS diff --git a/libnm-util/nm-setting.c b/libnm-util/nm-setting.c index 980a65b967..f0ff42c884 100644 --- a/libnm-util/nm-setting.c +++ b/libnm-util/nm-setting.c @@ -112,7 +112,7 @@ destroy_gvalue (gpointer data) * name to a GValue describing that property, suitable for marshalling over * D-Bus or serializing. The mapping is string:GValue. * - * Returns: a new #GHashTable describing the setting's properties + * Returns: (transfer full) (element-type utf8 GObject.Value): a new #GHashTable describing the setting's properties **/ GHashTable * nm_setting_to_hash (NMSetting *setting) @@ -254,7 +254,7 @@ duplicate_setting (NMSetting *setting, * * Duplicates a #NMSetting. * - * Returns: a new #NMSetting containing the same properties and values as the + * Returns: (transfer full): a new #NMSetting containing the same properties and values as the * source #NMSetting **/ NMSetting * @@ -390,7 +390,7 @@ nm_setting_compare (NMSetting *a, /** * nm_setting_enumerate_values: * @setting: the #NMSetting - * @func: user-supplied function called for each property of the setting + * @func: (scope call): user-supplied function called for each property of the setting * @user_data: user data passed to @func at each invocation * * Iterates over each property of the #NMSetting object, calling the supplied @@ -465,7 +465,7 @@ nm_setting_clear_secrets (NMSetting *setting) * guide to what secrets may be required, because in some circumstances, there * is no way to conclusively determine exactly which secrets are needed. * - * Returns: a #GPtrArray containing the property names of secrets of the + * Returns: (transfer full) (element-type utf8): a #GPtrArray containing the property names of secrets of the * #NMSetting which may be required; the caller owns the array * and must free the each array element with g_free(), as well as the array * itself with g_ptr_array_free() diff --git a/libnm-util/nm-utils.c b/libnm-util/nm-utils.c index 9c3662f47f..87c5d5f6e2 100644 --- a/libnm-util/nm-utils.c +++ b/libnm-util/nm-utils.c @@ -487,7 +487,7 @@ value_dup (gpointer key, gpointer val, gpointer user_data) * * Utility function to duplicate a hash table of GValues. * - * Returns: a newly allocated duplicated #GHashTable, caller must free the + * Returns: (transfer container) (element-type utf8 GObject.Value): a newly allocated duplicated #GHashTable, caller must free the * returned hash with g_hash_table_unref() or g_hash_table_destroy() **/ GHashTable * @@ -1359,7 +1359,7 @@ nm_utils_security_valid (NMUtilsSecurityType type, * this serialization is not guaranteed to be stable and the #GArray may be * extended in the future. * - * Returns: a newly allocated #GSList of #NMIP4Address objects + * Returns: (transfer full) (element-type NetworkManager.IP4Address): a newly allocated #GSList of #NMIP4Address objects **/ GSList * nm_utils_ip4_addresses_from_gvalue (const GValue *value) @@ -1441,7 +1441,7 @@ nm_utils_ip4_addresses_to_gvalue (GSList *list, GValue *value) * format of this serialization is not guaranteed to be stable and may be * extended in the future. * - * Returns: a newly allocated #GSList of #NMIP4Route objects + * Returns: (transfer full) (element-type NetworkManager.IP4Route): a newly allocated #GSList of #NMIP4Route objects **/ GSList * nm_utils_ip4_routes_from_gvalue (const GValue *value) @@ -1604,7 +1604,7 @@ nm_utils_ip4_get_default_prefix (guint32 ip) * this serialization is not guaranteed to be stable and the #GValueArray may be * extended in the future. * - * Returns: a newly allocated #GSList of #NMIP6Address objects + * Returns: (transfer full) (element-type NetworkManager.IP6Address): a newly allocated #GSList of #NMIP6Address objects **/ GSList * nm_utils_ip6_addresses_from_gvalue (const GValue *value) @@ -1747,7 +1747,7 @@ nm_utils_ip6_addresses_to_gvalue (GSList *list, GValue *value) * into a GSList of #NMIP6Route objects. The specific format of this serialization * is not guaranteed to be stable and may be extended in the future. * - * Returns: a newly allocated #GSList of #NMIP6Route objects + * Returns: (transfer full) (element-type NetworkManager.IP6Route): a newly allocated #GSList of #NMIP6Route objects **/ GSList * nm_utils_ip6_routes_from_gvalue (const GValue *value) @@ -1863,6 +1863,18 @@ nm_utils_ip6_routes_to_gvalue (GSList *list, GValue *value) g_value_take_boxed (value, routes); } +/* FIXME: the Posix namespace does not exist, and thus neither does + the in6_addr struct. Marking (skip) for now */ +/** + * nm_utils_ip6_dns_from_gvalue: (skip): + * @value: a #GValue + * + * Converts a #GValue containing a #GPtrArray of IP6 DNS, represented as + * #GByteArray<!-- -->s into a #GSList of #in6_addr<!-- -->s. + * + * Returns: (transfer full) (element-type Posix.in6_addr): a #GSList of IP6 + * addresses. + */ GSList * nm_utils_ip6_dns_from_gvalue (const GValue *value) { @@ -2046,8 +2058,8 @@ utils_bin2hexstr (const char *bytes, int len, int final_len) /** * nm_utils_rsa_key_encrypt: * @data: RSA private key data to be encrypted - * @in_password: existing password to use, if any - * @out_password: if @in_password was NULL, a random password will be generated + * @in_password: (allow-none): existing password to use, if any + * @out_password: (out) (allow-none): if @in_password was NULL, a random password will be generated * and returned in this argument * @error: detailed error information on return, if an error occurred * @@ -2055,7 +2067,7 @@ utils_bin2hexstr (const char *bytes, int len, int final_len) * a password if no password was given) and converts the data to PEM format * suitable for writing to a file. * - * Returns: on success, PEM-formatted data suitable for writing to a PEM-formatted + * Returns: (transfer full): on success, PEM-formatted data suitable for writing to a PEM-formatted * certificate/private key file. **/ GByteArray * diff --git a/m4/introspection.m4 b/m4/introspection.m4 new file mode 100644 index 0000000000..589721c5a0 --- /dev/null +++ b/m4/introspection.m4 @@ -0,0 +1,94 @@ +dnl -*- mode: autoconf -*- +dnl Copyright 2009 Johan Dahlin +dnl +dnl This file is free software; the author(s) gives unlimited +dnl permission to copy and/or distribute it, with or without +dnl modifications, as long as this notice is preserved. +dnl + +# serial 1 + +m4_define([_GOBJECT_INTROSPECTION_CHECK_INTERNAL], +[ + AC_BEFORE([AC_PROG_LIBTOOL],[$0])dnl setup libtool first + AC_BEFORE([AM_PROG_LIBTOOL],[$0])dnl setup libtool first + AC_BEFORE([LT_INIT],[$0])dnl setup libtool first + + dnl enable/disable introspection + m4_if([$2], [require], + [dnl + enable_introspection=yes + ],[dnl + AC_ARG_ENABLE(introspection, + AS_HELP_STRING([--enable-introspection[=@<:@no/auto/yes@:>@]], + [Enable introspection for this build]),, + [enable_introspection=auto]) + ])dnl + + AC_MSG_CHECKING([for gobject-introspection]) + + dnl presence/version checking + AS_CASE([$enable_introspection], + [no], [dnl + found_introspection="no (disabled, use --enable-introspection to enable)" + ],dnl + [yes],[dnl + PKG_CHECK_EXISTS([gobject-introspection-1.0],, + AC_MSG_ERROR([gobject-introspection-1.0 is not installed])) + PKG_CHECK_EXISTS([gobject-introspection-1.0 >= $1], + found_introspection=yes, + AC_MSG_ERROR([You need to have gobject-introspection >= $1 installed to build AC_PACKAGE_NAME])) + ],dnl + [auto],[dnl + PKG_CHECK_EXISTS([gobject-introspection-1.0 >= $1], found_introspection=yes, found_introspection=no) + ],dnl + [dnl + AC_MSG_ERROR([invalid argument passed to --enable-introspection, should be one of @<:@no/auto/yes@:>@]) + ])dnl + + AC_MSG_RESULT([$found_introspection]) + + INTROSPECTION_SCANNER= + INTROSPECTION_COMPILER= + INTROSPECTION_GENERATE= + INTROSPECTION_GIRDIR= + INTROSPECTION_TYPELIBDIR= + if test "x$found_introspection" = "xyes"; then + INTROSPECTION_SCANNER=`$PKG_CONFIG --variable=g_ir_scanner gobject-introspection-1.0` + INTROSPECTION_COMPILER=`$PKG_CONFIG --variable=g_ir_compiler gobject-introspection-1.0` + INTROSPECTION_GENERATE=`$PKG_CONFIG --variable=g_ir_generate gobject-introspection-1.0` + INTROSPECTION_GIRDIR=`$PKG_CONFIG --variable=girdir gobject-introspection-1.0` + INTROSPECTION_TYPELIBDIR="$($PKG_CONFIG --variable=typelibdir gobject-introspection-1.0)" + INTROSPECTION_CFLAGS=`$PKG_CONFIG --cflags gobject-introspection-1.0` + INTROSPECTION_LIBS=`$PKG_CONFIG --libs gobject-introspection-1.0` + INTROSPECTION_MAKEFILE=`$PKG_CONFIG --variable=datadir gobject-introspection-1.0`/gobject-introspection-1.0/Makefile.introspection + fi + AC_SUBST(INTROSPECTION_SCANNER) + AC_SUBST(INTROSPECTION_COMPILER) + AC_SUBST(INTROSPECTION_GENERATE) + AC_SUBST(INTROSPECTION_GIRDIR) + AC_SUBST(INTROSPECTION_TYPELIBDIR) + AC_SUBST(INTROSPECTION_CFLAGS) + AC_SUBST(INTROSPECTION_LIBS) + AC_SUBST(INTROSPECTION_MAKEFILE) + + AM_CONDITIONAL(HAVE_INTROSPECTION, test "x$found_introspection" = "xyes") +]) + + +dnl Usage: +dnl GOBJECT_INTROSPECTION_CHECK([minimum-g-i-version]) + +AC_DEFUN([GOBJECT_INTROSPECTION_CHECK], +[ + _GOBJECT_INTROSPECTION_CHECK_INTERNAL([$1]) +]) + +dnl Usage: +dnl GOBJECT_INTROSPECTION_REQUIRE([minimum-g-i-version]) + + +AC_DEFUN([GOBJECT_INTROSPECTION_REQUIRE], +[ + _GOBJECT_INTROSPECTION_CHECK_INTERNAL([$1], [require]) +]) |