Re: libnm-glib

On 01/23/2015 06:04 AM, Cezary Manista wrote:
I worked around that by creating the NMClient using g_object_new
directly, and passing bus object via construction parameters. This way
my component may be missing some initialization done by
_nm_object_ensure_inited (that's called in nm_client_new), but I noticed
that _nm_object_ensure_inited is also called by other methods like
nm_client_get_state, so I assume that whenever I call one of these, the
object gets fully initialized. It seems to work fine, by the way.

Actually, you should just call g_initable_init() on it. Then if
something does go wrong with initialization, you'll get back a GError or
exception or something. (I'm not sure what language binding you're using
with NodeJS... it's possible that it does that for you automatically
with objects that implement GInitable, as NMClient does.)

 - Is it OK to create NMClient object this way? (at least with the
version of NM)

Yes, the libnm-glib test programs do this as well.

 - I noticed that in the latest revision, nm_client_new hasn't changed.
Is there a reason why DBusGConnection parameter is not there? Is there a
chance that it will be added in future releases?

The API is stable, so it can't change between versions.

Note that in the new "libnm" library in NM 1.0 there is no longer a
"dbus-connection" property, but you can set the environment variable
"LIBNM_USE_SESSION_BUS" to make NMClient use the session bus rather than
the system bus.

-- Dan

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]