[Frugalware-git] frugal-tweak: *don't hide update system for no root user *start command with gksu or ksu only for now *will probably do that for install package, services configuration...

bouleetbil bouleetbil at frogdev.info
Tue Sep 7 21:57:09 CEST 2010


Git-Url: http://git.frugalware.org/gitweb/gitweb.cgi?p=frugal-tweak.git;a=commitdiff;h=c07a5a389f2957f7d4f6f502f72c4db2f37ba052

commit c07a5a389f2957f7d4f6f502f72c4db2f37ba052
Author: bouleetbil <bouleetbil at frogdev.info>
Date:   Tue Sep 7 21:17:40 2010 +0200

*don't hide update system for no root user
*start command with gksu or ksu only for now
*will probably do that for install package, services configuration...

diff --git a/frugal-mono-tools/MainWindow.cs b/frugal-mono-tools/MainWindow.cs
index df42a19..66ab01f 100644
--- a/frugal-mono-tools/MainWindow.cs
+++ b/frugal-mono-tools/MainWindow.cs
@@ -245,7 +245,6 @@ public partial class MainWindow : Gtk.Window
BTN_Network.Visible=false;
BTN_LoginManager.Visible=false;
BTN_Xorg.Visible=false;
-			BTN_Update.Visible=false;
BTN_Setup.Visible = false;
BTN_UpdateDatabase.Visible = false;
BTN_System.Visible=false;
@@ -895,7 +894,10 @@ public partial class MainWindow : Gtk.Window

protected virtual void OnBTNUpdateClicked (object sender, System.EventArgs e)
{
-		Outils.Excecute("python","/usr/bin/PyFrugalVTE pacman-g2 -Syu",false);
+		if(boRoot)
+			Outils.Excecute("python","/usr/bin/PyFrugalVTE pacman-g2 -Syu",false);
+		else
+			Outils.ExcecuteAsRoot("python /usr/bin/PyFrugalVTE pacman-g2 -Syu",false);
}

protected virtual void OnBTNPrinterClicked (object sender, System.EventArgs e)
diff --git a/frugal-mono-tools/OUTILS/Outils.cs b/frugal-mono-tools/OUTILS/Outils.cs
index f8af9c7..f3524bf 100644
--- a/frugal-mono-tools/OUTILS/Outils.cs
+++ b/frugal-mono-tools/OUTILS/Outils.cs
@@ -74,6 +74,21 @@ namespace frugalmonotools
if (wait) proc.WaitForExit();
return true;
}
+		public static Boolean ExcecuteAsRoot(string Commande,bool wait)
+		{
+			string str_CommandeRoot;
+			if(MainClass.pacmanG2.IsInstalled("gksu-frugalware"))
+			   str_CommandeRoot="gksu";
+			else
+			   str_CommandeRoot="ksu";
+			System.Diagnostics.Process proc = new System.Diagnostics.Process();
+			proc.EnableRaisingEvents=false;
+			proc.StartInfo.FileName = str_CommandeRoot;
+			proc.StartInfo.Arguments = Commande;
+			if (!proc.Start()) return false;
+			if (wait) proc.WaitForExit();
+			return true;
+		}
/// <summary>
///enable disable service,enable = false disable and stop this service
/// </summary>
diff --git a/frugal-mono-tools/gtk-gui/MainWindow.cs b/frugal-mono-tools/gtk-gui/MainWindow.cs
index 46273b9..cadf242 100644
--- a/frugal-mono-tools/gtk-gui/MainWindow.cs
+++ b/frugal-mono-tools/gtk-gui/MainWindow.cs
@@ -311,7 +311,7 @@ public partial class MainWindow
this.ONG_principal = new global::Gtk.Notebook ();
this.ONG_principal.CanFocus = true;
this.ONG_principal.Name = "ONG_principal";
-		this.ONG_principal.CurrentPage = 5;
+		this.ONG_principal.CurrentPage = 1;
// Container child ONG_principal.Gtk.Notebook+NotebookChild
this.vbox4 = new global::Gtk.VBox ();
this.vbox4.Name = "vbox4";
diff --git a/frugal-mono-tools/gtk-gui/gui.stetic b/frugal-mono-tools/gtk-gui/gui.stetic
index fb2fb23..b2805f9 100644
--- a/frugal-mono-tools/gtk-gui/gui.stetic
+++ b/frugal-mono-tools/gtk-gui/gui.stetic
@@ -27,7 +27,7 @@
<widget class="Gtk.Notebook" id="ONG_principal">
<property name="MemberName" />
<property name="CanFocus">True</property>
-        <property name="CurrentPage">5</property>
+        <property name="CurrentPage">1</property>
<child>
<widget class="Gtk.VBox" id="vbox4">
<property name="MemberName" />


More information about the Frugalware-git mailing list