hal/tools lshal.c,1.10,1.11
David Zeuthen
david at freedesktop.org
Wed Feb 16 10:39:58 PST 2005
Update of /cvs/hal/hal/tools
In directory gabe:/tmp/cvs-serv27614/tools
Modified Files:
lshal.c
Log Message:
2005-02-16 David Zeuthen <davidz at redhat.com>
* tools/device-manager/DeviceManager.py:
(DeviceManager.update_tab_advanced): Make this work for string lists
* tools/lshal.c (main): Various cleanups
* libhal/libhal.c (libhal_property_fill_value_from_variant): Make
this one static. Make sure to recurse into string array otherwise
it won't work at all
(libhal_get_string_array_from_iter): Make this static. Take
num_elems pointer
(libhal_property_set_get_num_elems): New function
(libhal_get_all_devices): Pass num_devices to
libhal_get_string_array_from_iter
(libhal_ctx_shutdown): Remove match and filter function
(libhal_ctx_free): Implement this one; free our context
* libhal/libhal.h: Add prototype for libhal_property_set_get_num_elems
* hald/hald_test_libhal.c (check_libhal): Add tests for the property
set functions as they were failing (see changes above)
* hald/Makefile.am (hald_test_SOURCES): Remove callout.[ch] as they
are now gone
Index: lshal.c
===================================================================
RCS file: /cvs/hal/hal/tools/lshal.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- lshal.c 31 Jan 2005 20:06:42 -0000 1.10
+++ lshal.c 16 Feb 2005 18:39:56 -0000 1.11
@@ -59,7 +59,7 @@
*
*/
static void
-dump_devices ()
+dump_devices (void)
{
int i;
int num_devices;
@@ -377,8 +377,6 @@
fprintf (stderr, "lshal version " PACKAGE_VERSION "\n");
- loop = g_main_loop_new (NULL, FALSE);
-
while (1) {
int c;
int option_index = 0;
@@ -413,13 +411,20 @@
}
}
+ if (do_monitor)
+ loop = g_main_loop_new (NULL, FALSE);
+ else
+ loop = NULL;
+
dbus_error_init (&error);
conn = dbus_bus_get (DBUS_BUS_SYSTEM, &error);
if (conn == NULL) {
fprintf (stderr, "error: dbus_bus_get: %s: %s\n", error.name, error.message);
return 1;
- }
- dbus_connection_setup_with_g_main (conn, NULL);
+ }
+
+ if (do_monitor)
+ dbus_connection_setup_with_g_main (conn, NULL);
if ((hal_ctx = libhal_ctx_new ()) == NULL) {
fprintf (stderr, "error: libhal_ctx_new\n");
@@ -444,13 +449,16 @@
dump_devices ();
/* run the main loop only if we should monitor */
- if (do_monitor) {
+ if (do_monitor && loop != NULL) {
libhal_device_property_watch_all (hal_ctx, &error);
g_main_loop_run (loop);
}
libhal_ctx_shutdown (hal_ctx, &error);
libhal_ctx_free (hal_ctx);
+
+ dbus_connection_disconnect (conn);
+ dbus_connection_unref (conn);
return 0;
}
More information about the hal-commit
mailing list