iPodDB::Menu::Edit - the edit menu


iPodDB documentation Contained in the iPodDB distribution.

Index


Code Index:

NAME

Top

iPodDB::Menu::Edit - the edit menu

SYNOPSIS

Top

    my $edit = iPodDB::Menu::Edit->new( $frame );

DESCRIPTION

Top

This is the Edit menu portion of the menu bar.

METHODS

Top

new( $frame )

Creates the menu and sets up the callbacks when menu items are clicked.

EVENTS

Top

on_preferences( )

When the "Preferences" option is selected this event is triggered. It will popup the preferences dialog for the user to modify then attempt to load the new database.

AUTHOR

Top

* Brian Cassidy <bricas@cpan.org>

COPYRIGHT AND LICENSE

Top


iPodDB documentation Contained in the iPodDB distribution.
package iPodDB::Menu::Edit;

use base qw( Wx::Menu );

use strict;
use warnings;

our $VERSION = '0.03';

sub new {
    my $class  = shift;
    my $parent = shift;
    my $self   = $class->SUPER::new;

    bless $self, $class;
    
    $self->Append( my $pref_id = Wx::NewId, '&Preferences', 'Modify your preferences' );

    $parent->EVT_MENU( $pref_id, \&on_preferences );

    return $self;
}

sub on_preferences {
    my $self        = shift;
    my $preferences = $self->preferences;
    my $mountpoint  = $preferences->mountpoint;

    $preferences->mountpoint( undef );
    $self->load_database;

    if( defined $preferences->mountpoint ) {
        $self->playlist->populate( $self->database->playlists ) if $self->database;
        $self->playlist->select_root;
    }
    else {
        $preferences->mountpoint( $mountpoint );
    }
}

1;