commiting changes - wallet checks and set deleted items to nil

This commit is contained in:
brent s. 2021-12-24 02:20:25 -05:00
parent 6c64681bc8
commit bc4383f488
Signed by: bts
GPG Key ID: 8C004C2F93481F6B
10 changed files with 31 additions and 3 deletions

1
blob_funcs_test.go Normal file
View File

@ -0,0 +1 @@
package gokwallet

1
folder_funcs_test.go Normal file
View File

@ -0,0 +1 @@
package gokwallet

1
funcs_test.go Normal file
View File

@ -0,0 +1 @@
package gokwallet

1
map_funcs_test.go Normal file
View File

@ -0,0 +1 @@
package gokwallet

1
password_funcs_test.go Normal file
View File

@ -0,0 +1 @@
package gokwallet

View File

@ -0,0 +1 @@
package gokwallet

1
utils_test.go Normal file
View File

@ -0,0 +1 @@
package gokwallet

View File

@ -94,6 +94,10 @@ func (w *Wallet) ChangePassword() (err error) {

var call *dbus.Call

if err = w.walletCheck(); err != nil {
return
}

call = w.Dbus.Call(
DbusWMChangePassword, 0, w.Name, DefaultWindowID, w.wm.AppID,
)
@ -189,6 +193,8 @@ func (w *Wallet) FolderExists(folderName string) (exists bool, err error) {

var notExists bool

// We don't need a walletcheck here since we don't need a handle.

if err = w.Dbus.Call(
DbusWMFolderNotExist, 0, w.Name, folderName,
).Store(&notExists); err != nil {
@ -208,8 +214,7 @@ func (w *Wallet) ForceClose() (err error) {

var rslt int32

if !w.isInit {
err = ErrNotInitialized
if err = w.walletCheck(); err != nil {
return
}

@ -228,6 +233,10 @@ func (w *Wallet) ForceClose() (err error) {
// HasFolder indicates if a Wallet has a Folder in it named folderName.
func (w *Wallet) HasFolder(folderName string) (hasFolder bool, err error) {

if err = w.walletCheck(); err != nil {
return
}

if err = w.Dbus.Call(
DbusWMHasFolder, 0, w.handle, folderName, w.wm.AppID,
).Store(&hasFolder); err != nil {
@ -240,6 +249,8 @@ func (w *Wallet) HasFolder(folderName string) (hasFolder bool, err error) {
// IsOpen returns whether a Wallet is open ("unlocked") or not (as well as updates Wallet.IsOpen).
func (w *Wallet) IsOpen() (isOpen bool, err error) {

// We don't call walletcheck here because this method is called by a walletcheck.

// We can call the same method with w.handle instead of w.Name. We don't have a handler yet though.
if err = w.Dbus.Call(
DbusWMIsOpen, 0, w.Name,
@ -276,7 +287,7 @@ func (w *Wallet) Open() (err error) {

var handler *int32

if _, err = w.IsOpen(); err != nil {
if err = w.walletCheck(); err != nil {
return
}

@ -308,6 +319,10 @@ func (w *Wallet) RemoveFolder(folderName string) (err error) {

var success bool

if err = w.walletCheck(); err != nil {
return
}

if err = w.Dbus.Call(
DbusWMRemoveFolder, 0, w.handle, folderName, w.wm.AppID,
).Store(&success); err != nil {
@ -328,6 +343,10 @@ func (w *Wallet) Update() (err error) {
var folderNames []string
var errs []error = make([]error, 0)

if err = w.walletCheck(); err != nil {
return
}

if folderNames, err = w.ListFolders(); err != nil {
return
}

1
wallet_funcs_test.go Normal file
View File

@ -0,0 +1 @@
package gokwallet

View File

@ -0,0 +1 @@
package gokwallet