mirror of
https://github.com/garraflavatra/rolens.git
synced 2025-07-20 22:48:02 +00:00
Removed Zenity dependency
This commit is contained in:
@ -1,17 +0,0 @@
|
||||
package ui
|
||||
|
||||
import "github.com/ncruces/zenity"
|
||||
|
||||
func (u *UI) OpenDirectory(title string) string {
|
||||
if title == "" {
|
||||
title = "Choose a directory"
|
||||
}
|
||||
|
||||
dir, err := zenity.SelectFile(zenity.Title(title), zenity.Directory(), zenity.Modal())
|
||||
|
||||
if err != nil && err != zenity.ErrCanceled {
|
||||
zenity.Error("Error while opening directory", zenity.ErrorIcon)
|
||||
}
|
||||
|
||||
return dir
|
||||
}
|
@ -1,34 +0,0 @@
|
||||
package ui
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/ncruces/zenity"
|
||||
)
|
||||
|
||||
// @todo: this takes ~0.5 seconds. Improve?
|
||||
func (u *UI) StartProgressBar(id uint, title string) {
|
||||
if title == "" {
|
||||
// default title
|
||||
title = "Loading…"
|
||||
}
|
||||
p, err := zenity.Progress(zenity.Title(title), zenity.Pulsate(), zenity.Modal())
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
u.progressBars[id] = p
|
||||
}
|
||||
|
||||
func (u *UI) StopProgressBar(id uint) {
|
||||
for try := 0; try < 10; try++ {
|
||||
if p := u.progressBars[id]; p != nil {
|
||||
p.Complete()
|
||||
p.Close()
|
||||
p = nil
|
||||
return
|
||||
}
|
||||
|
||||
println("Progress dialog not found:", id, try)
|
||||
time.Sleep(100 * time.Millisecond)
|
||||
}
|
||||
}
|
@ -5,18 +5,14 @@ import (
|
||||
"runtime"
|
||||
|
||||
"github.com/gen2brain/beeep"
|
||||
"github.com/ncruces/zenity"
|
||||
)
|
||||
|
||||
type UI struct {
|
||||
ctx context.Context
|
||||
progressBars map[uint]zenity.ProgressDialog
|
||||
}
|
||||
|
||||
func New() *UI {
|
||||
return &UI{
|
||||
progressBars: make(map[uint]zenity.ProgressDialog),
|
||||
}
|
||||
return &UI{}
|
||||
}
|
||||
|
||||
func (u *UI) Startup(ctx context.Context) {
|
||||
|
Reference in New Issue
Block a user