gnome-power-manager r3059 - in trunk: . src
- From: rhughes svn gnome org
- To: svn-commits-list gnome org
- Subject: gnome-power-manager r3059 - in trunk: . src
- Date: Mon, 3 Nov 2008 17:41:25 +0000 (UTC)
Author: rhughes
Date: Mon Nov 3 17:41:25 2008
New Revision: 3059
URL: http://svn.gnome.org/viewvc/gnome-power-manager?rev=3059&view=rev
Log:
2008-11-03 Richard Hughes <richard hughsie com>
* src/gpm-manager.c: (gpm_manager_action_suspend),
(gpm_manager_action_hibernate), (manager_policy_do),
(idle_do_sleep), (idle_changed_cb), (button_pressed_cb),
(ac_adapter_changed_cb), (control_sleep_failure_cb),
(dpms_mode_changed_cb), (gpm_manager_init), (gpm_manager_finalize):
Don't use org.freedesktop.PowerManagement.Statistics when we are
building with DeviceKit-power support.
Modified:
trunk/ChangeLog
trunk/src/gpm-manager.c
Modified: trunk/src/gpm-manager.c
==============================================================================
--- trunk/src/gpm-manager.c (original)
+++ trunk/src/gpm-manager.c Mon Nov 3 17:41:25 2008
@@ -54,7 +54,9 @@
#include "gpm-common.h"
#include "gpm-dpms.h"
#include "gpm-idle.h"
-#include "gpm-info.h"
+#ifndef HAVE_DK_POWER
+ #include "gpm-info.h"
+#endif
#include "gpm-inhibit.h"
#include "gpm-manager.h"
#include "gpm-notify.h"
@@ -69,9 +71,11 @@
#include "gpm-engine.h"
#include "gpm-feedback-widget.h"
-#include "org.freedesktop.PowerManagement.Statistics.h"
#include "org.freedesktop.PowerManagement.Inhibit.h"
#include "org.freedesktop.PowerManagement.Backlight.h"
+#ifndef HAVE_DK_POWER
+ #include "org.freedesktop.PowerManagement.Statistics.h"
+#endif
static void gpm_manager_class_init (GpmManagerClass *klass);
static void gpm_manager_init (GpmManager *manager);
@@ -91,7 +95,9 @@
GConfClient *conf;
GpmDpms *dpms;
GpmIdle *idle;
+#ifndef HAVE_DK_POWER
GpmInfo *info;
+#endif
GpmPrefsServer *prefs_server;
GpmInhibit *inhibit;
GpmNotify *notify;
@@ -434,8 +440,10 @@
if (gpm_manager_is_inhibit_valid (manager, FALSE, "suspend") == FALSE)
return FALSE;
+#ifndef HAVE_DK_POWER
gpm_info_explain_reason (manager->priv->info, GPM_EVENT_SUSPEND,
_("Suspending computer."), reason);
+#endif
gpm_control_suspend (manager->priv->control, &error);
if (error != NULL)
g_error_free (error);
@@ -481,8 +489,10 @@
if (gpm_manager_is_inhibit_valid (manager, FALSE, "hibernate") == FALSE)
return FALSE;
+#ifndef HAVE_DK_POWER
gpm_info_explain_reason (manager->priv->info, GPM_EVENT_HIBERNATE,
_("Hibernating computer."), reason);
+#endif
gpm_control_hibernate (manager->priv->control, &error);
if (error != NULL)
g_error_free (error);
@@ -540,9 +550,10 @@
return FALSE;
if (strcmp (action, ACTION_NOTHING) == 0) {
+#ifndef HAVE_DK_POWER
gpm_info_explain_reason (manager->priv->info, GPM_EVENT_NOTIFICATION,
_("Doing nothing."), reason);
-
+#endif
} else if (strcmp (action, ACTION_SUSPEND) == 0) {
gpm_manager_action_suspend (manager, reason);
@@ -553,13 +564,17 @@
gpm_manager_blank_screen (manager, NULL);
} else if (strcmp (action, ACTION_SHUTDOWN) == 0) {
+#ifndef HAVE_DK_POWER
gpm_info_explain_reason (manager->priv->info, GPM_EVENT_NOTIFICATION,
_("Shutting down computer."), reason);
+#endif
gpm_control_shutdown (manager->priv->control, NULL);
} else if (strcmp (action, ACTION_INTERACTIVE) == 0) {
+#ifndef HAVE_DK_POWER
gpm_info_explain_reason (manager->priv->info, GPM_EVENT_NOTIFICATION,
_("GNOME interactive logout."), reason);
+#endif
gpm_manager_logout_interactive (manager);
} else {
egg_warning ("unknown action %s", action);
@@ -820,8 +835,10 @@
egg_debug ("doing nothing as system idle action");
} else if (strcmp (action, ACTION_SUSPEND) == 0) {
+#ifndef HAVE_DK_POWER
gpm_info_explain_reason (manager->priv->info, GPM_EVENT_SUSPEND,
_("Suspending computer."), _("System idle."));
+#endif
ret = gpm_control_suspend (manager->priv->control, &error);
if (!ret) {
egg_warning ("cannot suspend (error: %s), so trying hibernate", error->message);
@@ -835,8 +852,10 @@
}
} else if (strcmp (action, ACTION_HIBERNATE) == 0) {
+#ifndef HAVE_DK_POWER
gpm_info_explain_reason (manager->priv->info, GPM_EVENT_HIBERNATE,
_("Hibernating computer."), _("System idle."));
+#endif
ret = gpm_control_hibernate (manager->priv->control, &error);
if (!ret) {
egg_warning ("cannot hibernate (error: %s), so trying suspend", error->message);
@@ -872,12 +891,14 @@
return;
}
+#ifndef HAVE_DK_POWER
if (mode == GPM_IDLE_MODE_NORMAL)
gpm_info_event_log (manager->priv->info, GPM_EVENT_SESSION_ACTIVE, _("idle mode ended"));
else if (mode == GPM_IDLE_MODE_SESSION)
gpm_info_event_log (manager->priv->info, GPM_EVENT_SESSION_IDLE, _("idle mode started"));
else if (mode == GPM_IDLE_MODE_POWERSAVE)
gpm_info_event_log (manager->priv->info, GPM_EVENT_SESSION_POWERSAVE, _("powersave mode started"));
+#endif
/* 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
@@ -1043,10 +1064,12 @@
return;
}
+#ifndef HAVE_DK_POWER
if (strcmp (type, GPM_BUTTON_LID_CLOSED) == 0)
gpm_info_event_log (manager->priv->info, GPM_EVENT_LID_CLOSED, _("The laptop lid has been closed"));
else if (strcmp (type, GPM_BUTTON_LID_OPEN) == 0)
gpm_info_event_log (manager->priv->info, GPM_EVENT_LID_OPENED, _("The laptop lid has been re-opened"));
+#endif
if (strcmp (type, GPM_BUTTON_POWER) == 0)
manager_policy_do (manager, GPM_CONF_BUTTON_POWER, _("The power button has been pressed."));
@@ -1112,10 +1135,12 @@
egg_debug ("Setting on-ac: %d", on_ac);
+#ifndef HAVE_DK_POWER
if (on_ac)
gpm_info_event_log (manager->priv->info, GPM_EVENT_ON_AC, _("AC adapter inserted"));
else
gpm_info_event_log (manager->priv->info, GPM_EVENT_ON_BATTERY, _("AC adapter removed"));
+#endif
if (on_ac)
brightness = gconf_client_get_int (manager->priv->conf, GPM_CONF_KEYBOARD_BRIGHTNESS_AC, NULL);
@@ -1488,10 +1513,12 @@
{
gboolean show_sleep_failed;
+#ifndef HAVE_DK_POWER
if (action == GPM_CONTROL_ACTION_HIBERNATE)
gpm_info_event_log (manager->priv->info, GPM_EVENT_NOTIFICATION, _("Hibernate Problem"));
else
gpm_info_event_log (manager->priv->info, GPM_EVENT_NOTIFICATION, _("Suspend Problem"));
+#endif
/* only show this if specified in gconf */
show_sleep_failed = gconf_client_get_bool (manager->priv->conf, GPM_CONF_NOTIFY_SLEEP_FAILED, NULL);
@@ -1815,6 +1842,7 @@
{
egg_debug ("DPMS mode changed: %d", mode);
+#ifndef HAVE_DK_POWER
if (mode == GPM_DPMS_MODE_ON)
gpm_info_event_log (manager->priv->info, GPM_EVENT_DPMS_ON, _("dpms on"));
else if (mode == GPM_DPMS_MODE_STANDBY)
@@ -1823,6 +1851,7 @@
gpm_info_event_log (manager->priv->info, GPM_EVENT_DPMS_SUSPEND, _("dpms suspend"));
else if (mode == GPM_DPMS_MODE_OFF)
gpm_info_event_log (manager->priv->info, GPM_EVENT_DPMS_OFF, _("dpms off"));
+#endif
update_dpms_throttle (manager);
}
@@ -1971,6 +2000,7 @@
"hibernate", G_CALLBACK (gpm_manager_tray_icon_hibernate),
manager, G_CONNECT_SWAPPED);
+#ifndef HAVE_DK_POWER
egg_debug ("initialising info infrastructure");
manager->priv->info = gpm_info_new ();
@@ -1978,6 +2008,7 @@
dbus_g_object_type_install_info (GPM_TYPE_INFO, &dbus_glib_gpm_statistics_object_info);
dbus_g_connection_register_g_object (connection, GPM_DBUS_PATH_STATS,
G_OBJECT (manager->priv->info));
+#endif
gpm_manager_sync_policy_sleep (manager);
@@ -2012,7 +2043,9 @@
collection = gpm_engine_get_collection (manager->priv->engine);
gpm_tray_icon_set_collection_data (manager->priv->tray_icon, collection);
+#ifndef HAVE_DK_POWER
gpm_info_set_collection_data (manager->priv->info, collection);
+#endif
}
/**
@@ -2037,7 +2070,9 @@
g_object_unref (manager->priv->hal_device_power);
g_object_unref (manager->priv->dpms);
g_object_unref (manager->priv->idle);
+#ifndef HAVE_DK_POWER
g_object_unref (manager->priv->info);
+#endif
g_object_unref (manager->priv->engine);
g_object_unref (manager->priv->tray_icon);
g_object_unref (manager->priv->inhibit);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]