~xavi-garcia-mena/ubuntu/vivid/upower/percentages-power-off

« back to all changes in this revision

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

  • Committer: Package Import Robot
  • Author(s): Iain Lane
  • Date: 2013-10-14 11:41:36 UTC
  • Revision ID: package-import@ubuntu.com-20131014114136-fyh80f8bw06jq7wf
Tags: 0.9.22-1ubuntu1
* Cherry-pick two fixes from upstream:
  - up-client: Really don't overwrite retval with prop values. Properties
    and property notification via libupower-glib got broken in 0.9.22.
    Incorrect values were being returned, meaning anything relying on these
    might do the wrong thing, such as in LP: #1238663
  - lib: Fix crasher calling _about_to_sleep_sync(). Crash fix.

Show diffs side-by-side

added added

removed removed

Lines of Context:
360
360
 
361
361
        prop_val = g_value_get_boolean (value) && allowed;
362
362
        if (prop_val != client->priv->can_suspend) {
363
 
                client->priv->can_suspend = ret;
 
363
                client->priv->can_suspend = prop_val;
364
364
                g_object_notify (G_OBJECT(client), "can-suspend");
365
365
        }
366
366
 
376
376
 
377
377
        prop_val = g_value_get_boolean (value) && allowed;
378
378
        if (prop_val != client->priv->can_hibernate) {
379
 
                client->priv->can_hibernate = ret;
 
379
                client->priv->can_hibernate = prop_val;
380
380
                g_object_notify (G_OBJECT(client), "can-hibernate");
381
381
        }
382
382
#endif /* ENABLE_DEPRECATED */
388
388
        }
389
389
        prop_val = g_value_get_boolean (value);
390
390
        if (prop_val != client->priv->lid_is_closed) {
391
 
                client->priv->lid_is_closed = ret;
 
391
                client->priv->lid_is_closed = prop_val;
392
392
                g_object_notify (G_OBJECT(client), "lid-is-closed");
393
393
        }
394
394
 
399
399
        }
400
400
        prop_val = g_value_get_boolean (value);
401
401
        if (prop_val != client->priv->on_battery) {
402
 
                client->priv->on_battery = ret;
 
402
                client->priv->on_battery = prop_val;
403
403
                g_object_notify (G_OBJECT(client), "on-battery");
404
404
        }
405
405
 
410
410
        }
411
411
        prop_val = g_value_get_boolean (value);
412
412
        if (prop_val != client->priv->on_low_battery) {
413
 
                client->priv->on_low_battery = ret;
 
413
                client->priv->on_low_battery = prop_val;
414
414
                g_object_notify (G_OBJECT(client), "on-low-battery");
415
415
        }
416
416
 
421
421
        }
422
422
        prop_val = g_value_get_boolean (value);
423
423
        if (prop_val != client->priv->lid_is_present) {
424
 
                client->priv->lid_is_present = ret;
 
424
                client->priv->lid_is_present = prop_val;
425
425
                g_object_notify (G_OBJECT(client), "lid-is-present");
426
426
        }
427
427
 
431
431
                goto out;
432
432
        }
433
433
        prop_val = g_value_get_boolean (value);
434
 
        if (ret != client->priv->is_docked) {
435
 
                client->priv->is_docked = ret;
 
434
        if (prop_val != client->priv->is_docked) {
 
435
                client->priv->is_docked = prop_val;
436
436
                g_object_notify (G_OBJECT(client), "is-docked");
437
437
        }
438
438
 
443
443
        }
444
444
        prop_val = g_value_get_boolean (value);
445
445
        if (prop_val != client->priv->lid_force_sleep) {
446
 
                client->priv->lid_force_sleep = ret;
 
446
                client->priv->lid_force_sleep = prop_val;
447
447
                g_object_notify (G_OBJECT(client), "lid-force-sleep");
448
448
        }
449
449