hal: Branch 'master'

David Zeuthen david at kemper.freedesktop.org
Mon Oct 9 14:47:43 PDT 2006


 hald/device.c         |  142 --------------------------------------------------
 hald/device.h         |   29 +---------
 hald/linux/coldplug.c |    1 
 hald/linux/osspec.c   |    4 -
 hald/property.c       |   43 ---------------
 hald/property.h       |   12 ----
 6 files changed, 6 insertions(+), 225 deletions(-)

New commits:
diff-tree 6ae9274c007edfbec8ac101f42a0e8f2a4424bc2 (from 54192c66659d5c531f74b9859052db06a58b8eaf)
Author: David Zeuthen <davidz at redhat.com>
Date:   Mon Oct 9 17:47:39 2006 -0400

    clean up HalDevice and HalProperty a bit

diff --git a/hald/device.c b/hald/device.c
index 223d431..cfd0f8f 100644
--- a/hald/device.c
+++ b/hald/device.c
@@ -50,8 +50,6 @@ struct _HalDevicePrivate
 enum {
 	PROPERTY_CHANGED,
 	CAPABILITY_ADDED,
-	CALLOUTS_FINISHED,
-	CANCELLED,
 	LAST_SIGNAL
 };
 
@@ -117,26 +115,6 @@ hal_device_class_init (HalDeviceClass *k
 			      hald_marshal_VOID__STRING,
 			      G_TYPE_NONE, 1,
 			      G_TYPE_STRING);
-
-	signals[CALLOUTS_FINISHED] =
-		g_signal_new ("callouts_finished",
-			      G_TYPE_FROM_CLASS (klass),
-			      G_SIGNAL_RUN_LAST,
-			      G_STRUCT_OFFSET (HalDeviceClass,
-					       callouts_finished),
-			      NULL, NULL,
-			      hald_marshal_VOID__VOID,
-			      G_TYPE_NONE, 0);
-
-	signals[CANCELLED] =
-		g_signal_new ("cancelled",
-			      G_TYPE_FROM_CLASS (klass),
-			      G_SIGNAL_RUN_LAST,
-			      G_STRUCT_OFFSET (HalDeviceClass,
-					       cancelled),
-			      NULL, NULL,
-			      hald_marshal_VOID__VOID,
-			      G_TYPE_NONE, 0);
 }
 
 static void
@@ -920,22 +898,6 @@ hal_device_property_remove (HalDevice *d
 	return TRUE;
 }
 
-gboolean
-hal_device_property_set_attribute (HalDevice *device,
-				   const char *key,
-				   enum PropertyAttribute attr,
-				   gboolean val)
-{
-	HalProperty *prop;
-
-	prop = hal_device_property_find (device, key);
-
-	if (prop == NULL)
-		return FALSE;
-
-	return TRUE;
-}
-
 void
 hal_device_print (HalDevice *device)
 {
@@ -988,110 +950,6 @@ hal_device_print (HalDevice *device)
         fprintf (stderr, "\n");
 }
 
