diff options
| author | Tomas Bzatek <tbzatek@users.sourceforge.net> | 2008-10-26 18:37:53 +0100 |
|---|---|---|
| committer | Tomas Bzatek <tbzatek@users.sourceforge.net> | 2008-10-26 18:37:53 +0100 |
| commit | 1764ca51847cff878acea4b0fa498288d61f3d17 (patch) | |
| tree | 2224f9a508a233b1676ac13870c821f8d052585f | |
| parent | 88131f070451c7ec4e4913da031436885377cdc5 (diff) | |
| download | tuxcmd-1764ca51847cff878acea4b0fa498288d61f3d17.tar.xz | |
Plugin interface: pass cancellation button id in ask_question callback
| -rw-r--r-- | UConnectionManager.pas | 4 | ||||
| -rw-r--r-- | UCore.pas | 6 | ||||
| -rw-r--r-- | vfs/uVFSprototypes.pas | 2 |
3 files changed, 7 insertions, 5 deletions
diff --git a/UConnectionManager.pas b/UConnectionManager.pas index dc97e20..90db1e7 100644 --- a/UConnectionManager.pas +++ b/UConnectionManager.pas @@ -343,7 +343,7 @@ begin DoConnect; end; -procedure vfs_ask_question_callback(const AMessage: PChar; const Choices: PPChar; choice: PInteger; user_data: Pointer); cdecl; +procedure vfs_ask_question_callback(const AMessage: PChar; const Choices: PPChar; choice: PInteger; cancel_choice: Integer; user_data: Pointer); cdecl; var ConnMgr: TFConnectionManager; DialogParent: PGtkWidget; begin @@ -356,7 +356,7 @@ begin end; HandleVFSAskQuestionCallback(DialogParent, AMessage, Choices, choice); if ConnMgr is TFConnectionManager then begin - if choice <> nil then ConnMgr.FSilenceError := choice^ < 0; + if choice <> nil then ConnMgr.FSilenceError := (choice^ < 0) or (choice^ = cancel_choice); end; end; @@ -2677,7 +2677,7 @@ begin end; (********************************************************************************************************************************) -procedure vfs_ask_question_callback(const AMessage: PChar; const Choices: PPChar; choice: PInteger; user_data: Pointer); cdecl; +procedure vfs_ask_question_callback(const AMessage: PChar; const Choices: PPChar; choice: PInteger; cancel_choice: Integer; user_data: Pointer); cdecl; var Thread: TOpenDirThread; begin Thread := user_data; @@ -2685,7 +2685,7 @@ begin if pthread_self = Application.ThreadID then begin DebugMsg(['!! (WARNING): vfs_ask_question_callback called from the main thread, expected spawn from a OpenDirThread']); HandleVFSAskQuestionCallback(FMain.FWidget, AMessage, Choices, choice); - if (choice <> nil) and (Thread <> nil) and (Thread is TOpenDirThread) then Thread.VFSCallbackCancelled := choice^ < 0; + if (choice <> nil) and (Thread <> nil) and (Thread is TOpenDirThread) then Thread.VFSCallbackCancelled := (choice^ < 0) or (choice^ = cancel_choice); Exit; end; @@ -2697,7 +2697,7 @@ begin Thread.VFSAskQuestion_Display := True; Thread.VFSCallbackEvent.WaitFor(INFINITE); DebugMsg(['******* thread: resuming...']); - if (choice <> nil) then Thread.VFSCallbackCancelled := choice^ < 0; + if (choice <> nil) then Thread.VFSCallbackCancelled := (choice^ < 0) or (choice^ = cancel_choice); Exit; end; diff --git a/vfs/uVFSprototypes.pas b/vfs/uVFSprototypes.pas index 7cff78b..ba848e9 100644 --- a/vfs/uVFSprototypes.pas +++ b/vfs/uVFSprototypes.pas @@ -262,10 +262,12 @@ type // Return index of the choice selected or negative number when dialog has been cancelled + // cancel_choice: index which represents the cancellation choice. Set to -1 (e.g.) to disable this feature PVFSAskQuestionCallback = ^TVFSAskQuestionCallback; TVFSAskQuestionCallback = procedure (const AMessage: PChar; const Choices: PPChar; choice: PInteger; + cancel_choice: Integer; user_data: Pointer); cdecl; PVFSAskPasswordCallback = ^TVFSAskPasswordCallback; |
