use strict;
use Glib qw(FALSE TRUE);
use Gnome2;
use Gnome2::VFS -init;
use Gtk2 -init;
set_locale Gtk2;
init Gtk2;
use Gtk2::GladeXML;
use Gtk2::Helper;
use Gtk2::Pango;
use Gtk2::SourceView;
use IPC::Open3;
use Monotone::AutomateStdio;
use POSIX qw(:errno_h :sys_wait_h);
use POSIX qw(strftime);
####
sub gtk2_update()
{
return if (Gtk2->main_level() == 0);
while (Gtk2->events_pending())
{
Gtk2->main_iteration();
}
}
####
sub make_busy($$)
{
my($instance, $busy) = @_;
# Create and store the cursors if we haven't done so already.
if (! exists($instance->{busy_cursor}))
{
$instance->{normal_cursor} = Gtk2::Gdk::Cursor->new("left-ptr");
$instance->{busy_cursor} = Gtk2::Gdk::Cursor->new("watch");
}
# Do it. Make the application bar grab the input when the window is
# busy, that way we gobble up keyboard and mouse events that could
# muck up the application state.
if ($busy)
{
$instance->{window}->window()->
set_cursor($instance->{busy_cursor});
Gtk2->grab_add($instance->{appbar});
}
else
{
$instance->{window}->window()->
set_cursor($instance->{normal_cursor});
Gtk2->grab_remove($instance->{appbar});
}
}