Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
bitmask-vpn
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Vladimir KozLove
bitmask-vpn
Commits
523f56ce
Verified
Commit
523f56ce
authored
6 years ago
by
meskio
Browse files
Options
Downloads
Patches
Plain Diff
[feat] set icon for the dialogs
parent
90059887
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
notificator.go
+44
-3
44 additions, 3 deletions
notificator.go
with
44 additions
and
3 deletions
notificator.go
+
44
−
3
View file @
523f56ce
...
...
@@ -16,6 +16,8 @@
package
main
import
(
"os"
"path"
"time"
"0xacab.org/leap/go-dialog"
...
...
@@ -28,6 +30,7 @@ const (
Do you want to donate now?`
missingAuthAgent
=
`Could not find a polkit authentication agent. Please run one and try again.`
notRunning
=
`Is bitmaskd running? Start bitmask and try again.`
svgFileName
=
"riseupvpn.svg"
)
type
notificator
struct
{
...
...
@@ -44,7 +47,10 @@ func (n *notificator) donations() {
time
.
Sleep
(
time
.
Minute
*
5
)
for
{
if
n
.
conf
.
needsNotification
()
{
letsDonate
:=
dialog
.
Message
(
printer
.
Sprintf
(
donationText
,
applicationName
))
.
Title
(
printer
.
Sprintf
(
"Donate"
))
.
YesNo
()
letsDonate
:=
dialog
.
Message
(
printer
.
Sprintf
(
donationText
,
applicationName
))
.
Title
(
printer
.
Sprintf
(
"Donate"
))
.
Icon
(
getSVGPath
())
.
YesNo
()
n
.
conf
.
setNotification
()
if
letsDonate
{
open
.
Run
(
"https://riseup.net/donate-vpn"
)
...
...
@@ -56,9 +62,44 @@ func (n *notificator) donations() {
}
func
(
n
*
notificator
)
bitmaskNotRunning
()
{
dialog
.
Message
(
printer
.
Sprintf
(
notRunning
))
.
Title
(
printer
.
Sprintf
(
"Can't contact bitmask"
))
.
Error
()
dialog
.
Message
(
printer
.
Sprintf
(
notRunning
))
.
Title
(
printer
.
Sprintf
(
"Can't contact bitmask"
))
.
Icon
(
getSVGPath
())
.
Error
()
}
func
(
n
*
notificator
)
authAgent
()
{
dialog
.
Message
(
printer
.
Sprintf
(
missingAuthAgent
))
.
Title
(
printer
.
Sprintf
(
"Missing authentication agent"
))
.
Error
()
dialog
.
Message
(
printer
.
Sprintf
(
missingAuthAgent
))
.
Title
(
printer
.
Sprintf
(
"Missing authentication agent"
))
.
Icon
(
getSVGPath
())
.
Error
()
}
func
getSVGPath
()
string
{
wd
,
_
:=
os
.
Getwd
()
svgPath
:=
path
.
Join
(
wd
,
svgFileName
)
if
fileExist
(
svgPath
)
{
return
svgPath
}
svgPath
=
"/usr/share/riseupvpn/riseupvpn.svg"
if
fileExist
(
svgPath
)
{
return
svgPath
}
gopath
:=
os
.
Getenv
(
"GOPATH"
)
if
gopath
==
""
{
gopath
=
path
.
Join
(
os
.
Getenv
(
"HOME"
),
"go"
)
}
svgPath
=
path
.
Join
(
gopath
,
"src"
,
"0xacab.org"
,
"leap"
,
"bitmask-systray"
,
svgFileName
)
if
fileExist
(
svgPath
)
{
return
svgPath
}
return
""
}
func
fileExist
(
filePath
string
)
bool
{
_
,
err
:=
os
.
Stat
(
filePath
)
return
err
==
nil
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment