~ubuntu-branches/ubuntu/precise/xfce4-power-manager/precise

« back to all changes in this revision

Viewing changes to src/xfpm-engine.c

  • Committer: Bazaar Package Importer
  • Author(s): Lionel Le Folgoc
  • Date: 2009-12-04 16:13:45 UTC
  • mfrom: (6.2.3 squeeze)
  • Revision ID: james.westby@ubuntu.com-20091204161345-pkcz5rs7pudco2hl
Tags: 0.8.4.2-1ubuntu1
* Merge from Debian testing, remaining Ubuntu changes:
  - debian/patches:
    + xubuntu-use-notification-icons.patch: use our notification-* icons for
      notification bubbles instead of the normal ones LP: #437374
    + 10_pc.patch: added patched files to POTFILES.skip
    + series: created, with these two patches
  - debian/rules: add --with quilt
  - debian/control: build-depends on quilt (>= 0.46-7~)
  - debian/README.source: added.

Show diffs side-by-side

added added

removed removed

Lines of Context:
50
50
#include "xfpm-screen-saver.h"
51
51
#include "xfpm-shutdown.h"
52
52
#include "xfpm-button-hal.h"
53
 
#include "xfpm-idle.h"
 
53
#include "egg-idletime.h"
54
54
#include "xfpm-errors.h"
55
55
#include "xfpm-config.h"
56
56
#include "xfpm-enum-types.h"
78
78
    XfpmShutdown        *shutdown;
79
79
    XfpmButton          *button;
80
80
    XfpmButtonHal       *bt_hal;
81
 
    XfpmIdle            *idle;
 
81
    EggIdletime         *idle;
82
82
    XfpmScreenSaver     *srv;
83
83
#ifdef HAVE_DPMS
84
84
    XfpmDpms *dpms;
236
236
{
237
237
    XfpmLidTriggerAction action;
238
238
    
 
239
    g_object_get (G_OBJECT (engine->priv->conf),
 
240
                      engine->priv->on_battery ? LID_SWITCH_ON_BATTERY_CFG : LID_SWITCH_ON_AC_CFG, &action,
 
241
                      NULL);
 
242
 
239
243
    if ( pressed )
240
244
    {
241
 
        g_object_get (G_OBJECT (engine->priv->conf),
242
 
                      engine->priv->on_battery ? LID_SWITCH_ON_BATTERY_CFG : LID_SWITCH_ON_AC_CFG, &action,
243
 
                      NULL);
244
 
                      
245
245
        XFPM_DEBUG_ENUM ("LID close event", action, XFPM_TYPE_LID_TRIGGER_ACTION);
246
246
        
247
 
        if ( action == LID_TRIGGER_LOCK_SCREEN )
 
247
        if ( action == LID_TRIGGER_NOTHING )
 
248
        {
 
249
            if ( !xfpm_is_multihead_connected () )
 
250
                xfpm_dpms_force_level (engine->priv->dpms, DPMSModeOff);
 
251
        }
 
252
        else if ( action == LID_TRIGGER_LOCK_SCREEN )
248
253
        {
249
254
            if ( !xfpm_is_multihead_connected () )
250
255
                xfpm_lock_screen ();
252
257
        else 
253
258
            xfpm_engine_shutdown_request (engine, action, FALSE);
254
259
    }
 
260
    else
 
261
    {
 
262
        XFPM_DEBUG_ENUM ("LID opened", action, XFPM_TYPE_LID_TRIGGER_ACTION);
 
263
        xfpm_dpms_force_level (engine->priv->dpms, DPMSModeOn);
 
264
    }
255
265
}
256
266
 
257
267
static void
401
411
{
402
412
    engine->priv->on_battery = !present;
403
413
    g_signal_emit (G_OBJECT (engine), signals [ON_BATTERY_CHANGED], 0, engine->priv->on_battery);
404
 
    xfpm_idle_alarm_reset_all (engine->priv->idle);
 
414
    egg_idletime_alarm_reset_all (engine->priv->idle);
405
415
}
406
416
 
407
417
static void
434
444
    
435
445
    if ( on_ac == 14 )
436
446
    {
437
 
        xfpm_idle_free_alarm (engine->priv->idle, TIMEOUT_INACTIVITY_ON_AC );
 
447
        egg_idletime_alarm_remove (engine->priv->idle, TIMEOUT_INACTIVITY_ON_AC );
438
448
    }
439
449
    else
440
450
    {
441
 
        xfpm_idle_set_alarm (engine->priv->idle, TIMEOUT_INACTIVITY_ON_AC, on_ac * 1000 * 60);
 
451
        egg_idletime_alarm_set (engine->priv->idle, TIMEOUT_INACTIVITY_ON_AC, on_ac * 1000 * 60);
442
452
    }
443
453
    
444
454
    if ( on_battery == 14 )
445
455
    {
446
 
        xfpm_idle_free_alarm (engine->priv->idle, TIMEOUT_INACTIVITY_ON_BATTERY );
 
456
        egg_idletime_alarm_remove (engine->priv->idle, TIMEOUT_INACTIVITY_ON_BATTERY );
447
457
    }
448
458
    else
449
459
    {
450
 
        xfpm_idle_set_alarm (engine->priv->idle, TIMEOUT_INACTIVITY_ON_BATTERY, on_battery * 1000 * 60);
 
460
        egg_idletime_alarm_set (engine->priv->idle, TIMEOUT_INACTIVITY_ON_BATTERY, on_battery * 1000 * 60);
451
461
    }
452
462
}
453
463
 
454
464
static void
455
 
xfpm_engine_alarm_timeout_cb (XfpmIdle *idle, guint id, XfpmEngine *engine)
 
465
xfpm_engine_alarm_timeout_cb (EggIdletime *idle, guint id, XfpmEngine *engine)
456
466
{
457
467
    XfpmShutdownRequest req = XFPM_DO_NOTHING;
458
468
    gchar *sleep_mode;
569
579
    g_signal_connect (engine->priv->adapter, "adapter-changed",
570
580
                      G_CALLBACK (xfpm_engine_adapter_changed_cb), engine);
571
581
 
572
 
    engine->priv->idle    = xfpm_idle_new ();
 
582
    engine->priv->idle    = egg_idletime_new ();
573
583
 
574
 
    g_signal_connect (engine->priv->idle, "alarm-timeout",
 
584
    g_signal_connect (engine->priv->idle, "alarm-expired",
575
585
                      G_CALLBACK (xfpm_engine_alarm_timeout_cb), engine);
576
586
                      
577
587
    g_signal_connect (engine->priv->conf, "notify",