Commit Graph

681 Commits

Author SHA1 Message Date
Jiří Klimeš
576c82049b libnm-glib: implement nm_device_delete() for D-Bus device' Delete() method 2014-07-22 14:24:42 +02:00
Jiří Klimeš
3dbe8041a7 libnm-glib: add nm_device_is_software() function to NMDevice
It says whether the device is a software one, according to device capabilities.
2014-07-22 14:24:42 +02:00
Thomas Haller
faa6c34db1 libnm-glib: evaluate assert check only once in test-remote-settings-client
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-07-21 12:20:56 +02:00
Dan Winship
396610d14a libnm-glib: fix assertion-failure messages in test-remote-settings-client
test-remote-setting-client uses a macro:

    #define test_assert(condition) \
    do { \
        if (!G_LIKELY (condition)) \
            cleanup (); \
        g_assert (condition); \
    } while (0)

where cleanup() kills the fake remote-settings service and unrefs
settings. However, in many cases, "condition" would involve a test
against a connection that was owned by settings, so if the check
failed, the connection would end up getting freed by cleanup(), and so
then the second invocation of condition would result in the program
aborting on a failed check somewhere else (eg, "invalid unclassed
pointer in cast to 'NMConnection'") rather than displaying the failed
assertion that had gotten us to that point.

Fix this by not unreffing settings from cleanup(); in the normal exit
case we can just have main() unref it, and in the assertion-failed
case, we don't need to free things anyway.
2014-07-20 08:58:56 -04:00
Dan Winship
30c74c6007 build: more srcdir!=builddir fixes
nm-version.h was getting disted, making srcdir!=builddir work for
tarball builds, but not for git builds.

Also, remove "-I${top_builddir}/include" from all Makefile.ams, since
there's nothing generated in include/ any more.
2014-07-15 11:37:19 -04:00
Dan Winship
3aad3124f1 libnm-glib: drop separate test library
Previously, we built a second copy of libnm-glib that was hacked to
use the session bus rather than the system bus, for use by the test
programs. Rather than doing that, just have test-nm-client explicitly
override the choice of bus. (test-remote-settings-client was actually
already doing this, although it leaked the bus after.)
2014-07-15 09:44:55 -04:00
Dan Winship
2570c5a17c libnm-util, libnm-glib: whitespace fixes
Fix indentation, kill trailing whitespace, split some long lines.
2014-07-15 09:44:55 -04:00
Dan Winship
cb7e1893e7 libnm-util, libnm-glib: standardize copyright/license headers
- Remove list of authors from files that had them; these serve no
  purpose except to quickly get out of date (and were only used in
  libnm-util and not libnm-glib anyway).

- Just say "Copyright", not "(C) Copyright" or "Copyright (C)"

- Put copyright statement after the license, not before

- Remove "NetworkManager - Network link manager" from the few files
  that contained it, and "libnm_glib -- Access network status &
  information from glib applications" from the many files that
  contained it.

- Remove vim modeline from nm-device-olpc-mesh.[ch], add emacs modeline
  to files that were missing it.
2014-07-15 09:44:54 -04:00
Dan Winship
4223fa47e4 libnm-util, libnm-glib: tweak (element-type) annotations in docs
g-i allows you to specify types in annotations using either their
fully-qualified introspected names (eg, "NMClient.Device") or their
plain C names ("NMDevice"). Switch from the former to the latter (so
that they'll still be correct when migrated to libnm later).
2014-07-15 09:44:54 -04:00
Thomas Haller
f352bfd2af trivial/libnm-glib: rename internal PROP_* enum values
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-07-14 19:31:34 +02:00
Thomas Haller
568742ed41 libnm-glib: fix initialization of NMObject type
Ensure that the @type_funcs and @type_async_funcs
hashes are initialized before running the class
init function.

libnm-glib-scan hits the following assertion:
  GLib-CRITICAL **: g_hash_table_insert_internal: assertion 'hash_table != NULL' failed
  #0  0x0000003370c504e9 in g_logv (log_domain=0x3370cb2f4e "GLib", log_level=G_LOG_LEVEL_CRITICAL, format=<optimized out>, args=args@entry=0x7fffd1578f70) at gmessages.c:989
  #1  0x0000003370c5063f in g_log (log_domain=<optimized out>, log_level=<optimized out>, format=<optimized out>) at gmessages.c:1025
  #2  0x00007f2169f42545 in _nm_object_register_type_func (base_type=base_type@entry=13597296, type_func=type_func@entry=0x7f2169f47ae9 <_nm_device_type_for_path>, type_async_func=type_async_func@entry=
      0x7f2169f47880 <_nm_device_type_for_path_async>) at nm-object.c:551
  #3  0x00007f2169f48664 in nm_device_get_type () at nm-device.c:62
  #4  0x0000000000402577 in get_object_types () at libnm-glib-scan.c:46
  #5  0x0000000000404b0b in main (argc=<optimized out>, argv=<optimized out>) at libnm-glib-scan.c:135

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-07-14 16:14:03 +02:00
Thomas Haller
734203e12e libnm-glib/tests: remove waiting time for initializing NMClient
This waiting time significantly increases the runtime of the tests.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-07-08 19:01:01 +02:00
Dan Winship
aa1dce6da2 all: remove remaining GParamSpec name/blurb strings
Remove all remaining GParamSpec name and blurb strings (and fix
indentation while we're there), and add G_PARAM_STATIC_STRINGS to all
paramspecs that were lacking it.
2014-06-19 17:45:03 -04:00
Dan Winship
8487a4490c libnm-util, libnm-glib: be consistent about "Wi-Fi", "Ethernet", "InfiniBand" in docs
We made the UIs consistent last year, but missed the documentation.
Fix the docs to also consistently use "Wi-Fi" rather than "WiFi",
"Wifi", "wifi", or "WiFI"; "Ethernet" rather than "ethernet"; and
"InfiniBand" rather than "Infiniband".
2014-06-19 17:45:01 -04:00
Thomas Haller
b633711572 libnm-glib: don't use deprecated nm_access_point_get_hw_address()
nm_access_point_get_hw_address() is already deprecated since
pre-0.9.0-beta3 (f30e15a04d). However,
it also is defined as NM_DEPRECATED_IN_0_9_10, because there
are no deprecated macros for previous version.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-06-07 11:19:02 +02:00
Dan Williams
351ab1d76f libnm-glib-vpn: bump soname (1.1.0 -> 1.2.0) for API additions 2014-06-06 18:28:20 -05:00
Dan Williams
08faaf1170 libnm-glib: bump soname (4.7.0 -> 4.8.0) for API additions 2014-06-06 18:28:20 -05:00
Jiří Klimeš
8b41e6e2ea libnm-glib: fix double unref() when object creation fails 2014-06-05 18:11:29 +02:00
Thomas Haller
41ced630fb libnm-glib: fix resetting IP config during additional SetConfig() calls
When receiving updated VPN IP configuration from the helper after the
initial connect event, the library overwrites the already initialized
GValue fields by calling g_value_init() again. This is an error and causes
the following warning:

   (nm-openvpn-service:27645): GLib-GObject-WARNING **: gvalue.c:183: cannot initialize GValue with type gchararray, the value has already been initialized as gchararray

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-06-04 20:17:22 +02:00
Jiří Klimeš
98ae6e06d2 all: g_type_init() has been deprecated in GLib 2.35.0
g_type_init() deprecation:
https://bugzilla.gnome.org/show_bug.cgi?id=686161
2014-05-27 16:58:21 +02:00
Dan Williams
2af30e813a docs: clarify some uses of nm_active_connection_get_connection() 2014-05-22 09:07:57 -05:00
Dan Winship
bea82ca98b all: set G_LOG_DOMAIN appropriately, for better g_log() messages 2014-04-23 10:19:17 -04:00
Dan Williams
2200687b0f libnm-glib: add documentation for NMRemoteSettings and connection addition 2014-04-10 10:51:29 -05:00
Dan Winship
1d0b50c2c4 build: add some missing -DNM_VERSION_MAX_ALLOWED
Add -DNM_VERSION_MAX_ALLOWED=NM_VERSION_NEXT_STABLE to a bunch of
Makefile.ams that were missing it and might eventually need it.
2014-04-07 11:30:18 -04:00
Jiří Klimeš
759236681c trivial: make clear the maximum bitrate is in kbit/s 2014-04-01 15:15:09 +02:00
Dan Winship
5cd37d250a libnm-glib: add nm_device_get_setting_type()
Add a function mapping NMDevices to their corresponding base NMSetting
types.
2014-03-06 09:38:36 -05:00
Dan Winship
6300ea57ab libnm-glib: fix a double free in NMDeviceVlan 2014-03-05 11:20:54 -05:00
Jiří Klimeš
ee6f684f0a libnm-glib: support 'type', 'id' properties in NMActiveConnection (rh #1061822)
https://bugzilla.redhat.com/show_bug.cgi?id=1061822
2014-03-05 16:17:13 +01:00
Dan Winship
74809e64cc libnm-glib: fix glib-mkenums warnings
glib-mkenums doesn't parse /*< public >*/ and /*< private >*/, and in
fact, it warns about them, so don't write it that way.
2014-02-28 16:13:22 -05:00
Thomas Haller
d3a2219cee replace snprintf by g_snprintf
Use the glib wrapper for snprintf.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-02-24 21:35:33 +01:00
Jiří Klimeš
c2a1cb1a44 docs: use %TRUE, %FALSE macros instead of plain TRUE, FALSE values for gtkdoc 2014-02-24 17:00:39 +01:00
Thomas Haller
f8dcab53d9 libnm-glib: take reference in NMRemoteConnection before calling DBUS
We always have to take a reference to the NMRemoteConnection
before calling to DBUS, because the connection might be deleted
in the meantime.

https://bugzilla.gnome.org/show_bug.cgi?id=723168

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-02-21 16:20:29 +01:00
Thomas Haller
9968895e19 libnm-glib: accept omitting callback in nm_remote_connection_*
The functions nm_remote_connection_save(), nm_remote_connection_commit_changes(),
and nm_remote_connection_commit_changes_unsaved() indicate in the documentation,
that they allow omitting the callback argument. Remove invalid checks
for callback.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-02-21 16:20:29 +01:00
Dan Winship
9c4d86ee80 libnm-util, libnm-glib: add versioned deprecation/availability macros
Add versioned NM_DEPRECATED_IN_* and NM_AVAILABLE_IN_* macros, and tag
new/deprecated functions accordingly. (All currently-deprecated
functions are assumed to have been deprecated in 0.9.10.)

Add NM_VERSION_MIN_REQUIRED and NM_VERSION_MAX_ALLOWED macros which
can be set to determine which versions will cause warnings.

With the current settings, external consumers of the
libnm-util/libnm-glib APIs will have MIN_REQUIRED and MAX_ALLOWED both
set to NM_VERSION_0_9_8 by default, meaning they will get warnings
about functions added in 0.9.10. NM internally sets
NM_VERSION_MAX_ALLOWED to NM_VERSION_NEXT_STABLE to ensure that it is
always allowed to use all APIs.
2014-02-13 11:24:37 -05:00
Dan Winship
95be722e54 libnm-util, libnm-glib: add some missing "Since: 0.9.10" tags
Based on diffing libnm-util.ver and libnm-glib.ver with their 0.9.8
versions.
2014-02-13 11:24:37 -05:00
Dan Williams
6029ef92c2 libnm-glib: suppress warnings unless LIBNM_GLIB_DEBUG is set
Most of these warnings are things libnm-glib can't do anything
about, and they are pretty annoying when running nmcli or nmtui,
and libraries usually shouldn't print random warnings anyway.
So downgrade them to debug messages that can be enabled if we
need to see them.
2014-02-13 06:38:54 -06:00
Dan Williams
e922c120a3 libnm-glib: zero 'secrets' to prevent crash getting secrets
If the GetSecrets call returned an error (eg, no secrets) then
'secrets' isn't set by dbus_g_proxy_end_call() and is garbage,
then gets freed.
2014-01-31 15:22:16 -06:00
Thomas Haller
97ededafd9 libnm-glib: fix leak in nm_remote_connection_get_secrets
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-01-30 10:40:51 +01:00
Thomas Haller
f76934de15 libnm-glib: add function nm_remote_settings_get_connection_by_id()
Utility function, to search the list of connections for a connection
with a matching id/name. Returns the first match.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-01-27 15:39:51 -05:00
Dan Winship
f7b1b28202 libnm-util, libnm-glib: add device/connection describing functions
Add functions to describe and disambiguate devices and connections for
display to the user. Originally from libnm-gtk.
2014-01-27 15:39:51 -05:00
Jiří Klimeš
df4c9347fc libnm-glib: chain up the parent constructed() of NMRemoteConnection 2014-01-27 17:39:29 +01:00
Dan Williams
24ba56faab trivial: remove unused #defines
These are no longer used by anything, but are determined
automatically from the GObject property names.
2014-01-23 17:46:20 -06:00
Dan Williams
bce1fc7c3b libnm-glib: add testing framework and testcases
Add a fake NM service and test various aspects of the new NM D-Bus
properties.
2014-01-23 17:46:20 -06:00
Dan Williams
41aa72a86c libnm-glib: remove unused pseudo-property code
Now that all previous pseudo-properties have been converted to
real D-Bus and GObject properties, we can remove this code.
2014-01-23 17:34:13 -06:00
Dan Williams
1878a5e4c9 libnm-glib: convert NMClient Devices to a real property 2014-01-23 17:34:12 -06:00
Dan Williams
41d735b9a1 libnm-glib: convert NMDeviceWimax NSPs to a real property 2014-01-23 17:34:12 -06:00
Dan Williams
511f3dcef3 libnm-glib: convert NMDeviceWifi AccessPoints to a real property
Note that this will cause the nm_device_wifi_get_access_points() to
return hidden-SSID access point objects immediately, which it
previously did not do until added/removed signals were sent by
NetworkManager for a hidden SSID AP.  Some clients may not handle
this correctly, but given that they would have crashed when the
first hidden SSID AP was found anyway, they should just be fixed.
2014-01-23 17:34:12 -06:00
Dan Williams
4bf27b2e68 libnm-glib: add support for non-pseudo-property added/removed signals
With the addition of D-Bus properties for object-array properties in
NetworkManager core, libnm-glib can use these properties instead of
the pseudo-property stuff.  However, we need to maintain API and
provide individual added/removed signals for these properties, and
that requires diff-ing the new and old object arrays.  Add the
infrastructure for doing that.
2014-01-23 17:34:12 -06:00
Jiří Klimeš
8ee4f58e9e libnm-glib: additional functions to get nameservers (rh #1056146)
This commit adds two new functions for introspection users to get nameservers:
guint32 nm_ip6_config_get_num_nameservers (NMIP6Config *config)
const struct in6_addr *nm_ip6_config_get_nameserver (NMIP6Config *config, guint32 idx)
The existing function can't be used due to GObject introspection limitations:
const GSList *nm_ip6_config_get_nameservers (NMIP6Config *config);

https://bugzilla.redhat.com/show_bug.cgi?id=1056146
2014-01-23 12:53:18 +01:00
Jiří Klimeš
3391fa810c libnm-glib: export missing get_gateway() and get_searches() functions
They were added by db9b7e10ac commit.
2014-01-22 15:52:19 +01:00