~ubuntu-branches/ubuntu/maverick/devicekit-power/maverick

« back to all changes in this revision

Viewing changes to devkit-power-gobject/dkp-client.c

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt
  • Date: 2009-07-06 19:12:49 UTC
  • mfrom: (1.1.5 experimental)
  • Revision ID: james.westby@ubuntu.com-20090706191249-hr0a9c2ti5u0b5lc
Tags: 009-1
* New upstream release.   
* debian/control: Add myself to uploaders (discussed with Michael).
* debian/devicekit-power.install: Upstream installs udev rules into
  /lib/udev/rules.d now, update accordingly.
* Add 0001-Add-a-notify-flag-to-set_lid_is_closed.patch: Properly fix the
  silencing of the coldplug lid event, so that the first real lid event
  actually works. Thanks to Loïc Minier! (fd.o #22574)

Show diffs side-by-side

added added

removed removed

Lines of Context:
50
50
        gboolean                 lid_is_closed;
51
51
        gboolean                 on_battery;
52
52
        gboolean                 on_low_battery;
 
53
        gboolean                 lid_is_present;
53
54
};
54
55
 
55
56
enum {
67
68
        PROP_CAN_HIBERNATE,
68
69
        PROP_ON_BATTERY,
69
70
        PROP_ON_LOW_BATTERY,
70
 
        PROP_LID_IS_CLOSED
 
71
        PROP_LID_IS_CLOSED,
 
72
        PROP_LID_IS_PRESENT,
 
73
        PROP_LAST
71
74
};
72
75
 
73
76
static guint signals [DKP_CLIENT_LAST_SIGNAL] = { 0 };
293
296
        }
294
297
        client->priv->on_low_battery = g_value_get_boolean (value);
295
298
 
 
299
        value = g_hash_table_lookup (props, "lid-is-present");
 
300
        if (value == NULL) {
 
301
                g_warning ("No 'lid-is-present' property");
 
302
                goto out;
 
303
        }
 
304
        client->priv->lid_is_present = g_value_get_boolean (value);
 
305
 
296
306
        /* cached */
297
307
        client->priv->have_properties = TRUE;
298
308
 
301
311
                g_hash_table_unref (props);
302
312
}
303
313
 
 
314
#ifndef DKP_DISABLE_DEPRECATED
304
315
/**
305
316
 * dkp_client_get_daemon_version:
306
317
 * @client : a #DkpClient instance.
339
350
 *
340
351
 * Get whether the laptop lid is closed.
341
352
 *
342
 
 * Return value: TRUE if lid is closed FALSE other wise.
 
353
 * Return value: %TRUE if lid is closed or %FALSE otherwise.
343
354
 */
344
355
gboolean
345
356
dkp_client_lid_is_closed (DkpClient *client)
396
407
        dkp_client_ensure_properties (client);
397
408
        return client->priv->on_low_battery;
398
409
}
 
410
#endif
399
411
 
400
412
/**
401
413
 * dkp_client_add:
479
491
        case PROP_CAN_SUSPEND:
480
492
                g_value_set_boolean (value, client->priv->can_suspend);
481
493
                break;
482
 
        case PROP_CAN_HIBERNATE:
 
494
        case PROP_CAN_HIBERNATE:
483
495
                g_value_set_boolean (value, client->priv->can_hibernate);
484
496
                break;
485
497
        case PROP_ON_BATTERY:
486
498
                g_value_set_boolean (value, client->priv->on_battery);
487
499
                break;
488
 
        case PROP_ON_LOW_BATTERY:
 
500
        case PROP_ON_LOW_BATTERY:
489
501
                g_value_set_boolean (value, client->priv->on_low_battery);
490
502
                break;
491
 
        case PROP_LID_IS_CLOSED:
 
503
        case PROP_LID_IS_CLOSED:
492
504
                g_value_set_boolean (value, client->priv->lid_is_closed);
493
505
                break;
 
506
        case PROP_LID_IS_PRESENT:
 
507
                g_value_set_boolean (value, client->priv->lid_is_present);
 
508
                break;
494
509
        default:
495
510
                G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
496
511
                break;
553
568
                                                               FALSE,
554
569
                                                               G_PARAM_READABLE));
555
570
 
 
571
        g_object_class_install_property (object_class,
 
572
                                         PROP_LID_IS_PRESENT,
 
573
                                         g_param_spec_boolean ("lid-is-present",
 
574
                                                               NULL, NULL,
 
575
                                                               FALSE,
 
576
                                                               G_PARAM_READABLE));
 
577
 
556
578
        signals [DKP_DEVICE_ADDED] =
557
579
                g_signal_new ("device-added",
558
580
                              G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST,