-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0484198
commit 639b5e0
Showing
11 changed files
with
182 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
package ui | ||
|
||
import ( | ||
"log" | ||
|
||
"github.com/balazsgrill/potatodrive/win" | ||
"github.com/lxn/walk" | ||
. "github.com/lxn/walk/declarative" | ||
) | ||
|
||
type StatusList struct { | ||
walk.ReflectListModelBase | ||
statuses []win.FileSyncState | ||
pathToStatus map[string]int | ||
} | ||
|
||
func NewStatusList() *StatusList { | ||
return &StatusList{ | ||
pathToStatus: make(map[string]int), | ||
} | ||
} | ||
|
||
func (sl *StatusList) AddState(state win.FileSyncState) { | ||
currentindex, exists := sl.pathToStatus[state.Path] | ||
if exists { | ||
sl.statuses[currentindex] = state | ||
} else { | ||
sl.statuses = append(sl.statuses, state) | ||
sl.pathToStatus[state.Path] = len(sl.statuses) - 1 | ||
} | ||
} | ||
|
||
func StatusWindow() { | ||
var mw *walk.MainWindow | ||
var lb *walk.ListBox | ||
|
||
if err := (MainWindow{ | ||
AssignTo: &mw, | ||
Title: "PotatoDrive status", | ||
MinSize: Size{200, 200}, | ||
Size: Size{800, 600}, | ||
Font: Font{Family: "Segoe UI", PointSize: 9}, | ||
Layout: VBox{}, | ||
Children: []Widget{ | ||
Composite{ | ||
DoubleBuffering: true, | ||
Layout: VBox{}, | ||
Children: []Widget{ | ||
ListBox{ | ||
AssignTo: &lb, | ||
MultiSelection: true, | ||
Model: model, | ||
ItemStyler: styler, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}).Create(); err != nil { | ||
log.Fatal(err) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package filesystem | ||
|
||
import "github.com/balazsgrill/potatodrive/win" | ||
|
||
func (instance *VirtualizationInstance) NotifyFileState(path string, state win.FileSyncStateEnum) { | ||
if instance.handler == nil { | ||
return | ||
} | ||
instance.handler(win.FileSyncState{ | ||
Path: path, | ||
State: state, | ||
}) | ||
} | ||
|
||
func (instance *VirtualizationInstance) NotifyFileError(path string, err error) { | ||
if instance.handler == nil { | ||
return | ||
} | ||
instance.handler(win.FileSyncState{ | ||
Path: path, | ||
State: win.FileSyncStateError, | ||
LastError: err, | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters