From c123430f22c8dc215383514df7221311ef4f9432 Mon Sep 17 00:00:00 2001 From: Travis McLane Date: Thu, 15 Jun 2023 14:33:50 -0500 Subject: [PATCH] [v3 linux] dialog fixes --- v3/pkg/application/dialogs_linux.go | 5 +---- v3/pkg/application/linux_purego.go | 20 ++++++++++---------- 2 files changed, 11 insertions(+), 14 deletions(-) diff --git a/v3/pkg/application/dialogs_linux.go b/v3/pkg/application/dialogs_linux.go index d715ef90..560f0762 100644 --- a/v3/pkg/application/dialogs_linux.go +++ b/v3/pkg/application/dialogs_linux.go @@ -1,7 +1,5 @@ package application -import "fmt" - func (m *linuxApp) showAboutDialog(title string, message string, icon []byte) { window := globalApplication.getWindowForID(m.getCurrentWindowID()) var parent pointer @@ -31,8 +29,7 @@ func (m *linuxDialog) show() { } response := runQuestionDialog(parent, m.dialog) - if response >= 0 { - fmt.Println("Response: ", response) + if response >= 0 && response < len(m.dialog.Buttons) { button := m.dialog.Buttons[response] if button.Callback != nil { go button.Callback() diff --git a/v3/pkg/application/linux_purego.go b/v3/pkg/application/linux_purego.go index cc7d6b8b..8c2eebd6 100644 --- a/v3/pkg/application/linux_purego.go +++ b/v3/pkg/application/linux_purego.go @@ -30,12 +30,12 @@ const ( GdkWindowStateFullscreen = 1 << 4 // https://gitlab.gnome.org/GNOME/gtk/-/blob/gtk-3-24/gtk/gtkmessagedialog.h#L87 - GtkButtonsNone int = iota - GtkButtonsOk - GtkButtonsClose - GtkButtonsCancel - GtkButtonsYesNo - GtkButtonsOkCancel + GtkButtonsNone int = 0 + GtkButtonsOk = 1 + GtkButtonsClose = 2 + GtkButtonsCancel = 3 + GtkButtonsYesNo = 4 + GtkButtonsOkCancel = 5 // https://gitlab.gnome.org/GNOME/gtk/-/blob/gtk-3-24/gtk/gtkdialog.h#L36 GtkDialogModal = 1 << 0 @@ -45,10 +45,10 @@ const ( GtkOrientationVertical = 1 // enum GtkMessageType - GtkMessageInfo = iota - GtkMessageWarning - GtkMessageQuestion - GtkMessageError + GtkMessageInfo = 0 + GtkMessageWarning = 1 + GtkMessageQuestion = 2 + GtkMessageError = 3 ) type GdkGeometry struct {