After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 160654 - zenity needs a timeout option
zenity needs a timeout option
Status: RESOLVED FIXED
Product: zenity
Classification: Core
Component: general
2.10.x
Other Linux
: Normal enhancement
: ---
Assigned To: Zenity Maintainers
Zenity Maintainers
Depends on:
Blocks:
 
 
Reported: 2004-12-07 02:21 UTC by Glynn Foster
Modified: 2007-08-13 20:38 UTC
See Also:
GNOME target: ---
GNOME version: Unversioned Enhancement


Attachments
Timeout Patch impl' (15.00 KB, patch)
2005-06-27 02:51 UTC, Muthiah Annamalai
none Details | Review
Test Case for timeout patch. (327 bytes, text/plain)
2005-06-27 02:51 UTC, Muthiah Annamalai
  Details
Patch against latest CVS head. Adds 1 feature only. (6.52 KB, patch)
2005-06-27 03:55 UTC, Muthiah Annamalai
none Details | Review
Test Case for timeout patch, excludes --extra-button stuff. (195 bytes, text/plain)
2005-06-27 03:56 UTC, Muthiah Annamalai
  Details
Timeout Patch impl' which replaces 'gtk_timeout_add' by 'g_timeout_add', and removes notification timeouts. (6.42 KB, patch)
2005-06-27 04:26 UTC, Muthiah Annamalai
none Details | Review
Adds a ZENITY_TIMEOUT enum return code, for dialogs killed on timeout. (6.07 KB, patch)
2005-06-27 04:44 UTC, Muthiah Annamalai
none Details | Review
Adds a ZENITY_TIMEOUT enum return code, for dialogs killed on timeout. (6.07 KB, patch)
2005-06-27 04:45 UTC, Muthiah Annamalai
none Details | Review
Adds a progress bar with time-remaining for the dialog before timeout expires. (9.33 KB, patch)
2005-06-27 09:11 UTC, Muthiah Annamalai
none Details | Review
Adds new changes with option checking etc, (11.37 KB, patch)
2005-07-03 16:12 UTC, Muthiah Annamalai
none Details | Review
screenshot with implemented patch, (27.26 KB, image/png)
2005-07-03 16:13 UTC, Muthiah Annamalai
  Details

Description Glynn Foster 2004-12-07 02:21:33 UTC
From: 	MDK <mdk@mdk.org.pl>
To: 	Glynn.Foster@Sun.COM
Subject: 	Zenity - feature suggestion
Date: 	Wed, 13 Oct 2004 02:16:15 +0200  (13:16 NZDT)

Hey,

thanks for Zenity, it's a cool tool. But there is one thing I'm really
missing - the TIMEOUT feature. I'd like some windows to automaticly
timeout (disappear) after some time, returning the default value (ie
button pressed). This way, I could use Zenity in my cron scripts! 

-- 
Micha&#322; Dominik K.
mdk@mdk.org.pl
www.mdk.org.pl
Comment 1 Lucas Rocha 2004-12-07 19:11:15 UTC
Should it be applied to all dialog types?
Comment 2 Muthiah Annamalai 2005-06-26 14:13:56 UTC
I guess having a timeout is just very simple to implement, and necessary, as use
case shows. --timeout=$SECONDS will be a valid option I guess.

I also think this is necessary for all dialogs
to have this patch. Whats your opinion?

Thanks
Muthu.
Comment 3 Muthiah Annamalai 2005-06-27 02:51:06 UTC
Created attachment 48389 [details] [review]
Timeout Patch impl'

adds a --timeout=$SECONDS type of option to zenity for all
dialogs, in 'general_options' variable.
Comment 4 Muthiah Annamalai 2005-06-27 02:51:54 UTC
Created attachment 48390 [details]
Test Case for timeout patch.

Just runs many dialogs with timeout options  from
the shell.
Comment 5 Muthiah Annamalai 2005-06-27 03:55:38 UTC
Created attachment 48392 [details] [review]
Patch against latest CVS head. Adds 1 feature only.

adds a --timeout=$SECONDS type of option to zenity for all
dialogs, in 'general_options' variable.
Comment 6 Muthiah Annamalai 2005-06-27 03:56:47 UTC
Created attachment 48393 [details]
Test Case for timeout patch, excludes --extra-button stuff.

New test case, for 48392 patch.
Comment 7 Muthiah Annamalai 2005-06-27 04:26:17 UTC
Created attachment 48396 [details] [review]
Timeout Patch impl' which replaces 'gtk_timeout_add'  by 'g_timeout_add', and removes notification timeouts.

Test case 48393 stays. Patch changes.
Comment 8 Muthiah Annamalai 2005-06-27 04:44:41 UTC
Created attachment 48398 [details] [review]
Adds a ZENITY_TIMEOUT enum return code, for dialogs killed on timeout.

betters 48396 by adding a 'ZENITY_TIMEOUT' return code.
Comment 9 Muthiah Annamalai 2005-06-27 04:45:26 UTC
Created attachment 48399 [details] [review]
Adds a ZENITY_TIMEOUT enum return code, for dialogs killed on timeout.

