summaryrefslogtreecommitdiff
path: root/save.pl
diff options
context:
space:
mode:
Diffstat (limited to 'save.pl')
-rw-r--r--save.pl28
1 files changed, 18 insertions, 10 deletions
diff --git a/save.pl b/save.pl
index df7952e..257a73a 100644
--- a/save.pl
+++ b/save.pl
@@ -12,8 +12,10 @@ unlink(D) :->
:- pce_global(@dialog, new(save_dialog('Save'))).
:- pce_global(@files, new(chain)).
+:- pce_global(@commits, new(chain)).
:- pce_global(@editor, new(editor)).
-:- pce_global(@browser, new(browser)).
+:- pce_global(@file_browser, new(browser)).
+:- pce_global(@commit_browser, new(browser)).
:- pce_global(@save_button,
new(button(save, message(@prolog, save), 'RET'))).
@@ -35,11 +37,12 @@ Ensure Git is in PATH.').
added(0) :-
%send(@pce, load_defaults, 'Defaults'),
- % File browser.
- send(@browser, right, @dialog),
+ % Right side.
+ send(@file_browser, right, @dialog),
+ send(@commit_browser, right, @dialog),
refresh,
- % Input fields.
+ % Left side.
send(@dialog, append, text('Commit message (optional):',
left,
bold)),
@@ -52,12 +55,10 @@ added(0) :-
refresh :-
send(@files, clear),
status(@files),
- send(@browser, members(@files)),
- get(@files, size, L),
- ( L > 0
- -> send(@save_button, status, active)
- ; send(@save_button, status, preview)
- ).
+ send(@file_browser, members(@files)),
+ send(@commits, clear),
+ log(@commits),
+ send(@commit_browser, members(@commits)).
status(C) :-
setup_call_cleanup(
@@ -66,6 +67,13 @@ status(C) :-
read_to_chain(Out, C),
close(Out)).
+log(C) :-
+ setup_call_cleanup(
+ process_create(path(git), ['log', '--format=format:%ai'],
+ [stdout(pipe(Out))]),
+ read_to_chain(Out, C),
+ close(Out)).
+
read_to_chain(S, C) :-
read_line_to_codes(S, Cs),
( Cs == end_of_file