Viewing file: gdialog (9.01 KB) -rwxr-xr-x Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
#!/usr/bin/perl
# gdialog -> zenity conversion wrapper
#
# by Mike Newman
#
# This is all, of course, horrible - but it should translate
# most commond gdialog types to zenity equivalents. It will mostly drop
# the pointless and unused (even by gdialog!) size arguments
# but hopefully will translate all the others.
#
# For testing purposes, I've used a couple of the nautilus scripts
# available at http://g-scripts.sourceforge.net - what is sometimes
# unclear is what is a gdialog/zenity translation problem, and what is
# a problem with the original script
my @command = ("zenity"); # the command line we build up to execute
my $element = ""; # current bit of command line
my $argn = 0; # counter for walking args
my $args = $#ARGV + 1; # total number of command line arguments
my $separator = 0; # set if --separate-output is in use
# Additon by: Kevin C. Krinke (kck)
#
# gdialog itself supports both the X-Windows interface as well as a console
# interface. Here's a fix to use regular dialog when appropriate.
# This should probably be a more advanced test of some sort, but I don't know
# of any other easy way of detecting and X-Windows environment. If someone does
# know better, please let me know. So for now this works: "no DISPLAY; no X".
unless (defined $ENV{'DISPLAY'} && length($ENV{'DISPLAY'})) {
# reset the command string
@command = ();
# examine all the available/default paths
my $PATHS = ($ENV{'PATH'} bool(false)
|