[gvfs/gnome-2-28] Don't subscribe to unnecessary HAL D-Bus events



commit 1b35fa24c502b3b19a2634bf25c5d7437cf21aed
Author: Alban Crequy <alban crequy collabora co uk>
Date:   Fri Oct 9 17:43:00 2009 +0200

    Don't subscribe to unnecessary HAL D-Bus events
    
    Fixes bug 597827
    (cherry picked from commit 8a540ab974ea032727ec0447ae678f9417d48103)

 monitor/hal/hal-device.c |    7 +++++++
 monitor/hal/hal-pool.c   |    7 -------
 2 files changed, 7 insertions(+), 7 deletions(-)
---
diff --git a/monitor/hal/hal-device.c b/monitor/hal/hal-device.c
index 9f0b5bc..68eddb6 100644
--- a/monitor/hal/hal-device.c
+++ b/monitor/hal/hal-device.c
@@ -44,6 +44,9 @@ G_DEFINE_TYPE (HalDevice, hal_device, G_TYPE_OBJECT)
 static void
 hal_device_finalize (HalDevice *device)
 {
+  libhal_device_remove_property_watch (device->priv->hal_ctx,
+      device->priv->udi, NULL);
+  
   if (device->priv->properties != NULL)
     libhal_free_property_set (device->priv->properties);
   g_free (device->priv->udi);
@@ -222,6 +225,8 @@ HalDevice *
 hal_device_new_from_udi (LibHalContext *hal_ctx, const char *udi)
 {
   HalDevice *device;
+
+  libhal_device_add_property_watch (hal_ctx, udi, NULL);
   
   device = HAL_DEVICE (g_object_new (HAL_TYPE_DEVICE, NULL));
   device->priv->udi = g_strdup (udi);
@@ -237,6 +242,8 @@ hal_device_new_from_udi_and_properties (LibHalContext *hal_ctx,
 {
   HalDevice *device;
   
+  libhal_device_add_property_watch (hal_ctx, udi, NULL);
+  
   device = HAL_DEVICE (g_object_new (HAL_TYPE_DEVICE, NULL));
   device->priv->udi = g_strdup (udi);
   device->priv->hal_ctx = hal_ctx;
diff --git a/monitor/hal/hal-pool.c b/monitor/hal/hal-pool.c
index 770effd..b6d7faa 100644
--- a/monitor/hal/hal-pool.c
+++ b/monitor/hal/hal-pool.c
@@ -327,13 +327,6 @@ hal_pool_new (char **cap_only)
   pool->priv->devices = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_object_unref);
   pool->priv->cap_only = g_strdupv (cap_only);
   
-  /* Gah, unfortunately we have to watch all devices as HAL's PropertyModified signal
-   * doesn't include the capabilities...
-   */
-  dbus_bus_add_match (dbus_connection,
-                      "type='signal',"
-                      "interface='org.freedesktop.Hal.Device',"
-                      "sender='org.freedesktop.Hal'", NULL);
   libhal_ctx_set_device_added (hal_ctx, _hal_device_added);
   libhal_ctx_set_device_removed (hal_ctx, _hal_device_removed);
   libhal_ctx_set_device_property_modified (hal_ctx, _hal_property_modified);



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