Re: Status for long-running operation



One option as already said is a modal dialog with progress bar, another option is to have a progress bar in the main GUI and set the rest of the GUI insensitive (you _really_ should familiarize yourself with gtk_widget_set_sensitive() ).

http://library.gnome.org/devel/gtk/unstable/GtkWidget.html#gtk-widget-set-sensitive

M.

On Sat, Sep 18, 2010 at 3:01 AM, Jeffrey Barish <jeff_barish earthlink net> wrote:
Lex Trotman wrote:

> On 18 September 2010 08:22, Jeffrey Barish <jeff_barish earthlink net>
> wrote:
>> Jeffrey Barish wrote:
>>
>>> My application has one operation that runs for a long time (~1 minute).
>>> During this time, the user is not allowed to do anything.  Nevertheless,
>>> I felt that it was important to give the user some feedback that the
>>> application is still alive and that the operation is running.  My
>>> solution was to print a message in a TextBuffer and follow the message
>>> with a string
>>> of dots that grows in length by one every second.  To get the TextView
>>> to update, I used events_pending/main_iteration.  This all works nicely.
>>> However, because of the events_pending/main_iteration statements, the
>>> entire
>>> GUI is now alive.  Thus, the user is able to do things that disrupt the
>>> long-running operation.  Basically, what I want is a way to get the
>>> TextView to update so that I can update the progress indicator but for
>>> everything
>>> else still to be locked out.  Is there a way to do this?
>>
>> Here's a possibility that seems to work:
>>
>> I used event_handler_set to define an event handler that filters out all
>> events (by not calling main_do_event) except EXPOSE while the
>> long-running operation is underway.  I wish that there were a way to
>> restore the default event handler, but there is only a set method.
>> Anything bad about this solution?
>> --
>> Jeffrey Barish
>
> You should show progress and block the application by showing a modal
> dialog containing a progress bar.
>
> Cheers
> Lex

Good point.  The TextView is where I put all messages, so I didn't want to
put the progress indicator in a different place, if I could avoid it.

My solution still seems to be working, but I worry about having all events
go through my filter all the time because it seems a bit inefficient.
--
Jeffrey Barish

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



--
Please note that according to the German law on data retention,
information on every electronic information exchange with me is
retained for a period of six months.
[Bitte beachten Sie, dass dem Gesetz zur Vorratsdatenspeicherung zufolge
jeder elektronische Kontakt mit mir sechs Monate lang gespeichert wird.]


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