From 9666a8707fdd41435ad7f2912745d4f025968abb Mon Sep 17 00:00:00 2001 From: Automeris naranja <104251-automerisnaranja@users.noreply.gitlab.gnome.org> Date: Mon, 28 Oct 2024 21:57:59 -0300 Subject: [PATCH 1/2] nautilus-application: Port AdwMessageDialog to AdwAlertDialog --- src/nautilus-application.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/src/nautilus-application.c b/src/nautilus-application.c index 065eb053b4..fb8ca88747 100644 --- a/src/nautilus-application.c +++ b/src/nautilus-application.c @@ -727,24 +727,23 @@ action_help (GSimpleAction *action, gpointer user_data) { GtkWindow *window; - GtkWidget *dialog; + AdwDialog *dialog; GtkApplication *application = user_data; GError *error = NULL; window = gtk_application_get_active_window (application); gtk_show_uri (window, "help:gnome-help/files", GDK_CURRENT_TIME); - if (error) + if (!error) { - dialog = adw_message_dialog_new (window ? GTK_WINDOW (window) : NULL, - NULL, NULL); - adw_message_dialog_format_heading (ADW_MESSAGE_DIALOG (dialog), - _("There was an error displaying help: \n%s"), - error->message); - adw_message_dialog_add_response (ADW_MESSAGE_DIALOG (dialog), "ok", _("_OK")); - adw_message_dialog_set_default_response (ADW_MESSAGE_DIALOG (dialog), "ok"); - - gtk_window_present (GTK_WINDOW (dialog)); + dialog = adw_alert_dialog_new (_("There was an error displaying help"), + NULL); + adw_alert_dialog_format_body (ADW_ALERT_DIALOG (dialog), "%s", + error->message); + adw_alert_dialog_add_response (ADW_ALERT_DIALOG (dialog), "ok", _("_OK")); + adw_alert_dialog_set_default_response (ADW_ALERT_DIALOG (dialog), "ok"); + + adw_dialog_present (dialog, GTK_WIDGET (window)); g_error_free (error); } } -- GitLab From e86cf094a3d951fe9a7648dd04d15e6d6d4b2c91 Mon Sep 17 00:00:00 2001 From: Automeris naranja <104251-automerisnaranja@users.noreply.gitlab.gnome.org> Date: Mon, 28 Oct 2024 22:26:59 -0300 Subject: [PATCH 2/2] nautilus-application: Port AdwMessageDialog to AdwAlertDialog Also, move the error message to the alert dialog body instead of presenting it in the alert dialog heading. --- src/nautilus-application.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/nautilus-application.c b/src/nautilus-application.c index fb8ca88747..4b17c36b31 100644 --- a/src/nautilus-application.c +++ b/src/nautilus-application.c @@ -734,12 +734,9 @@ action_help (GSimpleAction *action, window = gtk_application_get_active_window (application); gtk_show_uri (window, "help:gnome-help/files", GDK_CURRENT_TIME); - if (!error) + if (error) { - dialog = adw_alert_dialog_new (_("There was an error displaying help"), - NULL); - adw_alert_dialog_format_body (ADW_ALERT_DIALOG (dialog), "%s", - error->message); + dialog = adw_alert_dialog_new (_("There was an error displaying help"), error->message); adw_alert_dialog_add_response (ADW_ALERT_DIALOG (dialog), "ok", _("_OK")); adw_alert_dialog_set_default_response (ADW_ALERT_DIALOG (dialog), "ok"); -- GitLab