From 840a3d43e3cab87f062d267f04376bdb6b54e395 Mon Sep 17 00:00:00 2001 From: oscfdezdz <42654671+oscfdezdz@users.noreply.github.com> Date: Sat, 27 Jan 2024 10:45:41 +0100 Subject: [PATCH] comment-dialog: Port AdwWindow to AdwDialog --- src/exm-comment-dialog.blp | 10 +++++----- src/exm-comment-dialog.c | 6 ++---- src/exm-comment-dialog.h | 2 +- src/exm-detail-view.c | 5 +---- 4 files changed, 9 insertions(+), 14 deletions(-) diff --git a/src/exm-comment-dialog.blp b/src/exm-comment-dialog.blp index 1d5b61cb9..fe0f3138c 100644 --- a/src/exm-comment-dialog.blp +++ b/src/exm-comment-dialog.blp @@ -1,14 +1,14 @@ using Gtk 4.0; using Adw 1; -template $ExmCommentDialog : Adw.Window { - default-width: 600; - default-height: 500; +template $ExmCommentDialog : Adw.Dialog { + content-width: 600; + content-height: 600; width-request: 360; height-request: 294; title: _("Comments"); - Adw.ToolbarView { + child: Adw.ToolbarView { [top] Adw.HeaderBar {} @@ -50,5 +50,5 @@ template $ExmCommentDialog : Adw.Window { } } }; - } + }; } diff --git a/src/exm-comment-dialog.c b/src/exm-comment-dialog.c index 621c5f735..3404a2f11 100644 --- a/src/exm-comment-dialog.c +++ b/src/exm-comment-dialog.c @@ -7,7 +7,7 @@ struct _ExmCommentDialog { - AdwWindow parent_instance; + AdwDialog parent_instance; ExmCommentProvider *comment_provider; @@ -17,7 +17,7 @@ struct _ExmCommentDialog int web_id; }; -G_DEFINE_FINAL_TYPE (ExmCommentDialog, exm_comment_dialog, ADW_TYPE_WINDOW) +G_DEFINE_FINAL_TYPE (ExmCommentDialog, exm_comment_dialog, ADW_TYPE_DIALOG) enum { PROP_0, @@ -106,8 +106,6 @@ exm_comment_dialog_class_init (ExmCommentDialogClass *klass) gtk_widget_class_bind_template_child (widget_class, ExmCommentDialog, list_box); gtk_widget_class_bind_template_child (widget_class, ExmCommentDialog, stack); - - gtk_widget_class_add_binding_action (widget_class, GDK_KEY_Escape, 0, "window.close", NULL); } static GtkWidget * diff --git a/src/exm-comment-dialog.h b/src/exm-comment-dialog.h index 4d99a35d5..1abd58414 100644 --- a/src/exm-comment-dialog.h +++ b/src/exm-comment-dialog.h @@ -8,7 +8,7 @@ G_BEGIN_DECLS #define EXM_TYPE_COMMENT_DIALOG (exm_comment_dialog_get_type()) -G_DECLARE_FINAL_TYPE (ExmCommentDialog, exm_comment_dialog, EXM, COMMENT_DIALOG, AdwWindow) +G_DECLARE_FINAL_TYPE (ExmCommentDialog, exm_comment_dialog, EXM, COMMENT_DIALOG, AdwDialog) ExmCommentDialog *exm_comment_dialog_new (int web_id); diff --git a/src/exm-detail-view.c b/src/exm-detail-view.c index 6a1058d64..ed65308ea 100644 --- a/src/exm-detail-view.c +++ b/src/exm-detail-view.c @@ -271,10 +271,7 @@ show_more_comments (GtkButton *button, dlg = exm_comment_dialog_new (self->pk); toplevel = gtk_widget_get_root (GTK_WIDGET (self)); - gtk_window_set_transient_for (GTK_WINDOW (dlg), GTK_WINDOW (toplevel)); - gtk_window_set_modal (GTK_WINDOW (dlg), TRUE); - - gtk_window_present (GTK_WINDOW (dlg)); + adw_dialog_present (ADW_DIALOG (dlg), GTK_WIDGET (toplevel)); } static void