Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/fast-user-switch-applet/ChangeLog,v
retrieving revision 1.52
diff -p -u -r1.52 ChangeLog
--- ChangeLog	16 Jul 2005 11:08:42 -0000	1.52
+++ ChangeLog	25 Jul 2005 15:35:40 -0000
@@ -1,3 +1,8 @@
+2005-07-25  William Jon McCann  <mccann@jhu.edu>
+
+	* src/applet.c (have_gnome_screensaver, maybe_lock_screen):
+	Add gnome-screensaver support
+
 === 0.2.3 ===
 
 2005-07-16  James M. Cape  <jcape@ignore-your.tv>
Index: src/applet.c
===================================================================
RCS file: /cvs/gnome/fast-user-switch-applet/src/applet.c,v
retrieving revision 1.16
diff -p -u -r1.16 applet.c
--- src/applet.c	3 Jun 2005 11:13:47 -0000	1.16
+++ src/applet.c	25 Jul 2005 15:35:40 -0000
@@ -2157,6 +2157,17 @@ run_switch (FusaAppletData *adata,
 			      manager_new_console_cb, adata, NULL);
 }
 
+static gboolean
+have_gnome_screensaver (void)
+{
+  gchar *tmp;
+
+  tmp = g_find_program_in_path ("gnome-screensaver-command");
+  g_free (tmp);
+
+  return (tmp != NULL);
+}
+
 static void
 maybe_lock_screen (FusaAppletData *adata,
 		   FusaDisplay    *display)
@@ -2164,33 +2175,49 @@ maybe_lock_screen (FusaAppletData *adata
   if (panel_applet_gconf_get_bool (adata->applet, LOCK_KEY, NULL) &&
       !fusa_display_get_nested (display))
     {
-      static gchar *lock_args[] = {
-	"xscreensaver-command",
-	"-lock",
-	NULL
-      };
-      static gchar *throttle_args[] = {
-	"xscreensaver-command",
-	"-throttle",
-	NULL
-      };
-      GError *err;
+      const gchar *lock_args[3];
+      const gchar *throttle_args[3];
+      GError      *err;
+
+      if (have_gnome_screensaver ())
+        {
+          lock_args[0] = "gnome-screensaver-command";
+          lock_args[1] = "--lock";
+          lock_args[2] = NULL;
+
+          throttle_args[0] = "gnome-screensaver-command";
+          throttle_args[1] = "--throttle";
+          throttle_args[2] = NULL;
+        }
+      else
+        {
+          lock_args[0] = "xscreensaver-command";
+          lock_args[1] = "-lock";
+          lock_args[2] = NULL;
+
+          throttle_args[0] = "xscreensaver-command";
+          throttle_args[1] = "-throttle";
+          throttle_args[2] = NULL;
+        }
 
       err = NULL;
-      if (!g_spawn_async (g_get_home_dir (), lock_args, NULL,
-			  (G_SPAWN_STDERR_TO_DEV_NULL |
-			   G_SPAWN_STDOUT_TO_DEV_NULL |
-			   G_SPAWN_SEARCH_PATH),
-			  NULL, NULL, NULL, &err))
+      if (!gdk_spawn_on_screen (gdk_screen_get_default (),
+                                g_get_home_dir (), lock_args, NULL,
+                                (G_SPAWN_STDERR_TO_DEV_NULL |
+                                 G_SPAWN_STDOUT_TO_DEV_NULL |
+                                 G_SPAWN_SEARCH_PATH),
+                                NULL, NULL, NULL, &err))
 	{
 	  g_warning (_("Can't lock screen: %s"), err->message);
 	  g_error_free (err);
 	}
-      else if (!g_spawn_async (g_get_home_dir (), throttle_args, NULL,
-			       (G_SPAWN_STDERR_TO_DEV_NULL |
-				G_SPAWN_STDOUT_TO_DEV_NULL |
-				G_SPAWN_SEARCH_PATH),
-			       NULL, NULL, NULL, &err))
+
+      if (!gdk_spawn_on_screen (gdk_screen_get_default (),
+                                g_get_home_dir (), throttle_args, NULL,
+                                (G_SPAWN_STDERR_TO_DEV_NULL |
+                                 G_SPAWN_STDOUT_TO_DEV_NULL |
+                                 G_SPAWN_SEARCH_PATH),
+                                NULL, NULL, NULL, &err))
 	{
 	  g_warning (_("Can't temporarily set screensaver to blank screen: %s"),
 		     err->message);
