Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Evergreen:11.2
gnome-power-manager
gnome-power-manager-notify-idle-sleep.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File gnome-power-manager-notify-idle-sleep.patch of Package gnome-power-manager
From 331e3d5383acc74daee8989f7c0e9df01a3b1421 Mon Sep 17 00:00:00 2001 From: Vincent Untz <vuntz@gnome.org> Date: Mon, 20 Jul 2009 14:37:02 +0200 Subject: [PATCH] Add a notification when coming back from idle sleep This lets the user know what happened. --- data/gnome-power-manager.schemas.in | 12 ++++++++++++ src/gpm-common.h | 1 + src/gpm-manager.c | 35 +++++++++++++++++++++++++++++++++++ 3 files changed, 48 insertions(+), 0 deletions(-) Index: gnome-power-manager-2.27.91/data/gnome-power-manager.schemas.in =================================================================== --- gnome-power-manager-2.27.91.orig/data/gnome-power-manager.schemas.in +++ gnome-power-manager-2.27.91/data/gnome-power-manager.schemas.in @@ -528,6 +528,18 @@ </schema> <schema> + <key>/schemas/apps/gnome-power-manager/notify/idle_sleep</key> + <applyto>/apps/gnome-power-manager/notify/idle_sleep</applyto> + <owner>gnome-power-manager</owner> + <type>bool</type> + <default>false</default> + <locale name="C"> + <short>If an information message should be displayed when returning from idle sleep.</short> + <long>If an information message should be displayed when returning from idle sleep.</long> + </locale> + </schema> + + <schema> <key>/schemas/apps/gnome-power-manager/statistics/show_axis_labels</key> <applyto>/apps/gnome-power-manager/statistics/show_axis_labels</applyto> <owner>gnome-power-manager</owner> Index: gnome-power-manager-2.27.91/src/gpm-common.h =================================================================== --- gnome-power-manager-2.27.91.orig/src/gpm-common.h +++ gnome-power-manager-2.27.91/src/gpm-common.h @@ -110,6 +110,7 @@ G_BEGIN_DECLS #define GPM_CONF_NOTIFY_SLEEP_FAILED GPM_CONF_DIR "/notify/sleep_failed" #define GPM_CONF_NOTIFY_SLEEP_FAILED_URI GPM_CONF_DIR "/notify/sleep_failed_uri" #define GPM_CONF_NOTIFY_LOW_POWER GPM_CONF_DIR "/notify/low_power" +#define GPM_CONF_NOTIFY_IDLE_SLEEP GPM_CONF_DIR "/notify/idle_sleep" /* statistics */ #define GPM_CONF_STATS_SHOW_AXIS_LABELS GPM_CONF_DIR "/statistics/show_axis_labels" Index: gnome-power-manager-2.27.91/src/gpm-manager.c =================================================================== --- gnome-power-manager-2.27.91.orig/src/gpm-manager.c +++ gnome-power-manager-2.27.91/src/gpm-manager.c @@ -551,6 +551,31 @@ gpm_manager_get_preferences_options (Gpm } /** + * gpm_manager_notify_idle_sleep: + * @manager: This class instance + * + * Called when we're back from suspend and the reason for suspend was a + * auto sleep due to system inactivity + **/ +static void +gpm_manager_notify_idle_sleep (GpmManager *manager) +{ + gboolean show_idle_sleep; + + /* only show this if specified in gconf */ + show_idle_sleep = gconf_client_get_bool (manager->priv->conf, GPM_CONF_NOTIFY_IDLE_SLEEP, NULL); + + /* only emit if in GConf */ + if (show_idle_sleep) + gpm_manager_notify (manager, &manager->priv->notification, + _("System resumed from sleep"), + _("The system automatically went to sleep because the system was idle."), + GPM_MANAGER_NOTIFY_TIMEOUT_SHORT, + GTK_STOCK_DIALOG_INFO, + NOTIFY_URGENCY_NORMAL); +} + +/** * gpm_manager_idle_do_sleep: * @manager: This class instance * @@ -586,6 +611,11 @@ gpm_manager_idle_do_sleep (GpmManager *m egg_warning ("cannot suspend or hibernate: %s", error->message); g_error_free (error); } + } else { + /* we're back from suspend without an error, tell the + * user that we've actually suspended due to system + * idleness */ + gpm_manager_notify_idle_sleep (manager); } } else if (policy == GPM_ACTION_POLICY_HIBERNATE) { @@ -600,6 +630,11 @@ gpm_manager_idle_do_sleep (GpmManager *m egg_warning ("cannot suspend or hibernate: %s", error->message); g_error_free (error); } + } else { + /* we're back from hibernate without an error, tell the + * user that we've actually suspended due to system + * idleness */ + gpm_manager_notify_idle_sleep (manager); } } g_free (action);
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor