Commit graph

512 commits

Author SHA1 Message Date
Dan Williams a9c22166f6 libnm-glib: ensure some new private symbols stay private
_ is our "private" prefix.
2012-02-10 15:03:12 -06:00
Dan Winship c721477d11 libnm-glib: fix premature child object signal emission
The notifications for child objects (like NMClient's device-added
signal or NMDeviceWifi's access-point-added signal) could get emitted
before the child objects were actually constructed, because
object_created() decrements the properties-retrieved tracking
variable, which wasn't always incremented before calling that
function.
2012-02-09 13:25:59 -06:00
Jiří Klimeš 39d25c2abb libnm-glib: add nm_device_get_state_reason() to libnm-glib.ver to export it
It was forgotten in the previous commit
2012-02-09 15:34:19 +01:00
Jiří Klimeš 81b697c57b libnm-glib: add StateReason property for NMDevice 2012-02-08 10:27:57 +01:00
Thomas Bechtold 32157d5187 libnm-glib: fix missing G_VALUE_INIT to not depend on newer glib 2012-02-07 12:43:39 -06:00
Dan Williams 7f9fe7601e libnm-glib: better debugging of property accesses and updates
Need to initialize libnm-util to get GValue transforms registered
so the property values print out as strings.  Then actually print
some debugging information about properties.
2012-02-07 12:36:45 -06:00
Dan Williams 57bd84139f libnm-glib: ensure synchronous property updates are actually synchronous
Some property updates (mainly those dealing with properties that
hold objects themsevles) weren't being done in a synchronous manner
when synchronicity was requested.  Make sure that happens.
2012-02-07 12:35:12 -06:00
Dan Winship 410ac72325 libnm-glib: fix to not depend on newer glib 2012-02-06 17:29:49 -06:00
Dan Williams 925d5e016b docs: reference NMRemoteSettings from NMClient creators
It can be a bit confusing that one object doesn't do both
control and configuration.  So throw users a bone and tell
them how.
2012-02-03 10:38:38 -06:00
Dan Winship c619365ee3 libnm-glib: asyncify NMRemoteSettings
Add nm_remote_settings_new_async/_finish, and misc other fixes
2012-02-03 10:33:44 -06:00
Dan Winship 7844ead116 libnm-glib: nm_client_new_async, fix up NMClient asynchrony issues 2012-02-03 10:33:43 -06:00
Dan Winship 9fd98ef91b libnm-glib: implement GInitable/GAsyncInitable in NMObject
Implement GInitable and GAsyncInitable in NMObject, with
implementations that synchronously or asynchonously load all
properties, and change _nm_object_ensure_inited() to run
g_initable_init().

Update the object/object-array property handling to initialize the
objects after creating them (synchronously or asynchronously,
according to the situation), so that they will have all of their
properties preloaded before they are ever visible to the caller.

Move the non-blocking/non-failable parts of various objects'
constructor() methods to constructed(), and move the blocking/failable
parts to init(), and implement init_async() methods with non-blocking
versions of the blocking methods.

Make nm_device_new() and nm_client_new() call
_nm_object_ensure_inited(), to preserve the behaviour formerly
enforced by their construct() methods, that properties are guaranteed
to be initialized before any signals involving them are emitted.
2012-02-03 10:33:43 -06:00
Dan Winship ad5daa098c libnm-glib: add "pseudoproperties" for things like Client.GetDevices
Add generic handling for "properties" that consist of a "Get" method,
an "Added" signal, and a "Removed" signal, reusing some of the code
for handling object-array-valued properties. And load the values of
pseudo properties from _nm_object_reload/ensure_properties as well.
2012-02-03 10:33:43 -06:00
Dan Winship cc90f1010e libnm-glib: simplify handling of object and object array properties
Add an "object_type" field to NMPropertiesInfo, and use that with
DBUS_TYPE_G_OBJECT_PATH and DBUS_TYPE_G_ARRAY_OF_OBJECT_PATH
properties so that we don't need custom marshallers for each one.

When creating an NMDevice or NMActiveConnection, we need to fetch an
extra property first to figure out the exact subclass to use, so add a
bit of infrastructure for that as well. Also, do that preprocessing
asynchronously when processing a property change notification, so that
it doesn't block the main loop.
2012-02-03 10:33:43 -06:00
Dan Winship 5afcee4693 libnm-glib: simplify property getter methods
Rather than having every property getter method have code to fetch
that specific property's value, just call the new
_nm_object_ensure_inited() (which makes sure that we've read all the
property values on the object at least once), and then return the
cached value. (After we've read the initial property values, the
PropertiesChanged signal handler will ensure that the values are kept
up to date, so we can always just return cached property values after
that point.)

This then lets us get rid of _nm_object_get_property() and its
wrappers.
2012-02-03 10:33:43 -06:00
Dan Winship 2e48cc092c libnm-glib: simplify and genericize property declaration
Rename _nm_object_handle_properties_changed(), etc, to be about
properties in general, rather than just property changes.

Interpret func==NULL in NMPropertiesInfo as meaning "use
_nm_object_demarshal_generic", and then reorder the fields so that you
can just leave that field out in the declarations when it's NULL.

Add a way to register properties that exist in D-Bus but aren't
tracked by the NMObjects, and use that for NMDevice's D-Bus Ip4Address
property, replacing the existing hack.

Also add a few other missing properties noticed along the way.
2012-02-03 10:33:43 -06:00
Dan Winship 8ad3ff24ad libnm-glib: don't use client-side generated dbus-glib bindings
Most of the code was using dbus_g_proxy_call() directly, but there
were some leftover uses of the generated bindings. Make things more
consistent by using dbus_g_proxy_call() everywhere, and stop building
the -bindings.h files.
2012-02-02 12:30:44 -06:00
Dan Winship ba4731dafd libnm-glib: remove nm-dbus-utils.[ch]
The code hasn't been used in a very long time.
2012-02-02 12:30:38 -06:00
Dan Winship efadfd8b17 libnm-glib: pre-emptively avoid some -Wshadow errors
including <gio/gio.h> will drag in some additional system headers that
result in new -Wshadow warnings. Fix those.
2012-02-02 12:30:35 -06:00
Dan Winship f32032694f libnm-glib: implement NMActiveConnection uuid property
This property existed as a #define and a get method, but the actual
GObject property itself was accidentally never implemented.
2012-02-02 12:30:32 -06:00
Dan Winship e74d729f17 libnm-glib: fix _nm_string_array_demarshal
dbus-glib returns 'as' results as G_TYPE_STRV (NULL-terminated
char**), not DBUS_TYPE_G_ARRAY_OF_STRING (GPtrArray of char*).
2012-02-02 12:28:56 -06:00
Dan Williams e281d09805 docs: update NMSecretAgent example code 2012-01-26 12:23:05 -06:00
Dan Williams 724df841a2 docs: update docs for NMSecretAgent callbacks 2012-01-26 12:21:27 -06:00
Jiří Klimeš 0558159c6b docs: fix 'connection' parameter name for nm_access_point_connection_valid() 2012-01-26 18:16:14 +01:00
Thomas Graf 1ba50e2f1b bonding: export path of master device property over DBUS
Adds a new "master" property to NMActiveConnection containing the path
of the master NMDevice if the connection has a master.

Signed-off-by: Thomas Graf <tgraf@redhat.com>
2012-01-25 11:12:43 -06:00
Alberto Ruiz 511bc09663 docs: added notes to the nm_device_filter_connections docs
Added some notes about how to get the connection list
2012-01-13 09:40:53 -06:00
Alberto Ruiz 4f72ed2296 docs: fix section header name for nm_access_point_connection_valid()
nm_access_point_connection_valid documentation had nm_access_point_filter_connection
as the section string, probably a typo after copy pasting
2012-01-13 09:40:26 -06:00
Alberto Ruiz fc66e85146 docs: Update NMAccessPoint documentation
Further explanation on how to get the connection list to filter against
an access point. Also noting that filtering by device is recommended.
2012-01-13 09:39:09 -06:00
Colin Walters dab7dfaf35 build: fix srcdir != builddir
nm-version.h is in ${top_builddir}/include.
2012-01-09 14:20:36 -06:00
Jiří Klimeš decfaa41ef libnm-glib: fix up nm_vpn_connection_get_banner()
We need to get current vpn_state in order for nm_vpn_connection_get_banner() to
work properly even if vpn_state had not been set before.
2012-01-05 11:37:41 +01:00
Jiří Klimeš fa5465a746 docs: update NMVPNConnection's documentation 2012-01-05 10:26:19 +01:00
Thomas Graf 5b7503e95e core: use nm_connection_get_setting_<type>() whenever possible
Leads to shorter, easier to read code and improves type casting safety.

Signed-off-by: Thomas Graf <tgraf@redhat.com>
2011-12-06 16:06:43 -06:00
Dan Winship e9cd59b654 libnm-glib: add NMDeviceInfiniband 2011-12-02 13:09:16 -06:00
Jiří Klimeš 576acdd2bf libnm-glib: get access points in constructor to prevent D-Bus errors
The errors appeared due to calling GetAccessPoints() on removed devices:
nm_device_wifi_get_access_points: error getting access points: Method "GetAccessPoints" with signature "" on interface "org.freedesktop.NetworkManager.Device.Wireless" doesn't exist
2011-11-24 17:15:39 +01:00
Jiří Klimeš 42060fdd89 libnm-glib: get devices and their properties in constructor (NMClient, NMDevice)
NMClient and NMDevice used a 'lazy' approach for getting stuff from D-Bus, i.e.
requesting data from NM when they are asked for. However, for some cases, like
removing devices it is not optimal. libnm-glib will never see a device that was
removed, but not added during NMClient's lifetime.

So let's get devices list in NMClient's constructor and device properties
in NMDevice constructor to have the data from the beginning.
2011-11-24 17:15:36 +01:00
Jiří Klimeš 43b3466b14 libnm-glib: fix demarshalling of ActiveConnection property in NMDevice 2011-11-24 14:11:52 +01:00
Dan Williams a5c2c47b3e wifi: make wireless-helper.h private to src/
The less stuff that needs WEXT the better.
2011-11-09 21:28:02 -06:00
Dan Williams d8437ffaf1 core: fix deprecated usage of g_value_[get|set]_char() (bgo #662694) 2011-10-28 11:35:59 -05:00
Dan Williams 8b1de024ba libnm-glib: fix allow-none introspection annotations (rh #747302) 2011-10-26 10:53:47 -05:00
Dan Williams a7f7e80839 libnm-glib: fix introspection annotations for callbacks and user_data (rh #747302)
user_data arguments should be annotated with (closure) and callbacks
should be marked (allow none) where it's safe to pass NULL.
2011-10-26 10:33:38 -05:00
Dan Williams 832c1aa69b release: bump version to 0.9.0
Yay!
2011-08-22 20:33:07 -05:00
Tomeu Vizoso 77e9cd53a8 libnm-glib: allow to constuct NMObject with NULL bus 2011-08-16 17:21:07 -05:00
Tomeu Vizoso dd175e3bf7 libnm-glib: warn early if an object is tried to be instantiated without a path 2011-08-16 17:20:49 -05:00
Daniel Drake 87b88fd38c libnm-glib: allow NMRemoteSettings constructor with NULL bus
NMRemoteSettings's constructor requires a DBusGConnection, but there
currently aren't any usable gobject-introspection bindings for that class.
This means that NMRemoteSettings can't be used over gobject-introspection.

Move the default fallback to the system bus into the constructor path, so
that introspection bindings are usable.

Python test case:
	from gi.repository import NMClient
	NMClient.RemoteSettings()

Before, this produced a segfault. Now it returns a usable RemoteSettings
object.
2011-08-16 17:19:15 -05:00
Dan Williams 70aba9a038 libnm-glib: VPN delete and save secrets operations are no longer used
They don't get called by anything since 0.9 reworked secrets handling
and added secret agents.  Make them nops but keep the functions.
2011-07-13 13:00:16 -05:00
Dan Williams af55e25f14 libnm-glib: fix GObject introspection annotation 2011-07-02 14:49:02 -05:00
Dan Williams 538cef0805 libnm-glib: fix make distcheck 2011-06-20 11:40:04 -05:00
Dan Williams cfd6ba1690 libnm-glib: fix demarshalling of Dhcp6Config property changes
This bit apparently got forgotten in 10ea7a911c
2011-06-18 17:16:48 -05:00
Jiří Klimeš 8d43875cbe libnm-glib: add nm_client_get_device_by_iface() for NMClient 2011-06-15 14:58:04 +02:00
Jiří Klimeš b4a72d1ad7 libnm-glib: fix crash for AddAndActivateConnection() D-Bus call (bgo #652512)
When a partial connection is passed to nm_client_add_and_activate_connection(),
but it doesn't contain any settings, nm_connection_to_hash() returns NULL and
there's a crash later on the NULL hash.
2011-06-14 19:39:23 +02:00
Dan Williams 10ea7a911c libnm-glib: fix up empty object path demarshalling after 8afce8590a
G_VALUE_HOLDS will fail if the value variable is NULL, so we only
want to check that the GValue holds the right type if the value
is valid.  NULL means "no object path" in demarshallers.
2011-06-01 12:55:54 -05:00
Dan Williams 0e7b71102b libnm-glib: add support for the "active-connection" device property 2011-05-26 19:39:12 -05:00
Dan Williams 8afce8590a libnm-glib: handle NULL object paths generically
Since D-Bus doesn't allow NULL or zero-length object paths, NM
uses "/" as a placeholder here.  Make sure the generic marshalling
code handles that so we don't have to do it in multiple places and
simplify handling of NULL objects somewhat.
2011-05-26 19:19:32 -05:00
Dan Williams 1e5cff5fa2 libnm-glib: export nm_device_get_ip_iface()
This got forgotten somehow.
2011-05-05 12:59:45 -05:00
Dan Williams b0f831ab0a Revert "libnm-glib: export nm_device_get_iface()"
This reverts commit 3116e3c980.

Commit message is wrong.
2011-05-05 12:58:45 -05:00
Dan Williams 3116e3c980 libnm-glib: export nm_device_get_iface()
This got forgotten somehow.
2011-05-05 12:38:29 -05:00
Dan Williams 429a05e675 libnm-glib: rename some internal symbols
To ensure they don't show up in the exported symbol check, even
though they aren't currently exported.
2011-05-05 12:37:21 -05:00
Dan Williams 3c6d2088e0 libnm-glib: rename some internal symbols in legacy compat library
To ensure they don't show up in the exported symbol check, even
though they aren't currently exported.
2011-05-05 12:33:49 -05:00
Dan Williams 55dde4f89d libnm-glib: fix WINS server handling
Copy & paste error, it seems.
2011-05-02 18:48:16 -05:00
Dan Williams 779215c742 libnm-glib: add *_connection_valid() utility functions
Like the *_filter_connections() functions, but for just one connection,
and now the *_filter_connections() functions call these new ones so
it's really just moving code around and not anything new.

These new functions more closely match the usage I've seen from
gnome-shell's network.js and elsewhere.
2011-04-25 17:07:38 -05:00
Dan Williams c790c95e75 libnm-glib: add a missing GObject Introspection annotation 2011-04-25 16:14:55 -05:00
Dan Williams 4cae0bb0fa settings: add a GetConnectionByUuid method
If the client knows the UUID, add a convenience function to get
the connection path directly, instead of having to iterate the
whole connection list and get each connection's details and then
check the UUID.
2011-04-22 12:29:07 -05:00
Dan Williams bb8e9a0b18 api: add "Uuid" property to ActiveConnection interface
A convenience so that clients which might key certain operations off
which connections are active (checking work mail only when on VPN for
example) can more easily get which connections are active.  This would
allow those apps to store the UUID (which they would already be doing)
and not have to create a Connection proxy and then get the connection
properties just to retrieve the UUID of the connection.  Instead they
can now get it from GetAll of the ActiveConnection object, which they
would already be doing.
2011-04-22 12:29:07 -05:00
Dan Williams df511f74f7 build: use -Wundef and fix up cases where stuff wasn't defined (bgo #647157) 2011-04-14 13:19:12 -05:00
Dan Williams fdd2727d21 libnm-glib: hook up networking enabled property writes 2011-03-31 17:38:39 -05:00
Dan Williams 0d92803ccc libnm-glib: make property set requests for wifi/wwan/wimax do something
They weren't actually poking NM, just setting internal values.
2011-03-31 17:34:13 -05:00
Michael Biebl 530f143adf use /usr/bin/env instead of /bin/env 2011-03-29 01:00:47 +02:00
Dan Williams 5ee1039067 libnm-glib: fix crash calling activation callback
Duh, need to zero the memory before reading from it.  It was
crashing in recheck_pending_activations() because the info->active_path
was random memory.
2011-03-24 23:20:32 -05:00
Dan Williams 435db3cb3d libnm-glib: test symbol exports against .ver file 2011-03-21 12:25:28 -05:00
Dan Williams 83ed56108c build: blow away all dbus-glib generated files during clean
Not just the ones we built; if you're switching often between
git branches, there will be some generated files left over from
the other branch, which then the docs generation stuff pick up
and pollute your autogenerated docs with stuff from other branches.
So just clean up everything on make clean.
2011-03-19 13:43:05 -05:00
Dan Williams 1701df4b75 core: add active connection state DEACTIVATING
Not used yet, but will be when device deactivating state gets
used.  Should be 100% backwards compatible with users that don't
know about it for now.
2011-03-17 14:23:21 -05:00
Dan Williams 14b23ba399 libnm-glib: handle new device states
The device states aren't used yet, but handle them anyway.
2011-03-17 13:42:22 -05:00
Dan Williams 4fca276e9a libnm-glib: automatically cancel secrets requests if NM goes away 2011-03-17 13:42:21 -05:00
Dan Williams 4390865bc0 libnm-glib: clarify usage of specific_object for activation calls 2011-03-17 11:27:30 -05:00
Dan Williams ab9af2277f libnm-glib: clarify some documentation 2011-03-17 11:18:35 -05:00
Dan Williams efc51d51e5 libnm-glib: more introspection annotation fixes
No connection is required for nm_client_add_and_activate_connection(),
it can be NULL.
2011-03-17 11:17:08 -05:00
Dan Williams 49c618a2a8 libnm-glib: fix introspection annotation for nm_remote_connection_delete() 2011-03-17 10:46:42 -05:00
Richard Hughes 4e73194500 libnm-glib: allow calling nm_remote_connection_delete() without a callback 2011-03-16 15:36:36 -05:00
Giovanni Campagna 4480365db7 libnm-glib: introspection annotation fixes (bgo #643011) 2011-03-16 15:25:37 -05:00
Jiří Klimeš 45521e3c68 libnm-glib: bump soname due to recent ABI break 2011-03-16 13:57:07 +01:00
Jiří Klimeš 6b2e8664a7 libnm-glib: update nm_client_activate_connection()'s description 2011-03-16 13:50:09 +01:00
Jiří Klimeš d91c68235d libnm-glib: fix calling callback when activating connection
Connections were not added to pending_activations resulting in callback
not being called.
2011-03-16 13:03:15 +01:00
Dan Williams ead5869825 libnm-glib: small activation callback rework
To make the API more consistent, instead of returning an
ActiveConnection object path, return the actual NMActiveConnection
object itself.  Suggested by Matthias Clasen.
2011-03-15 19:03:18 -05:00
Dan Williams 47a7f30682 libnm-glib: move some code around
Move the GObject boilerplate stuff to the bottom.
2011-03-15 17:16:52 -05:00
Dan Williams d4f8c43f40 libnm-glib: allow NULL device for nm_client_activate_connection() 2011-03-15 17:04:50 -05:00
Dan Williams 1c3a67aaa5 api: clarify function and usage of the Device.Udi property 2011-03-15 12:56:19 -05:00
Kjartan Maraas b224ab8e56 trivial: let g_free and g_strdup handle NULL (bgo #644763) 2011-03-15 00:08:58 -05:00
Kjartan Maraas c2b4b9c1d7 build: fix return types (bgo #644665)
Some functions were returning FALSE or 0 instead of NULL.
2011-03-14 01:05:51 -05:00
Dan Williams 16948ce927 libnm-glib: add nm_wimax_nsp_filter_connections() 2011-03-11 10:09:19 -06:00
Dan Williams f30e15a04d libnm-glib: add nm_access_point_filter_connections() 2011-03-11 09:36:41 -06:00
Dan Williams 3320764e1e libnm-glib: add nm_device_filter_connections() 2011-03-10 22:27:10 -06:00
Dan Williams fbf118e58e libnm-glib: documentation update for nm_remote_settings_list_connections() 2011-03-10 17:46:51 -06:00
Dan Williams bf76960597 libnm-glib: documentation fixes 2011-03-10 12:35:43 -06:00
Dan Williams 09b46bb269 libnm-glib: update some documentation 2011-03-10 11:55:09 -06:00
Dan Williams 0ae870bf09 libnm-glib: remove deprecated nm_ip4_config_get_hostname() function
Deprecated since 0.7 days; it always returned NULL anyway.
2011-03-10 11:48:22 -06:00
Dan Williams 8a80a62458 libnm-glib: make sure nm_device_get_dhcp6_config() is visible 2011-03-10 09:50:23 -06:00
Michael Biebl 8119ecf6b0 core: depend on stable gudev API 2011-03-10 03:19:27 -06:00
Dan Williams fa48970b4e libnm-glib: fix reply processing of AddConnection calls
It really is an object path, folks.
2011-03-10 02:03:25 -06:00
Dan Williams 9637fbfd12 libnm-glib: bump required NM version in pkgconfig file
To something modern, at least.
2011-03-10 01:55:30 -06:00
Dan Williams d35bf585d2 libnm-glib: fix bogus free
Apparently dbus-glib will pass non-NULL parameters to proxy
callbacks in the error case, so we've got to make sure we don't
touch any return parameters if there's been an error.
2011-03-10 01:35:09 -06:00