-
-typedef struct {
-	char *key;
-	HalDevice *device;
-	HalDeviceAsyncCallback callback;
-	gpointer user_data;
-
-	guint prop_signal_id;
-	guint timeout_id;
-} AsyncMatchInfo;
-
-static void
-destroy_async_match_info (AsyncMatchInfo *ai)
-{
-	g_free (ai->key);
-	g_signal_handler_disconnect (ai->device, ai->prop_signal_id);
-	g_source_remove (ai->timeout_id);
-	g_object_unref (ai->device);
-	g_free (ai);
-}
-
-static void
-prop_changed_cb (HalDevice *device, const char *key,
-		 gboolean removed, gboolean added, gpointer user_data)
-{
-	AsyncMatchInfo *ai = user_data;
-
-	if (strcmp (key, ai->key) != 0)
-		return;
-
-	/* the property is no longer there */
-	if (removed)
-		goto cleanup;
-
-
-	ai->callback (ai->device, ai->user_data, TRUE);
-
-cleanup:
-	destroy_async_match_info (ai);
-}
-
-
-static gboolean
-async_wait_timeout (gpointer user_data)
-{
-	AsyncMatchInfo *ai = (AsyncMatchInfo *) user_data;
-
-	ai->callback (ai->device, ai->user_data, FALSE);
-
-	destroy_async_match_info (ai);
-
-	return FALSE;
-}
-
-void
-hal_device_async_wait_property (HalDevice    *device,
-				const char   *key,
-				HalDeviceAsyncCallback callback,
-				gpointer     user_data,
-				int          timeout)
-{
-	HalProperty *prop;
-	AsyncMatchInfo *ai;
-
-	/* check if property already exists */
-	prop = hal_device_property_find (device, key);
-
-	if (prop != NULL || timeout==0) {
-		callback (device, user_data, prop != NULL);
-		return;
-	}
-
-	ai = g_new0 (AsyncMatchInfo, 1);
-
-	ai->device = g_object_ref (device);
-	ai->key = g_strdup (key);
-	ai->callback = callback;
-	ai->user_data = user_data;
-
-	ai->prop_signal_id = g_signal_connect (device, "property_changed",
-					       G_CALLBACK (prop_changed_cb),
-					       ai);
-
-	ai->timeout_id = g_timeout_add (timeout, async_wait_timeout, ai);
-}
-
-void
-hal_device_callouts_finished (HalDevice *device)
-{
-	g_signal_emit (device, signals[CALLOUTS_FINISHED], 0);
-}
-
-/** Used when giving up on a device, e.g. if no device file appeared
- */
-void
-hal_device_cancel (HalDevice *device)
-{
-	HAL_INFO (("udi=%s", device->private->udi));
-	g_signal_emit (device, signals[CANCELLED], 0);
-}
-
-
-
-
 GSList *
 hal_device_property_get_strlist (HalDevice    *device, 
 				 const char   *key)
diff --git a/hald/device.h b/hald/device.h
index 6ffe494..247e143 100644
--- a/hald/device.h
+++ b/hald/device.h
@@ -55,10 +55,6 @@ struct _HalDeviceClass {
 
 	void (*capability_added) (HalDevice *device,
 				  const char *capability);
-
-	void (*callouts_finished) (HalDevice *device);
-
-	void (*cancelled) (HalDevice *device);
 };
 
 #define HAL_TYPE_DEVICE             (hal_device_get_type ())
@@ -71,10 +67,6 @@ struct _HalDeviceClass {
 #define HAL_IS_DEVICE_CLASS(klass)  (G_TYPE_CHECK_CLASS_TYPE ((klass), \
                                      HAL_TYPE_DEVICE))
 
