gnome-settings-daemon/gnome-settings-daemon-notify-idle-resumed.patch
Dominique Leuenberger f3f44f9994 Accepting request 417855 from home:mgorse:branches:GNOME:Factory
Synch with SLE.

Forgot to actually remove the old patch (oops!) It's really gone this time.
- Only require udev on SLE. Only needed for older filesystem
  package.
- Re-enable gnome-patch-translation on SLE. We don't have any
  non-rebased patches now, so probably safe.
- Drop gnome-settings-daemon-housekeeping-ignore-boot-efi.patch:
  now handled in branding.

- Add gnome-settings-daemon-housekeeping-ignore-boot-efi.patch
  (bsc#919217). Prevent popup warnings about /boot/efi on a default
  UEFI installation.

- Remove gnome-settings-daemon-bnc877552.patch - fixed upstream

- Added back an updated version of
  gnome-settings-daemon-initial-keyboard.patch for bsc#979051. 
  Suse works differently from GNOME; we set the default keyboard
  from xkb, and GNOME likes to do it itself.  This makes sure
  there is no keyboard selector icon if there is a single default
  keyboard defined.

- Removed
  gsettings-do-not-store-autodetected-keyboard-settings.patch.
  Equivalent code is now upstream.

- Removed gnome-settings-daemon-initial-keyboard.patch.  Upstream's
  behavior is fine, as the default keyboard layout needs to be
  available for the screen lock.

- Update to GNOME 3.20.1  Fate#318572
- Rebased gnome-settings-daemon-notify-idle-resumed.patch.

OBS-URL: https://build.opensuse.org/request/show/417855
OBS-URL: https://build.opensuse.org/package/show/GNOME:Factory/gnome-settings-daemon?expand=0&rev=248
2016-08-12 09:42:58 +00:00

115 lines
5.2 KiB
Diff

Index: gnome-settings-daemon-3.18.2/data/org.gnome.settings-daemon.plugins.power.gschema.xml.in.in
===================================================================
--- gnome-settings-daemon-3.18.2.orig/data/org.gnome.settings-daemon.plugins.power.gschema.xml.in.in
+++ gnome-settings-daemon-3.18.2/data/org.gnome.settings-daemon.plugins.power.gschema.xml.in.in
@@ -50,5 +50,10 @@
<summary>Power button action</summary>
<description>The action to take when the system power button is pressed. This action is hard-coded (and the setting ignored) on virtual machines (power off) and tablets (suspend).</description>
</key>
+ <key name="notify-idle-resumed" type="b">
+ <default>true</default>
+ <_summary>If an information message should be displayed when returning from idle sleep.</_summary>
+ <_description>If an information message should be displayed when returning from idle sleep.</_description>
+ </key>
</schema>
</schemalist>
Index: gnome-settings-daemon-3.18.2/plugins/power/gsd-power-manager.c
===================================================================
--- gnome-settings-daemon-3.18.2.orig/plugins/power/gsd-power-manager.c
+++ gnome-settings-daemon-3.18.2/plugins/power/gsd-power-manager.c
@@ -149,6 +149,7 @@ struct GsdPowerManagerPrivate
NotifyNotification *notification_ups_discharging;
NotifyNotification *notification_low;
NotifyNotification *notification_sleep_warning;
+ NotifyNotification *notification_resumed;
GsdPowerActionType sleep_action_type;
gboolean battery_is_low; /* laptop battery low, or UPS discharging */
@@ -184,6 +185,7 @@ struct GsdPowerManagerPrivate
guint inhibit_lid_switch_timer_id;
gboolean is_virtual_machine;
gboolean is_tablet;
+ GsdPowerActionType last_idle_power_action;
/* Idles */
GnomeIdleMonitor *idle_monitor;
@@ -1475,6 +1477,49 @@ is_session_active (GsdPowerManager *mana
}
static void
+show_resumed_notification (GsdPowerManager *manager)
+{
+ GError *error = NULL;
+ gboolean ret;
+
+ /* don't show when running under GDM */
+ if (g_getenv ("RUNNING_UNDER_GDM") != NULL) {
+ g_debug ("running under gdm, so no notification");
+ return;
+ }
+
+ ret = g_settings_get_boolean (manager->priv->settings, "notify-idle-resumed");
+ if (!ret)
+ return;
+
+ /* close any existing notification of this class */
+ notify_close_if_showing (&manager->priv->notification_resumed);
+
+ /* create a new notification */
+ create_notification (_("System resumed from sleep"),
+ _("The system automatically went to sleep because the system was idle."),
+ NULL,
+ &manager->priv->notification_resumed);
+ notify_notification_set_timeout (manager->priv->notification_resumed,
+ GSD_POWER_MANAGER_NOTIFY_TIMEOUT_SHORT);
+ notify_notification_set_urgency (manager->priv->notification_resumed,
+ NOTIFY_URGENCY_NORMAL);
+ /* TRANSLATORS: this is the notification application name */
+ notify_notification_set_app_name (manager->priv->notification_resumed, _("Power"));
+ notify_notification_set_hint (manager->priv->notification_resumed,
+ "transient", g_variant_new_boolean (TRUE));
+
+ /* try to show */
+ ret = notify_notification_show (manager->priv->notification_resumed,
+ &error);
+ if (!ret) {
+ g_warning ("failed to show notification: %s", error->message);
+ g_error_free (error);
+ g_object_unref (manager->priv->notification_resumed);
+ }
+}
+
+static void
idle_set_mode (GsdPowerManager *manager, GsdPowerIdleMode mode)
{
gboolean ret = FALSE;
@@ -1564,6 +1609,7 @@ idle_set_mode (GsdPowerManager *manager,
action_type = g_settings_get_enum (manager->priv->settings,
"sleep-inactive-ac-type");
}
+ manager->priv->last_idle_power_action = action_type;
do_power_action_type (manager, action_type);
/* turn on screen and restore user-selected brightness level */
@@ -2340,6 +2386,12 @@ handle_suspend_actions (GsdPowerManager
static void
handle_resume_actions (GsdPowerManager *manager)
{
+ if (manager->priv->last_idle_power_action == GSD_POWER_ACTION_SUSPEND ||
+ manager->priv->last_idle_power_action == GSD_POWER_ACTION_HIBERNATE)
+ show_resumed_notification (manager);
+
+ manager->priv->last_idle_power_action = GSD_POWER_ACTION_NOTHING;
+
/* ensure we turn the panel back on after resume */
backlight_enable (manager);
@@ -2349,6 +2401,7 @@ handle_resume_actions (GsdPowerManager *
/* set up the delay again */
inhibit_suspend (manager);
+
}
static void