From a1c02b979547c84397ec5da8b1b967038d9b1907 Mon Sep 17 00:00:00 2001 From: wwmm Date: Thu, 26 Sep 2024 00:28:12 -0300 Subject: [PATCH] replacing deprecated libadwaita calls --- data/ui/preferences_window.ui | 4 +--- include/preferences_window.hpp | 2 +- src/application.cpp | 6 ++---- src/preferences_window.cpp | 12 ++++++------ 4 files changed, 10 insertions(+), 14 deletions(-) diff --git a/data/ui/preferences_window.ui b/data/ui/preferences_window.ui index 4fc57d716..46bf38709 100644 --- a/data/ui/preferences_window.ui +++ b/data/ui/preferences_window.ui @@ -1,6 +1,4 @@ - + \ No newline at end of file diff --git a/include/preferences_window.hpp b/include/preferences_window.hpp index f9cb56c9f..d74e3148f 100644 --- a/include/preferences_window.hpp +++ b/include/preferences_window.hpp @@ -29,7 +29,7 @@ G_BEGIN_DECLS #define EE_TYPE_PREFERENCES_WINDOW (preferences_window_get_type()) -G_DECLARE_FINAL_TYPE(PreferencesWindow, preferences_window, EE, PREFERENCES_WINDOW, AdwPreferencesWindow) +G_DECLARE_FINAL_TYPE(PreferencesWindow, preferences_window, EE, PREFERENCES_WINDOW, AdwPreferencesDialog) G_END_DECLS diff --git a/src/application.cpp b/src/application.cpp index 0af348cad..bfc102068 100644 --- a/src/application.cpp +++ b/src/application.cpp @@ -511,10 +511,8 @@ void application_init(Application* self) { [](GSimpleAction* action, GVariant* parameter, gpointer gapp) { auto* preferences = ui::preferences::window::create(); - gtk_window_set_transient_for(GTK_WINDOW(preferences), - GTK_WINDOW(gtk_application_get_active_window(GTK_APPLICATION(gapp)))); - - gtk_window_present(GTK_WINDOW(preferences)); + adw_dialog_present(ADW_DIALOG(preferences), + GTK_WIDGET(gtk_application_get_active_window(GTK_APPLICATION(gapp)))); }, nullptr, nullptr, nullptr}; diff --git a/src/preferences_window.cpp b/src/preferences_window.cpp index a58eecd58..9ef737438 100644 --- a/src/preferences_window.cpp +++ b/src/preferences_window.cpp @@ -33,7 +33,7 @@ namespace ui::preferences::window { struct _PreferencesWindow { - AdwPreferencesWindow parent_instance; + AdwPreferencesDialog parent_instance; ui::preferences::general::PreferencesGeneral* page_general; @@ -41,7 +41,7 @@ struct _PreferencesWindow { }; // NOLINTNEXTLINE -G_DEFINE_TYPE(PreferencesWindow, preferences_window, ADW_TYPE_PREFERENCES_WINDOW) +G_DEFINE_TYPE(PreferencesWindow, preferences_window, ADW_TYPE_PREFERENCES_DIALOG) void dispose(GObject* object) { auto* self = EE_PREFERENCES_WINDOW(object); @@ -49,8 +49,8 @@ void dispose(GObject* object) { gtk_window_set_icon_name(GTK_WINDOW(self), IS_DEVEL_BUILD ? std::string(tags::app::id).append(".Devel").c_str() : tags::app::id); - adw_preferences_window_remove(ADW_PREFERENCES_WINDOW(self), ADW_PREFERENCES_PAGE(self->page_general)); - adw_preferences_window_remove(ADW_PREFERENCES_WINDOW(self), ADW_PREFERENCES_PAGE(self->page_spectrum)); + adw_preferences_dialog_remove(ADW_PREFERENCES_DIALOG(self), ADW_PREFERENCES_PAGE(self->page_general)); + adw_preferences_dialog_remove(ADW_PREFERENCES_DIALOG(self), ADW_PREFERENCES_PAGE(self->page_spectrum)); util::debug("disposed"); @@ -72,8 +72,8 @@ void preferences_window_init(PreferencesWindow* self) { self->page_general = ui::preferences::general::create(); self->page_spectrum = ui::preferences::spectrum::create(); - adw_preferences_window_add(ADW_PREFERENCES_WINDOW(self), ADW_PREFERENCES_PAGE(self->page_general)); - adw_preferences_window_add(ADW_PREFERENCES_WINDOW(self), ADW_PREFERENCES_PAGE(self->page_spectrum)); + adw_preferences_dialog_add(ADW_PREFERENCES_DIALOG(self), ADW_PREFERENCES_PAGE(self->page_general)); + adw_preferences_dialog_add(ADW_PREFERENCES_DIALOG(self), ADW_PREFERENCES_PAGE(self->page_spectrum)); } auto create() -> PreferencesWindow* {