Description: Support gdmflexiserver or dm-tool
 gdmflexiserver is no longer provided by lightdm. Use dm-tool if it is
 available.
Author: Sean Davis <smd.seandavis@gmail.com>
Bug-Ubuntu: https://launchpad.net/bugs/1320560
Last-Update: 2014-10-11
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- a/plugins/actions/actions.c
+++ b/plugins/actions/actions.c
@@ -860,9 +860,17 @@
   GError          *error = NULL;
 
   /* check for commands we use */
-  path = g_find_program_in_path ("gdmflexiserver");
+  path = g_find_program_in_path ("dm-tool");
   if (path != NULL)
     PANEL_SET_FLAG (allow_mask, ACTION_TYPE_SWITCH_USER);
+  else
+    {
+      /* check for gdmflexiserver if no dm-tool */
+      g_free (path);
+      path = g_find_program_in_path ("gdmflexiserver");
+      if (path != NULL)
+        PANEL_SET_FLAG (allow_mask, ACTION_TYPE_SWITCH_USER);
+    }
   g_free (path);
 
   path = g_find_program_in_path ("xflock4");
@@ -917,6 +925,7 @@
   gboolean       succeed = FALSE;
   XfconfChannel *channel;
   gboolean       allow_save;
+  gchar       *path;
 
   entry = g_object_get_qdata (G_OBJECT (widget), action_quark);
   panel_return_if_fail (entry != NULL);
@@ -965,7 +974,12 @@
       break;
 
     case ACTION_TYPE_SWITCH_USER:
-      succeed = g_spawn_command_line_async ("gdmflexiserver", &error);
+      path = g_find_program_in_path ("dm-tool");
+      if (path != NULL)
+        succeed = g_spawn_command_line_async ("dm-tool switch-to-greeter", &error);
+      else
+        succeed = g_spawn_command_line_async ("gdmflexiserver", &error);
+      g_free (path);
       break;
 
     case ACTION_TYPE_LOCK_SCREEN:
