Sisyphus repositório
Última atualização: 1 outubro 2023 | SRPMs: 18631 | Visitas: 37531854
en ru br
ALT Linux repositórios
S:4.18.3-alt2
5.0: 4.6.1-alt1
4.1: 4.4.3-alt0.M41.1
4.0: 4.4.2-alt0.M40
3.0: 4.2.2-alt1

Group :: Desktop gráfico/XFce
RPM: xfce4-session

 Main   Changelog   Spec   Patches   Sources   Download   Gear   Bugs e FR  Repocop 

Patch: xfce4-session-4.8.2-alt-lock-screen.patch
Download


diff --git a/xfce4-session/xfsm-shutdown-helper.c b/xfce4-session/xfsm-shutdown-helper.c
index 3debeb2..04fbde3 100644
--- a/xfce4-session/xfsm-shutdown-helper.c
+++ b/xfce4-session/xfsm-shutdown-helper.c
@@ -70,6 +70,7 @@
 #include <dbus/dbus-glib-lowlevel.h>
 
 #include <libxfce4util/libxfce4util.h>
+#include <xfconf/xfconf.h>
 
 #include "xfsm-shutdown-helper.h"
 #include "xfsm-global.h"
@@ -1777,6 +1778,50 @@ gboolean xfsm_shutdown_helper_restart (XfsmShutdownHelper *helper, GError **erro
 
 }
 
+/* Check xfce4-power-manager settings
+ * and lock screen if needed
+ */
+void
+lock_screen (void)
+{
+  XfconfChannel *xpm_channel;
+
+  xpm_channel = xfconf_channel_new("xfce4-power-manager");
+  g_return_if_fail (xpm_channel != NULL);
+
+  if (xfconf_channel_get_bool (xpm_channel,
+                               "/xfce4-power-manager/lock-screen-suspend-hibernate",
+                               FALSE))
+  {
+    /* Copy & paste from xfce4-power-manager */
+
+    gboolean ret = g_spawn_command_line_async ("xflock4", NULL);
+
+    if ( !ret )
+    {
+      g_spawn_command_line_async ("gnome-screensaver-command -l", NULL);
+    }
+
+    if ( !ret )
+    {
+      /* this should be the default*/
+      ret = g_spawn_command_line_async ("xdg-screensaver lock", NULL);
+    }
+
+    if ( !ret )
+    {
+      ret = g_spawn_command_line_async ("xscreensaver-command -lock", NULL);
+    }
+
+    if ( !ret )
+    {
+      g_critical ("Connot lock screen\n");
+    }
+  }
+
+  g_object_unref (xpm_channel);
+}
+
 /**
  * xfsm_shutdown_helper_suspend:
  *
@@ -1785,6 +1830,8 @@ gboolean xfsm_shutdown_helper_suspend (XfsmShutdownHelper *helper, GError **erro
 {
   g_return_val_if_fail (!error || !*error, FALSE);
 
+  lock_screen ();
+
 #ifdef ENABLE_UPOWER
   if ( helper->sleep_backend == XFSM_SLEEP_BACKEND_UPOWER )
     {
@@ -1812,6 +1859,8 @@ gboolean xfsm_shutdown_helper_hibernate (XfsmShutdownHelper *helper, GError **er
 {
   g_return_val_if_fail (!error || !*error, FALSE);
 
+  lock_screen ();
+
 #ifdef ENABLE_UPOWER
   if ( helper->sleep_backend == XFSM_SLEEP_BACKEND_UPOWER )
     {
 
projeto & código: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
mantenedor atual: Michael Shigorin
mantenedor da tradução: Fernando Martini aka fmartini © 2009