~ubuntu-branches/debian/sid/hal/sid

« back to all changes in this revision

Viewing changes to hald/device.c

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt
  • Date: 2007-10-23 12:33:58 UTC
  • Revision ID: james.westby@ubuntu.com-20071023123358-xaf8mjc5n84d5gtz
Tags: upstream-0.5.10
ImportĀ upstreamĀ versionĀ 0.5.10

Show diffs side-by-side

added added

removed removed

Lines of Context:
355
355
        }
356
356
        g_slist_free (prop->v.strlist_value);
357
357
 
358
 
        return FALSE;
 
358
        return TRUE;
359
359
}
360
360
 
361
361
 
598
598
                {
599
599
                        GSList *l;
600
600
 
601
 
                        hal_device_property_strlist_clear (ud->target, target_key);
 
601
                        hal_device_property_strlist_clear (ud->target, target_key, FALSE);
602
602
                        for (l = hal_property_get_strlist (p); l != NULL; l = l->next)
603
 
                                hal_device_property_strlist_append (ud->target, target_key, l->data);
 
603
                                hal_device_property_strlist_append (ud->target, target_key, l->data, FALSE);
604
604
                }
605
605
                break;
606
606
 
1409
1409
gboolean
1410
1410
hal_device_property_strlist_append (HalDevice    *device,
1411
1411
                                    const char   *key,
1412
 
                                    const char *value)
 
1412
                                    const char   *value,
 
1413
                                    gboolean     changeset)
1413
1414
{
1414
1415
        HalProperty *prop;
1415
1416
 
1421
1422
                        return FALSE;
1422
1423
 
1423
1424
                hal_property_strlist_append (prop, value);
1424
 
 
1425
 
                g_signal_emit (device, signals[PROPERTY_CHANGED], 0,
1426
 
                               key, FALSE, FALSE);
 
1425
                
 
1426
                if (!changeset) 
 
1427
                        g_signal_emit (device, signals[PROPERTY_CHANGED], 0,
 
1428
                                       key, FALSE, FALSE);
1427
1429
 
1428
1430
        } else {
1429
1431
                prop = hal_property_new (HAL_PROPERTY_TYPE_STRLIST);
1431
1433
 
1432
1434
                g_hash_table_insert (device->private->props, g_strdup (key), prop);
1433
1435
 
 
1436
                if (!changeset)
 
1437
                        g_signal_emit (device, signals[PROPERTY_CHANGED], 0,
 
1438
                                       key, FALSE, TRUE);
 
1439
        }
 
1440
 
 
1441
        return TRUE;
 
1442
}
 
1443
 
 
1444
gboolean
 
1445
hal_device_property_strlist_append_finish_changeset (HalDevice    *device,
 
1446
                                                     const char   *key,
 
1447
                                                     gboolean     is_added){
 
1448
 
 
1449
        HalProperty *prop;
 
1450
 
 
1451
        /* check if property already exists */
 
1452
        prop = hal_device_property_find (device, key);
 
1453
 
 
1454
        if (prop != NULL) {
 
1455
                if (hal_property_get_type (prop) != HAL_PROPERTY_TYPE_STRLIST)
 
1456
                        return FALSE;
 
1457
 
1434
1458
                g_signal_emit (device, signals[PROPERTY_CHANGED], 0,
1435
 
                               key, FALSE, TRUE);
 
1459
                               key, FALSE, is_added);
 
1460
 
 
1461
        } else {
 
1462
                return FALSE;
1436
1463
        }
1437
1464
 
1438
1465
        return TRUE;
1439
1466
}
1440
1467
 
 
1468
 
1441
1469
gboolean 
1442
1470
hal_device_property_strlist_prepend (HalDevice    *device,
1443
1471
                                     const char   *key,
1497
1525
 
1498
1526
gboolean
1499
1527
hal_device_property_strlist_clear (HalDevice    *device,
1500
 
                                   const char   *key)
 
1528
                                   const char   *key,
 
1529
                                   gboolean     changeset)
1501
1530
{
1502
1531
        HalProperty *prop;
1503
1532
 
1508
1537
                prop = hal_property_new (HAL_PROPERTY_TYPE_STRLIST);
1509
1538
                g_hash_table_insert (device->private->props, g_strdup (key), prop);
1510
1539
 
1511
 
                g_signal_emit (device, signals[PROPERTY_CHANGED], 0,
1512
 
                               key, FALSE, TRUE);
 
1540
                if (!changeset)
 
1541
                        g_signal_emit (device, signals[PROPERTY_CHANGED], 0,
 
1542
                                       key, FALSE, TRUE);
1513
1543
                return TRUE;
1514
1544
        }
1515
1545
 
1516
1546
        if (hal_property_get_type (prop) != HAL_PROPERTY_TYPE_STRLIST)
1517
1547
                return FALSE;
1518
1548
        
1519
 
        if (hal_property_strlist_clear (prop)) {
 
1549
        /* TODO: check why  hal_property_strlist_clear (prop) not work */ 
 
1550
        g_hash_table_remove (device->private->props, key);
 
1551
        prop = hal_property_new (HAL_PROPERTY_TYPE_STRLIST);
 
1552
        g_hash_table_insert (device->private->props, g_strdup (key), prop);
 
1553
 
 
1554
        if (!changeset) {
1520
1555
                g_signal_emit (device, signals[PROPERTY_CHANGED], 0,
1521
1556
                               key, FALSE, FALSE);
1522
 
                return TRUE;
1523
1557
        }
1524
 
        
1525
 
        return FALSE;
 
1558
 
 
1559
        return TRUE;
1526
1560
}
1527
1561
 
1528
1562
 
1672
1706
                goto out;
1673
1707
        }
1674
1708
 
1675
 
        hal_device_property_strlist_append (device, buf, sender);
 
1709
        hal_device_property_strlist_append (device, buf, sender, FALSE);
1676
1710
        g_snprintf (buf, sizeof (buf), "info.named_locks.%s.locked", lock_name);
1677
1711
        hal_device_property_set_bool (device, buf, TRUE);
1678
1712
 
1829
1863
        }
1830
1864
}
1831
1865
 
 
1866
gboolean 
 
1867
hal_device_is_lock_exclusive (HalDevice *device, const char *lock_name)
 
1868
{
 
1869
        char buf[256];
 
1870
        g_snprintf (buf, sizeof (buf), "info.named_locks.%s.exclusive", lock_name);
 
1871
        return hal_device_property_get_bool (device, buf);
 
1872
}
 
1873