summaryrefslogtreecommitdiff
path: root/lib/LDFM/MainController.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/LDFM/MainController.pm')
-rw-r--r--lib/LDFM/MainController.pm62
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;
}