[libhal] Changes to make libhal more useable

Henning Günther eq at eq.homelinux.org
Sat Sep 25 02:36:08 PDT 2004


Hi everybody,

I just played around a bit with libhal as I want to integrate it into my
program. But I've noticed a little limitation in it:
If hal_initialize is called, it immedeatily calls the
LibHalIntegrateDBusIntoMainLoop method that was given to it. The
limitation is that I'm not able to access the user-data of the hal-
context because I can't set it before it calls
LibHalIntegrateDBusIntoMainLoop.
Here's a proposal how to remove this limitation:
To create a hal-context, the user calls hal_new(const LibHalFunctions*
cb_functions, dbus_bool_t use_cache). This creates a new context but it
doesn't call any of the functions you give it.
The user can now set the user data.
To start the hal-loop, the user calls hal_start(LibHalContext* context).
It calls the integration method.

To have backwards compatibility, you could declare hal_initialize as the
following:
LibHalContext* hal_initialize(const LibHalFunctions*
cb_functions,dbus_bool_t use_cache) {
	LibHalContext* context=hal_new(cb_functions,use_cache);
	hal_start(context);
	return context;
}

I hope there's no big problem with this.

Henning

_______________________________________________
hal mailing list
hal at freedesktop.org
http://freedesktop.org/mailman/listinfo/hal



More information about the Hal mailing list