On 10/1/10, IMP Technologies - Tajinder Singh <[email protected]> wrote:
>
> I have created a small basic interface for Fedora to change Plymouth theme.
> But as changing theme requires to run some commands as root, I would like to
> ask for root password before starting the application.
> Similarly whenever we run 'system-config-boot' or other software that
> requires root privileges.
>
Here's how I did it in the Main class of a system utility that manages
the kernel cpufreq settings:
<CODE>
' Gambas module file
PUBLIC SUB Main()
DIM Ret AS String
IF System.User.Id <> 0 THEN
EXEC ["which", "gksu"] TO Ret
IF InStr(Ret, "gksu") THEN
EXEC ["gksu", Application.Path &/ "vcpufreq.gambas"]
ELSE
EXEC ["which", "kdesu"] TO Ret
IF InStr(Ret, "kdesu") THEN
EXEC ["kdesu", Application.Path &/ "vcpufreq.gambas"]
ELSE
PRINT "No gksu or kdesu available (try vcpufreq in a root terminal)..."
ENDIF
ENDIF
QUIT
ELSE
Global.root = TRUE
ENDIF
FMain.Show ' Show main form...
END
</CODE>
Regards,
Joe1962
------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1, ECMAScript5, and DOM L2 & L3.
Spend less time writing and rewriting code and more time creating great
experiences on the web. Be a part of the beta today.
http://p.sf.net/sfu/beautyoftheweb
_______________________________________________
Gambas-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gambas-user