1. 25 Sep, 2014 1 commit
    • Dan Winship's avatar
      libnm: make sync/async APIs more GLib-like · 2237ea3d
      Dan Winship authored
      Make synchronous APIs take GCancellables, and make asynchronous APIs
      use GAsyncReadyCallbacks and have names ending in "_async", with
      "_finish" functions to retrieve the results.
      
      Also, make nm_client_activate_connection_finish(),
      nm_client_add_and_activate_finish(), and
      nm_remote_settings_add_connection_finish() be (transfer full) rather
      than (transfer none), because the refcounting semantics become
      slightly confusing in some edge cases otherwise.
      2237ea3d
  2. 18 Sep, 2014 3 commits
    • Dan Winship's avatar
      libnm: port to GDBus · 6793a32a
      Dan Winship authored
      Port libnm-core/libnm to GDBus.
      
      The NetworkManager daemon continues to use dbus-glib; the
      previously-added connection hash/variant conversion methods are now
      moved to NetworkManagerUtils (along with a few other utilities that
      are now only needed by the daemon code).
      6793a32a
    • Dan Winship's avatar
      libnm-core: change connection hash tables to variants in API · acf86f68
      Dan Winship authored
      In preparation for porting to GDBus, make nm_connection_to_dbus(),
      etc, represent connections as GVariants of type 'a{sa{sv}}' rather
      than as GHashTables-of-GHashTables-of-GValues.
      
      This means we're constantly converting back and forth internally, but
      this is just a stepping stone on the way to the full GDBus port, and
      all of that code will go away again later.
      acf86f68
    • Dan Winship's avatar
      libnm: let NMObject create all D-Bus proxies · b728d1fb
      Dan Winship authored
      Add _nm_object_class_add_interface(), for declaring that a class
      implements a particular interface, and then have NMObject create the
      corresponding proxies itself. (The subclass can get a copy with
      _nm_object_get_proxy() if it needs it for something).
      
      (In GDBus, creating a proxy is a heavier operation than in dbus-glib,
      so we'll need to create the proxies asynchronously. Moving the
      creation to NMObject makes that easier since we can do it as part
      of the existing init/init_async.)
      b728d1fb
  3. 04 Sep, 2014 3 commits
    • Dan Winship's avatar
      libnm: change empty-GPtrArray-return semantics · 3e5b3833
      Dan Winship authored
      libnm functions that return GPtrArrays of objects had a rule that if
      the array was empty, they would return NULL rather than a 0-length
      array. As it turns out, this is just a nuisance to clients, since in
      most places the code for the non-empty case would end up doing the
      right thing for the empty case as well (and where it doesn't, we can
      check "array->len == 0" just as easily as "array == NULL"). So just
      return the 0-length array instead.
      3e5b3833
    • Dan Winship's avatar
      libnm: drop NM_TYPE_OBJECT_ARRAY, use G_TYPE_PTR_ARRAY · 074c2093
      Dan Winship authored
      Use G_TYPE_PTR_ARRAY for GPtrArray-of-NMObject-valued properties,
      because it has better introspection/bindings support.
      
      As with the strdict change in libnm-core, we need to manually copy the
      array in get_property() implementations, to preserve the standard
      semantics that get_property() returns a copy, not the internal array.
      
      (This patch also changes those properties so that they are always
      non-NULL until dispose(); previously some of them could be either NULL
      or 0-length at different times.)
      074c2093
    • Dan Winship's avatar
      libnm-core: rename NMConnection to/from_hash methods · 773d3f0a
      Dan Winship authored
      Rename nm_connection_to_hash() to nm_connection_to_dbus(), and
      nm_connection_new_from_hash() to nm_connection_new_from_dbus(). In
      addition to clarifying that this is specifically the D-Bus
      serialization format, these names will also work better in the
      GDBus-based future where the serialization format is GVariant, not
      GHashTable.
      
      Also, move NMSettingHashFlags to nm-connection.h, and rename it
      NMConnectionSerializationFlags.
      773d3f0a
  4. 16 Aug, 2014 1 commit
    • Dan Winship's avatar
      libnm: get rid of redundant NMRemoteConnection properties · 5ed054ac
      Dan Winship authored
      NMRemoteConnection had two DBusGConnection properties
      (NMRemoteConnection:bus and NMRemoteConnection:dbus-connection) and
      two D-Bus path properties (NMConnection:path and
      NMRemoteConnection:dbus-path). The former of each pair were the
      traditional names, and the latter were added for compatibility with
      NMObject.
      
      In libnm, we can just drop NMRemoteConnection:bus, and use the
      NMObject-compatible :dbus-connection name instead.
      
      For the path properties, we need to rename either NMConnection:path or
      NMObject:dbus-path. Since NMObject already has "nm_object_get_path()"
      rather than "nm_object_get_dbus_path()", and it already mistakenly
      referred to the property as "NMObject:path" in the gtk-docs, it seemed
      to make sense to rename that one rather than the NMConnection one.
      
      (And then, for consistency, rename "nm_object_get_connection()" to
      "nm_object_get_dbus_connection()" to also match its property.)
      5ed054ac
  5. 07 Aug, 2014 3 commits
    • Dan Winship's avatar
      libnm: remove redundant NM name watching code · c4a86eba
      Dan Winship authored
      NMClient was watching to see whether NetworkManager was running, but
      its parent class NMObject was already doing that anyway, so NMClient
      doesn't need to do it itself.
      
      This also requires making NMClient:init_async() wait for NMObject's
      init_async() code to finish before calling GetPermissions, rather than
      running the two in parallel like before (since we don't know if NM is
      running or not until after NMObject's init_async() returns). This is
      probably more correct anyway in terms of inheritance, and it's not as
      much slower than the original code as it sounds, since previously
      we were calling NameHasOwner twice (in serial) anyway.
      c4a86eba
    • Dan Winship's avatar
      libnm: synchronize NMClient and NMRemoteSettings "is NM running" properties · 8ce06b81
      Dan Winship authored
      Rename NMClient:manager-running and NMRemoteSettings:service-running
      to both be :nm-running.
      8ce06b81
    • Dan Winship's avatar
      libnm, libnm-glib: belatedly replace _nm_client_is_object_path() · 7e791ce3
      Dan Winship authored
      _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.)
      7e791ce3
  6. 01 Aug, 2014 8 commits
    • Dan Winship's avatar
      libnm: make the the use of GInitable mandatory · 258e74eb
      Dan Winship authored
      Remove _nm_object_ensure_inited(), etc; objects that implement
      GInitable are now mandatory-to-init().
      
      Remove constructor() implementations that sometimes return NULL; do
      all the relevant checking in init() instead.
      
      Make nm_client_new() and nm_remote_settings_new() take a GCancellable
      and a GError**.
      258e74eb
    • Dan Winship's avatar
      libnm: add init_dbus() virtual method to NMObject · 8ca2998d
      Dan Winship authored
      Rather than having each object type override constructed() to call
      _nm_object_register_properties(), have NMObject call a virtual method
      on the subclass to ask it to register them.
      
      Move some code around in nm-client.c and nm-object.c so that all
      D-Bus-related initialization happens in init_dbus(), and
      non-D-Bus-related stuff stays in construct().
      
      (This simplifies the next commit.)
      8ca2998d
    • Dan Winship's avatar
      libnm: remove Since tags and NM_AVAILABLE_IN_* attributes · b4ae6eae
      Dan Winship authored
      Everything currently in libnm has always been there.
      b4ae6eae
    • Dan Winship's avatar
      libnm: remove all deprecated functions and types · 054c12ea
      Dan Winship authored
      Remove deprecated functions and enum types.
      
      For now, deprecated properties are still around, because removing them
      would cause warnings when talking to older implementations.
      054c12ea
    • Dan Winship's avatar
      libnm: add libnm/libnm-core (part 2) · eedcf185
      Dan Winship authored
      This fixes up the code from the previous "clean" import, and adds
      build infrastructure.
      
      [There are two slightly orthogonal sets of changes in this patch.
      First, the files added in the previous commit were modified as followed:
      
        # Replace internal references to "libnm-util" and "libnm-glib" with "libnm"
        perl -pi -e 's/libnm-(util|glib)/libnm/;' libnm-core/*.[ch] libnm-core/tests/*.[ch] libnm/*.[ch] libnm/tests/*.[ch]
      
        # Fix includes of the enum-types files
        perl -pi -e 's/nm-utils-enum-types/nm-core-enum-types/;' libnm-core/*.[ch] libnm-core/tests/*.[ch] libnm/*.[ch] libnm/tests/*.[ch]
        perl -pi -e 's/nm-glib-enum-types/nm-enum-types/;' libnm/*.[ch] libnm/tests/*.[ch]
      
        # Fix some python example code
        perl -pi -e 's/import NMClient/import NM/;' -e 's/NMClient.Client\(\)/NM.Client()/;' libnm/nm-client.c
      
      Then, the build infrastructure was added (without further modifying
      any existing files in libnm-core or libnm.)
      
      Note: to regenerate libnm.ver after rebase:
        (head -2 libnm-util/libnm-util.ver; (grep -h '\s'nm_ libnm-util/libnm-util.ver libnm-glib/libnm-glib.ver | env LANG=C sort); tail -3 libnm-util/libnm-util.ver) > libnm/libnm.ver
      ]
      eedcf185
    • Dan Winship's avatar
      libnm: add libnm/libnm-core (part 1) · d595f784
      Dan Winship authored
      This commit begins creating the new "libnm", which will replace
      libnm-util and libnm-glib.
      
      The main reason for the libnm-util/libnm-glib split is that the daemon
      needs to link to libnm-util (to get NMSettings, NMConnection, etc),
      but can't link to libnm-glib (because it uses many of the same type
      names as the NetworkManager daemon. eg, NMDevice). So the daemon links
      to only libnm-util, but basically all clients link to both.
      
      With libnm, there will be only a single client-visible library, and
      NetworkManager will internally link against a private "libnm-core"
      containing the parts that used to be in libnm-util.
      
      (The "libnm-core" parts still need to be in their own directory so
      that the daemon can see those header files without also seeing the
      ones in libnm/ that conflict with its own headers.)
      
      [This commit just copies the source code from libnm-util/ to
      libnm-core/, and libnm-glib/ to libnm/:
      
        mkdir -p libnm-core/tests/
        mkdir -p libnm/tests/
        cp libnm-util/*.[ch] libnm-util/nm-version.h.in libnm-core/
        rm -f libnm-core/nm-version.h libnm-core/nm-setting-template.[ch] libnm-core/nm-utils-enum-types.[ch]
        cp libnm-util/tests/*.[ch] libnm-core/tests/
        cp libnm-glib/*.[ch] libnm/
        rm -f libnm/libnm_glib.[ch] libnm/libnm-glib-test.c libnm/nm-glib-enum-types.[ch]
        cp libnm-glib/tests/*.[ch] libnm/tests/
      
      ]
      d595f784
    • Dan Winship's avatar
      libnm-glib: fix a crash when using multiple NMClients · fe264a2d
      Dan Winship authored
      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.)
      fe264a2d
    • Giovanni Campagna's avatar
      libnm-glib: disconnect the connectivity check cancellable signal after the... · 07046462
      Giovanni Campagna authored
      libnm-glib: disconnect the connectivity check cancellable signal after the 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
      07046462
  7. 27 Jul, 2014 1 commit
    • Thomas Haller's avatar
      libnm-glib: fix gtk-doc for NMClient:active-connections · 7f35d808
      Thomas Haller authored
      Since previous commit dafe51e8,
      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's avatarThomas Haller <thaller@redhat.com>
      7f35d808
  8. 25 Jul, 2014 1 commit
    • Dan Winship's avatar
      libnm-glib: document some properties · dafe51e8
      Dan Winship authored
      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.)
      dafe51e8
  9. 15 Jul, 2014 3 commits
    • Dan Winship's avatar
      libnm-util, libnm-glib: whitespace fixes · 2570c5a1
      Dan Winship authored
      Fix indentation, kill trailing whitespace, split some long lines.
      2570c5a1
    • Dan Winship's avatar
      libnm-util, libnm-glib: standardize copyright/license headers · cb7e1893
      Dan Winship authored
      - 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.
      cb7e1893
    • Dan Winship's avatar
      libnm-util, libnm-glib: tweak (element-type) annotations in docs · 4223fa47
      Dan Winship authored
      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).
      4223fa47
  10. 19 Jun, 2014 2 commits
  11. 23 Jan, 2014 1 commit
  12. 13 Nov, 2013 1 commit
  13. 31 Oct, 2013 1 commit
  14. 22 Oct, 2013 1 commit
    • Thomas Haller's avatar
      core: cleanup freeing of glib collections of pointers · 3eb1d5e9
      Thomas Haller authored
      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's avatarThomas Haller <thaller@redhat.com>
      3eb1d5e9
  15. 14 Oct, 2013 1 commit
  16. 11 Oct, 2013 1 commit
    • Dan Winship's avatar
      libnm-util, libnm-glib: fix up some gtk-doc comments · 76cc2bd9
      Dan Winship authored
      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.
      76cc2bd9
  17. 03 Oct, 2013 1 commit
  18. 11 Sep, 2013 1 commit
  19. 28 Aug, 2013 2 commits
  20. 16 Aug, 2013 1 commit
  21. 08 May, 2013 1 commit
  22. 19 Apr, 2013 1 commit
    • Martin Pitt's avatar
      Use %NULL macro in doc strings · 57a9fb3c
      Martin Pitt authored
      Mass-converted "NULL" to "%NULL" in docstrings with
      
        find -name '*.c'| xargs sed -i '/^ \*.*[^%]NULL/ s/NULL\b/%NULL/g'
      57a9fb3c
  23. 08 Apr, 2013 1 commit
    • Dan Williams's avatar
      libnm-glib: never call NM D-Bus methods if NM isn't running · 110a4035
      Dan Williams authored
      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.
      110a4035