Re: strange behaviour with p_bar update

On Sun, 2004-07-25 at 20:28, Syed Imran wrote:


my $pbar_update_timeout;

sub button_handler()

    $pbar_update_timeout = Glib::Timeout->add (120, \&pbar_update);

      $pbar->set_text( "...flashing..." );
#     Gtk2->main_iteration while Gtk2->events_pending;


sub watch_callback
      my ($fd, $condition, $fh) = @_;

      if( $condition >= 'in' )
              my $data = <$fh>;
              if( defined $data )
                      my $buffer = $textview->get_buffer;
                      $buffer->insert( $buffer->get_end_iter, $data );

      if( $condition >= 'hup' or $condition >= 'err' )

    Glib::Source->remove ($pbar_update_timeout);

              $fh = undef;


the above wasn't tried, b/c it would be a pain in the ass to get the
code out of an email. send it as an attachment in the future.

there are other things that are kinda messy about the code, that i
haven't touched, but this should work. returning false from the
pbar_update function when called from the timeout closure will uninstall
it. calling it yourself and returning false will do nothing.


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