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



commit 5a54b528b69ed831643bec28a8a53e10a8de467b
Author: Vincent Untz <vuntz gnome org>
Date:   Mon Sep 6 23:59:56 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 |   49 +++++++++++++++++++++++++----------------
 3 files changed, 34 insertions(+), 19 deletions(-)
---
diff --git a/NEWS b/NEWS
index 8012d50..4f5e954 100644
--- a/NEWS
+++ b/NEWS
@@ -29,6 +29,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 4ee6fb0..15d4f0d 100644
--- a/doc/C/gnome-commander.xml
+++ b/doc/C/gnome-commander.xml
@@ -7429,6 +7429,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 bf13a76..84914b2 100644
--- a/src/gnome-cmd-user-actions.cc
+++ b/src/gnome-cmd-user-actions.cc
@@ -1197,25 +1197,36 @@ void command_open_nautilus_in_cwd (GtkMenuItem *menuitem, gpointer not_used)
 
 void command_root_mode (GtkMenuItem *menuitem, gpointer not_used)
 {
-    char *su;
-
-    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)
-    {
-        gnome_cmd_show_message (*main_win, _("gksu, kdesu or beesu is not found."));
-        return ;
-    }
-
-    char *argv[3];
-
-    argv[0] = su;
-    argv[1] = g_get_prgname ();
-    argv[2] = NULL;
+   char *su = NULL;
+   gboolean need_c = FALSE;
+
+   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;
+
+   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[4];
+   int i = 0;
+
+   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]