diff options
Diffstat (limited to 'libnm-glib')
25 files changed, 75 insertions, 89 deletions
diff --git a/libnm-glib/libnm_glib.c b/libnm-glib/libnm_glib.c index 709d44aa..1e0725ca 100644 --- a/libnm-glib/libnm_glib.c +++ b/libnm-glib/libnm_glib.c @@ -34,7 +34,6 @@ #define DBUS_NO_SERVICE_ERROR "org.freedesktop.DBus.Error.ServiceDoesNotExist" - struct libnm_glib_ctx { unsigned char check; @@ -65,12 +64,10 @@ typedef struct libnm_glib_callback gpointer user_data; } libnm_glib_callback; - static void _libnm_glib_schedule_dbus_watcher (libnm_glib_ctx *ctx); static DBusConnection * _libnm_glib_dbus_init (gpointer *user_data, GMainContext *context); static void _libnm_glib_update_state (libnm_glib_ctx *ctx, NMState state); - static void _libnm_glib_nm_state_cb (DBusPendingCall *pcall, void *user_data) { @@ -184,7 +181,6 @@ _libnm_glib_call_callbacks (libnm_glib_ctx *ctx) g_mutex_unlock (ctx->callbacks_lock); } - static void _libnm_glib_update_state (libnm_glib_ctx *ctx, NMState state) { @@ -215,7 +211,6 @@ _libnm_glib_update_state (libnm_glib_ctx *ctx, NMState state) _libnm_glib_call_callbacks (ctx); } - static DBusHandlerResult _libnm_glib_dbus_filter (DBusConnection *connection, DBusMessage *message, @@ -287,7 +282,6 @@ _libnm_glib_dbus_filter (DBusConnection *connection, return (handled ? DBUS_HANDLER_RESULT_HANDLED : DBUS_HANDLER_RESULT_NOT_YET_HANDLED); } - /* * libnm_glib_dbus_init * @@ -339,7 +333,6 @@ _libnm_glib_dbus_init (gpointer *user_data, GMainContext *context) return (connection); } - /* * libnm_glib_dbus_watcher * @@ -378,7 +371,6 @@ _libnm_glib_dbus_watcher (gpointer user_data) return FALSE; } - /* * libnm_glib_schedule_dbus_watcher * @@ -400,7 +392,6 @@ _libnm_glib_schedule_dbus_watcher (libnm_glib_ctx *ctx) } } - /* * libnm_glib_dbus_worker * @@ -431,7 +422,6 @@ _libnm_glib_dbus_worker (gpointer user_data) return NULL; } - static void _libnm_glib_ctx_free (libnm_glib_ctx *ctx) { @@ -468,7 +458,6 @@ _libnm_glib_ctx_free (libnm_glib_ctx *ctx) g_free (ctx); } - static libnm_glib_ctx * _libnm_glib_ctx_new (void) { @@ -489,7 +478,6 @@ error: return NULL; } - libnm_glib_ctx * libnm_glib_init (void) { @@ -517,7 +505,6 @@ error: return NULL; } - void libnm_glib_shutdown (libnm_glib_ctx *ctx) { @@ -530,7 +517,6 @@ libnm_glib_shutdown (libnm_glib_ctx *ctx) _libnm_glib_ctx_free (ctx); } - libnm_glib_state libnm_glib_get_network_state (const libnm_glib_ctx *ctx) { @@ -540,7 +526,6 @@ libnm_glib_get_network_state (const libnm_glib_ctx *ctx) return ctx->nm_state; } - guint libnm_glib_register_callback (libnm_glib_ctx *ctx, libnm_glib_callback_func func, @@ -568,7 +553,6 @@ libnm_glib_register_callback (libnm_glib_ctx *ctx, return (callback->id); } - void libnm_glib_unregister_callback (libnm_glib_ctx *ctx, guint id) diff --git a/libnm-glib/libnm_glib.h b/libnm-glib/libnm_glib.h index 01c055d0..4137a8ca 100644 --- a/libnm-glib/libnm_glib.h +++ b/libnm-glib/libnm_glib.h @@ -41,10 +41,8 @@ typedef enum libnm_glib_state typedef struct libnm_glib_ctx libnm_glib_ctx G_GNUC_DEPRECATED; - typedef void (*libnm_glib_callback_func) (libnm_glib_ctx *libnm_ctx, gpointer user_data) G_GNUC_DEPRECATED; - G_GNUC_DEPRECATED libnm_glib_ctx * libnm_glib_init (void); G_GNUC_DEPRECATED void libnm_glib_shutdown (libnm_glib_ctx *ctx); diff --git a/libnm-glib/meson.build b/libnm-glib/meson.build index eddf983e..fabd8818 100644 --- a/libnm-glib/meson.build +++ b/libnm-glib/meson.build @@ -79,13 +79,6 @@ sources = files( glue = 'nm-vpn-plugin-glue.h' -sources += custom_target( - glue, - input: ifaces_vpn_plugin_xml, - output: glue, - command: [dbus_binding_tool, '--prefix=nm_vpn_plugin', '--mode=glib-server', '--output=@OUTPUT@', '@INPUT@'] -) - enum_types = 'nm-vpn-enum-types' libnm_glib_vpn_enum = gnome.mkenums( @@ -104,7 +97,18 @@ linker_script = join_paths(meson.current_source_dir(), 'libnm-glib-vpn.ver') libnm_glib_vpn = shared_library( 'nm-glib-vpn', - sources: sources + libnm_glib_vpn_enum, + sources: files( + 'nm-vpn-plugin.c', + 'nm-vpn-plugin-ui-interface.c', + 'nm-vpn-plugin-utils.c', + ) + [ + custom_target( + glue, + input: ifaces_vpn_plugin_xml, + output: glue, + command: [dbus_binding_tool, '--prefix=nm_vpn_plugin', '--mode=glib-server', '--output=@OUTPUT@', '@INPUT@'], + ), + ] + libnm_glib_vpn_enum, version: libnm_glib_vpn_version, dependencies: deps, c_args: cflags, @@ -131,7 +135,7 @@ pkg.generate( variables: 'exec_prefix=${prefix}' ) -sources = shared_udev_utils + files( +libnm_glib_sources = shared_files_libnm_glib + files( 'nm-access-point.c', 'nm-active-connection.c', 'nm-client.c', @@ -194,12 +198,10 @@ linker_script = join_paths(meson.current_source_dir(), 'libnm-glib.ver') libnm_glib = shared_library( 'nm-glib', - sources: sources + libnm_glib_enum + [nm_secret_agent_glue], + sources: libnm_glib_sources + libnm_glib_enum + [nm_secret_agent_glue], version: libnm_glib_version, dependencies: deps, - c_args: cflags + [ - '-DNMRUNDIR="@0@"'.format(nm_pkgrundir), - ], + c_args: cflags, link_whole: libdeprecated_nm_glib, link_args: [ '-Wl,--version-script,@0@'.format(linker_script), @@ -225,7 +227,7 @@ pkg.generate( ) if enable_introspection - gir_sources = sources + headers + libnm_glib_enum + gir_sources = libnm_glib_sources + headers + libnm_glib_enum deps = [ dbus_glib_dep, @@ -287,7 +289,7 @@ pkg.generate( variables: [ 'exec_prefix=${prefix}', 'libgnome_serverdir=' + nm_libexecdir, - 'plugindir=' + nm_pkglibdir, + 'plugindir=' + nm_vpndir, 'configdir=' + nm_pkgconfdir ] ) diff --git a/libnm-glib/nm-access-point.c b/libnm-glib/nm-access-point.c index 3b923aa2..592818fa 100644 --- a/libnm-glib/nm-access-point.c +++ b/libnm-glib/nm-access-point.c @@ -166,9 +166,9 @@ nm_access_point_get_ssid (NMAccessPoint *ap) * nm_access_point_get_frequency: * @ap: a #NMAccessPoint * - * Gets the frequency of the access point. + * Gets the frequency of the access point in MHz. * - * Returns: the frequency + * Returns: the frequency in MHz **/ guint32 nm_access_point_get_frequency (NMAccessPoint *ap) @@ -252,9 +252,9 @@ nm_access_point_get_max_bitrate (NMAccessPoint *ap) * nm_access_point_get_strength: * @ap: a #NMAccessPoint * - * Gets the current signal strength of the access point. + * Gets the current signal strength of the access point as a percentage. * - * Returns: the signal strength + * Returns: the signal strength (0 to 100) **/ guint8 nm_access_point_get_strength (NMAccessPoint *ap) @@ -563,7 +563,6 @@ constructed (GObject *object) register_properties (NM_ACCESS_POINT (object)); } - static void nm_access_point_class_init (NMAccessPointClass *ap_class) { diff --git a/libnm-glib/nm-access-point.h b/libnm-glib/nm-access-point.h index 5750c76c..e9a3fc6b 100644 --- a/libnm-glib/nm-access-point.h +++ b/libnm-glib/nm-access-point.h @@ -51,7 +51,6 @@ G_BEGIN_DECLS /* DEPRECATED */ #define NM_ACCESS_POINT_HW_ADDRESS "hw-address" - typedef struct { NMObject parent; } NMAccessPoint; diff --git a/libnm-glib/nm-active-connection.c b/libnm-glib/nm-active-connection.c index aa79e1ac..a8150755 100644 --- a/libnm-glib/nm-active-connection.c +++ b/libnm-glib/nm-active-connection.c @@ -638,7 +638,6 @@ constructed (GObject *object) register_properties (NM_ACTIVE_CONNECTION (object)); } - static void nm_active_connection_class_init (NMActiveConnectionClass *ap_class) { diff --git a/libnm-glib/nm-client.c b/libnm-glib/nm-client.c index c14d8c96..0da7b0f4 100644 --- a/libnm-glib/nm-client.c +++ b/libnm-glib/nm-client.c @@ -674,7 +674,7 @@ nm_client_activate_connection (NMClient *client, activate_cb, info, NULL, DBUS_TYPE_G_OBJECT_PATH, connection ? nm_connection_get_path (connection) : "/", DBUS_TYPE_G_OBJECT_PATH, device ? nm_object_get_path (NM_OBJECT (device)) : "/", - DBUS_TYPE_G_OBJECT_PATH, specific_object ? specific_object : "/", + DBUS_TYPE_G_OBJECT_PATH, specific_object ?: "/", G_TYPE_INVALID); } @@ -762,7 +762,7 @@ nm_client_add_and_activate_connection (NMClient *client, add_activate_cb, info, NULL, DBUS_TYPE_G_MAP_OF_MAP_OF_VARIANT, hash, DBUS_TYPE_G_OBJECT_PATH, nm_object_get_path (NM_OBJECT (device)), - DBUS_TYPE_G_OBJECT_PATH, specific_object ? specific_object : "/", + DBUS_TYPE_G_OBJECT_PATH, specific_object ?: "/", G_TYPE_INVALID); } else info->idle_id = g_idle_add (activate_nm_not_running, info); @@ -1257,8 +1257,8 @@ nm_client_set_logging (NMClient *client, const char *level, const char *domains, return TRUE; return dbus_g_proxy_call (priv->client_proxy, "SetLogging", error, - G_TYPE_STRING, level ? level : "", - G_TYPE_STRING, domains ? domains : "", + G_TYPE_STRING, level ?: "", + G_TYPE_STRING, domains ?: "", G_TYPE_INVALID, G_TYPE_INVALID); } diff --git a/libnm-glib/nm-device-ethernet.c b/libnm-glib/nm-device-ethernet.c index 2817a320..df677b29 100644 --- a/libnm-glib/nm-device-ethernet.c +++ b/libnm-glib/nm-device-ethernet.c @@ -137,9 +137,9 @@ nm_device_ethernet_get_permanent_hw_address (NMDeviceEthernet *device) * nm_device_ethernet_get_speed: * @device: a #NMDeviceEthernet * - * Gets the speed of the #NMDeviceEthernet. + * Gets the speed of the #NMDeviceEthernet in Mbit/s. * - * Returns: the speed of the device + * Returns: the speed of the device in Mbit/s **/ guint32 nm_device_ethernet_get_speed (NMDeviceEthernet *device) diff --git a/libnm-glib/nm-device.c b/libnm-glib/nm-device.c index c340d5e5..6179b757 100644 --- a/libnm-glib/nm-device.c +++ b/libnm-glib/nm-device.c @@ -1311,7 +1311,6 @@ nm_device_set_autoconnect (NMDevice *device, gboolean autoconnect) g_value_init (&value, G_TYPE_BOOLEAN); g_value_set_boolean (&value, autoconnect); - NM_DEVICE_GET_PRIVATE (device)->autoconnect = autoconnect; _nm_object_set_property (NM_OBJECT (device), @@ -2100,7 +2099,7 @@ nm_device_get_physical_port_id (NMDevice *device) * * Gets the MTU of the #NMDevice. * - * Returns: the MTU of the device. + * Returns: the MTU of the device in bytes. * * Since: 0.9.10 **/ diff --git a/libnm-glib/nm-ip4-config.c b/libnm-glib/nm-ip4-config.c index 9e0e2e2d..8954ee7b 100644 --- a/libnm-glib/nm-ip4-config.c +++ b/libnm-glib/nm-ip4-config.c @@ -259,7 +259,7 @@ nm_ip4_config_class_init (NMIP4ConfigClass *config_class) /** * NMIP4Config:routes: * - * The #GPtrArray containing #NMSettingIP4Routes of the configuration. + * The #GPtrArray containing #NMSettingIP4Route<!-- -->s of the configuration. **/ g_object_class_install_property (object_class, PROP_ROUTES, @@ -459,7 +459,7 @@ nm_ip4_config_get_wins_servers (NMIP4Config *config) * Gets the routes. * * Returns: (element-type NMIP4Route): the #GSList containing - * #NMIP4Routes. This is the internal copy used by the configuration, + * #NMIP4Route<!-- -->s. This is the internal copy used by the configuration, * and must not be modified. **/ const GSList * diff --git a/libnm-glib/nm-ip6-config.c b/libnm-glib/nm-ip6-config.c index 5ec02dae..b655b239 100644 --- a/libnm-glib/nm-ip6-config.c +++ b/libnm-glib/nm-ip6-config.c @@ -310,7 +310,7 @@ nm_ip6_config_get_searches (NMIP6Config *config) * Gets the routes. * * Returns: (element-type NMIP6Route): the #GSList containing - * #NMIP6Routes. This is the internal copy used by the configuration, + * #NMIP6Route<!-- -->s. This is the internal copy used by the configuration, * and must not be modified. **/ const GSList * diff --git a/libnm-glib/nm-object.c b/libnm-glib/nm-object.c index d3f8c830..5956b344 100644 --- a/libnm-glib/nm-object.c +++ b/libnm-glib/nm-object.c @@ -1328,7 +1328,7 @@ _nm_object_register_properties (NMObject *object, } pi = g_malloc0 (sizeof (PropertyInfo)); - pi->func = tmp->func ? tmp->func : demarshal_generic; + pi->func = tmp->func ?: demarshal_generic; pi->object_type = tmp->object_type; pi->field = tmp->field; pi->signal_prefix = tmp->signal_prefix; @@ -1374,7 +1374,6 @@ _nm_object_suppress_property_updates (NMObject *object, gboolean suppress) priv->suppress_property_updates = suppress; } - void _nm_object_ensure_inited (NMObject *object) { @@ -1573,5 +1572,5 @@ _nm_object_new_proxy (NMObject *self, const char *path, const char *interface) { NMObjectPrivate *priv = NM_OBJECT_GET_PRIVATE (self); - return _nm_dbus_new_proxy_for_connection (priv->connection, path ? path : priv->path, interface); + return _nm_dbus_new_proxy_for_connection (priv->connection, path ?: priv->path, interface); } diff --git a/libnm-glib/nm-remote-connection.c b/libnm-glib/nm-remote-connection.c index 820f9e5c..eb99ef35 100644 --- a/libnm-glib/nm-remote-connection.c +++ b/libnm-glib/nm-remote-connection.c @@ -67,7 +67,6 @@ static guint signals[LAST_SIGNAL] = { 0 }; typedef struct RemoteCall RemoteCall; typedef void (*RemoteCallFetchResultCb) (RemoteCall *call, DBusGProxyCall *proxy_call, GError *error); - struct RemoteCall { NMRemoteConnection *self; DBusGProxyCall *call; @@ -390,7 +389,6 @@ get_secrets_cb (RemoteCall *call, DBusGProxyCall *proxy_call, GError *error) g_hash_table_destroy (secrets); } - /** * nm_remote_connection_get_secrets: * @connection: the #NMRemoteConnection @@ -708,7 +706,6 @@ init_async (GAsyncInitable *initable, int io_priority, NMRemoteConnectionInitData *init_data; NMRemoteConnectionPrivate *priv = NM_REMOTE_CONNECTION_GET_PRIVATE (initable); - init_data = g_slice_new0 (NMRemoteConnectionInitData); init_data->connection = NM_REMOTE_CONNECTION (initable); init_data->result = g_simple_async_result_new (G_OBJECT (initable), callback, diff --git a/libnm-glib/nm-remote-connection.h b/libnm-glib/nm-remote-connection.h index 5b746a44..1f951cfa 100644 --- a/libnm-glib/nm-remote-connection.h +++ b/libnm-glib/nm-remote-connection.h @@ -36,7 +36,6 @@ G_BEGIN_DECLS #define NM_IS_REMOTE_CONNECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_REMOTE_CONNECTION)) #define NM_REMOTE_CONNECTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_REMOTE_CONNECTION, NMRemoteConnectionClass)) - /** * NMRemoteConnectionError: * @NM_REMOTE_CONNECTION_ERROR_UNKNOWN: unknown or unclassified error diff --git a/libnm-glib/nm-remote-settings.c b/libnm-glib/nm-remote-settings.c index be6b7ee3..e8a80f6f 100644 --- a/libnm-glib/nm-remote-settings.c +++ b/libnm-glib/nm-remote-settings.c @@ -576,7 +576,7 @@ fetch_connections_done (DBusGProxy *proxy, && priv->service_running) { g_warning ("%s: error fetching connections: %s.", __func__, - error->message ? error->message : "(unknown)"); + error->message ?: "(unknown)"); } g_clear_error (&error); @@ -964,7 +964,7 @@ nm_remote_settings_save_hostname (NMRemoteSettings *settings, save_hostname_cb, info, g_free, - G_TYPE_STRING, hostname ? hostname : "", + G_TYPE_STRING, hostname ?: "", G_TYPE_INVALID); return TRUE; } diff --git a/libnm-glib/nm-remote-settings.h b/libnm-glib/nm-remote-settings.h index af6cc603..2f9e00a0 100644 --- a/libnm-glib/nm-remote-settings.h +++ b/libnm-glib/nm-remote-settings.h @@ -59,7 +59,6 @@ typedef enum { #define NM_REMOTE_SETTINGS_ERROR nm_remote_settings_error_quark () GQuark nm_remote_settings_error_quark (void); - #define NM_REMOTE_SETTINGS_BUS "bus" #define NM_REMOTE_SETTINGS_SERVICE_RUNNING "service-running" #define NM_REMOTE_SETTINGS_HOSTNAME "hostname" @@ -71,7 +70,6 @@ GQuark nm_remote_settings_error_quark (void); typedef struct _NMRemoteSettings NMRemoteSettings; typedef struct _NMRemoteSettingsClass NMRemoteSettingsClass; - typedef void (*NMRemoteSettingsAddConnectionFunc) (NMRemoteSettings *settings, NMRemoteConnection *connection, GError *error, @@ -86,7 +84,6 @@ typedef void (*NMRemoteSettingsSaveHostnameFunc) (NMRemoteSettings *settings, GError *error, gpointer user_data); - struct _NMRemoteSettings { GObject parent; }; diff --git a/libnm-glib/nm-secret-agent.c b/libnm-glib/nm-secret-agent.c index 69c81d07..16e3199d 100644 --- a/libnm-glib/nm-secret-agent.c +++ b/libnm-glib/nm-secret-agent.c @@ -98,7 +98,6 @@ enum { static guint signals[LAST_SIGNAL] = { 0 }; - /*****************************************************************************/ GQuark diff --git a/libnm-glib/nm-vpn-connection.c b/libnm-glib/nm-vpn-connection.c index 7670d2ef..68f495a9 100644 --- a/libnm-glib/nm-vpn-connection.c +++ b/libnm-glib/nm-vpn-connection.c @@ -55,7 +55,6 @@ enum { static guint signals[LAST_SIGNAL] = { 0 }; - /** * nm_vpn_connection_new: * @connection: the #DBusGConnection diff --git a/libnm-glib/nm-vpn-plugin-ui-interface.c b/libnm-glib/nm-vpn-plugin-ui-interface.c index f06e77c4..ec554e6c 100644 --- a/libnm-glib/nm-vpn-plugin-ui-interface.c +++ b/libnm-glib/nm-vpn-plugin-ui-interface.c @@ -69,7 +69,6 @@ interface_init (gpointer g_iface) initialized = TRUE; } - GType nm_vpn_plugin_ui_interface_get_type (void) { @@ -99,7 +98,6 @@ nm_vpn_plugin_ui_interface_get_type (void) return vpn_plugin_ui_interface_type; } - NMVpnPluginUiWidgetInterface * nm_vpn_plugin_ui_interface_ui_factory (NMVpnPluginUiInterface *iface, NMConnection *connection, @@ -167,7 +165,6 @@ nm_vpn_plugin_ui_interface_delete_connection (NMVpnPluginUiInterface *iface, return TRUE; } - static void widget_interface_init (gpointer g_iface) { diff --git a/libnm-glib/nm-vpn-plugin-ui-interface.h b/libnm-glib/nm-vpn-plugin-ui-interface.h index bc5d8436..7d870128 100644 --- a/libnm-glib/nm-vpn-plugin-ui-interface.h +++ b/libnm-glib/nm-vpn-plugin-ui-interface.h @@ -37,7 +37,6 @@ typedef struct _NMVpnPluginUiWidgetInterface NMVpnPluginUiWidgetInterface; typedef NMVpnPluginUiInterface * (*NMVpnPluginUiFactory) (GError **error); NMVpnPluginUiInterface *nm_vpn_plugin_ui_factory (GError **error); - /*****************************************************************************/ /* Plugin interface */ /*****************************************************************************/ @@ -93,7 +92,6 @@ typedef enum { NM_VPN_PLUGIN_UI_INTERFACE_PROP_SERVICE } NMVpnPluginUiInterfaceProp; - struct _NMVpnPluginUiInterface { GTypeInterface g_iface; @@ -173,7 +171,6 @@ gboolean nm_vpn_plugin_ui_interface_delete_connection (NMVpnPluginUiInterface *i NMConnection *connection, GError **error); - /*****************************************************************************/ /* UI widget interface */ /*****************************************************************************/ @@ -224,7 +221,6 @@ gboolean nm_vpn_plugin_ui_widget_interface_save_secrets (NMVpnPluginUiWidgetInte NMConnection *connection, GError **error); - #ifdef NM_VPN_LIBNM_COMPAT #define nm_vpn_editor_plugin_factory nm_vpn_plugin_ui_factory diff --git a/libnm-glib/nm-vpn-plugin.c b/libnm-glib/nm-vpn-plugin.c index 316939ca..c7c68a8d 100644 --- a/libnm-glib/nm-vpn-plugin.c +++ b/libnm-glib/nm-vpn-plugin.c @@ -122,7 +122,6 @@ enum { static GSList *active_plugins = NULL; - GQuark nm_vpn_plugin_error_quark (void) { @@ -134,7 +133,6 @@ nm_vpn_plugin_error_quark (void) return quark; } - static void nm_vpn_plugin_set_connection (NMVPNPlugin *plugin, DBusGConnection *connection) diff --git a/libnm-glib/nm-wimax-nsp.c b/libnm-glib/nm-wimax-nsp.c index 9e36e5b9..d0ab1f5c 100644 --- a/libnm-glib/nm-wimax-nsp.c +++ b/libnm-glib/nm-wimax-nsp.c @@ -278,7 +278,6 @@ constructed (GObject *object) register_properties (NM_WIMAX_NSP (object)); } - static void nm_wimax_nsp_class_init (NMWimaxNspClass *nsp_class) { diff --git a/libnm-glib/tests/meson.build b/libnm-glib/tests/meson.build index 029b3c20..34779018 100644 --- a/libnm-glib/tests/meson.build +++ b/libnm-glib/tests/meson.build @@ -14,12 +14,13 @@ test_units = [ foreach test_unit: test_units exe = executable( test_unit, - [test_unit + '.c'] + shared_test_utils, + [test_unit + '.c'] + shared_nm_test_utils_impl_c, dependencies: deps, - c_args: common_cflags + [ - '-DNETWORKMANAGER_COMPILATION_TEST', - '-DTEST_NM_SERVICE="@0@"'.format(join_paths(meson.source_root(), 'tools', 'test-networkmanager-service.py')), - ], + c_args: + common_cflags + [ + '-DNETWORKMANAGER_COMPILATION_TEST', + ] + + nm_build_cflags, ) test( diff --git a/libnm-glib/tests/test-nm-client.c b/libnm-glib/tests/test-nm-client.c index b6b5968b..df857215 100644 --- a/libnm-glib/tests/test-nm-client.c +++ b/libnm-glib/tests/test-nm-client.c @@ -155,6 +155,9 @@ test_device_added (void) DeviceAddedInfo info = { loop, FALSE, FALSE, 0, 0 }; sinfo = nmtstc_service_init (); + if (!nmtstc_service_available (sinfo)) + return; + client = nmtstc_nm_client_new (); devices = nm_client_get_devices (client); @@ -312,6 +315,9 @@ test_wifi_ap_added_removed (void) char *expected_path = NULL; sinfo = nmtstc_service_init (); + if (!nmtstc_service_available (sinfo)) + return; + client = nmtstc_nm_client_new (); /*************************************/ @@ -535,6 +541,9 @@ test_wimax_nsp_added_removed (void) char *expected_path = NULL; sinfo = nmtstc_service_init (); + if (!nmtstc_service_available (sinfo)) + return; + client = nmtstc_nm_client_new (); /*************************************/ @@ -720,6 +729,9 @@ test_devices_array (void) GVariant *ret; sinfo = nmtstc_service_init (); + if (!nmtstc_service_available (sinfo)) + return; + client = nmtstc_nm_client_new (); /*************************************/ @@ -820,7 +832,8 @@ manager_running_changed (GObject *client, static void test_client_manager_running (void) { - NMClient *client1, *client2; + gs_unref_object NMClient *client1 = NULL; + gs_unref_object NMClient *client2 = NULL; guint quit_id; int running_changed = 0; GError *error = NULL; @@ -842,6 +855,9 @@ test_client_manager_running (void) /* Now start the test service. */ sinfo = nmtstc_service_init (); + if (!nmtstc_service_available (sinfo)) + return; + client2 = nmtstc_nm_client_new (); /* client2 should know that NM is running, but the previously-created @@ -868,9 +884,6 @@ test_client_manager_running (void) g_assert_cmpint (running_changed, ==, 2); g_assert (!nm_client_get_manager_running (client1)); g_source_remove (quit_id); - - g_object_unref (client1); - g_object_unref (client2); } /*****************************************************************************/ @@ -1078,7 +1091,6 @@ test_connection_invalid (void) nmtst_assert_connection_unnormalizable (connections->pdata[idx[1]], 0, 0); nmtst_assert_connection_verifies_without_normalization (connections->pdata[idx[2]]); - /************************************************************************** * Modify the invalid connection and make it valid *************************************************************************/ diff --git a/libnm-glib/tests/test-remote-settings-client.c b/libnm-glib/tests/test-remote-settings-client.c index 57bc4faa..031e83f8 100644 --- a/libnm-glib/tests/test-remote-settings-client.c +++ b/libnm-glib/tests/test-remote-settings-client.c @@ -70,6 +70,9 @@ test_add_connection (void) time_t start, now; gboolean done = FALSE; + if (!nmtstc_service_available (sinfo)) + return; + connection = nm_connection_new (); s_con = (NMSettingConnection *) nm_setting_connection_new (); @@ -145,6 +148,9 @@ test_make_invisible (void) gboolean done = FALSE, has_settings = FALSE; char *path; + if (!nmtstc_service_available (sinfo)) + return; + g_assert (remote != NULL); /* Listen for the remove event when the connection becomes invisible */ @@ -212,6 +218,9 @@ test_make_visible (void) char *path; NMRemoteConnection *new = NULL; + if (!nmtstc_service_available (sinfo)) + return; + g_assert (remote != NULL); /* Wait for the new-connection signal when the connection is visible again */ @@ -229,7 +238,6 @@ test_make_visible (void) dbus_g_proxy_begin_call (proxy, "SetVisible", set_visible_cb, NULL, NULL, G_TYPE_BOOLEAN, TRUE, G_TYPE_INVALID); - /* Wait for the settings service to announce the connection again */ start = time (NULL); do { @@ -293,6 +301,9 @@ test_remove_connection (void) gboolean done = FALSE; char *path; + if (!nmtstc_service_available (sinfo)) + return; + /* Find a connection to delete */ list = nm_remote_settings_list_connections (settings); g_assert_cmpint (g_slist_length (list), >, 0); @@ -361,11 +372,14 @@ settings_service_running_changed (GObject *client, static void test_service_running (void) { - NMRemoteSettings *settings2; + gs_unref_object NMRemoteSettings *settings2 = NULL; guint quit_id; int running_changed = 0; gboolean running; + if (!nmtstc_service_available (sinfo)) + return; + loop = g_main_loop_new (NULL, FALSE); g_object_get (G_OBJECT (settings), @@ -404,6 +418,7 @@ test_service_running (void) /* Now restart it */ sinfo = nmtstc_service_init (); + g_assert (nmtstc_service_available (sinfo)); quit_id = g_timeout_add_seconds (5, loop_quit, loop); g_main_loop_run (loop); @@ -414,8 +429,6 @@ test_service_running (void) NM_REMOTE_SETTINGS_SERVICE_RUNNING, &running, NULL); g_assert (running == TRUE); - - g_object_unref (settings2); } /*****************************************************************************/ |