Re: dialog with timeout



I'll take a crack at this one :)

First, create a standard dialog box with the cancel button set to close
the dialog.  Make the dialog modal and call gtk_window_set_transients to
force the dialog to stay on top of the parent window.  For the retries
and the progress bar, call gtk_timeout_add() and set it to call a
"retry" function every second.  In the retry func, try to connect to the
remote service and update the progress bar (you will need to do
while(gtk_events_pending()) {gtk_main_iteration()} to update the
progress bar on the screen while still in the timeout func).  If you
successfully connect, close the dialog and return TRUE to disable the
timout.  Otherwise, leave the dialog on screen and return FALSE - this
will leave the timeout in place to call you back again in another
second.

Simple :)



Lance

On 10 May 2001 08:47:00 -0700, Dave Morse wrote:


----------
From:       Dave Morse[SMTP:DM-GTK BOMBERLAN NET]
Sent:       Thursday, May 10, 2001 9:47:00 AM
To:         gtk-app-devel-list gnome org
Subject:    dialog with timeout
Auto forwarded by a Rule

_________________________________________________
|Connecting to 12.34.56.78:9012                 |
|_______________________________________________|
|                                               |
|                                               |
| [==============            (try 2/10)      ]  |  <-- progress bar
|                                               |
|                                               |
|                                       CANCEL  |
|_______________________________________________|


I'm trying to create a modal dialog with a timeout.  The interface is
connecting to a remote service.  This may fail up to ten times, each try
should be seperated by 1 second of "idleness", where idleness means
checking to see if the user has clicked the Cancel button, etc.  

How to do it?


_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

-- 





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]