GNOME Bugzilla – Bug 160654
zenity needs a timeout option
Last modified: 2007-08-13 20:38:44 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ł Dominik K. mdk@mdk.org.pl www.mdk.org.pl
Should it be applied to all dialog types?
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.
Created attachment 48389 [details] [review] Timeout Patch impl' adds a --timeout=$SECONDS type of option to zenity for all dialogs, in 'general_options' variable.
Created attachment 48390 [details] Test Case for timeout patch. Just runs many dialogs with timeout options from the shell.
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.
Created attachment 48393 [details] Test Case for timeout patch, excludes --extra-button stuff. New test case, for 48392 patch.
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.
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.
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.
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.
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.
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.
Created attachment 48595 [details] [review] Adds new changes with option checking etc,
Created attachment 48596 [details] screenshot with implemented patch,
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.
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!
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`
"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).
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.
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.)
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>.