[nautilus/wip/cdavis/use-adw-message-dialog: 4/8] application: Use AdwMessageDialog for help error




commit 80307475d4d83b59fd12f24f64427a4b495ca31b
Author: Christopher Davis <christopherdavis gnome org>
Date:   Wed Jul 6 20:55:53 2022 -0400

    application: Use AdwMessageDialog for help error

 src/nautilus-application.c | 23 ++++++++++-------------
 1 file changed, 10 insertions(+), 13 deletions(-)
---
diff --git a/src/nautilus-application.c b/src/nautilus-application.c
index 77fd7d045..f3664d66b 100644
--- a/src/nautilus-application.c
+++ b/src/nautilus-application.c
@@ -166,7 +166,7 @@ check_required_directories (NautilusApplication *self)
         GSList *l;
         char *error_string;
         g_autofree char *detail_string = NULL;
-        GtkDialog *dialog;
+        AdwMessageDialog *dialog;
 
         ret = FALSE;
 
@@ -765,18 +765,15 @@ action_help (GSimpleAction *action,
 
     if (error)
     {
-        dialog = gtk_message_dialog_new (window ? GTK_WINDOW (window) : NULL,
-                                         GTK_DIALOG_MODAL,
-                                         GTK_MESSAGE_ERROR,
-                                         GTK_BUTTONS_OK,
-                                         _("There was an error displaying help: \n%s"),
-                                         error->message);
-        g_signal_connect (G_OBJECT (dialog), "response",
-                          G_CALLBACK (gtk_window_destroy),
-                          NULL);
-
-        gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE);
-        gtk_widget_show (dialog);
+        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));
         g_error_free (error);
     }
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]