hal: Branch 'master'

David Zeuthen david at kemper.freedesktop.org
Mon Oct 9 21:19:59 PDT 2006


 hald/device_store.c |  127 ----------------------------------------------------
 hald/device_store.h |    7 --
 2 files changed, 134 deletions(-)

New commits:
diff-tree 1b5448d2f839f889da56d348990fdbcb0e6d038a (from 826d5da730f5323d29ff6eea6f92dd5fade66c48)
Author: David Zeuthen <davidz at redhat.com>
Date:   Tue Oct 10 00:19:55 2006 -0400

    removed unneeded and fragile async matching from device store

diff --git a/hald/device_store.c b/hald/device_store.c
index 1515450..7c06aab 100644
--- a/hald/device_store.c
+++ b/hald/device_store.c
@@ -364,130 +364,3 @@ hal_device_store_match_multiple_key_valu
 
 	return matches;
 }
-
-typedef struct {
-	HalDeviceStore *store;
-	char *key;
-	char *value;
-	HalDeviceStoreAsyncCallback callback;
-	gpointer user_data;
-
-	guint prop_signal_id;
-	guint store_signal_id;
-	guint timeout_id;
-} AsyncMatchInfo;
-
-static void
-destroy_async_match_info (AsyncMatchInfo *info)
-{
-	g_object_unref (info->store);
-
-	g_free (info->key);
-	g_free (info->value);
-
-	g_signal_handler_disconnect (info->store, info->prop_signal_id);
-	g_signal_handler_disconnect (info->store, info->store_signal_id);
-	g_source_remove (info->timeout_id);
-
-	g_free (info);
-}
-
-static void
-match_device_async (HalDeviceStore *store, HalDevice *device,
-		    const char *key, gboolean removed, gboolean added,
-		    gpointer user_data)
-{
-	AsyncMatchInfo *info = (AsyncMatchInfo *) user_data;
-
-	/* Only want to do it for added or changed properties */
-	if (removed)
-		return;
-
-	/* Keys have to match */
-	if (strcmp (info->key, key) != 0)
-		return;
-
-	/* Values have to match */
-	if (strcmp (hal_device_property_get_string (device, key),
-		    info->value) != 0)
-		return;
-
-	info->callback (store, device, info->user_data);
-
-	destroy_async_match_info (info);
-}
-
-static void
-store_changed (HalDeviceStore *store, HalDevice *device,
-	       gboolean added, gpointer user_data)
-{
-	AsyncMatchInfo *info = (AsyncMatchInfo *) user_data;
-
-	if (!added)
-		return;
-
-	if (!hal_device_has_property (device, info->key))
-		return;
-
-	if (strcmp (hal_device_property_get_string (device, info->key),
-		    info->value) != 0)
-		return;
-
-	info->callback (store, device, info->user_data);
-
-	destroy_async_match_info (info);
-}
-
-static gboolean
-match_device_async_timeout (gpointer user_data)
-{
-	AsyncMatchInfo *info = (AsyncMatchInfo *) user_data;
-
-	info->callback (info->store, NULL, info->user_data);
-
-	destroy_async_match_info (info);
-
-	return FALSE;
-}
-
-void
-hal_device_store_match_key_value_string_async (HalDeviceStore *store,
-					       const char *key,
-					       const char *value,
-					       HalDeviceStoreAsyncCallback callback,
-					       gpointer user_data,
-					       int timeout)
-{
-	HalDevice *device;
-	AsyncMatchInfo *info;
-
-	/* First check to see if it's already there */
-	device = hal_device_store_match_key_value_string (store, key, value);
-
-	if (device != NULL || timeout == 0) {
-		callback (store, device, user_data);
-
-		return;
-	}
-
-	info = g_new0 (AsyncMatchInfo, 1);
-
-	info->store = g_object_ref (store);
-	info->key = g_strdup (key);
-	info->value = g_strdup (value);
-	info->callback = callback;
-	info->user_data = user_data;
-
-	info->prop_signal_id = g_signal_connect (store,
-						 "device_property_changed",
-						 G_CALLBACK (match_device_async),
-						 info);
-	info->store_signal_id = g_signal_connect (store,
-						  "store_changed",
-						  G_CALLBACK (store_changed),
-						  info);
-
-	info->timeout_id = g_timeout_add (timeout,
-					  match_device_async_timeout,
-					  info);
-}
diff --git a/hald/device_store.h b/hald/device_store.h
index 6a03ea8..0e1578a 100644
--- a/hald/device_store.h
+++ b/hald/device_store.h
@@ -109,13 +109,6 @@ GSList         *hal_device_store_match_m
 								  const char *key,
 								  const char *value);
 
-void           hal_device_store_match_key_value_string_async (HalDeviceStore *store,
-							      const char *key,
-							      const char *value,
-							      HalDeviceStoreAsyncCallback callback,
-							      gpointer user_data,
-							      int timeout);
-
 void hal_device_store_print (HalDeviceStore *store);
 
 


More information about the hal-commit mailing list