betters 48396 by adding a 'ZENITY_TIMEOUT' return code. Fixes some indentation
and coding style.
Comment 10 Muthiah Annamalai 2005-06-27 09:11:35 UTC
Created attachment 48404 [details] [review]
Adds a progress bar with time-remaining for the dialog before timeout expires.

Implements zenity_util_timeout_add() & zenity_util_timeout_widget_add()
to add timeout, and a progress bar to show the timeout details.
Comment 11 Lucas Rocha 2005-07-03 04:37:13 UTC
Muthiah, this patch doesn't seem to come from zenity CVS HEAD but from a changed
local version. Generate the patch by diffing from CVS HEAD.

The option handling is incomplete because you need to test in which dialogs the
--timeout option can be used or not.

You should think about which dialogs really should have timeout.  IMHO, file
selection, progress and notification are not candidates.
Comment 12 Muthiah Annamalai 2005-07-03 16:11:12 UTC
Lucas: Thanks for comments on the patch.
Ive reworked the against CVS repostiory checked out
from anoncvs/gnome/org.

I think timeout needs to be a general option
for all dialogs, maybe except the 'about dialog',
because according to the bug-reporter, he needs
to run zenity from his crond. You have the 
final say, and if you really think other dialogs
dont need timeout, I can still rework the patch.

This copy adds, progressbars to all the dialogs,
except 'about dialog', and checks the options correctly.


Cheers
Muthu.
Comment 13 Muthiah Annamalai 2005-07-03 16:12:21 UTC
Created attachment 48595 [details] [review]
Adds new changes with option checking etc,
Comment 14 Muthiah Annamalai 2005-07-03 16:13:43 UTC
Created attachment 48596 [details]
screenshot with implemented patch,
Comment 15 Lucas Rocha 2005-07-08 23:32:39 UTC
Muthiah, I don't think the progress bar is the best aproach to give visual
feedback about the remaining time. I'll talk about it with the usability guys. 

We can stay with timeout feature on all dialogs except file-selection,
notification and progress, ok? Though, I need to think more about this.
Comment 16 Brice Goglin 2006-07-25 05:09:08 UTC
What's the status of this feature? I'd really like to have it. I don't care about having a progress bar or anything else to show the remaining time before automatic closing.

Thanks in advance!
Comment 17 Motin / Fredrik 2006-10-07 06:29:06 UTC
I know this is ugly - but I couldn't wait for the timeout-option to be finished, so i made this work-around:

zenity --entry --text "Enter text. Timeout is 5 seconds" > /tmp/zenitylastanswer &
sleep 5
killall zenity > /dev/null 2>&1
echo Zenity output: `cat /tmp/zenitylastanswer`
Comment 18 era+gnome 2007-02-15 07:46:27 UTC
"killall" is a little bit brutal. You can know the PID of the process and kill only that:

zenity_with_timeout () {
  zenity "$@" >/tmp/orary & #### FIXME: use mktemp or some such
  zenity_timeout_pid=$!  
  sleep 5  #### FIXME: if zenity finishes before 5 seconds elapsed, this is silly
  if test -z /tmp/orary ; then
    kill $zenity_timeout_pid
  else
    echo -n 'Zenity output: '
    cat /tmp/orary
  fi
  rm /tmp/orary
}

The problem with the unconditional sleep can be fixed with a SIGALRM handler but of course, the best thing would be if the available patch could be accepted and committed (sans the rather superfluous "time remaining" thing, until somebody comes up with a usable and useful implementation for that).
Comment 19 Ramon de Ruiter 2007-03-06 21:57:47 UTC
I managed to copy&paste the last patch into the current SVN code. 
For me it seems to work fine but I think it'd be nice if it was integrated in mainstream. What would it take for the patch to be accepted?

I also mailed Glynn Foster about this but he hasn't responded yet.

Lucas: I'm really interested in whether you've had that talk with the usability people and what came out of it.
Comment 20 André Klapper 2007-05-15 19:01:46 UTC
lucas, gnome-target is meant to be used on bugs severe enough to possibly require
delaying GNOME releases.  The target milestone is the field you want for bugs
you'd like to remember to fix by a certain release.  You can add target
milestones for your product by clicking on the "Edit this product" link in the
lower-right hand corner of the browse.cgi ("product overview") page.  See also
the "Target Milestone" and "GNOME Target Milestone" sections of
http://bugzilla.gnome.org/page.cgi?id=bug-status.html.  :-)

(i cannot consider an enhancement request as a relaease blocker, that's why i will remove the gnome-target.)
Comment 21 Lucas Rocha 2007-08-13 20:38:44 UTC
This problem has been fixed in the development version. The fix will be available in the next major software release. Thank you for your bug report.

2007-08-13  Lucas Rocha  <lucasr@gnome.org>

        * src/*.c: added timeout option to all dialogs (Fixes bug #160654).
        Based on patch from Muthiah Annamalai <gnumuthu@users.sf.net>.