#=====================================================================#
#                                                                     #
# This is the 'Alert_Window' class                                    #
#                                                                     #
#=====================================================================#
# $Id: Alert_Window.pm,v 1.2 2009/04/14 22:00:05 matyas Exp $

package Alert_Window;
use strict;
use CSL::Gnome2;
use Gnome2;
use Gtk2::GladeXML;
use Carp;

our $GLADEPATH = '/s/lab/common/lib/library5';
sub new
{
    my $this = shift;
    my $class = ref($this) || $this;

    my $self = { };
    bless $self, $class;

    $self->{xml} = Gtk2::GladeXML->new("$GLADEPATH/library.glade",
                                'alert_window');
    croak "Error opening Glade file" if (!$self->{xml});

    $self->{xml}->signal_autoconnect_from_package($self);

    return $self;
}

sub run
{
    my ($class, $message) = @_;
    Gnome2::Program->init("library", "5");
    my $self = $class->new;

    $self->wgt('reason_label')->set_text($message);

    $self->wgt('alert_window')->show;
}

sub on_ok_button_clicked
{
    my ($self) = @_;

    $self->wgt('alert_window')->destroy;
}

sub wgt
{
    my ($self, $widget) = @_;

    return $self->{xml}->get_widget($widget);
}

1;

