[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
Re: Run menu action in background
- From: "Philipp E. Letschert" <phil uni-koblenz de>
- To: gtk-perl-list gnome org
- Subject: Re: Run menu action in background
- Date: Thu, 11 Jan 2007 16:26:21 +0100
On Wed, Jan 10, 2007 at 10:51:26PM -0500, muppet wrote:
>
> On Jan 10, 2007, at 8:36 PM, Philipp E. Letschert wrote:
>
> >I have a subroutine connected to a popup menu item. When that
> >routine is
> >finished a new popup window displays the result. Sometimes the
> >routine takes
> >longer to finish and during that time the popup menu stays visible.
> >
> >How can I run the subroutine in background and have the popup menu
> >disappear
> >right after activating the menu item?
>
> Have your menu item handler install an idle action that starts the
> dialog box. That is:
>
> 1 user activates menu item
> 2 menu handler is called
> 3 menu handler does Glib::Idle->add (\&do_the_thing);
> 4 menu handler finishes, menu disappears
> 5 control returns to main loop
> 6 main loop sees that there is a pending idle action
> 7 do_the_thing() fires
> 8 do_the_thing() launches your dialog box
>
> In essence, it's just a layer of indirection to defer running the
> dialog box until "sometime later".
Thanks, partial success. The menu disappears as requested, but when step 7 is
reached, the main window freezes until do_the_thing() finishes. It would be
great if the user could continue using the application normally during the
subroutine runs (and queue additional calls to that subroutine...).
Setting a lower priority with
Glib::Idle->add(\&do_the_thing, $data, 300);
did not work as desired, I've looked up the API, the tutorial and other sources,
but haven't found the right answer (or overlooked it?).
Currently I'm also a bit confused if this is a Glib/Gtk issue or perl-specific
(fork, threads?).
Additional hints, or a pointer to a working solution would be very nice.
TIA, Phil
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]