Hmm, forgot some other bits - support --separate-output, ensure list rows

are returned.
This commit is contained in:
Mike Newman 2003-05-23 16:57:16 +00:00
parent c4bdad5128
commit 1930a4a763
2 changed files with 27 additions and 5 deletions

View File

@ -1,7 +1,8 @@
2003-05-23 Mike Newman <mikegtn@gnome.org> 2003-05-23 Mike Newman <mikegtn@gnome.org>
* src/gdialog: fixed --textbox to actually load filename * src/gdialog: fixed --textbox to actually load filename
specified. specified. Added --separate-output support. Make sure we get
output from list widgets.
2003-05-20 Mike Newman <mikegtn@gnome.org> 2003-05-20 Mike Newman <mikegtn@gnome.org>

View File

@ -18,6 +18,7 @@ my $command = "zenity "; # the command line we build up to execute
my $element = ""; # current bit of command line my $element = ""; # current bit of command line
my $argn = 0; # counter for walking args my $argn = 0; # counter for walking args
my $args = $#ARGV + 1; # total number of command line arguments my $args = $#ARGV + 1; # total number of command line arguments
my $separator = 0; # set if --separate-output is in use
# this just loads the current arg into $element # this just loads the current arg into $element
@ -31,6 +32,10 @@ ARG: while ($argn < $args) {
get_arg; get_arg;
# Section 1 : Args which gdialog expects BEFORE box options
# --clear, --backtitle have no obvious effect - ignored
if ($element eq "--title") { if ($element eq "--title") {
# --title argument is almost analogous in gdialog and # --title argument is almost analogous in gdialog and
@ -39,12 +44,23 @@ ARG: while ($argn < $args) {
$argn++; $argn++;
get_arg; get_arg;
$command .= "--title=\"$element\" "; $command .= "--title=\"$element\" ";
$argn++;
# keep processing args # keep processing args
$argn++;
next ARG; next ARG;
} }
if ($element eq "--separate-output") {
# set the flag to pring list output line by line
$separator = 1;
# keep processing args
$argn++;
next ARG;
}
# Section 2 : Box Options and subsequent args
if ($element eq "--msgbox" || $element eq "--infobox") { if ($element eq "--msgbox" || $element eq "--infobox") {
@ -113,7 +129,12 @@ ARG: while ($argn < $args) {
# and the 'text' arg as a second column header # and the 'text' arg as a second column header
$command .= "--list $list --column='' --column $element "; $command .= "--list $list --column='' --column $element ";
# should output be line by line?
if ($separator) {
$command .= " --separator='\n' ";
}
# Skip to the first 'item' arg of the list content # Skip to the first 'item' arg of the list content
# bypassing height, width and list-height # bypassing height, width and list-height
# from here args run [tag] [item] [status] ... # from here args run [tag] [item] [status] ...
@ -184,5 +205,5 @@ ARG: while ($argn < $args) {
} }
# execute the constructed zenity command line # execute the constructed zenity command line
$command .= " 2>&1";
system($command); system($command);