diff options
| author | Tomas Bzatek <tbzatek@users.sourceforge.net> | 2009-10-25 18:11:35 +0100 |
|---|---|---|
| committer | Tomas Bzatek <tbzatek@users.sourceforge.net> | 2009-10-25 18:11:35 +0100 |
| commit | 4aba4d7597005af1efa12f420e01d5f938ad60d8 (patch) | |
| tree | 1fbfbffb402f18e54883bddb31780b9581ad5d0d /UMain.pas | |
| parent | 53c1df30e07af532133db05ee0254f9c1dae66f7 (diff) | |
| download | tuxcmd-4aba4d7597005af1efa12f420e01d5f938ad60d8.tar.xz | |
Clean VFS API up a littlev0.6.69
Strictly split archiving and networking mode, get rid of prefixes
Diffstat (limited to 'UMain.pas')
| -rw-r--r-- | UMain.pas | 31 |
1 files changed, 16 insertions, 15 deletions
@@ -204,6 +204,7 @@ type procedure UpdatePanelInfo; procedure UpdatePanelInfoDown(LeftPanel: boolean); procedure UpdateCaption; + function FormatPathString(Engine: TPanelEngine): string; procedure ChangingDir(LeftPanel: boolean; NewPath: string; HiliString1: string = ''; HiliString2: string = ''; const PreserveSelection: boolean = False; const AutoFallback: boolean = False; Plugin: TVFSPlugin = nil); procedure DoSelect(SelectType: integer); procedure ListViewCellDataFunc(Sender: TObject; tree_view: PGtkTreeView; tree_column : PGtkTreeViewColumn; cell : PGtkCellRenderer; tree_model : PGtkTreeModel; iter : PGtkTreeIter); @@ -1724,7 +1725,7 @@ begin if not HandleVFSArchive(LeftPanel, IncludeTrailingPathDelimiter(Engine.Path) + String(Data^.FName), String(Data^.FName), '/') then if (not ConfUseURI) or ((Engine is TVFSEngine) and TVFSEngine(Engine).ArchiveMode) then RunFile(IncludeTrailingPathDelimiter(Engine.Path) + String(Data^.FName), Engine, -1) - else RunFile(ExcludeTrailingPathDelimiter(Engine.GetPrefix) + IncludeTrailingPathDelimiter(Engine.Path) + String(Data^.FName), Engine, -1); + else RunFile(IncludeTrailingPathDelimiter((Engine as TVFSEngine).GetPathURI) + String(Data^.FName), Engine, -1); end; end; @@ -1957,9 +1958,15 @@ begin ChangingDir(LeftPanel, Engine.Path, s1, s2, StaySame, AutoFallback); end; +function TFMain.FormatPathString(Engine: TPanelEngine): string; +begin + if not (Engine is TVFSEngine) then Result := Engine.Path else + if (Engine as TVFSEngine).ArchiveMode then Result := Format(ConstFullPathFormatStr, [(Engine as TVFSEngine).ArchivePath, Engine.Path]) + else Result := (Engine as TVFSEngine).GetPathURI; +end; + procedure TFMain.UpdateCaption; var LeftPanel: boolean; - s: string; Engine: TPanelEngine; begin if LeftListView.Focused then LeftPanel := True else @@ -1969,9 +1976,7 @@ begin if LeftPanel then Engine := LeftPanelEngine else Engine := RightPanelEngine; - if Engine.GetPrefix <> '' then s := Format(ConstFullPathFormatStr, [Engine.GetPrefix, Engine.Path]) - else s := Engine.Path; - Caption := Format('Tux Commander [%s]', [StrToUTF8(s)]); + Caption := Format('Tux Commander [%s]', [StrToUTF8(FormatPathString(Engine))]); miVerifyChecksums.Enabled := Engine is TLocalTreeEngine; miCreateChecksums.Enabled := Engine is TLocalTreeEngine; @@ -1986,12 +1991,8 @@ var FSFree, FSSize: Int64; begin UpdateCaption; Time1 := Now; - if LeftPanelEngine.GetPrefix <> '' - then LeftPathLabel.Caption := StrToUTF8(Format(ConstFullPathFormatStr, [LeftPanelEngine.GetPrefix, LeftPanelEngine.Path])) - else LeftPathLabel.Caption := StrToUTF8(LeftPanelEngine.Path); - if RightPanelEngine.GetPrefix <> '' - then RightPathLabel.Caption := StrToUTF8(Format(ConstFullPathFormatStr, [RightPanelEngine.GetPrefix, RightPanelEngine.Path])) - else RightPathLabel.Caption := StrToUTF8(RightPanelEngine.Path); + LeftPathLabel.Caption := StrToUTF8(FormatPathString(LeftPanelEngine)); + RightPathLabel.Caption := StrToUTF8(FormatPathString(RightPanelEngine)); LeftPathLabel.UseMarkup := True; RightPathLabel.UseMarkup := True; if LeftLastFocused then s := LeftPathLabel.Caption @@ -2016,7 +2017,7 @@ begin LeftDiskInfoLabel.UseMarkup := True; RightDiskInfoLabel.UseMarkup := True; - // Update the visibility of VFS buttons + // Update visibility of VFS buttons LeftDisconnectButton.Visible := (LeftPanelEngine is TVFSEngine) and (not TVFSEngine(LeftPanelEngine).ArchiveMode); LeftLeaveArchiveButton.Visible := (LeftPanelEngine is TVFSEngine) and TVFSEngine(LeftPanelEngine).ArchiveMode; RightDisconnectButton.Visible := (RightPanelEngine is TVFSEngine) and (not TVFSEngine(RightPanelEngine).ArchiveMode); @@ -4495,7 +4496,9 @@ begin Engine := RightPanelEngine; AListView := RightListView; end; - FileName := IncludeTrailingPathDelimiter(Engine.Path); + if ConfUseURI and ((Engine is TVFSEngine) and (not (Engine as TVFSEngine).ArchiveMode)) + then FileName := IncludeTrailingPathDelimiter((Engine as TVFSEngine).GetPathURI) + else FileName := IncludeTrailingPathDelimiter(Engine.Path); if Assigned(AListView.Selected) and Assigned(AListView.Selected.Data) and (not PDataItem(AListView.Selected.Data)^.UpDir) then FileName := FileName + PDataItem(AListView.Selected.Data)^.FName; ShortFName := ExtractFileName(ExcludeTrailingPathDelimiter(FileName)); @@ -4504,8 +4507,6 @@ begin DebugMsg(['Error: File data not assigned. Bug ???! FileName = ', FileName]); Exit; end; - if ConfUseURI and ((Engine is TVFSEngine) and (not TVFSEngine(Engine).ArchiveMode)) - then FileName := ExcludeTrailingPathDelimiter(Engine.GetPrefix) + FileName; case Integer((Sender as TGTKMenuItem).Data) of 1: if DataItem^.IsDir then ActivateItem(AListView.Selected.Index) |
