My Custom Playlist



Hi,
i would make something like a playlist, so i read the example of the customlist, and i found what i was looking for.
The problem is that i would make my playlist sortable so i used:

use Glib::Object::Subclass
   Glib::Object::,
   interfaces => [qw/Gtk2::TreeModel Gtk2::TreeSortable/],
;

but i've this error: Can't locate object method "_ADD_INTERFACE" via package "Gtk2::TreeSortable" at /usr/lib/perl5/Glib/Object/Subclass.pm line 209.

what going wrong?

Moreover i would remove the elements from the playlist, so i wrote this subroutine:

package Playlist

sub remove_record {
  my ($self, $path) = @_;

  splice @{ $self->{rows} }, $path->to_string, 1;
  $self->row_deleted($path);
}

1;

which i call in another package, for instance:

package Gui;

use Playlist;

$self->{playlist} = Playlist->new;

$self->{playlist_treeview} = Gtk2::TreeView->new($self->{playlist});

sub playlist_remove {
  my $self = shift;

  my $selection = $self->{playlist_treeview}->get_selection;

  return FALSE if(!$selection || !$selection->get_selected_rows);

  foreach my $row ($selection->get_selected_rows) {
     $self->{playlist}->remove_record($row);
  }
}

1;

but doing so i can remove only the last element of my playlist, insead i would be able to remove any element from the, therefore where is the mistake? And what if i would remove all the elements?

Regards, Lorenzo.




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]