gnome-power-manager r3092 - in branches/gnome-2-24: . src
- From: rhughes svn gnome org
- To: svn-commits-list gnome org
- Subject: gnome-power-manager r3092 - in branches/gnome-2-24: . src
- Date: Mon, 17 Nov 2008 10:07:39 +0000 (UTC)
Author: rhughes
Date: Mon Nov 17 10:07:39 2008
New Revision: 3092
URL: http://svn.gnome.org/viewvc/gnome-power-manager?rev=3092&view=rev
Log:
2008-11-17 Richard Hughes <richard hughsie com>
* src/Makefile.am:
* src/gpm-manager.c: (idle_changed_cb), (button_pressed_cb),
(ac_adapter_changed_cb),
(gpm_manager_console_kit_active_changed_cb), (gpm_manager_init),
(gpm_manager_finalize):
Don't apply policy when not active. This is needed when multiple
instances of g-p-m are present in multiple sessions.
Modified:
branches/gnome-2-24/ChangeLog
branches/gnome-2-24/src/Makefile.am
branches/gnome-2-24/src/gpm-manager.c
Modified: branches/gnome-2-24/src/Makefile.am
==============================================================================
--- branches/gnome-2-24/src/Makefile.am (original)
+++ branches/gnome-2-24/src/Makefile.am Mon Nov 17 10:07:39 2008
@@ -139,6 +139,8 @@
egg-color.h \
egg-debug.h \
egg-debug.c \
+ egg-console-kit.h \
+ egg-console-kit.c \
gpm-dpms.h \
gpm-dpms.c \
gpm-notify.h \
Modified: branches/gnome-2-24/src/gpm-manager.c
==============================================================================
--- branches/gnome-2-24/src/gpm-manager.c (original)
+++ branches/gnome-2-24/src/gpm-manager.c Mon Nov 17 10:07:39 2008
@@ -43,6 +43,8 @@
#include <libhal-gpower.h>
#include <libhal-gmanager.h>
+#include "egg-console-kit.h"
+
#include "gpm-ac-adapter.h"
#include "gpm-button.h"
#include "gpm-conf.h"
@@ -98,6 +100,7 @@
/* interactive services */
GpmBacklight *backlight;
+ EggConsoleKit *console;
GpmSrvBrightnessKbd *srv_brightness_kbd;
GpmSrvScreensaver *srv_screensaver;
};
@@ -799,6 +802,12 @@
GpmIdleMode mode,
GpmManager *manager)
{
+ /* ConsoleKit says we are not on active console */
+ if (!egg_console_kit_is_active (manager->priv->console)) {
+ egg_debug ("ignoring as not on active console");
+ return;
+ }
+
/* Ignore timeout events when the lid is closed, as the DPMS is
* already off, and we don't want to perform policy actions or re-enable
* the screen when the user moves the mouse on systems that do not
@@ -960,6 +969,12 @@
{
egg_debug ("Button press event type=%s", type);
+ /* ConsoleKit says we are not on active console */
+ if (!egg_console_kit_is_active (manager->priv->console)) {
+ egg_debug ("ignoring as not on active console");
+ return;
+ }
+
if (strcmp (type, GPM_BUTTON_POWER) == 0) {
power_button_pressed (manager);
@@ -999,6 +1014,12 @@
gboolean event_when_closed;
gboolean power_save;
+ /* ConsoleKit says we are not on active console */
+ if (!egg_console_kit_is_active (manager->priv->console)) {
+ egg_debug ("ignoring as not on active console");
+ return;
+ }
+
egg_debug ("Setting on-ac: %d", on_ac);
gpm_manager_sync_policy_sleep (manager);
@@ -1644,6 +1665,16 @@
}
/**
+ * gpm_manager_console_kit_active_changed_cb:
+ **/
+static void
+gpm_manager_console_kit_active_changed_cb (EggConsoleKit *console, gboolean active, GpmManager *manager)
+{
+ egg_debug ("console now %s", active ? "active" : "inactive");
+ /* FIXME: do we need to do policy actions when we switch? */
+}
+
+/**
* gpm_manager_init:
* @manager: This class instance
**/
@@ -1664,6 +1695,11 @@
/* do some actions even when killed */
g_atexit (gpm_manager_at_exit);
+ /* don't apply policy when not active */
+ manager->priv->console = egg_console_kit_new ();
+ g_signal_connect (manager->priv->console, "active-changed",
+ G_CALLBACK (gpm_manager_console_kit_active_changed_cb), manager);
+
/* this is a singleton, so we keep a master copy open here */
manager->priv->prefs_server = gpm_prefs_server_new ();
@@ -1831,6 +1867,7 @@
g_object_unref (manager->priv->srv_screensaver);
g_object_unref (manager->priv->prefs_server);
g_object_unref (manager->priv->control);
+ g_object_unref (manager->priv->console);
/* optional gobjects */
if (manager->priv->button) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]