Skip to content

Commit

Permalink
Merge pull request #46 from pymq/fyne-dbus-conn-handling
Browse files Browse the repository at this point in the history
  • Loading branch information
andydotxyz authored May 8, 2023
2 parents 7dc3c09 + 8d90ac8 commit 6892e4d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions systray_menu_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ func refresh() {
dbusErr := instance.menuProps.Set("com.canonical.dbusmenu", "Version",
dbus.MakeVariant(instance.menuVersion))
if dbusErr != nil {
log.Printf("systray error: failed to update menu version: %s\n", dbusErr)
log.Printf("systray error: failed to update menu version: %v\n", dbusErr)
return
}
err := menu.Emit(instance.conn, &menu.Dbusmenu_LayoutUpdatedSignal{
Expand All @@ -329,7 +329,7 @@ func refresh() {
},
})
if err != nil {
log.Printf("systray error: failed to emit layout updated signal: %s\n", err)
log.Printf("systray error: failed to emit layout updated signal: %v\n", err)
}

}
Expand Down
12 changes: 6 additions & 6 deletions systray_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,18 +164,18 @@ func quit() {

func nativeStart() {
systrayReady()
conn, _ := dbus.ConnectSessionBus()
if conn == nil {
log.Printf("systray error: failed to connect to DBus")
conn, err := dbus.SessionBus()
if err != nil {
log.Printf("systray error: failed to connect to DBus: %v\n", err)
return
}
err := notifier.ExportStatusNotifierItem(conn, path, &notifier.UnimplementedStatusNotifierItem{})
err = notifier.ExportStatusNotifierItem(conn, path, &notifier.UnimplementedStatusNotifierItem{})
if err != nil {
log.Printf("systray error: failed to export status notifier item: %s\n", err)
log.Printf("systray error: failed to export status notifier item: %v\n", err)
}
err = menu.ExportDbusmenu(conn, menuPath, instance)
if err != nil {
log.Printf("systray error: failed to export status notifier item: %s\n", err)
log.Printf("systray error: failed to export status notifier menu: %v\n", err)
return
}

Expand Down

0 comments on commit 6892e4d

Please sign in to comment.