PerlFM

 view release on metacpan or  search on metacpan

lib/PerlFM.pm  view on Meta::CPAN

	#'cancel' means the user decided not to create a new set
	#'accept' means the user wants to create a new set with the entered name
	my $response=$window->run;
	
	$window->destroy;
	
	#set the pressed to reject if 
	if (($action eq '' )&&($pressed eq 'accept')) {
		$pressed='reject';
		return;
	}
	
	$self->setAction($action);

	$self->update( $guiID, $self );
	$self->updateRmenu($guiID);
}

=head2 update

This is the is used by callbacks for updating.

    $pfm->update($gui{id}, $self);

=cut

sub update{
#	my $self=$_[0];
#	my %gui;
#	if (defined($_[1])) {
#		%gui=%{$_[1]};
#	}
	my $guiID=$_[1];
	my $self=$_[2];

#	if (!defined($gui{VB})) {
#		warn('PerlFM update: The passed GUI hash does not appear to be something returned by the filemanager method');
#		return undef;
#	}

	#set the window title
	if (defined($self->{window})) {
		$self->{window}{window}->set_title('pfm: '.cwd);
	}

	#gets the data
	my %datahash=$self->datahash($self->{gui}{$guiID}{hidden});
	$self->{data}{$guiID}{data}=\%datahash;

	$self->{test}="3\n\n";

	my @listdata;
	my @dirlistdata;
	my @dirlistdata2;
	my $int=0;
	while (defined( $datahash{reverse}[$int] )) {
		my $entry=$datahash{reverse}[$int];
		my $atime=localtime($datahash{names}{$entry}{atime});
		my $ctime=localtime($datahash{names}{$entry}{ctime});
		my $mtime=localtime($datahash{names}{$entry}{mtime});
		my ($name,$passwd,$uid,$gid,$quota,$comment,$gcos,$dir,$shell,$expire) = getpwuid($datahash{names}{$entry}{uid});
		if (!defined($name)) {
			$name=$datahash{names}{$entry}{uid};
		}
		my ($gname,$gpasswd,$ggid,$members) = getgrgid($datahash{names}{$entry}{gid});
		if (!defined($gname)) {
			$gname=$datahash{names}{$entry}{gid};
		}

		if (-d $entry) {
			my @row=(
					 $entry,
					 );
			my @row2=(
					  $entry,
					  $name,
					  $gname,
					  $datahash{names}{$entry}{mode},
					  $datahash{names}{$entry}{size},
					  $mtime,
					  $ctime,
					  $atime
					  );
			push(@dirlistdata2, \@row2);
			push(@dirlistdata, \@row);
		}else {
			my @row=(
					 $entry,
					 $name,
					 $gname,
					 $datahash{names}{$entry}{mode},
					 $datahash{names}{$entry}{size},
					 $mtime,
					 $ctime,
					 $atime
					 );
			push(@listdata, \@row);
		}

		$int++;
	}

	my @fulllist;
	push(@fulllist, @dirlistdata2);
	push(@fulllist, @listdata);

	@{$self->{gui}{$guiID}{list}->{data}}=@fulllist;

	@{$self->{gui}{$guiID}{dirlist}->{data}}=@dirlistdata;

	$self->{gui}{$guiID}{PB}->setPath(cwd);

	$self->{gui}{$guiID}{watcher}=Dir::Watch->new;
}

=head2 updateBM

This is the method that is used for updating the bookmark selection.

It is called automatically as needed.



( run in 1.971 second using v1.01-cache-2.11-cpan-39bf76dae61 )