diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/URLQueue/MainController.pm | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/lib/URLQueue/MainController.pm b/lib/URLQueue/MainController.pm index 9d4cd5b..dcf83a6 100644 --- a/lib/URLQueue/MainController.pm +++ b/lib/URLQueue/MainController.pm @@ -11,6 +11,14 @@ use MIME::EncWords; use File::ShareDir 'dist_file'; use POSIX 'strftime'; +sub set_icon { + my ($self,$icon) = @_; + + $self->{input}->set_from_file( + dist_file('URLQueue',"stock_book_${icon}.png") + ); +} + sub new { my ($class,%params)=@_; @@ -24,7 +32,7 @@ sub new { [qw(default copy move link private ask)], ); $self->{input}->drag_dest_set_target_list($target_list); - $self->{input}->set_from_file(dist_file('URLQueue','stock_book_green.png')); + $self->set_icon('green'); $self->{glade_dir}=$params{glade_dir}; @@ -37,7 +45,7 @@ sub drag_motion { $context->status($context->suggested_action,$time); if (!$self->{_dragging}) { - $self->{input}->set_from_file(dist_file('URLQueue','stock_book_open.png')); + $self->set_icon('open'); $self->{_dragging}=1; } @@ -48,7 +56,7 @@ sub drag_leave { my ($self, $widget, $context, $time) = @_; if ($self->{_dragging}) { - $self->{input}->set_from_file(dist_file('URLQueue','stock_book_green.png')); + $self->set_icon('green'); $self->{_dragging}=0; } @@ -59,7 +67,7 @@ sub drag_drop { my ($self, $widget, $context, $x, $y, $time) = @_; if (my $atom=$context->targets) { - $self->{input}->set_from_file(dist_file('URLQueue','stock_book_yellow.png')); + $self->set_icon('yellow'); $self->{_dragging}=0; $widget->drag_get_data($context, $atom, $time); return 1; @@ -97,7 +105,7 @@ sub button_release { my ($self,$widget,$event)=@_; if ($event->button==2) { - $self->{input}->set_from_file(dist_file('URLQueue','stock_book_yellow.png')); + $self->set_icon('yellow'); my $clipboard=Gtk2::Clipboard->get(Gtk2::Gdk->SELECTION_PRIMARY); $clipboard->request_text(sub{$self->handle_text($_[1])}); @@ -145,7 +153,7 @@ sub handle_text { $self->send_email($title,$text); - $self->{input}->set_from_file(dist_file('URLQueue','stock_book_green.png')); + $self->set_icon('green'); } sub handle_uris { @@ -167,7 +175,7 @@ sub handle_uris { } $self->send_email($title,$body); - $self->{input}->set_from_file(dist_file('URLQueue','stock_book_green.png')); + $self->set_icon('green'); } sub send_email { |