From 82b76239aa0d85d24778e68c5bf0fb51e9d25b0a Mon Sep 17 00:00:00 2001 From: Glynn Foster Date: Mon, 1 Sep 2003 18:44:19 +0000 Subject: Add patch from Buchan Miln to fix the gdialog wrapper. 2003-09-01 Glynn Foster * src/gdialog.in: Add patch from Buchan Miln to fix the gdialog wrapper. --- src/gdialog.in | 31 +++++++++++++++++++++++++------ 1 file changed, 25 insertions(+), 6 deletions(-) (limited to 'src/gdialog.in') diff --git a/src/gdialog.in b/src/gdialog.in index 004571ba..ff47010d 100755 --- a/src/gdialog.in +++ b/src/gdialog.in @@ -259,26 +259,45 @@ ARG: while ($argn < $args) { $argn++; get_arg; - # a gdialog --menu is just a one column zenity --list + # a gdialog --menu is just a two column zenity --list + # Leave the first column blank (not provided) # Use the 'text' arg as a second column header # FIXME: or should it be the dialog text, or both? - $command .= "--list --column $element "; + $command .= "--list --column '' --column \"$element\" "; # Skip to the first 'item' arg of the list content - # bypassing height, width and list-height + # after using height, width and bypassing list-height # from here args run [tag] [item] ... - $argn += 5; + $argn += 1; + + get_arg; + # Height and width in characters to be displayed, so adjust + # cdialog uses 6 height for non-list, zenity uses ~24 pixels + # per list entry (default font), and 103 pixels for non-list + # This appears to be almost exact + $element = $element*24 - 35; + $command .= " --height $element"; + + $argn += 1; + get_arg; + # cdialog uses 6 width for non-list, zenity uses ~7 pixels + # per character (default font), and 22 pixels for non-list + # This is not exact, but close enough + $element = $element*7 - 20; + $command .= " --width $element " ; + + $argn += 2; # Loop over the remainder of the commandline - # discarding the 'tag' args of each item + # keeping 'tag' args of each item (required to return) # and using the 'item' for display in our second column while ($argn < $args) { get_arg; $command .= "$element "; - $argn += 2; + $argn += 1; } last ARG; } -- cgit