App-USBKeyCopyCon

 view release on metacpan or  search on metacpan

lib/App/USBKeyCopyCon.pm  view on Meta::CPAN

The constructor is responsible for building the user interface and the C<run>
method invokes the Gtk2 event loop.  UI events are dispatched as method calls
on the application object.

=cut

use Moose;

use Gtk2 -init;
use Glib qw(TRUE FALSE);
use Gtk2::SimpleMenu;

use App::USBKeyCopyCon::Chrome;

use Net::DBus;
use Net::DBus::GLib;
use Net::DBus::Dumper;

use POSIX        qw(:sys_wait_h);
use IO::Handle   qw();
use File::Path   qw(mkpath rmtree);

lib/App/USBKeyCopyCon.pm  view on Meta::CPAN

has 'vendor_combo'     => ( is => 'rw', isa => 'Gtk2::ComboBox' );
has 'vendor_entry'     => ( is => 'rw', isa => 'Gtk2::Entry' );
has 'capacity_combo'   => ( is => 'rw', isa => 'Gtk2::ComboBox' );
has 'capacity_entry'   => ( is => 'rw', isa => 'Gtk2::Entry' );
has 'hal'              => ( is => 'rw', isa => 'Net::DBus::RemoteObject' );



my @menu_entries = (
    # name,       stock id,          label
    [ "FileMenu", undef,             "_File"        ],
    [ "EditMenu", undef,             "_Edit"        ],
    [ "HelpMenu", undef,             "_Help"        ],
    # name,       stock id,          label,               accelerator,  tooltip,                  action
    [ "New",      'gtk-new',         "_New master key",   "<control>N", "Re-read the master key", 'file_new' ],
    [ "Quit",     'gtk-quit',        "_Quit",             "<control>Q", "Quit",                   'file_quit' ],
    [ "Prefs",    'gtk-preferences', "_Preferences",      "<control>E", "About",                  'edit_preferences' ],
    [ "About",    'gtk-about',       "_About",            "<control>A", "About",                  'help_about' ],
);

my $menu_ui = "<ui>
  <menubar name='MenuBar'>
    <menu action='FileMenu'>
      <menuitem action='New'/>
      <menuitem action='Quit'/>
    </menu>
    <menu action='EditMenu'>
      <menuitem action='Prefs'/>
    </menu>
    <menu action='HelpMenu'>
      <menuitem action='About'/>
    </menu>
  </menubar>
</ui>";

my %hal_key_map = (
    'info.udi'                     => 'udi',
    'info.vendor'                  => 'vendor',
    'info.product'                 => 'product',
    'block.device'                 => 'block_device',

lib/App/USBKeyCopyCon.pm  view on Meta::CPAN

    }
    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);



( run in 0.495 second using v1.01-cache-2.11-cpan-49f99fa48dc )