From d6776910288f2ed81a3a351b36cce5f987a89a09 Mon Sep 17 00:00:00 2001 From: smolBlackCat <66385489+smolBlackCat@users.noreply.github.com> Date: Wed, 25 Dec 2024 13:02:59 -0300 Subject: [PATCH] (core): Improve Board dialog implementation * Properly use AdwDialog UI builder * Remove can-close=false workaround to be able to close dialogs using adw_dialog_force_close --- src/dialog/create_board_dialog.cpp | 9 +- src/dialog/preferences-board-dialog.cpp | 6 +- src/resources/ui/board-dialog.ui | 150 ++++++++++++++---------- 3 files changed, 96 insertions(+), 69 deletions(-) diff --git a/src/dialog/create_board_dialog.cpp b/src/dialog/create_board_dialog.cpp index 7b487dd..5563449 100644 --- a/src/dialog/create_board_dialog.cpp +++ b/src/dialog/create_board_dialog.cpp @@ -3,11 +3,12 @@ #include #include -#include - namespace ui { CreateBoardDialog::CreateBoardDialog(ProgressWindow& board_creator) - : BoardDialog{}, board_creator{board_creator} {} + : BoardDialog{}, board_creator{board_creator} { + adw_dialog_set_title(ADW_DIALOG(board_dialog->gobj()), + _("Create New Board")); +} CreateBoardDialog* CreateBoardDialog::create(ProgressWindow& board_creator) { return new CreateBoardDialog(board_creator); @@ -52,6 +53,6 @@ void CreateBoardDialog::create_board() { } board_creator.add_local_board(backend); - close(); + adw_dialog_close(ADW_DIALOG(board_dialog->gobj())); } } // namespace ui diff --git a/src/dialog/preferences-board-dialog.cpp b/src/dialog/preferences-board-dialog.cpp index 9cb62b5..6d9e238 100644 --- a/src/dialog/preferences-board-dialog.cpp +++ b/src/dialog/preferences-board-dialog.cpp @@ -5,12 +5,14 @@ #include -#include "gtkmm/messagedialog.h" +#include "adwaita.h" namespace ui { PreferencesBoardDialog::PreferencesBoardDialog(BoardWidget& board_widget) : BoardDialog{}, board_widget{board_widget} { + adw_dialog_set_title(ADW_DIALOG(board_dialog->gobj()), + _("Board Preferences")); footer_button->set_label(_("Save")); load_board(); } @@ -87,6 +89,6 @@ void PreferencesBoardDialog::on_save_changes() { } board_widget.save(false); - close(); + adw_dialog_close(ADW_DIALOG(board_dialog->gobj())); } } // namespace ui diff --git a/src/resources/ui/board-dialog.ui b/src/resources/ui/board-dialog.ui index d2f31c9..c5c1e32 100644 --- a/src/resources/ui/board-dialog.ui +++ b/src/resources/ui/board-dialog.ui @@ -1,73 +1,97 @@ - + - - - + + + - False - - - 15 - 15 - 15 - 15 - vertical - 10 - - - vertical - 2 - - - title-4 - start - Board Title - - - - - - - - - - vertical - 2 - - - title-4 - start - Board Background - + True + + + + - - - - cover - frame - 10 - 10 - - - right - bg-setter-menu-model - Click to set a board background - True - + + 15 + 15 + 15 + 15 + vertical + 10 + + + vertical + 2 + + + title-4 + start + Board Title + + + + + + + + + + vertical + 2 + + + title-4 + start + Board Background + + + + + + + cover + frame + 10 + 10 + + + right + bg-setter-menu-model + Click to set a board background + True + + + + + + + suggested-action + Create Board + + + - - - - - suggested-action - Create Board - - - - + + 450 400