summaryrefslogtreecommitdiff
path: root/libnm-glib/nm-client.c
Commit message (Collapse)AuthorAgeFilesLines
* libnm, libnm-glib: belatedly replace _nm_client_is_object_path()Dan Winship2014-08-071-46/+2
| | | | | | | _nm_client_is_object_path() had been copied from g_variant_is_object_path() with a note that it should be replaced when we depended on GLib > 2.24, but it got missed when we actually updated the dependency. Fix it now. (Also fix a nearby typo.)
* libnm-glib: fix a crash when using multiple NMClientsDan Winship2014-08-011-1/+1
| | | | | | | | | | | | | | NMObjectCache was assuming there would never be more than one object with the same path, but since NMClient is an NMObject, it was getting cached too, so if you created two clients and then unreffed one of them, it's possible the wrong one could get left in the cache, causing a crash the next time the other one called nm_object_cache_clear(). Fix this by only adding NMObjects to the cache in the codepaths where we also check to see if the object was already in the cache. (This also means we can remove the "except" argument to nm_object_cache_clear(), since the NMClient won't be cached any more.)
* libnm-glib: disconnect the connectivity check cancellable signal after the ↵Giovanni Campagna2014-07-311-0/+5
| | | | | | | | | | | | call has ended (bgo #733915) We cannot rely on connectivity data freeing to disconnect the signal, because the simple async result might be kept alive by external code (for example the language runtime for JS), but we must not call dbus_g_proxy_cancel_call() if that cancellable is cancelled or reused afterwards. https://bugzilla.gnome.org/show_bug.cgi?id=733915
* libnm-glib: fix gtk-doc for NMClient:active-connectionsThomas Haller2014-07-271-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since previous commit dafe51e8819c31ef6c0a7e901e43e821e229650f, the gtk-doc is no longer ignored. However, the angle brackets add invalid XML characters to ./docs/libnm-glib/xml/nm-client.xml This breaks the build. make[3]: Entering directory `./NetworkManager/docs/libnm-glib' DOC Scanning header files DOC Introspecting gobjects DOC Building HTML ../xml/nm-client.xml:1110: parser error : Opening and ending tag mismatch: NMActiveConnection line 1109 and para </para></refsect2> ^ ../xml/nm-client.xml:1110: parser error : Opening and ending tag mismatch: para line 1107 and refsect2 </para></refsect2> ^ ../xml/nm-client.xml:1211: parser error : Opening and ending tag mismatch: refsect2 line 1104 and refsect1 </refsect1> ^ ../xml/nm-client.xml:1262: parser error : Opening and ending tag mismatch: refsect1 line 1095 and refentry </refentry> ^ ../xml/nm-client.xml:1263: parser error : Premature end of data in tag refentry line 7 ^ ../libnm-glib-docs.xml:67: element include: XInclude error : could not load ../xml/nm-client.xml, and no fallback was found make[3]: *** [html-build.stamp] Error 6 Signed-off-by: Thomas Haller <thaller@redhat.com>
* libnm-glib: document some propertiesDan Winship2014-07-251-9/+9
| | | | | | | | Some libnm-glib object properties were only documented in the GParamSpec strings, not via gtk-doc comments, so they became undocumented when the paramspec strings went away. Fix that. (Also fix incorrect gtk-doc syntax with several NMClient properties.)
* libnm-util, libnm-glib: whitespace fixesDan Winship2014-07-151-23/+23
| | | | Fix indentation, kill trailing whitespace, split some long lines.
* libnm-util, libnm-glib: standardize copyright/license headersDan Winship2014-07-151-4/+2
| | | | | | | | | | | | | | | | | | - 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.
* libnm-util, libnm-glib: tweak (element-type) annotations in docsDan Winship2014-07-151-5/+5
| | | | | | | 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).
* all: remove remaining GParamSpec name/blurb stringsDan Winship2014-06-191-72/+57
| | | | | | 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.
* libnm-util, libnm-glib: be consistent about "Wi-Fi", "Ethernet", ↵Dan Winship2014-06-191-3/+3
| | | | | | | | | "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".
* libnm-glib: convert NMClient Devices to a real propertyDan Williams2014-01-231-23/+20
|
* coverity: fix various warnings detected with CoverityThomas Haller2013-11-131-1/+6
| | | | | | | | | | | | | These are (most likely) only warnings and not severe bugs. Some of these changes are mostly made to get a clean run of Coverity without any warnings. Error found by running Coverity scan https://bugzilla.redhat.com/show_bug.cgi?id=1025894 Co-Authored-By: Jiří Klimeš <jklimes@redhat.com> Signed-off-by: Thomas Haller <thaller@redhat.com>
* libnm-glib: add support for NULL connections to nm_client_activate_connection()Dan Williams2013-10-311-3/+7
| | | | | Pass along to NetworkManager, which picks the best available connection for the device and activates it.
* core: cleanup freeing of glib collections of pointersThomas Haller2013-10-221-2/+1
| | | | | | | | | | | | | | | | When freeing one of the collections such as GArray, GPtrArray, GSList, etc. it is common that the items inside the connections must be freed/unrefed too. The previous code often iterated over the collection first with e.g. g_ptr_array_foreach and passing e.g. g_free as GFunc argument. For one, this has the problem, that g_free has a different signature GDestroyNotify then the expected GFunc. Moreover, this can be simplified either by setting a clear function (g_ptr_array_set_clear_func) or by passing the destroy function to the free function (g_slist_free_full). Signed-off-by: Thomas Haller <thaller@redhat.com>
* libnm-glib: fix a crash in nm_client_new() (rh #1010288)Jiří Klimeš2013-10-141-5/+30
| | | | | | | | We have to check if 'client' is valid when calling _nm_object_ensure_inited(). Creation of NMClient object can fail, because its parent NMObject's constructor() returns NULL for D-Bus errors. https://bugzilla.redhat.com/show_bug.cgi?id=1010288
* libnm-util, libnm-glib: fix up some gtk-doc commentsDan Winship2013-10-111-2/+2
| | | | | | | | | gtk-doc recognizes that #NMFoos is the plural of #NMFoo now, so you don't need to put an empty comment between the type name and the "s" to make it work. (Unfortunately, it's not smart enough to realize that "NMIP4Addresses" is the plural of "NMIP4Address".) Also, add some missing "#"s noticed along the way.
* libnm: more valgrinding fixesDan Winship2013-10-031-2/+4
|
* libnm-glib: change "Since: 0.9.10" to "Since: 0.9.8.6" for backported APIDan Winship2013-09-111-9/+9
|
* libnm-glib: Add NMClient:primary-connection and :activating-connectionDan Winship2013-08-281-0/+98
| | | | https://bugzilla.gnome.org/show_bug.cgi?id=704841
* libnm-glib: support new connectivity property/methodsDan Winship2013-08-281-0/+212
|
* libnm-glib: add NMClient:startup, nm_client_get_startup()Dan Winship2013-08-161-0/+43
| | | | Expose the new NMManager:startup property on NMClient.
* libnm-glib, core: use g_cclosure_marshal_genericDan Winship2013-05-081-7/+3
| | | | | Since we depend on new glib now, we can just use the generic marshaller rather than generating our own.
* Use %NULL macro in doc stringsMartin Pitt2013-04-191-3/+3
| | | | | | Mass-converted "NULL" to "%NULL" in docstrings with find -name '*.c'| xargs sed -i '/^ \*.*[^%]NULL/ s/NULL\b/%NULL/g'
* libnm-glib: never call NM D-Bus methods if NM isn't runningDan Williams2013-04-081-36/+106
| | | | | | | | | | | | | | | | | | Though the client shouldn't be calling anything when NM isn't running (because clients have nm_client_get_manager_running()), make sure that NMClient never calls a NetworkManager method when NM isn't on the bus. Next, ensure NMObject doesn't try to refresh properties when NM isn't running. Creating an NMClient may trigger a property refresh request, but if NM isn't running, defer that until NM starts, to ensure that we don't D-Bus autostart NM. Third, ensure NMRemoteSettings doesn't attempt to list connections unless NM is running. This prevents service activation of NetworkManager in lieu of dbus-glib learning about DBUS_HEADER_FLAG_NO_AUTO_START.
* libnm-glib: clear and recheck permissions on NM restartsDan Williams2013-04-081-0/+2
|
* libnm-glib: use private connection before trying the system busDan Williams2013-04-081-71/+57
| | | | | | | | | Use the D-Bus connection helper whenever we need a connection to NM, which by default tries to use a private connection instead of the shared bus connection whenever the user is root. Doing this by default will not change the behavior of libnm-glib, and allows tools like nmcli and libnm-glib-using clients to work in minimal environments (those without a bus daemon) by default.
* libnm-glib: use helpers to create dbus proxiesDan Williams2013-04-081-10/+3
| | | | | | | | | | When using a private connection, we need to use dbus_g_proxy_new_for_peer() because the bus isn't involved. Since many parts of libnm-glib create a proxy for their corresponding remote object, consolidate the proxy creation logic. A later patch will add logic to use a private connection versus a bus-based one.
* all: use G_VALUE_INIT to initialize GValue variablesJiří Klimeš2013-03-251-3/+3
| | | | | It makes the initializations more explicit. G_VALUE_INIT is available since glib 2.30, and NM now require glib >= 2.32
* libnm-glib: add Since tags to new functions and propertiesDan Williams2013-02-221-0/+4
|
* libnm-glib: add nm_client_set_logging() for setting debugging level and domainsJiří Klimeš2013-01-091-0/+37
|
* libnm-glib: add nm_client_get_logging() functionJiří Klimeš2013-01-091-0/+39
| | | | to get current logging level and domains.
* libnm-glib: clarify documentation of nm_client_get_devices()Colin Walters2012-12-131-3/+7
|
* libnm-glib: fix GAsyncInitable implementationsDan Winship2012-07-171-0/+12
| | | | | | If a class implements init_async, it should implement init_finish too, rather than assuming the default implementation will do the right thing (which it briefly didn't in glib 2.33).
* docs: fix some annotations in libnm-glibJiří Klimeš2012-06-291-14/+14
|
* libnm-glib: add "object-creation-failed" signal to NMObjectJiří Klimeš2012-04-251-14/+45
| | | | | | | | The signal is private for libnm-glib and should not be used externally. It is emitted when there's an error while creating an object. In addition, this commit makes use of the signal in NMClient to ensure that the callbacks are always called for nm_client_activate_connection() and nm_client_add_and_activate_connection().
* libnm-glib: ensure object cache is cleared when NM stops (bgo #674473)Dan Williams2012-04-231-0/+5
| | | | | | | Otherwise if a client holds references to the objects (or in the JavaScript case, uses deferred garbage collection) they'll still be in the cache when NM restarts, and the old object may have the same path as some new object, which isn't good.
* libnm-glib: discard devices and active connections when NM goes downDan Winship2012-04-231-19/+40
| | | | | | | | When NMClient changes state to "not running", don't just unref all the devices and connections: emit notify::active-connections and device-removed signals too, so the app will drop its copies of them. https://bugzilla.gnome.org/show_bug.cgi?id=674473
* libnm-glib: NULL out priv fields on dispose()Dan Winship2012-04-231-10/+7
| | | | | | | | In some situations, objects might get used after being disposed, so clear out their various priv fields so we don't try to access unreffed objects, freed strings, etc. https://bugzilla.gnome.org/show_bug.cgi?id=674473
* trivial: fix spacingDan Williams2012-04-201-1/+1
|
* libnm-glib: more ensure_inited() fixingDan Winship2012-03-281-0/+2
| | | | | | | | | We need to do _nm_object_ensure_inited() / _nm_remote_settings_ensure_inited() from the get_property() implementations; in most cases, get_property() just calls another accessor method (which will call _nm_object_ensure_inited()), but in a few places, it reads priv->whatever directly, so we need to make sure that it's valid.
* libnm-glib: ensure bindings-created NMClient object work (rh #802536)Jiří Klimeš2012-03-271-0/+99
| | | | | | | | | | | | Most of the stuff was done by 762df85234e7a042a2a5d31053e6cc273ae3e2ec. But to allow this piece of code: from gi.repository import NMClient nmclient = NMClient.Client() print nmclient.get_active_connections() we also need to set "dbus-path" property in NMClient constuctor(), else parent NMObject is not properly constructed.
* libnm-glib: ensure bindings-created objects work as expected (rh #802536)Dan Williams2012-03-211-14/+10
| | | | | | | | | | | | | | | | | | | | | | | | Bindings (like GObject Introspection) almost always create objects using g_object_new() by default and don't use our helper functions like nm_client_new(). Thus we need to make sure that if the object is created in that way, any property accesses or functions that return properties ensure that the object is fully initialized, which is what the _new() functions were supposed to do. In one case in NMClient that was missing (getting active connections) and wasn't happening at all in NMRemoteSettings, which are our two entry points into libnm-glib. This allows this python+GI sequence to return the expected active connection list: from gi.repository import NMClient nmclient = NMClient.Client(dbus_path='/org/freedesktop/NetworkManager') active = nmclient.get_active_connections() print(active) where previously it returned an empty list because the NMClient wasn't fully initialized by the time nm_client_get_active_connections() was called.
* libnm-glib: fix leaked NMDevice objects due to circular refcountingDan Williams2012-03-121-2/+17
| | | | | | Active Device objects held a reference to their ActiveConnection which also held a reference back to the Device. Ensure that's broken so everyone can get disposed correctly.
* Use glib-mkenums to generate enum typesDan Winship2012-02-151-2/+2
| | | | | | | | | | | | | | | | | | | Rather than generating enum classes by hand (and complaining in each file that "this should really be standard"), use glib-mkenums. Unfortunately, we need a very new version of glib-mkenums in order to deal with NM's naming conventions and to fix a few other bugs, so just import that into the source tree temporarily. Also, to simplify the use of glib-mkenums, import Makefile.glib from https://bugzilla.gnome.org/654395. To avoid having to run glib-mkenums for every subdirectory of src/, add a new "generated" directory, and put the generated enums files there. Finally, use Makefile.glib for marshallers too, and generate separate ones for libnm-glib and NetworkManager.
* libnm-glib: better debugging of property accesses and updatesDan Williams2012-02-071-0/+2
| | | | | | 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.
* libnm-glib: fix to not depend on newer glibDan Winship2012-02-061-0/+1
|
* docs: reference NMRemoteSettings from NMClient creatorsDan Williams2012-02-031-0/+8
| | | | | | 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.
* libnm-glib: nm_client_new_async, fix up NMClient asynchrony issuesDan Winship2012-02-031-101/+100
|
* libnm-glib: implement GInitable/GAsyncInitable in NMObjectDan Winship2012-02-031-48/+165
| | | | | | | | | | | | | | | | | | | | | | 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.
* libnm-glib: add "pseudoproperties" for things like Client.GetDevicesDan Winship2012-02-031-74/+16
| | | | | | | 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.