[gnome-commander/gcmd-1-2-8] Fixed problem #626469 (add support for other su-like programs: xdg-su, gnomesu)



commit 7133f0e2624713e1c9da2302f378987f062b4f35
Author: Vincent Untz <vuntz gnome org>
Date:   Tue Aug 17 23:15:45 2010 +0200

    Fixed problem #626469 (add support for other su-like programs: xdg-su, gnomesu)

 NEWS                          |    1 +
 doc/C/gnome-commander.xml     |    3 ++
 src/gnome-cmd-user-actions.cc |   42 ++++++++++++++++++++++++++--------------
 3 files changed, 31 insertions(+), 15 deletions(-)
---
diff --git a/NEWS b/NEWS
index 0439711..04e9229 100644
--- a/NEWS
+++ b/NEWS
@@ -4,6 +4,7 @@ gnome-commander 1.2.8.8
 
 Bug fixes:
  * Fixed problem #610764 (menu item won't stay checked)
+ * Fixed problem #626469 (add support for other su-like programs: xdg-su, gnomesu)
  * Fixed problem with broken Spanish translation
 
 
diff --git a/doc/C/gnome-commander.xml b/doc/C/gnome-commander.xml
index 6834f3e..2e972b8 100644
--- a/doc/C/gnome-commander.xml
+++ b/doc/C/gnome-commander.xml
@@ -6056,6 +6056,9 @@
                             <para>Fixed problem #610764 (menu item won't stay checked)</para>
                         </listitem>
                         <listitem>
+                            <para>Fixed problem #626469 (add support for other su-like programs: xdg-su, gnomesu)</para>
+                        </listitem>
+                        <listitem>
                             <para>Fixed problem with broken Spanish translation</para>
                         </listitem>
                     </itemizedlist>
diff --git a/src/gnome-cmd-user-actions.cc b/src/gnome-cmd-user-actions.cc
index debcff9..2f9b0aa 100644
--- a/src/gnome-cmd-user-actions.cc
+++ b/src/gnome-cmd-user-actions.cc
@@ -1106,25 +1106,37 @@ void command_open_nautilus_in_cwd (GtkMenuItem *menuitem, gpointer not_used)
 
 void command_root_mode (GtkMenuItem *menuitem, gpointer not_used)
 {
-    char *su;
+    char *su = NULL;
+    gboolean need_c = FALSE;
 
-    su = g_find_program_in_path ("gksu");
-    if  (!su)
-        su = g_find_program_in_path ("beesu");
-    if  (!su)
-        su = g_find_program_in_path ("kdesu");
+    if ((su = g_find_program_in_path ("xdg-su")))
+        goto with_c_param;
+    if ((su = g_find_program_in_path ("gksu")))
+        goto without_c_param;
+    if ((su = g_find_program_in_path ("gnomesu")))
+        goto with_c_param;
+    if ((su = g_find_program_in_path ("beesu")))
+        goto without_c_param;
+    if ((su = g_find_program_in_path ("kdesu")))
+        goto without_c_param;
 
-    if  (!su)
-    {
-        gnome_cmd_show_message (NULL, _("gksu, kdesu or beesu is not found."));
-        return ;
-    }
+    gnome_cmd_show_message (NULL, _("xdg-su, gksu, gnomesu, kdesu or beesu is not found."));
+    return;
+
+  with_c_param:
+
+    need_c = TRUE;
+
+  without_c_param:
 
-    char *argv[3];
+    char *argv[4];
+    int i = 0;
 
-    argv[0] = su;
-    argv[1] = g_get_prgname ();
-    argv[2] = NULL;
+    argv[i++] = su;
+    argv[i++] = g_get_prgname ();
+    if (need_c)
+        argv[i++] = "-c";
+    argv[i++] = NULL;
 
     GError *error = NULL;
 



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