App-USBKeyCopyCon
view release on metacpan or search on metacpan
lib/App/USBKeyCopyCon.pm view on Meta::CPAN
return FALSE;
}
sub remove_key_from_rack {
my($self, $udi) = @_;
my $key_info = delete $self->current_keys->{$udi} or return;
$self->key_rack->remove($key_info->{widget});
return;
}
sub update_key_progress {
my($self, $udi, $status) = @_;
$status = -1 if !defined $status or $status < -1 or $status > 10;
my $key_info = $self->current_keys->{$udi} or return;
$key_info->{status} = $status;
$key_info->{icon_widget}->set_from_pixbuf(
App::USBKeyCopyCon::Chrome::usb_icon($status)
);
}
sub on_menu_file_new {
my $self = shift;
$self->require_master_key;
}
sub on_menu_file_quit {
my $self = shift;
# TODO: check for work in progress
# TODO: check if desktop automount should be re-enabled
Gtk2->main_quit;
}
sub on_menu_edit_preferences {
my $self = shift;
$self->say("Edit>Preferences - not implemented\n");
}
sub on_menu_help_about {
my $self = shift;
my $dialog = Gtk2::Dialog->new(
'About: usb-key-copy-con',
$self->app_win,
[qw/modal destroy-with-parent/],
'gtk-close' => 'ok',
);
$dialog->set_default_size (90, 80);
my $panel = Gtk2::VBox->new(FALSE, 12);
my $title = Gtk2::Label->new;
$title->set_markup("<span font_desc='sans 20'> USB Key Copy Console </span>");
$title->set_selectable(TRUE);
$panel->pack_start($title, FALSE, FALSE, 10);
my $version = Gtk2::Label->new;
$version->set_markup("<span font_desc='sans 16'>Version: $VERSION</span>");
$version->set_selectable(TRUE);
$panel->pack_start($version, FALSE, FALSE, 0);
my $author = Gtk2::Label->new;
my $detail = '(c) 2009 Grant McLean <grantm@cpan.org>';
$author->set_markup(" <span font_desc='sans 10'>$detail</span> ");
$author->set_selectable(TRUE);
$panel->pack_start($author, FALSE, FALSE, 10);
$dialog->vbox->pack_start($panel, FALSE, FALSE, 4);
$dialog->show_all;
$dialog->run;
$dialog->destroy;
}
sub build_menu {
my $self = shift;
foreach my $item (@menu_entries) {
if(exists $item->[5]) {
my $action = 'on_menu_' . $item->[5];
$item->[5] = sub { $self->$action(@_) };
}
}
my $actions = Gtk2::ActionGroup->new("Actions");
$actions->add_actions(\@menu_entries, undef);
my $ui = Gtk2::UIManager->new;
$ui->insert_action_group($actions, 0);
$self->app_win->add_accel_group($ui->get_accel_group);
$ui->add_ui_from_string ($menu_ui);
return $ui->get_widget('/MenuBar');
}
sub build_key_rack {
my $self = shift;
my $box = Gtk2::HBox->new(FALSE, 4);
$self->key_rack($box);
return $box;
}
sub build_filters {
my $self = shift;
my $box = Gtk2::HBox->new(FALSE, 4);
my $label = Gtk2::Label->new("Filter parameters:");
$box->pack_start($label, FALSE, FALSE, 10);
my $vendor_combo = Gtk2::ComboBox->new_text;
$vendor_combo->append_text('Exactly match vendor');
$vendor_combo->append_text('Pattern match vendor');
$vendor_combo->append_text('Match any vendor');
$vendor_combo->set_active(VENDOR_EXACT);
#$vendor_combo->signal_connect(changed => sub { $self->apply_filter(); });
$box->pack_start($vendor_combo, FALSE, FALSE, 10);
( run in 1.635 second using v1.01-cache-2.11-cpan-ceb78f64989 )