231
* cd_device_get_profiling_inhibitors:
232
* @device: a #CdDevice instance.
234
* Gets any profiling inhibitors for the device.
236
* Return value: (transfer none): A strv, or %NULL for invalid
241
cd_device_get_profiling_inhibitors (CdDevice *device)
243
g_return_val_if_fail (CD_IS_DEVICE (device), NULL);
244
g_return_val_if_fail (device->priv->proxy != NULL, NULL);
245
return (const gchar **) device->priv->profiling_inhibitors;
229
249
* cd_device_get_created:
230
250
* @device: a #CdDevice instance.
404
424
gchar *object_path_tmp;
409
428
g_ptr_array_set_size (device->priv->profiles, 0);
410
429
if (profiles == NULL)
412
len = g_variant_iter_init (&iter, profiles);
431
len = g_variant_n_children (profiles);
413
432
for (i=0; i<len; i++) {
414
433
g_variant_get_child (profiles, i,
415
434
"o", &object_path_tmp);
472
491
g_hash_table_remove_all (device->priv->metadata);
474
493
/* insert the new metadata */
475
g_variant_get (variant, "a{ss}",
477
while (g_variant_iter_loop (iter, "{ss}",
494
g_variant_iter_init (&iter, variant);
495
while (g_variant_iter_loop (&iter, "{ss}",
478
496
&prop_key, &prop_value)) {
479
497
g_hash_table_insert (device->priv->metadata,
480
498
g_strdup (prop_key),
505
* cd_device_get_nullable_str:
507
* We can't get nullable types from a GVariant yet. Work around...
510
cd_device_get_nullable_str (GVariant *value)
513
tmp = g_variant_get_string (value, NULL);
518
return g_strdup (tmp);
487
522
* cd_device_dbus_properties_changed_cb:
508
543
&property_value);
509
544
if (g_strcmp0 (property_name, CD_DEVICE_PROPERTY_MODEL) == 0) {
510
545
g_free (device->priv->model);
511
device->priv->model = g_variant_dup_string (property_value, NULL);
546
device->priv->model = cd_device_get_nullable_str (property_value);
512
547
} else if (g_strcmp0 (property_name, CD_DEVICE_PROPERTY_SERIAL) == 0) {
513
548
g_free (device->priv->serial);
514
device->priv->serial = g_variant_dup_string (property_value, NULL);
549
device->priv->serial = cd_device_get_nullable_str (property_value);
515
550
} else if (g_strcmp0 (property_name, CD_DEVICE_PROPERTY_FORMAT) == 0) {
516
551
g_free (device->priv->format);
517
device->priv->format = g_variant_dup_string (property_value, NULL);
552
device->priv->format = cd_device_get_nullable_str (property_value);
518
553
} else if (g_strcmp0 (property_name, CD_DEVICE_PROPERTY_VENDOR) == 0) {
519
554
g_free (device->priv->vendor);
520
device->priv->vendor = g_variant_dup_string (property_value, NULL);
555
device->priv->vendor = cd_device_get_nullable_str (property_value);
556
} else if (g_strcmp0 (property_name, CD_DEVICE_PROPERTY_PROFILING_INHIBITORS) == 0) {
557
g_free (device->priv->profiling_inhibitors);
558
device->priv->profiling_inhibitors = g_variant_dup_strv (property_value, NULL);
521
559
} else if (g_strcmp0 (property_name, CD_DEVICE_PROPERTY_KIND) == 0) {
522
560
device->priv->kind =
523
561
cd_device_kind_from_string (g_variant_get_string (property_value, NULL));
536
574
device->priv->modified = g_variant_get_uint64 (property_value);
537
575
} else if (g_strcmp0 (property_name, CD_DEVICE_PROPERTY_METADATA) == 0) {
538
576
cd_device_set_metadata_from_variant (device, property_value);
577
} else if (g_strcmp0 (property_name, CD_DEVICE_PROPERTY_OWNER) == 0) {
578
device->priv->owner = g_variant_get_uint32 (property_value);
539
579
} else if (g_strcmp0 (property_name, CD_DEVICE_PROPERTY_ID) == 0) {
540
580
/* ignore this, we don't support it changing */;
641
682
id = g_dbus_proxy_get_cached_property (device->priv->proxy,
642
683
CD_DEVICE_PROPERTY_ID);
644
device->priv->id = g_variant_dup_string (id, NULL);
685
device->priv->id = cd_device_get_nullable_str (id);
646
687
/* if the device is missing, then fail */
647
688
if (id == NULL) {
691
732
model = g_dbus_proxy_get_cached_property (device->priv->proxy,
692
733
CD_DEVICE_PROPERTY_MODEL);
693
734
if (model != NULL)
694
device->priv->model = g_variant_dup_string (model, NULL);
735
device->priv->model = cd_device_get_nullable_str (model);
697
738
serial = g_dbus_proxy_get_cached_property (device->priv->proxy,
698
739
CD_DEVICE_PROPERTY_SERIAL);
699
740
if (serial != NULL)
700
device->priv->serial = g_variant_dup_string (serial, NULL);
741
device->priv->serial = cd_device_get_nullable_str (serial);
703
744
format = g_dbus_proxy_get_cached_property (device->priv->proxy,
704
745
CD_DEVICE_PROPERTY_FORMAT);
705
746
if (format != NULL)
706
device->priv->format = g_variant_dup_string (format, NULL);
747
device->priv->format = cd_device_get_nullable_str (format);
709
750
vendor = g_dbus_proxy_get_cached_property (device->priv->proxy,
710
751
CD_DEVICE_PROPERTY_VENDOR);
711
752
if (vendor != NULL)
712
device->priv->vendor = g_variant_dup_string (vendor, NULL);
753
device->priv->vendor = cd_device_get_nullable_str (vendor);
755
/* get profiling inhibitors */
756
profiling_inhibitors = g_dbus_proxy_get_cached_property (device->priv->proxy,
757
CD_DEVICE_PROPERTY_PROFILING_INHIBITORS);
758
if (profiling_inhibitors != NULL)
759
device->priv->profiling_inhibitors = g_variant_dup_strv (profiling_inhibitors, NULL);
714
761
/* get created */
715
762
created = g_dbus_proxy_get_cached_property (device->priv->proxy,
1819
1868
case PROP_VENDOR:
1820
1869
g_value_set_string (value, device->priv->vendor);
1871
case PROP_PROFILING_INHIBITORS:
1872
g_value_set_boxed (value, device->priv->profiling_inhibitors);
1822
1874
case PROP_KIND:
1823
1875
g_value_set_uint (value, device->priv->kind);
1985
2037
G_PARAM_READABLE));
2039
* CdDevice:profiling_inhibitors:
2041
* Any profiling inhibitors.
2045
g_object_class_install_property (object_class,
2046
PROP_PROFILING_INHIBITORS,
2047
g_param_spec_boxed ("profiling-inhibitors",
1987
2052
* CdDevice:kind:
1989
2054
* The device kind, e.g. %CD_DEVICE_KIND_KEYBOARD.
2099
2164
g_free (device->priv->serial);
2100
2165
g_free (device->priv->format);
2101
2166
g_free (device->priv->vendor);
2167
g_strfreev (device->priv->profiling_inhibitors);
2102
2168
g_ptr_array_unref (device->priv->profiles);
2103
2169
if (device->priv->proxy != NULL) {
2104
2170
ret = g_signal_handlers_disconnect_by_func (device->priv->proxy,