Compare commits

..

6 commits

Author SHA1 Message Date
Piotr Grabowski 9f092010fb chore(makefile): replace pushd with cd 2022-09-12 17:13:23 +02:00
Piotr Grabowski 68d8439b6b explo(ghactions): - 2022-09-12 17:02:11 +02:00
Piotr Grabowski afaaa3f4e1 explo(ghactions): - 2022-09-12 17:01:04 +02:00
Piotr Grabowski bd2ef3d400 explo(ghactions): - 2022-09-12 16:52:49 +02:00
Piotr Grabowski e099487fb0 explo(ghactions): - 2022-09-12 16:50:18 +02:00
Piotr Grabowski 5d8416cdc2 explo(ghactions): - 2022-09-12 16:47:23 +02:00
47 changed files with 153 additions and 431 deletions

30
.github/workflows/dist.yml vendored Normal file
View file

@ -0,0 +1,30 @@
---
name: dist
"on":
push:
branches: [master, explo/gh-actions]
jobs:
dist:
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: "^1.19.1"
- name: Install dependencies
run: |
sudo apt update
sudo apt install libgtk-3-dev libcairo2-dev libglib2.0-dev
- name: Run `make dist`
run: make dist
- name: Upload dist package
uses: actions/upload-artifact@v3
with:
name: dist-package
path: target/Gomics*.zip

View file

@ -1,6 +0,0 @@
---
run:
skip-dirs:
- ".*go/pkg.*"
- ".*go/src.*"

View file

