Empty icons, fixes.

This commit is contained in:
Nuno Cruces 2021-03-04 13:06:49 +00:00
parent 7f1f5d1aa3
commit a422ef6a6d
5 changed files with 12 additions and 5 deletions

View file

@ -245,6 +245,8 @@ func loadFlags() []zenity.Option {
var ico zenity.DialogIcon var ico zenity.DialogIcon
switch icon { switch icon {
case "":
ico = zenity.NoIcon
case "error", "dialog-error": case "error", "dialog-error":
ico = zenity.ErrorIcon ico = zenity.ErrorIcon
case "info", "dialog-information": case "info", "dialog-information":

View file

@ -52,6 +52,8 @@ func message(kind messageKind, text string, opts options) (bool, error) {
args = append(args, "--default-cancel") args = append(args, "--default-cancel")
} }
switch opts.icon { switch opts.icon {
case NoIcon:
args = append(args, "--icon-name=")
case ErrorIcon: case ErrorIcon:
args = append(args, "--window-icon=error", "--icon-name=dialog-error") args = append(args, "--window-icon=error", "--icon-name=dialog-error")
case WarningIcon: case WarningIcon:

View file

@ -16,14 +16,16 @@ func notify(text string, opts options) error {
args = append(args, "--title", *opts.title) args = append(args, "--title", *opts.title)
} }
switch opts.icon { switch opts.icon {
case NoIcon:
args = append(args, "--window-icon=dialog")
case ErrorIcon: case ErrorIcon:
args = append(args, "--window-icon=error") args = append(args, "--window-icon=dialog-error")
case WarningIcon: case WarningIcon:
args = append(args, "--window-icon=warning") args = append(args, "--window-icon=dialog-warning")
case InfoIcon: case InfoIcon:
args = append(args, "--window-icon=info") args = append(args, "--window-icon=dialog-information")
case QuestionIcon: case QuestionIcon:
args = append(args, "--window-icon=question") args = append(args, "--window-icon=dialog-question")
} }
_, err := zenutil.Run(opts.ctx, args) _, err := zenutil.Run(opts.ctx, args)

View file

@ -33,7 +33,7 @@ func notify(text string, opts options) error {
} }
switch opts.icon { switch opts.icon {
case InfoIcon: case InfoIcon, QuestionIcon:
args.InfoFlags |= 0x1 // NIIF_INFO args.InfoFlags |= 0x1 // NIIF_INFO
case WarningIcon: case WarningIcon:
args.InfoFlags |= 0x2 // NIIF_WARNING args.InfoFlags |= 0x2 // NIIF_WARNING

View file

@ -97,6 +97,7 @@ const (
WarningIcon WarningIcon
InfoIcon InfoIcon
QuestionIcon QuestionIcon
NoIcon
) )
// Icon returns an Option to set the dialog icon. // Icon returns an Option to set the dialog icon.