~ubuntu-branches/ubuntu/vivid/upower/vivid-proposed

« back to all changes in this revision

Viewing changes to libupower-glib/up-client.c

  • Committer: Package Import Robot
  • Author(s): Martin Pitt
  • Date: 2013-10-08 18:26:25 UTC
  • mfrom: (1.5.4)
  • Revision ID: package-import@ubuntu.com-20131008182625-afgb0c8beb0ot1yf
Tags: 0.9.22-1
* New upstream release.
* Drop 00git_updates.patch, included in new release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
314
314
up_client_get_properties_sync (UpClient *client, GCancellable *cancellable, GError **error)
315
315
{
316
316
        gboolean ret = TRUE;
317
 
        gboolean allowed = FALSE;
 
317
        gboolean prop_val;
318
318
        GHashTable *props;
319
319
        GValue *value;
 
320
#ifdef ENABLE_DEPRECATED
 
321
        gboolean allowed = FALSE;
 
322
#endif
320
323
 
321
324
        props = NULL;
322
325
 
325
328
        if (!client->priv->prop_proxy)
326
329
                goto out;
327
330
 
328
 
        error = NULL;
 
331
        if (error != NULL)
 
332
                *error = NULL;
329
333
        ret = dbus_g_proxy_call (client->priv->prop_proxy, "GetAll", error,
330
334
                                 G_TYPE_STRING, "org.freedesktop.UPower",
331
335
                                 G_TYPE_INVALID,
342
346
        g_free (client->priv->daemon_version);
343
347
        client->priv->daemon_version = g_strdup (g_value_get_string (value));
344
348
 
 
349
#ifdef ENABLE_DEPRECATED
345
350
        value = g_hash_table_lookup (props, "CanSuspend");
346
351
        if (value == NULL) {
347
352
                g_warning ("No 'CanSuspend' property");
353
358
        if (!ret)
354
359
                goto out;
355
360
 
356
 
        ret = g_value_get_boolean (value) && allowed;
357
 
        if (ret != client->priv->can_suspend) {
 
361
        prop_val = g_value_get_boolean (value) && allowed;
 
362
        if (prop_val != client->priv->can_suspend) {
358
363
                client->priv->can_suspend = ret;
359
364
                g_object_notify (G_OBJECT(client), "can-suspend");
360
365
        }
369
374
        if (!ret)
370
375
                goto out;
371
376
 
372
 
        ret = g_value_get_boolean (value) && allowed;
373
 
        if (ret != client->priv->can_hibernate) {
 
377
        prop_val = g_value_get_boolean (value) && allowed;
 
378
        if (prop_val != client->priv->can_hibernate) {
374
379
                client->priv->can_hibernate = ret;
375
380
                g_object_notify (G_OBJECT(client), "can-hibernate");
376
381
        }
 
382
#endif /* ENABLE_DEPRECATED */
377
383
 
378
384
        value = g_hash_table_lookup (props, "LidIsClosed");
379
385
        if (value == NULL) {
380
386
                g_warning ("No 'LidIsClosed' property");
381
387
                goto out;
382
388
        }
383
 
        ret = g_value_get_boolean (value);
384
 
        if (ret != client->priv->lid_is_closed) {
 
389
        prop_val = g_value_get_boolean (value);
 
390
        if (prop_val != client->priv->lid_is_closed) {
385
391
                client->priv->lid_is_closed = ret;
386
392
                g_object_notify (G_OBJECT(client), "lid-is-closed");
387
393
        }
391
397
                g_warning ("No 'OnBattery' property");
392
398
                goto out;
393
399
        }
394
 
        ret = g_value_get_boolean (value);
395
 
        if (ret != client->priv->on_battery) {
 
400
        prop_val = g_value_get_boolean (value);
 
401
        if (prop_val != client->priv->on_battery) {
396
402
                client->priv->on_battery = ret;
397
403
                g_object_notify (G_OBJECT(client), "on-battery");
398
404
        }
402
408
                g_warning ("No 'OnLowBattery' property");
403
409
                goto out;
404
410
        }
405
 
        ret = g_value_get_boolean (value);
406
 
        if (ret != client->priv->on_low_battery) {
 
411
        prop_val = g_value_get_boolean (value);
 
412
        if (prop_val != client->priv->on_low_battery) {
407
413
                client->priv->on_low_battery = ret;
408
414
                g_object_notify (G_OBJECT(client), "on-low-battery");
409
415
        }
413
419
                g_warning ("No 'LidIsPresent' property");
414
420
                goto out;
415
421
        }
416
 
        ret = g_value_get_boolean (value);
417
 
        if (ret != client->priv->lid_is_present) {
 
422
        prop_val = g_value_get_boolean (value);
 
423
        if (prop_val != client->priv->lid_is_present) {
418
424
                client->priv->lid_is_present = ret;
419
425
                g_object_notify (G_OBJECT(client), "lid-is-present");
420
426
        }
424
430
                g_warning ("No 'IsDocked' property");
425
431
                goto out;
426
432
        }
427
 
        ret = g_value_get_boolean (value);
 
433
        prop_val = g_value_get_boolean (value);
428
434
        if (ret != client->priv->is_docked) {
429
435
                client->priv->is_docked = ret;
430
436
                g_object_notify (G_OBJECT(client), "is-docked");
435
441
                g_warning ("No 'LidForceSleep' property");
436
442
                goto out;
437
443
        }
438
 
        ret = g_value_get_boolean (value);
439
 
        if (ret != client->priv->lid_force_sleep) {
 
444
        prop_val = g_value_get_boolean (value);
 
445
        if (prop_val != client->priv->lid_force_sleep) {
440
446
                client->priv->lid_force_sleep = ret;
441
447
                g_object_notify (G_OBJECT(client), "lid-force-sleep");
442
448
        }