diff options
author | dakkar <dakkar@fcb26f47-9200-0410-b104-b98ab5b095f3> | 2005-11-24 09:53:38 +0000 |
---|---|---|
committer | dakkar <dakkar@fcb26f47-9200-0410-b104-b98ab5b095f3> | 2005-11-24 09:53:38 +0000 |
commit | 77005a11e9b05f8b41df0b2002f9ae601a7183a9 (patch) | |
tree | 797c28751bd8cc9801b709b68d457d659a31c8a4 /lib | |
parent | r797@narval2: dakkar | 2005-11-19 16:51:31 +0100 (diff) | |
download | GtkPerlFileManager-77005a11e9b05f8b41df0b2002f9ae601a7183a9.tar.gz GtkPerlFileManager-77005a11e9b05f8b41df0b2002f9ae601a7183a9.tar.bz2 GtkPerlFileManager-77005a11e9b05f8b41df0b2002f9ae601a7183a9.zip |
r798@narval2: dakkar | 2005-11-19 17:50:42 +0100
aggiunta gestione dei doppio-click sulle liste
git-svn-id: svn://luxion/repos/GtkPerlFileManager/trunk@43 fcb26f47-9200-0410-b104-b98ab5b095f3
Diffstat (limited to 'lib')
-rw-r--r-- | lib/LDFM/MainController.pm | 62 |
1 files changed, 57 insertions, 5 deletions
diff --git a/lib/LDFM/MainController.pm b/lib/LDFM/MainController.pm index 9c81ecd..63f981a 100644 --- a/lib/LDFM/MainController.pm +++ b/lib/LDFM/MainController.pm @@ -45,13 +45,22 @@ sub simplify_list { sub update_list_with_path { my ($self,$side,$path)=@_; - my $curpath=dir($path)->absolute; - $self->{"cur_${side}_path"}=$curpath; - $self->{"${side}_path"}->set_text($curpath->stringify); + my $newpath; + if ($path eq '..') { + $newpath=$self->{"cur_${side}_path"}->parent; + } + else { + $newpath=dir($path)->absolute($self->{"cur_${side}_path"})->cleanup; + } + + return unless -d $newpath; + + $self->{"cur_${side}_path"}=$newpath; + $self->{"${side}_path"}->set_text($newpath->stringify); my @dir_list=(); - for my $item ($curpath->children(all=>1)) { - my @row=($item->relative($curpath)->stringify); + for my $item ($newpath->children(all=>1)) { + my @row=($item->relative($newpath)->stringify); if ($item->isa('Class::Path::Dir')) { push @row,'DIR',0; } @@ -64,6 +73,49 @@ sub update_list_with_path { @{$self->{"${side}_data"}}=@dir_list; } +sub set_left_path { + my ($self,$widget)=@_; + + $self->update_list_with_path('left',$widget->get_text()); + + return; +} + +sub set_right_path { + my ($self,$widget)=@_; + + $self->update_list_with_path('right',$widget->get_text()); + + return; +} + +sub use_a_row { + my ($self,$side,$tree_path)=@_; + + #my $row_ref=$widget->get_row_data_from_path($tree_path); + my ($row_num)=$tree_path->get_indices(); + my $row_ref=$self->{"${side}_data"}->[$row_num]; + my $relpath=$row_ref->[0]; + + $self->update_list_with_path($side,$relpath); +} + +sub use_left_row { + my ($self,$widget,$tree_path)=@_; + + $self->use_a_row('left',$tree_path); + + return; +} + +sub use_right_row { + my ($self,$widget,$tree_path)=@_; + + $self->use_a_row('right',$tree_path); + + return; +} + sub quit { Gtk2->main_quit; } |