Skip to content

Commit

Permalink
Autoset the save destination to the same filename
Browse files Browse the repository at this point in the history
  • Loading branch information
oxplot committed Dec 29, 2023
1 parent f5a93cd commit 54630df
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ var (

pageImages []*gtk.Image
pageLabels []*gtk.Label

openFilePath string
)

func showErrMsg(title string, msg string) {
Expand Down Expand Up @@ -209,6 +211,7 @@ func open(path string) {
return
}

openFilePath = path
dir, file := filepath.Split(shrinkHome(path))
hdrBar.SetTitle(file)
hdrBar.SetSubtitle(dir)
Expand Down Expand Up @@ -363,6 +366,7 @@ func closeFile() bool {
}
sessMu.Unlock()

openFilePath = ""
return true
}

Expand Down Expand Up @@ -398,6 +402,8 @@ func save() {
filter.AddPattern("*.PDF")
ofd.AddFilter(filter)

ofd.SetFilename(openFilePath)

if ofd.Run() != gtk.RESPONSE_OK {
return
}
Expand Down

0 comments on commit 54630df

Please sign in to comment.