Skip to content

Commit 3c84eef

Browse files
authored
🔀 Merge pull request #351 from Schneegans/fix/menu-layout
2 parents 4a08c44 + 712f61a commit 3c84eef

File tree

6 files changed

+4347
-4370
lines changed

6 files changed

+4347
-4370
lines changed

docs/changelog.md

+5
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,14 @@ SPDX-License-Identifier: CC-BY-4.0
1313

1414
**Release Date:** TBD
1515

16+
#### Changes
17+
18+
- The settings dialog now uses libadwaita for the tab pages. This brings some minor layout changes.
19+
1620
#### Bug Fixes
1721

1822
- Fixed selecting items on GNOME 46 requiring two clicks.
23+
- Fixed an issue which allowed the settings dialog to be resized below its minimal size.
1924
- Fixed a bug which caused achievement notifications to be not shown on GNOME 46.
2025

2126
## [Fly-Pie 25](https://github.com/schneegans/fly-pie/releases/tag/v25)

prefs.js

+25-32
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ export default class FlyPiePreferences extends ExtensionPreferences {
3434
fillPreferencesWindow(window) {
3535

3636
// Give some space to the window's widgets.
37-
window.set_default_size(650, 750);
37+
window.set_default_size(850, 800);
38+
window.set_size_request(850, 550);
3839

3940
// Create the Gio.Settings object.
4041
const settings = utils.createSettings();
@@ -80,33 +81,31 @@ export default class FlyPiePreferences extends ExtensionPreferences {
8081
// Initialize the Achievements page.
8182
const achievementsPage = new AchievementsPage(builder, settings);
8283

83-
// Hide the in-app notification when its close button is pressed.
84-
builder.get_object('notification-close-button').connect('clicked', () => {
85-
builder.get_object('notification-revealer').reveal_child = false;
86-
});
87-
88-
// This is our top-level widget which we will return later.
89-
const mainWidget = builder.get_object('main-notebook');
84+
// These are our top-level preferences pages which we will return later.
85+
this._pages = [
86+
builder.get_object('tutorial-page'), builder.get_object('settings-page'),
87+
builder.get_object('menu-editor-page'), builder.get_object('achievements-page')
88+
];
9089

9190
// Because it looks cool, we add the stack switcher and the menu button to the
9291
// window's title bar. We should refactor this to use libadwaita widgets in the
9392
// future.
94-
mainWidget.connect('realize', widget => {
93+
this._pages[0].connect('realize', widget => {
9594
const window = widget.get_root();
9695

97-
const stackSwitcher = builder.get_object('main-stack-switcher');
98-
const menuButton = builder.get_object('menu-button');
99-
100-
stackSwitcher.parent.remove(menuButton);
101-
stackSwitcher.parent.remove(stackSwitcher);
102-
103-
// In the future, we should drop support for older GNOME versions and rewrite the
104-
// entire dialog using libadwaita widgets!
96+
// Save the currently active settings page. This way, the tutorial will be shown
97+
// when the settings dialog is shown for the first time. Then, when the user
98+
// modified something on another page, this will be shown when the settings dialog
99+
// is shown again.
100+
window.visible_page_name = settings.get_string('active-stack-child');
101+
window.connect('notify::visible-page-name', (w) => {
102+
settings.set_string('active-stack-child', w.visible_page_name);
103+
});
105104

106-
// Add widgets to the titlebar.
107-
const titlebar = this._findChildByType(window, Adw.HeaderBar);
108-
titlebar.set_title_widget(stackSwitcher);
109-
titlebar.pack_start(menuButton);
105+
// Add the menu to the header bar.
106+
const menu = builder.get_object('menu-button');
107+
const header = this._findChildByType(window.get_content(), Adw.HeaderBar);
108+
header.pack_start(menu);
110109

111110
// Now create all the actions for the main menu.
112111
const group = Gio.SimpleActionGroup.new();
@@ -175,19 +174,11 @@ export default class FlyPiePreferences extends ExtensionPreferences {
175174
}
176175
});
177176

178-
// Save the currently active settings page. This way, the tutorial will be shown when
179-
// the settings dialog is shown for the first time. Then, when the user modified
180-
// something on another page, this will be shown when the settings dialog is shown
181-
// again.
182-
const stack = builder.get_object('main-stack');
183-
stack.visible_child_name = settings.get_string('active-stack-child');
184-
stack.connect('notify::visible-child-name', (stack) => {
185-
settings.set_string('active-stack-child', stack.visible_child_name);
186-
});
177+
187178

188179
// As we do not have something like a destructor, we just listen for the destroy
189180
// signal of our main widget.
190-
mainWidget.connect('destroy', () => {
181+
this._pages[0].connect('destroy', () => {
191182
// Delete the static settings object of the statistics.
192183
Statistics.destroyInstance();
193184

@@ -203,7 +194,9 @@ export default class FlyPiePreferences extends ExtensionPreferences {
203194
// Record this construction for the statistics.
204195
Statistics.getInstance().addSettingsOpened();
205196

206-
window.add(mainWidget);
197+
this._pages.forEach(page => {
198+
window.add(page);
199+
});
207200
}
208201

209202
// ----------------------------------------------------------------------- private stuff
Loading
Loading

0 commit comments

Comments
 (0)