[gdm-list] [PATCH] prefer gnome-screensaver when installed



Hi

All GNOME modules are now preferring, when available, gnome-screensaver
instead of xscreensaver. So, attached patch does the same for gdm.

Ok to commit?
-- 
Rodrigo Moya <rodrigo novell com>
Index: gui/gdmflexiserver.c
===================================================================
RCS file: /cvs/gnome/gdm2/gui/gdmflexiserver.c,v
retrieving revision 1.31
diff -u -p -r1.31 gdmflexiserver.c
--- gui/gdmflexiserver.c	18 Aug 2005 21:40:11 -0000	1.31
+++ gui/gdmflexiserver.c	22 Aug 2005 12:11:01 -0000
@@ -394,14 +394,26 @@ run_again:
 			/* we switched to a different screen as a result of this,
 			 * lock the current screen */
 			if ( ! no_lock && vt != get_cur_vt () && vt >= 0) {
-				char *argv[3] = {"xscreensaver-command",
-					"-lock", NULL};
+				char *argv[3], *path, *throttle_arg;
+
+				if ((path = g_find_program_in_path ("gnome-screensaver-command"))) {
+					argv[0] = "gnome-screensaver-command";
+					argv[1] = "--lock";
+					argv[2] = NULL;
+					throttle_arg = "--throttle";
+					g_free (path);
+				} else {
+					argv[0] = "xscreensaver-command";
+					argv[1] = "-lock";
+					argv[2] = NULL;
+					throttle_arg = "-throttle";
+				}
 
 				if (gnome_execute_async (g_get_home_dir (),
 				    2, argv) < 0)
 					g_warning (_("Can't lock screen"));
 
-				argv[1] = "-throttle";
+				argv[1] = throttle_arg;
 
 				if (gnome_execute_async (g_get_home_dir (),
 				    2, argv) < 0)
@@ -814,7 +826,21 @@ main (int argc, char *argv[])
 		/* if we switched to a different screen as a result of this,
 		 * lock the current screen */
 		if ( ! no_lock && ! use_xnest) {
-			char *argv[3] = {"xscreensaver-command", "-lock", NULL};
+			char *argv[3], *path, *throttle_arg;
+
+			if ((path = g_find_program_in_path ("gnome-screensaver-command"))) {
+				argv[0] = "gnome-screensaver-command";
+				argv[1] = "--lock";
+				argv[2] = NULL;
+				throttle_arg = "--throttle";
+				g_free (path);
+			} else {
+				argv[0] = "xscreensaver-command";
+				argv[1] = "-lock";
+				argv[2] = NULL;
+				throttle_arg = "-throttle";
+			}
+
 			if (gnome_execute_async (g_get_home_dir (), 2, argv) < 0)
 				g_warning (_("Can't lock screen"));
 			argv[1] = "-throttle";


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]