Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:zhy20120210:failed_1
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
Index: src/gpm-manager.c =================================================================== --- src/gpm-manager.c.orig +++ src/gpm-manager.c @@ -719,6 +719,26 @@ gpm_manager_get_low_battery (GpmManager } /** + * 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 +notify_idle_sleep (GpmManager *manager) +{ + gboolean show_idle_sleep; + + /* only show this if specified in gconf */ + gpm_conf_get_bool (manager->priv->conf, GPM_CONF_NOTIFY_IDLE_SLEEP, &show_idle_sleep); + + /* only emit if in GConf */ + if (show_idle_sleep) + gpm_notify_idle_sleep (manager->priv->notify); +} + +/** * idle_do_sleep: * @manager: This class instance * @@ -763,6 +783,11 @@ idle_do_sleep (GpmManager *manager) 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 */ + notify_idle_sleep (manager); } } else if (strcmp (action, ACTION_HIBERNATE) == 0) { @@ -778,6 +803,11 @@ idle_do_sleep (GpmManager *manager) 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 */ + notify_idle_sleep (manager); } } g_free (action); Index: src/gpm-notify.c =================================================================== --- src/gpm-notify.c.orig +++ src/gpm-notify.c @@ -440,6 +440,37 @@ gpm_notify_low_capacity (GpmNotify *noti } /** + * gpm_notify_idle_sleep: + **/ +gboolean +gpm_notify_idle_sleep (GpmNotify *notify) +{ + const gchar *msg; + const gchar *title; + + title = _("System resumed from sleep"); + msg = _("The system automatically went to sleep because the system " + "was idle."); + + gpm_notify_create (notify, title, msg, 2, + GTK_STOCK_DIALOG_WARNING, + GPM_NOTIFY_URGENCY_CRITICAL); + + /* add extra stuff */ +#ifdef HAVE_LIBNOTIFY + notify->priv->do_not_show_gconf = GPM_CONF_NOTIFY_IDLE_SLEEP; + notify_notification_add_action (notify->priv->libnotify, + "dont-show-again", + _("Do not show me this again"), + (NotifyActionCallback) notify_general_clicked_cb, + notify, NULL); +#endif + + gpm_notify_show (notify); + return TRUE; +} + +/** * gpm_notify_inhibit_lid: **/ gboolean Index: src/gpm-notify.h =================================================================== --- src/gpm-notify.h.orig +++ src/gpm-notify.h @@ -79,6 +79,7 @@ gboolean gpm_notify_perhaps_recall (Gpm const gchar *website); gboolean gpm_notify_low_capacity (GpmNotify *notify, guint capacity); +gboolean gpm_notify_idle_sleep (GpmNotify *notify); gboolean gpm_notify_inhibit_lid (GpmNotify *notify); gboolean gpm_notify_fully_charged_primary (GpmNotify *notify); gboolean gpm_notify_discharging_primary (GpmNotify *notify); Index: data/gnome-power-manager.schemas.in =================================================================== --- data/gnome-power-manager.schemas.in.orig +++ data/gnome-power-manager.schemas.in @@ -657,6 +657,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: src/gpm-conf.h =================================================================== --- src/gpm-conf.h.orig +++ src/gpm-conf.h @@ -124,6 +124,7 @@ G_BEGIN_DECLS #define GPM_CONF_NOTIFY_LOW_POWER GPM_CONF_DIR "/notify/low_power" #define GPM_CONF_NOTIFY_ESTIMATED_DATA GPM_CONF_DIR "/notify/estimated_data" #define GPM_CONF_NOTIFY_INHIBIT_LID GPM_CONF_DIR "/notify/inhibit_lid" +#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"
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