Skip to content

Commit 0a3135e

Browse files
committed
Minor refactoring
Moved a method in the model to group it with other public methods
1 parent 06ce782 commit 0a3135e

File tree

2 files changed

+24
-24
lines changed

2 files changed

+24
-24
lines changed

cmd/cbxv/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import (
1313

1414
const (
1515
NAME = "cbxv"
16-
VERSION = "0.4.7"
16+
VERSION = "0.4.8"
1717
)
1818

1919
// Update listens for messages on the message channel and

internal/model/model.go

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -584,6 +584,29 @@ func (m *Model) PageToSpread(n int) int {
584584
return 0
585585
}
586586

587+
func (m *Model) StoreLayout() error {
588+
layout := Layout{
589+
FormatVersion: "0.1",
590+
}
591+
c := ComicData{}
592+
c.Hash = m.Hash
593+
c.FilePath = m.FilePath
594+
layout.Comic = c
595+
layout.Mode = m.LayoutMode
596+
layout.Pages = m.Pages
597+
598+
data, err := json.Marshal(layout)
599+
if err != nil {
600+
return err
601+
}
602+
603+
err = util.WriteLayout(m.Hash, string(data))
604+
if err != nil {
605+
return err
606+
}
607+
return nil
608+
}
609+
587610
func (m *Model) loadBookmarks() {
588611
m.Bookmarks = NewBookmarkList(m.FilePath)
589612
m.Bookmarks.Load(m.Hash)
@@ -624,29 +647,6 @@ func (m *Model) applyLayout(layout *Layout) {
624647
}
625648
}
626649

627-
func (m *Model) StoreLayout() error {
628-
layout := Layout{
629-
FormatVersion: "0.1",
630-
}
631-
c := ComicData{}
632-
c.Hash = m.Hash
633-
c.FilePath = m.FilePath
634-
layout.Comic = c
635-
layout.Mode = m.LayoutMode
636-
layout.Pages = m.Pages
637-
638-
data, err := json.Marshal(layout)
639-
if err != nil {
640-
return err
641-
}
642-
643-
err = util.WriteLayout(m.Hash, string(data))
644-
if err != nil {
645-
return err
646-
}
647-
return nil
648-
}
649-
650650
// Make sure we always send a result message, no errors allowed
651651
func (m *Model) sendOpenFileResMsg(code ResultCode, description string) {
652652
var d string

0 commit comments

Comments
 (0)