-typedef void     (*HalDeviceAsyncCallback) (HalDevice *device,
-					    gpointer user_data,
-					    gboolean prop_exists);
-
 /* Return value of FALSE means that the foreach should be short-circuited */
 typedef gboolean (*HalDevicePropertyForeachFn) (HalDevice *device,
 						HalProperty *property,
@@ -180,29 +172,14 @@ gboolean      hal_device_property_strlis
 gboolean      hal_device_property_remove     (HalDevice    *device,
 					      const char   *key);
 
+
+void          hal_device_print               (HalDevice    *device);
+
 gboolean      hal_device_copy_property       (HalDevice *from_device, 
 					      const char *from,
 					      HalDevice *to_device,
 					      const char *to);
 
-
-void          hal_device_print               (HalDevice    *device);
-
-void          hal_device_async_wait_property (HalDevice    *device,
-					      const char   *key,
-					      HalDeviceAsyncCallback callback,
-					      gpointer      user_data,
-					      int           timeout);
-
-void          hal_device_callouts_finished    (HalDevice    *device);
-
-void          hal_device_cancel               (HalDevice    *device);
-
-gboolean      hal_device_property_set_attribute (HalDevice *device,
-						 const char *key,
-						 enum PropertyAttribute attr,
-						 gboolean persistence);
-
 void          hal_device_inc_num_addons (HalDevice *device);
 
 gboolean      hal_device_inc_num_ready_addons (HalDevice *device);
diff --git a/hald/linux/coldplug.c b/hald/linux/coldplug.c
index 3693cda..d220f4a 100644
--- a/hald/linux/coldplug.c
+++ b/hald/linux/coldplug.c
@@ -227,6 +227,7 @@ static HotplugEvent
 	struct stat statbuf;
 	gboolean from_pool = FALSE;
 
+	/* TODO: FIXME: this is experimental code */
 	if (pool == NULL) {
 		pool = g_new0 (HotplugEvent, pool_size);
 		pool_next_free = 0;
diff --git a/hald/linux/osspec.c b/hald/linux/osspec.c
index def76ff..ee3d2b2 100644
--- a/hald/linux/osspec.c
+++ b/hald/linux/osspec.c
@@ -448,7 +448,7 @@ set_suspend_hibernate_keys (HalDevice *d
 	ssize_t read;
 	size_t len;
 	char *poweroptions;
-	char *pmtype;
+	const char *pmtype;
 	FILE *fp;
 
 	can_suspend = FALSE;
@@ -474,7 +474,7 @@ set_suspend_hibernate_keys (HalDevice *d
 		can_hibernate = TRUE;
 	free (poweroptions);
 
-	pmtype = hal_device_property_get_string(d, "power_management.type");
+	pmtype = hal_device_property_get_string (d, "power_management.type");
 	if (pmtype != NULL && strcmp(pmtype, "pmu") == 0) {
 		/* We got our own helper for suspend PMU machines */
 		can_suspend = TRUE;
diff --git a/hald/property.c b/hald/property.c
index 8a4955d..9a1adaa 100644
--- a/hald/property.c
+++ b/hald/property.c
@@ -37,8 +37,6 @@
 struct _HalProperty {
 	char *key;
 
-	void *foo;
-
 	int type;
 	union {
 		char *str_value;
@@ -48,9 +46,6 @@ struct _HalProperty {
 		double double_value;
 		GSList *strlist_value;
 	} v;
-	gboolean readonly;
-	gboolean persistence;
-	gboolean callout;
 };
 
 void
@@ -343,44 +338,6 @@ hal_property_set_double (HalProperty *pr
 	prop->v.double_value = value;
 }
 
-void
-hal_property_set_attribute (HalProperty *prop,
-			    enum PropertyAttribute attr,
-			    gboolean val)
-{
-	g_return_if_fail (prop != NULL);
-
-	switch (attr) {
-	case READONLY:
-		prop->readonly = val;
-		break;
-	case PERSISTENCE:
-		prop->persistence = val;
-		break;
-	case CALLOUT:
-		prop->callout = val;
-		break;
-	}
-}
-
-gboolean
-hal_property_get_attribute (HalProperty *prop,
-			    enum PropertyAttribute attr)
-{
-	g_return_val_if_fail (prop != NULL, -1);
-
-	switch (attr) {
-	case READONLY:
-		return prop->readonly;
-	case PERSISTENCE:
-		return prop->persistence;
-	case CALLOUT:
-		return prop->callout;
-	default:
-		return -1;
-	}
-}
-
 HalProperty *
 hal_property_new_strlist (const char *key)
 {
diff --git a/hald/property.h b/hald/property.h
index b5afa25..32f21df 100644
--- a/hald/property.h
+++ b/hald/property.h
@@ -39,12 +39,6 @@ typedef struct _HalProperty HalProperty;
 #define HAL_PROPERTY_TYPE_STRING      DBUS_TYPE_STRING
 #define HAL_PROPERTY_TYPE_STRLIST     ((int) (DBUS_TYPE_STRING<<8)+('l'))
 
-enum PropertyAttribute {
-	READONLY,
-	PERSISTENCE,
-	CALLOUT
-};
-
 void          hal_property_free               (HalProperty  *prop);
 
 HalProperty *hal_property_new_string          (const char   *key,
@@ -94,10 +88,4 @@ gboolean      hal_property_strlist_remov
 gboolean      hal_property_strlist_clear      (HalProperty  *prop);
 
 
-void          hal_property_set_attribute      (HalProperty *prop,
-					       enum PropertyAttribute attr,
-					       gboolean val);
-gboolean      hal_property_get_attribute      (HalProperty *prop,
-					       enum PropertyAttribute attr);
-
 #endif /* PROPERTY_H */


More information about the hal-commit mailing list