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




commit d49a96a6a3d159fb8b7cf9ff1b31651a15225722
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 b8f2bea8c..41fb539d2 100644
--- a/src/nautilus-application.c
+++ b/src/nautilus-application.c
@@ -169,7 +169,7 @@ check_required_directories (NautilusApplication *self)
         GSList *l;
         char *error_string;
         g_autofree char *detail_string = NULL;
-        GtkDialog *dialog;
+        AdwMessageDialog *dialog;
 
         ret = FALSE;
 
@@ -773,18 +773,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]