Skip to content

Commit

Permalink
replacing deprecated libadwaita calls
Browse files Browse the repository at this point in the history
  • Loading branch information
wwmm committed Sep 26, 2024
1 parent cc5bcd4 commit a1c02b9
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 14 deletions.
4 changes: 1 addition & 3 deletions data/ui/preferences_window.ui
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface domain="easyeffects">
<template class="PreferencesWindow" parent="AdwPreferencesWindow">
<property name="modal">1</property>
</template>
<template class="PreferencesWindow" parent="AdwPreferencesDialog"> </template>
</interface>
2 changes: 1 addition & 1 deletion include/preferences_window.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 2 additions & 4 deletions src/application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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};

Expand Down
12 changes: 6 additions & 6 deletions src/preferences_window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,24 +33,24 @@
namespace ui::preferences::window {

struct _PreferencesWindow {
AdwPreferencesWindow parent_instance;
AdwPreferencesDialog parent_instance;

ui::preferences::general::PreferencesGeneral* page_general;

ui::preferences::spectrum::PreferencesSpectrum* page_spectrum;
};

// 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);

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");

Expand All @@ -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* {
Expand Down

0 comments on commit a1c02b9

Please sign in to comment.