zenity/0001-progress-don-t-update-responses-that-aren-t-there.patch

72 lines
3.2 KiB
Diff

From debaf6de1bfcd71d403e252caa639c52d2cba6e3 Mon Sep 17 00:00:00 2001
From: Adam Williamson <awilliam@redhat.com>
Date: Thu, 20 Apr 2023 09:38:28 -0700
Subject: [PATCH] progress: don't update responses that aren't there
zenity_progress_handle_stdin always tries to update these
responses when progress seems to be done, but sometimes the
responses aren't present at all. The cancel response is not
present if `no_cancel` is true (that's when the CLI param
`--no-cancel` is used), and the OK response is not present if
`auto_close` is true (that's when `--auto-close` is used). We
need to only update the responses when they're present. This
solves a problem where zenity will print some errors then crash
when `--no-cancel` or `--auto-close` (or both) are used, notably
by Steam:
zenity[3319]: adw_message_dialog_set_response_enabled: assertion 'adw_message_dialog_has_response (self, response)' failed
zenity[3319]: adw_message_dialog_set_response_enabled: assertion 'adw_message_dialog_has_response (self, response)' failed
zenity[3319]: adw_message_dialog_set_response_enabled: assertion 'adw_message_dialog_has_response (self, response)' failed
steam.desktop[3319]: **
steam.desktop[3319]: Zenity:ERROR:../src/util.c:465:zenity_util_gapp_quit: assertion failed: (GTK_IS_WINDOW (window))
steam.desktop[3319]: Bail out! Zenity:ERROR:../src/util.c:465:zenity_util_gapp_quit: assertion failed: (GTK_IS_WINDOW (window))
I don't know why this causes the parent to stop being a window,
but...apparently it does. See:
https://bugzilla.redhat.com/show_bug.cgi?id=2177287
Signed-off-by: Adam Williamson <awilliam@redhat.com>
---
src/progress.c | 17 ++++++++++++-----
1 file changed, 12 insertions(+), 5 deletions(-)
diff --git a/src/progress.c b/src/progress.c
index cae1a6c3..507c4c58 100644
--- a/src/progress.c
+++ b/src/progress.c
@@ -249,8 +249,11 @@ zenity_progress_handle_stdin (GIOChannel *channel, GIOCondition condition,
if (percentage == 100)
{
- adw_message_dialog_set_response_enabled (ADW_MESSAGE_DIALOG(parent), "ok", TRUE);
- adw_message_dialog_set_default_response (ADW_MESSAGE_DIALOG(parent), "ok");
+ if (!auto_close)
+ {
+ adw_message_dialog_set_response_enabled (ADW_MESSAGE_DIALOG(parent), "ok", TRUE);
+ adw_message_dialog_set_default_response (ADW_MESSAGE_DIALOG(parent), "ok");
+ }
if (progress_data->autoclose)
{
@@ -271,9 +274,13 @@ zenity_progress_handle_stdin (GIOChannel *channel, GIOCondition condition,
{
/* We assume that we are done, so stop the pulsating and de-sensitize
* the buttons */
- adw_message_dialog_set_response_enabled (ADW_MESSAGE_DIALOG(parent), "ok", TRUE);
- adw_message_dialog_set_response_enabled (ADW_MESSAGE_DIALOG(parent), "cancel", FALSE);
- adw_message_dialog_set_default_response (ADW_MESSAGE_DIALOG(parent), "ok");
+ if (!no_cancel)
+ adw_message_dialog_set_response_enabled (ADW_MESSAGE_DIALOG(parent), "cancel", FALSE);
+ if (!auto_close)
+ {
+ adw_message_dialog_set_response_enabled (ADW_MESSAGE_DIALOG(parent), "ok", TRUE);
+ adw_message_dialog_set_default_response (ADW_MESSAGE_DIALOG(parent), "ok");
+ }
gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (progress_bar), 1.0);
--
2.40.0