summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Williamson <awilliam@redhat.com>2023-04-20 09:38:28 -0700
committerAdam Williamson <awilliam@redhat.com>2023-04-20 11:35:25 -0700
commitdebaf6de1bfcd71d403e252caa639c52d2cba6e3 (patch)
tree9ff49aff49c368938d9bec4b10344bf43090f4ee
parent7998cc581046aeab3f7c952656aec8accaef76e2 (diff)
downloadzenity-debaf6de1bfcd71d403e252caa639c52d2cba6e3.tar.gz
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>
-rw-r--r--src/progress.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/progress.c b/src/progress.c
index cae1a6c..507c4c5 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);