From 1930a4a763d2136ea41fbdb6daa4249853b950d2 Mon Sep 17 00:00:00 2001 From: Mike Newman Date: Fri, 23 May 2003 16:57:16 +0000 Subject: [PATCH] Hmm, forgot some other bits - support --separate-output, ensure list rows are returned. --- ChangeLog | 3 ++- src/gdialog | 29 +++++++++++++++++++++++++---- 2 files changed, 27 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index e4520c5..efaab9b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,7 +1,8 @@ 2003-05-23 Mike Newman * 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 diff --git a/src/gdialog b/src/gdialog index 63e0e1d..649d3f3 100644 --- a/src/gdialog +++ b/src/gdialog @@ -18,6 +18,7 @@ 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 # this just loads the current arg into $element @@ -31,6 +32,10 @@ ARG: while ($argn < $args) { get_arg; + + # Section 1 : Args which gdialog expects BEFORE box options + # --clear, --backtitle have no obvious effect - ignored + if ($element eq "--title") { # --title argument is almost analogous in gdialog and @@ -39,12 +44,23 @@ ARG: while ($argn < $args) { $argn++; get_arg; $command .= "--title=\"$element\" "; - $argn++; # keep processing args - + $argn++; 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") { @@ -113,7 +129,12 @@ ARG: while ($argn < $args) { # and the 'text' arg as a second column header $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 # bypassing height, width and list-height # from here args run [tag] [item] [status] ... @@ -184,5 +205,5 @@ ARG: while ($argn < $args) { } # execute the constructed zenity command line - +$command .= " 2>&1"; system($command);