@@ -34,7 +34,8 @@ export default class FlyPiePreferences extends ExtensionPreferences {
34
34
fillPreferencesWindow ( window ) {
35
35
36
36
// 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 ) ;
38
39
39
40
// Create the Gio.Settings object.
40
41
const settings = utils . createSettings ( ) ;
@@ -80,33 +81,31 @@ export default class FlyPiePreferences extends ExtensionPreferences {
80
81
// Initialize the Achievements page.
81
82
const achievementsPage = new AchievementsPage ( builder , settings ) ;
82
83
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
+ ] ;
90
89
91
90
// Because it looks cool, we add the stack switcher and the menu button to the
92
91
// window's title bar. We should refactor this to use libadwaita widgets in the
93
92
// future.
94
- mainWidget . connect ( 'realize' , widget => {
93
+ this . _pages [ 0 ] . connect ( 'realize' , widget => {
95
94
const window = widget . get_root ( ) ;
96
95
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
+ } ) ;
105
104
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 ) ;
110
109
111
110
// Now create all the actions for the main menu.
112
111
const group = Gio . SimpleActionGroup . new ( ) ;
@@ -175,19 +174,11 @@ export default class FlyPiePreferences extends ExtensionPreferences {
175
174
}
176
175
} ) ;
177
176
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
+
187
178
188
179
// As we do not have something like a destructor, we just listen for the destroy
189
180
// signal of our main widget.
190
- mainWidget . connect ( 'destroy' , ( ) => {
181
+ this . _pages [ 0 ] . connect ( 'destroy' , ( ) => {
191
182
// Delete the static settings object of the statistics.
192
183
Statistics . destroyInstance ( ) ;
193
184
@@ -203,7 +194,9 @@ export default class FlyPiePreferences extends ExtensionPreferences {
203
194
// Record this construction for the statistics.
204
195
Statistics . getInstance ( ) . addSettingsOpened ( ) ;
205
196
206
- window . add ( mainWidget ) ;
197
+ this . _pages . forEach ( page => {
198
+ window . add ( page ) ;
199
+ } ) ;
207
200
}
208
201
209
202
// ----------------------------------------------------------------------- private stuff
0 commit comments