error in example for zenity progress dialog

Bug #1059102 reported by Peter Troesch
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
zenity (Ubuntu)
New
Undecided
Unassigned

Bug Description

'cancel' button does not work
in /usr/share/gnome/help-langpack/zenity/en_GB/progress.page example

the return code tested is -1 "An unexpected error has occurred." rather than 1 "The user has either pressed Cancel, or used the window functions to close the dialog."

change
if [ "$?" = -1 ] ; then
to
if [ "$?" = 1 ] ; then

or maybe
case $? in
    1)
        zenity --error \
          --text="Update canceled."
    ;;
    -1)
        zenity --error \
          --text="An unexpected error has occurred."
    ;;
esac

from /usr/share/gnome/help-langpack/zenity/en_GB:
...
<code>
#!/bin/sh
(
echo "10" ; sleep 1
echo "# Updating mail logs" ; sleep 1
echo "20" ; sleep 1
echo "# Resetting cron jobs" ; sleep 1
echo "50" ; sleep 1
echo "This line will just be ignored" ; sleep 1
echo "75" ; sleep 1
echo "# Rebooting system" ; sleep 1
echo "100" ; sleep 1
) |
zenity --progress \
  --title="Update System Logs" \
  --text="Scanning mail logs..." \
  --percentage=0

if [ "$?" = -1 ] ; then
        zenity --error \
          --text="Update canceled."
fi
</code>
...

ProblemType: Bug
DistroRelease: Ubuntu 12.10
Package: ubuntu-docs 12.10.2
ProcVersionSignature: Ubuntu 3.5.0-16.25-generic 3.5.4
Uname: Linux 3.5.0-16-generic x86_64
ApportVersion: 2.5.3-0ubuntu1
Architecture: amd64
Date: Sun Sep 30 07:16:43 2012
InstallationMedia: Ubuntu 12.10 "Quantal Quetzal" - Alpha amd64 (20120905.2)
PackageArchitecture: all
ProcEnviron:
 PATH=(custom, no user)
 LANG=en_US.UTF-8
 SHELL=/bin/bash
SourcePackage: ubuntu-docs
UpgradeStatus: No upgrade log present (probably fresh install)

Revision history for this message
Peter Troesch (peter-troesch) wrote :
Matthew East (mdke)
affects: ubuntu-docs (Ubuntu) → zenity (Ubuntu)
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.