@ -1,35 +1,24 @@
# --- PREAMBLE
SHELL := bash
.ONESHELL:
.SHELLFLAGS := -eu -o pipefail -c
MAKEFLAGS += --warn-undefined-variables
.PHONY: build clean dist
BUILD_DATE := $(shell date +'%Y%m%d')
VERSION := $(shell support/get-version.sh)
build:
go build -o target/gomicsv \
-ldflags="-X main.buildDate=$(BUILD_DATE) -X main.versionString=$(VERSION)" \
cmd/gomicsv/main.go
.PHONY: build
-ldflags="-X main.buildDate=$(BUILD_DATE) -X main.versionString=$(VERSION)" \
cmd/gomicsv/main.go
clean:
rm -rf target/
.PHONY: clean
rm -rf target/; \
dist: build
rm -rf target/dist
rm -rf target/*.zip
mkdir -p target/dist/gomicsv
cp target/gomicsv target/dist/gomicsv/gomicsv
cp README.md target/dist/gomicsv
cp COPYING.md target/dist/gomicsv
cp CHANGELOG.md target/dist/gomicsv
pushd target/dist
zip -r ../Gomics-v_$(VERSION).zip gomicsv
rm -rf gomicsv
.PHONY: dist
lint:
golangci-lint run
.PHONY: lint
rm -rf target/dist; \
rm -rf target/*.zip; \
mkdir -p target/dist/gomicsv; \
cp target/gomicsv target/dist/gomicsv/gomicsv; \
cp README.md target/dist/gomicsv; \
cp COPYING.md target/dist/gomicsv; \
cp CHANGELOG.md target/dist/gomicsv; \
cd target/dist; \
zip -r ../Gomics-v_$(VERSION).zip gomicsv; \
rm -rf gomicsv; \

View file

@ -18,9 +18,6 @@ This fork has been made with personal use for reading manga with
mouse-centered navigation in mind. Consequently, some aspects of other workflows
might have been broken.
The program has only been confirmed to work on Linux, but it is possible it
would work on other platforms.
<p align="center">
<img src="screenshot.png" title="A screenshot of Gomics-v">
</p>
@ -72,11 +69,10 @@ would work on other platforms.
## Installation
Download the latest release package from the [Releases] page (Linux only) and
extract it to the location where you want to keep the program files (e.g.,
`/opt/gomicsv`).
Download the latest release package from the [Releases] page and extract it to
the location where you want to keep the program files (e.g., `/opt/gomicsv`).
Or build it from the source (see below).
Or build it from the source:
[Releases]: https://github.com/fauu/gomicsv/releases
@ -98,14 +94,6 @@ Building requires [go] and some GTK-related dependencies. See
[gomics: Requirements][gomics-requirements]. GTK-related build steps might take
up to 15 minutes on first compile.
---
Extra information for Windows and macOS:
- <https://github.com/gotk3/gotk3/wiki/Installing-on-Windows>
- <https://github.com/gotk3/gotk3/wiki/Installing-on-macOS>
[go]: https://go.dev/
[gomics-requirements]: https://github.com/salviati/gomics#requirements
@ -113,7 +101,7 @@ Extra information for Windows and macOS:
Gomics-v\
Copyright (c) 20132021 Utkan Güngördü <utkan@freeconsole.org>\
Copyright (c) 20212024 Piotr Grabowski
Copyright (c) 20212022 Piotr Grabowski
This program is free software: you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software

8
app.go
View file

@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2021 Utkan Güngördü <utkan@freeconsole.org>
* Copyright (c) 2021-2024 Piotr Grabowski
* Copyright (c) 2021-2022 Piotr Grabowski
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -70,7 +70,6 @@ type State struct {
RecentManager *gtk.RecentManager
BackgroundColorCssProvider *gtk.CssProvider
PageCacheTrimTimeoutHandle *glib.SourceHandle
UITemporarilyRevealed bool
}
//go:embed about.jpg
@ -237,11 +236,6 @@ func (app *App) handleKeyPress(key uint, shift bool, ctrl bool) {
} else {
app.W.MenuItemNextPage.Activate()
}
case gdk.KEY_Alt_L:
if app.Config.HideUI {
app.S.UITemporarilyRevealed = !app.S.UITemporarilyRevealed
app.toggleHideUI(!app.S.UITemporarilyRevealed)
}
}
}

View file

@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2021 Utkan Güngördü <utkan@freeconsole.org>
* Copyright (c) 2021-2024 Piotr Grabowski
* Copyright (c) 2021-2022 Piotr Grabowski
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -24,6 +24,7 @@ import (
"net/url"
"os"
"path/filepath"
"reflect"
"strings"
"github.com/fauu/gomicsv/archive"
@ -118,7 +119,7 @@ func (app *App) doLoadArchive(path string, assumeHTTPURL bool, httpReferer strin
}
func (app *App) archiveIsLoaded() bool {
return app.S.ArchivePath != ""
return app.S.Archive != nil && !reflect.ValueOf(app.S.Archive).IsNil() && app.S.ArchivePath != ""
}
func (app *App) archiveGetBaseName() string {
@ -143,6 +144,7 @@ func (app *App) archiveClose() {
app.S.Archive.Close()
app.S.Archive = nil
app.S.ArchivePath = ""
app.S.ArchivePos = 0

View file

@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2021 Utkan Güngördü <utkan@freeconsole.org>
* Copyright (c) 2021-2024 Piotr Grabowski
* Copyright (c) 2021-2022 Piotr Grabowski
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -64,9 +64,7 @@ func NewArchive(path string, pageCache *pagecache.PageCache, httpReferer string)
switch ext {
case "zip", "cbz":
return NewZip(path)
case "rar":
return NewRar(path)
case "7z", "tar", "tgz", "gz", "tbz2", "cb7", "cbr", "cbt", "lha":
case "7z", "rar", "tar", "tgz", "gz", "tbz2", "cb7", "cbr", "cbt", "lha":
return nil, errors.New("Archive type not supported, please unpack it first")
}

View file

@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2021 Utkan Güngördü <utkan@freeconsole.org>
* Copyright (c) 2021-2024 Piotr Grabowski
* Copyright (c) 2021-2022 Piotr Grabowski
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View file

@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2021 Utkan Güngördü <utkan@freeconsole.org>
* Copyright (c) 2021-2024 Piotr Grabowski
* Copyright (c) 2021-2022 Piotr Grabowski
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View file

@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2021 Utkan Güngördü <utkan@freeconsole.org>
* Copyright (c) 2021-2024 Piotr Grabowski
* Copyright (c) 2021-2022 Piotr Grabowski
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View file

@ -1,162 +0,0 @@
/*
* Copyright (c) 2013-2021 Utkan Güngördü <utkan@freeconsole.org>
* Copyright (c) 2021-2024 Piotr Grabowski
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package archive
import (
"errors"
"fmt"
"io"
"log"
"path/filepath"
"sort"
"github.com/fauu/gomicsv/pixbuf"
"github.com/gotk3/gotk3/gdk"
"github.com/nwaples/rardecode/v2"
)
type Rar struct {
files RarMembers // Sorted by name
reader *rardecode.ReadCloser
name string
}
type RarMember struct {
Header *rardecode.FileHeader
Offset int // in terms of files
}
type RarMembers []RarMember
func (p RarMembers) Len() int { return len(p) }
func (p RarMembers) Less(i, j int) bool { return strcmp(p[i].Header.Name, p[j].Header.Name, true) }
func (p RarMembers) Swap(i, j int) { p[i], p[j] = p[j], p[i] }
// NewRar reads supported image filenames from a given rar archive and sorts them
func NewRar(name string) (*Rar, error) {
var err error
ar := new(Rar)
ar.name = filepath.Base(name)
ar.files = make([]RarMember, 0, MaxArchiveEntries)
ar.reader, err = rardecode.OpenReader(name)
if err != nil {
return nil, err
}
offsetAcc := -1
for {
offsetAcc += 1
header, err := ar.reader.Next()
if err != nil {
if err == io.EOF {
break
}
log.Printf("error reading a file inside the rar archive: %v", err)
}
if header.IsDir {
continue
}
if !extensionMatches(header.Name, imageExtensions) {
continue
}
ar.files = append(ar.files, RarMember{
Header: header,
Offset: offsetAcc,
})
}
if len(ar.files) == 0 {
return nil, errors.New(ar.name + ": no supported images in the rar file")
}
sort.Sort(RarMembers(ar.files))
ar.Close()
return ar, nil
}
func (ar *Rar) checkbounds(i int) error {
if i < 0 || i >= len(ar.files) {
return ErrBounds
}
return nil
}
func (ar *Rar) Load(i int, autorotate bool, _nPreload int) (*gdk.Pixbuf, error) {
var err error
if err = ar.checkbounds(i); err != nil {
return nil, err
}
ar.reader, err = rardecode.OpenReader(ar.name)
if err != nil {
return nil, err
}
targetOffset := ar.files[i].Offset
offsetAcc := -1
for {
offsetAcc += 1
header, err := ar.reader.Next()
if err != nil {
if err == io.EOF {
break
}
log.Printf("error reading a file inside the rar archive: %v", err)
}
if header.IsDir {
continue
}
if offsetAcc == targetOffset {
defer ar.Close()
return pixbuf.Load(ar.reader, autorotate)
}
}
return nil, fmt.Errorf(ar.name + ": could not find a file inside the rar archive")
}
func (ar *Rar) Kind() Kind {
return Packed
}
func (ar *Rar) ArchiveName() string {
return ar.name
}
func (ar *Rar) Name(i int) (string, error) {
if err := ar.checkbounds(i); err != nil {
return "", err
}
return ar.files[i].Header.Name, nil
}
func (ar *Rar) Len() *int {
l := len(ar.files)
return &l
}
func (ar *Rar) Close() error {
return ar.reader.Close()
}

View file

@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2021 Utkan Güngördü <utkan@freeconsole.org>
* Copyright (c) 2021-2024 Piotr Grabowski
* Copyright (c) 2021-2022 Piotr Grabowski
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -37,7 +37,7 @@ type Loader interface {
Len() int
}
var archiveExtensions = []string{".zip", ".cbz", ".rar"}
var archiveExtensions = []string{".zip", ".cbz"}
var imageExtensions []string
func init() {
@ -119,7 +119,7 @@ func NewFile(f *os.File) *File {
}
func (r *File) Size() (int64, error) {
fi, err := r.Stat() // nolint:typecheck
fi, err := r.Stat()
if err != nil {
return 0, err
}
@ -127,11 +127,11 @@ func (r *File) Size() (int64, error) {
}
func (r *File) SetSize(n int64) error {
return r.Truncate(n) // nolint:typecheck
return r.Truncate(n)
}
func (r *File) Ext() string {
ext := filepath.Ext(r.Name()) // nolint:typecheck
ext := filepath.Ext(r.Name())
if len(ext) <= 1 || ext[0] != '.' {
return ""
}
@ -156,7 +156,7 @@ func (b *Buffer) SetSize(int64) error {
}
func (b *Buffer) Size() (int64, error) {
return int64(b.Len()), nil // nolint:typecheck
return int64(b.Len()), nil
}
func strcmp(a, b string, nat bool) bool {

View file

@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2021 Utkan Güngördü <utkan@freeconsole.org>
* Copyright (c) 2021-2024 Piotr Grabowski
* Copyright (c) 2021-2022 Piotr Grabowski
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View file

@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2021 Utkan Güngördü <utkan@freeconsole.org>
* Copyright (c) 2021-2024 Piotr Grabowski
* Copyright (c) 2021-2022 Piotr Grabowski
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View file

@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2021 Utkan Güngördü <utkan@freeconsole.org>
* Copyright (c) 2021-2024 Piotr Grabowski
* Copyright (c) 2021-2022 Piotr Grabowski
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View file

@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2021 Utkan Güngördü <utkan@freeconsole.org>
* Copyright (c) 2021-2024 Piotr Grabowski
* Copyright (c) 2021-2022 Piotr Grabowski
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View file

@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2021 Utkan Güngördü <utkan@freeconsole.org>
* Copyright (c) 2021-2024 Piotr Grabowski
* Copyright (c) 2021-2022 Piotr Grabowski
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View file

@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2021 Utkan Güngördü <utkan@freeconsole.org>
* Copyright (c) 2021-2024 Piotr Grabowski
* Copyright (c) 2021-2022 Piotr Grabowski
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -194,15 +194,30 @@ func (app *App) setVFlip(vflip bool) {
func (app *App) setFullscreen(fullscreen bool) {
app.Config.Fullscreen = fullscreen
app.toggleFullscreen(fullscreen)
if fullscreen {
app.W.MainWindow.Fullscreen()
} else {
app.W.MainWindow.Unfullscreen()
}
app.W.MenuItemFullscreen.SetActive(fullscreen)
}
func (app *App) setHideUI(hideUI bool) {
app.Config.HideUI = hideUI
app.toggleHideUI(hideUI)
if hideUI {
app.W.Menubar.Hide()
app.W.Toolbar.Hide()
app.W.Statusbar.Hide()
} else {
app.W.Menubar.Show()
app.W.Toolbar.Show()
app.W.Statusbar.Show()
}
app.W.MenuItemHideUI.SetActive(hideUI)
app.S.UITemporarilyRevealed = false
}
func (app *App) setShrink(shrink bool) {

View file

@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2021 Utkan Güngördü <utkan@freeconsole.org>
* Copyright (c) 2021-2024 Piotr Grabowski
* Copyright (c) 2021-2022 Piotr Grabowski
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

11
go.mod
View file

@ -2,12 +2,11 @@ module github.com/fauu/gomicsv
replace github.com/fauu/gomicsv => ./
go 1.20
go 1.17
require (
github.com/flytam/filenamify v1.2.0
github.com/gotk3/gotk3 v0.6.3
github.com/nwaples/rardecode/v2 v2.0.0-beta.2
github.com/spf13/pflag v1.0.5
golang.org/x/sys v0.24.0
github.com/flytam/filenamify v1.1.0
github.com/gotk3/gotk3 v0.6.1
github.com/spf13/pflag v1.0.5
golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6
)

30
go.sum
View file

@ -1,22 +1,16 @@
github.com/flytam/filenamify v1.1.2 h1:dGlfWU4zrhDlsmvob4IFcfgjG5vIjfo4UwLyec6Wx94=
github.com/flytam/filenamify v1.1.2/go.mod h1:Dzf9kVycwcsBlr2ATg6uxjqiFgKGH+5SKFuhdeP5zu8=
github.com/flytam/filenamify v1.2.0 h1:7RiSqXYR4cJftDQ5NuvljKMfd/ubKnW/j9C6iekChgI=
github.com/flytam/filenamify v1.2.0/go.mod h1:Dzf9kVycwcsBlr2ATg6uxjqiFgKGH+5SKFuhdeP5zu8=
github.com/diamondburned/gotk4 v0.0.3-0.20220418035147-8a785583d00a h1:u+75gz/SWdpIWJaD0TFR4lgmz+s0JUkKfLXgJesf+GQ=
github.com/diamondburned/gotk4 v0.0.3-0.20220418035147-8a785583d00a/go.mod h1:WbOkeM91aOubLbxqcbYwd7q/HCKxAmqObvT5Dhpzm1Y=
github.com/diamondburned/gotk4/pkg v0.0.0-20220418035147-8a785583d00a h1:UrzOwwQiOLckSyU1ETP66Qz9XV/vvVCn0RS1YTY1prk=
github.com/diamondburned/gotk4/pkg v0.0.0-20220418035147-8a785583d00a/go.mod h1:rLH6FHos690jFgAM/GYEpMykuE/9NmN6zOvFlr8JTvE=
github.com/flytam/filenamify v1.1.0 h1:iEOcC/1UgxJf4lp2E2CWtYO7TMyYmgb2RPSTou89FLs=
github.com/flytam/filenamify v1.1.0/go.mod h1:Dzf9kVycwcsBlr2ATg6uxjqiFgKGH+5SKFuhdeP5zu8=
github.com/gotk3/gotk3 v0.6.0 h1:Aqlq4/6VabNwtCyA9M9zFNad5yHAqCi5heWnZ9y+3dA=
github.com/gotk3/gotk3 v0.6.0/go.mod h1:/hqFpkNa9T3JgNAE2fLvCdov7c5bw//FHNZrZ3Uv9/Q=
github.com/gotk3/gotk3 v0.6.1 h1:GJ400a0ecEEWrzjBvzBzH+pB/esEMIGdB9zPSmBdoeo=
github.com/gotk3/gotk3 v0.6.1/go.mod h1:/hqFpkNa9T3JgNAE2fLvCdov7c5bw//FHNZrZ3Uv9/Q=
github.com/gotk3/gotk3 v0.6.2 h1:sx/PjaKfKULJPTPq8p2kn2ZbcNFxpOJqi4VLzMbEOO8=
github.com/gotk3/gotk3 v0.6.2/go.mod h1:/hqFpkNa9T3JgNAE2fLvCdov7c5bw//FHNZrZ3Uv9/Q=
github.com/gotk3/gotk3 v0.6.3 h1:+Ke4WkM1TQUNOlM2TZH6szqknqo+zNbX3BZWVXjSHYw=
github.com/gotk3/gotk3 v0.6.3/go.mod h1:/hqFpkNa9T3JgNAE2fLvCdov7c5bw//FHNZrZ3Uv9/Q=
github.com/gotk3/gotk3 v0.6.4 h1:5ur/PRr86PwCG8eSj98D1eXvhrNNK6GILS2zq779dCg=
github.com/gotk3/gotk3 v0.6.4/go.mod h1:/hqFpkNa9T3JgNAE2fLvCdov7c5bw//FHNZrZ3Uv9/Q=
github.com/nwaples/rardecode/v2 v2.0.0-beta.2 h1:e3mzJFJs4k83GXBEiTaQ5HgSc/kOK8q0rDaRO0MPaOk=
github.com/nwaples/rardecode/v2 v2.0.0-beta.2/go.mod h1:yntwv/HfMc/Hbvtq9I19D1n58te3h6KsqCf3GxyfBGY=
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
golang.org/x/sys v0.4.0 h1:Zr2JFtRQNX3BCZ8YtxRE9hNJYC8J6I1MVbMg6owUp18=
golang.org/x/sys v0.4.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.14.0 h1:Vz7Qs629MkJkGyHxUlRHizWJRG2j8fbQKjELVSNhy7Q=
golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.24.0 h1:Twjiwq9dn6R1fQcyiK+wQyHWfaz/BJB+YIpzU/Cv3Xg=
golang.org/x/sys v0.24.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.0.0-20220310020820-b874c991c1a5 h1:y/woIyUBFbpQGKS0u1aHF/40WUDnek3fPOyD08H5Vng=
golang.org/x/sys v0.0.0-20220310020820-b874c991c1a5/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6 h1:nonptSpoQ4vQjyraW20DXPAglgQfVnM9ZC6MmNLMR60=
golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=

View file

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2013-2021 Utkan Güngördü <utkan@freeconsole.org>
Copyright (c) 2021-2024 Piotr Grabowski
Copyright (c) 2021-2022 Piotr Grabowski
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -23,7 +23,6 @@
<mime-types>
<mime-type>application/zip</mime-type>
<mime-type>application/x-cbz</mime-type>
<mime-type>application/vnd.rar</mime-type>
</mime-types>
</object>
<object class="GtkRecentFilter" id="RecentFilter">
@ -169,28 +168,6 @@
<object class="GtkMenu" id="MenuView">
<property name="visible">true</property>
<property name="can-focus">false</property>
<child>
<object class="GtkCheckMenuItem" id="MenuItemFullscreen">
<property name="visible">true</property>
<property name="can-focus">false</property>
<property name="label" translatable="yes">Fullscreen</property>
<property name="use-underline">true</property>
</object>
</child>
<child>
<object class="GtkCheckMenuItem" id="MenuItemHideUI">
<property name="visible">true</property>
<property name="can-focus">false</property>
<property name="label" translatable="yes">Hide UI</property>
<property name="use-underline">true</property>
</object>
</child>
<child>
<object class="GtkSeparatorMenuItem" id="menuitem0">
<property name="visible">true</property>
<property name="can-focus">false</property>
</object>
</child>
<child>
<object class="GtkCheckMenuItem" id="MenuItemShrink">
<property name="visible">true</property>
@ -266,6 +243,22 @@
<property name="can-focus">false</property>
</object>
</child>
<child>
<object class="GtkCheckMenuItem" id="MenuItemFullscreen">
<property name="visible">true</property>
<property name="can-focus">false</property>
<property name="label" translatable="yes">Fullscreen</property>
<property name="use-underline">true</property>
</object>
</child>
<child>
<object class="GtkCheckMenuItem" id="MenuItemHideUI">
<property name="visible">true</property>
<property name="can-focus">false</property>
<property name="label" translatable="yes">Hide UI</property>
<property name="use-underline">true</property>
</object>
</child>
<child>
<object class="GtkCheckMenuItem" id="MenuItemSeamless">
<property name="visible">true</property>
@ -733,7 +726,7 @@
<property name="transient-for">MainWindow</property>
<property name="program-name">Gomics-v</property>
<property name="copyright" translatable="yes">Copyright (c) 20132021 Utkan Güngördü
Copyright (c) 20212024 Piotr Grabowski</property>
Copyright (c) 20212022 Piotr Grabowski</property>
<property name="comments" translatable="yes">Gomics-v is a GTK comic and image archive viewer written in Go, available under the GNU GPL v3 or later.</property>
<property name="website">https://github.com/fauu/gomicsv</property>
<property name="authors">Utkan Güngördü, Piotr Grabowski</property>

View file

@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2021 Utkan Güngördü <utkan@freeconsole.org>
* Copyright (c) 2021-2024 Piotr Grabowski
* Copyright (c) 2021-2022 Piotr Grabowski
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

2
gtk.go
View file

@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2021 Utkan Güngördü <utkan@freeconsole.org>
* Copyright (c) 2021-2024 Piotr Grabowski
* Copyright (c) 2021-2022 Piotr Grabowski
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View file

@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2021 Utkan Güngördü <utkan@freeconsole.org>
* Copyright (c) 2021-2024 Piotr Grabowski
* Copyright (c) 2021-2022 Piotr Grabowski
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View file

@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2021 Utkan Güngördü <utkan@freeconsole.org>
* Copyright (c) 2021-2024 Piotr Grabowski
* Copyright (c) 2021-2022 Piotr Grabowski
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -35,12 +35,6 @@ func (app *App) imageAreaInit() {
})
app.W.ScrolledWindow.Connect("button-press-event", func(self *gtk.ScrolledWindow, event *gdk.Event) bool {
if app.S.UITemporarilyRevealed {
app.S.UITemporarilyRevealed = false
app.toggleHideUI(true)
return true
}
be := &gdk.EventButton{Event: event}
switch be.Button() {
case 1:

View file

@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2021 Utkan Güngördü <utkan@freeconsole.org>
* Copyright (c) 2021-2024 Piotr Grabowski
* Copyright (c) 2021-2022 Piotr Grabowski
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View file

@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2021 Utkan Güngördü <utkan@freeconsole.org>
* Copyright (c) 2021-2024 Piotr Grabowski
* Copyright (c) 2021-2022 Piotr Grabowski
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View file

@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2021 Utkan Güngördü <utkan@freeconsole.org>
* Copyright (c) 2021-2024 Piotr Grabowski
* Copyright (c) 2021-2022 Piotr Grabowski
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -25,7 +25,6 @@ import (
"fmt"
"log"
"net/http"
"net/url"
"github.com/gotk3/gotk3/gdk"
)
@ -167,6 +166,6 @@ func kamiteSendOCRImageCommand(port int, imgBytes []byte, w, h int) {
}
func kamiteMakeEndpointURL(port int, suffix string) string {
path, _ := url.JoinPath(fmt.Sprintf(kamiteCMDEndpointBaseTpl, port), suffix)
return path
// TODO(fau): Go 1.19+ url.JoinPath()
return fmt.Sprintf(kamiteCMDEndpointBaseTpl, port) + suffix
}

2
md5.go
View file

@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2021 Utkan Güngördü <utkan@freeconsole.org>
* Copyright (c) 2021-2024 Piotr Grabowski
* Copyright (c) 2021-2022 Piotr Grabowski
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View file

@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2021 Utkan Güngördü <utkan@freeconsole.org>
* Copyright (c) 2021-2024 Piotr Grabowski
* Copyright (c) 2021-2022 Piotr Grabowski
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View file

@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2021 Utkan Güngördü <utkan@freeconsole.org>
* Copyright (c) 2021-2024 Piotr Grabowski
* Copyright (c) 2021-2022 Piotr Grabowski
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -293,7 +293,7 @@ func (app *App) currentArchiveIdx() (idx int, err error) {
}
}
if idx == -1 {
return 0, errors.New("could not find the current archive in the current directory. Deleted, perhaps?")
return 0, errors.New("Couldn't find the current archive in the current dir. Deleted, perhaps?")
}
return
}
@ -321,7 +321,7 @@ func (app *App) archiveNameRelativeToCurrent(relIdx int) (newName string, err er
idx := currIdx + relIdx
if idx < 0 || idx >= len(arNames) {
err = errors.New("no more archives in the directory")
err = errors.New("No more archives in the directory")
return
}

View file

@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2021 Utkan Güngördü <utkan@freeconsole.org>
* Copyright (c) 2021-2024 Piotr Grabowski
* Copyright (c) 2021-2022 Piotr Grabowski
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View file

@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2021 Utkan Güngördü <utkan@freeconsole.org>
* Copyright (c) 2021-2024 Piotr Grabowski
* Copyright (c) 2021-2022 Piotr Grabowski
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View file

@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2021 Utkan Güngördü <utkan@freeconsole.org>
* Copyright (c) 2021-2024 Piotr Grabowski
* Copyright (c) 2021-2022 Piotr Grabowski
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View file

@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2021 Utkan Güngördü <utkan@freeconsole.org>
* Copyright (c) 2021-2024 Piotr Grabowski
* Copyright (c) 2021-2022 Piotr Grabowski
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View file

@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2021 Utkan Güngördü <utkan@freeconsole.org>
* Copyright (c) 2021-2024 Piotr Grabowski
* Copyright (c) 2021-2022 Piotr Grabowski
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View file

@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2021 Utkan Güngördü <utkan@freeconsole.org>
* Copyright (c) 2021-2024 Piotr Grabowski
* Copyright (c) 2021-2022 Piotr Grabowski
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View file

@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2021 Utkan Güngördü <utkan@freeconsole.org>
* Copyright (c) 2021-2024 Piotr Grabowski
* Copyright (c) 2021-2022 Piotr Grabowski
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -95,7 +95,6 @@ func (app *App) scroll(dx, dy float64) {
}
func (app *App) scrollToStart() {
app.W.ScrolledWindow.SetVAdjustment(nil) // Needed to prevent a bug where it scrolls back by itself
app.W.ScrolledWindow.GetVAdjustment().SetValue(0) // Vertical: top
var newHadj float64 = 0
@ -103,21 +102,18 @@ func (app *App) scrollToStart() {
imgw, _ := app.getImageAreaInnerSize()
newHadj = float64(imgw)
}
app.W.ScrolledWindow.SetHAdjustment(nil)
app.W.ScrolledWindow.GetHAdjustment().SetValue(newHadj) // Horizontal: left (non-manga) or right (manga) edge
}
func (app *App) scrollToEnd() {
imgw, imgh := app.getImageAreaInnerSize()
app.W.ScrolledWindow.SetVAdjustment(nil)
app.W.ScrolledWindow.GetVAdjustment().SetValue(float64(imgh)) // Vertical: bottom
var newHadj float64 = 0
if !app.Config.MangaMode {
newHadj = float64(imgw)
}
app.W.ScrolledWindow.SetHAdjustment(nil)
app.W.ScrolledWindow.GetHAdjustment().SetValue(newHadj) // Horizontal: left (manga) or right (non-manga) edge
}

View file

@ -1,41 +0,0 @@
//go:build darwin
/*
* Copyright (c) 2013-2021 Utkan Güngördü <utkan@freeconsole.org>
* Copyright (c) 2021-2024 Piotr Grabowski
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gomicsv
import (
"errors"
"os"
"path/filepath"
)
func getConfigLocation(appName string) (string, error) {
return getUserDataLocation(appName)
}
func getUserDataLocation(appName string) (string, error) {
if appName == "" {
return "", errors.New("'appName' is empty")
}
if envHome := os.Getenv("HOME"); envHome != "" {
return filepath.Join(envHome, "Library", "Application Support", appName), nil
}
return "", errors.New("getting user appdata directory")
}

View file

@ -1,8 +1,9 @@
//go:build freebsd || linux || netbsd || openbsd || solaris
//go:build linux
// +build linux
/*
* Copyright (c) 2013-2021 Utkan Güngördü <utkan@freeconsole.org>
* Copyright (c) 2021-2024 Piotr Grabowski
* Copyright (c) 2021-2022 Piotr Grabowski
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View file

@ -1,41 +0,0 @@
//go:build windows
/*
* Copyright (c) 2013-2021 Utkan Güngördü <utkan@freeconsole.org>
* Copyright (c) 2021-2024 Piotr Grabowski
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gomicsv
import (
"errors"
"os"
"path/filepath"
)
func getConfigLocation(appName string) (string, error) {
return getUserDataLocation(appName)
}
func getUserDataLocation(appName string) (string, error) {
if appName == "" {
return "", errors.New("'appName' is empty")
}
if envAppdata := os.Getenv("APPDATA"); envAppdata != "" {
return filepath.Join(envAppdata, appName), nil
}
return "", errors.New("getting user appdata directory")
}

View file

@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2021 Utkan Güngördü <utkan@freeconsole.org>
* Copyright (c) 2021-2024 Piotr Grabowski
* Copyright (c) 2021-2022 Piotr Grabowski
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

22
ui.go
View file

@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2021 Utkan Güngördü <utkan@freeconsole.org>
* Copyright (c) 2021-2024 Piotr Grabowski
* Copyright (c) 2021-2022 Piotr Grabowski
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -119,23 +119,3 @@ func (app *App) syncWidgetsToConfig() {
app.W.KamitePortContainer.SetSensitive(app.Config.KamiteEnabled)
app.W.KamitePortEntry.SetText(fmt.Sprint(app.Config.KamitePort))
}
func (app *App) toggleHideUI(hideUI bool) {
if hideUI {
app.W.Menubar.Hide()
app.W.Toolbar.Hide()
app.W.Statusbar.Hide()
} else {
app.W.Menubar.Show()
app.W.Toolbar.Show()
app.W.Statusbar.Show()
}
}
func (app *App) toggleFullscreen(fullscreen bool) {
if fullscreen {
app.W.MainWindow.Fullscreen()
} else {
app.W.MainWindow.Unfullscreen()
}
}

View file

@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2021 Utkan Güngördü <utkan@freeconsole.org>
* Copyright (c) 2021-2024 Piotr Grabowski
* Copyright (c) 2021-2022 Piotr Grabowski
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View file

@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2021 Utkan Güngördü <utkan@freeconsole.org>
* Copyright (c) 2021-2024 Piotr Grabowski
* Copyright (c) 2021-2022 Piotr Grabowski
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View file

@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2021 Utkan Güngördü <utkan@freeconsole.org>
* Copyright (c) 2021-2024 Piotr Grabowski
* Copyright (c) 2021-2022 Piotr Grabowski
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by