@@ -7,7 +7,7 @@ using Granite;
77using Larawan.Constants ;
88using Larawan.Widgets ;
99
10- public class Larawan.Views.SettingsDialog : Granite . Dialog {
10+ public class Larawan.Views.SettingsView : Box {
1111
1212 const double MAX_WINDOW_HEIGHT = 650 ;
1313 const double MAX_WINDOW_WIDTH = 650 ;
@@ -23,26 +23,24 @@ public class Larawan.Views.SettingsDialog : Granite.Dialog {
2323 Scale window_width_scale;
2424 Scale window_height_scale;
2525 LinkButton startup_linkbutton;
26- Box root_box;
2726
2827 public ApplicationWindow window { get ; construct set ; }
2928
30- public SettingsDialog (ApplicationWindow window) {
29+ public SettingsView (ApplicationWindow window) {
3130 Object (window: window);
3231 }
3332
3433 construct {
35- transient_for = window;
3634 set_size_request (700 , 0 );
37- add_css_class (" settings-dialog " );
38- resizable = false ;
39- root_box = new Box ( Orientation . VERTICAL , 10 ) ;
35+ add_css_class (" settings-view " );
36+ orientation = Orientation . VERTICAL ;
37+ spacing = 10 ;
4038
4139 var slideshow_label = new Label (_(" Slideshow" )) {
4240 xalign = 0.0f
4341 };
4442 slideshow_label. add_css_class (Granite . STYLE_CLASS_H4_LABEL );
45- root_box . append (slideshow_label);
43+ append (slideshow_label);
4644 add_album_folder_field ();
4745 add_recursive_field ();
4846 add_duration_field ();
@@ -53,14 +51,12 @@ public class Larawan.Views.SettingsDialog : Granite.Dialog {
5351 window_label. add_css_class (Granite . STYLE_CLASS_H4_LABEL );
5452 window_label. add_css_class (" window-legend-label" );
5553
56- root_box . append (window_label);
54+ append (window_label);
5755 add_startup_field ();
5856 add_always_visible_field ();
5957 add_width_field ();
6058 add_height_field ();
6159
62- add_button (_(" Close" ), Gtk . ResponseType . CANCEL );
63- get_content_area (). append (root_box);
6460 bind_settings ();
6561 bind_events ();
6662 }
@@ -76,12 +72,6 @@ public class Larawan.Views.SettingsDialog : Granite.Dialog {
7672 }
7773 });
7874 });
79-
80- response. connect ((response_id) = > {
81- if (response_id == Gtk . ResponseType . CANCEL ) {
82- hide ();
83- }
84- });
8575 }
8676
8777 private void bind_settings () {
@@ -101,17 +91,17 @@ public class Larawan.Views.SettingsDialog : Granite.Dialog {
10191 hexpand = false
10292 };
10393 album_picker = new AlbumPicker .from_icon_name (" folder-open" );
104- album_picker. hexpand = true ;
10594 string pictures_dir = Path . build_filename (Environment . get_home_dir (), " Pictures" );
10695
10796 file_dialog = new FileDialog () {
108- initial_folder = File.new_for_path (pictures_dir )
97+ initial_folder = File.new_for_path (pictures_dir ),
98+ modal = true
10999 };
110100
111101 var album_folder_box = new Box (Orientation . HORIZONTAL , 10 );
112102 album_folder_box.append (folder_label );
113103 album_folder_box.append (album_picker );
114- root_box. append (album_folder_box );
104+ append (album_folder_box );
115105 }
116106
117107 private void add_recursive_field () {
@@ -138,7 +128,7 @@ public class Larawan.Views.SettingsDialog : Granite.Dialog {
138128
139129 box. append (control_box);
140130
141- root_box . append (box);
131+ append (box);
142132 }
143133
144134 private void add_duration_field () {
@@ -161,7 +151,7 @@ public class Larawan.Views.SettingsDialog : Granite.Dialog {
161151 duration_box. append (duration_label);
162152 duration_box. append (duration_scale);
163153
164- root_box . append (duration_box);
154+ append (duration_box);
165155 }
166156
167157 private void add_startup_field () {
@@ -186,7 +176,7 @@ public class Larawan.Views.SettingsDialog : Granite.Dialog {
186176 box. add_css_class (" form-field" );
187177 box. append (label);
188178 box. append (value_box);
189- root_box . append (box);
179+ append (box);
190180 }
191181
192182 private void add_width_field () {
@@ -197,11 +187,11 @@ public class Larawan.Views.SettingsDialog : Granite.Dialog {
197187 };
198188
199189 window_width_scale = new Scale .with_range (
200- Orientation . HORIZONTAL ,
201- MIN_WINDOW_WIDTH ,
202- MAX_WINDOW_WIDTH ,
190+ Orientation . HORIZONTAL ,
191+ MIN_WINDOW_WIDTH ,
192+ MAX_WINDOW_WIDTH ,
203193 1
204- ) {
194+ ) {
205195 digits = 0 ,
206196 draw_value = true ,
207197 hexpand = true ,
@@ -211,7 +201,7 @@ public class Larawan.Views.SettingsDialog : Granite.Dialog {
211201 box. add_css_class (" form-field" );
212202 box. append (window_width_label);
213203 box. append (window_width_scale);
214- root_box . append (box);
204+ append (box);
215205 }
216206
217207 private void add_height_field () {
@@ -222,11 +212,11 @@ public class Larawan.Views.SettingsDialog : Granite.Dialog {
222212 };
223213
224214 window_height_scale = new Scale .with_range (
225- Orientation . HORIZONTAL ,
215+ Orientation . HORIZONTAL ,
226216 MIN_WINDOW_HEIGHT ,
227- MAX_WINDOW_HEIGHT ,
217+ MAX_WINDOW_HEIGHT ,
228218 1
229- ) {
219+ ) {
230220 digits = 0 ,
231221 draw_value = true ,
232222 hexpand = true ,
@@ -236,7 +226,7 @@ public class Larawan.Views.SettingsDialog : Granite.Dialog {
236226 box. add_css_class (" form-field" );
237227 box. append (window_height_label);
238228 box. append (window_height_scale);
239- root_box . append (box);
229+ append (box);
240230 }
241231
242232 private void add_always_visible_field () {
@@ -254,6 +244,6 @@ public class Larawan.Views.SettingsDialog : Granite.Dialog {
254244 box. add_css_class (" form-field" );
255245 box. append (label);
256246 box. append (always_visible_label);
257- root_box . append (box);
247+ append (box);
258248 }
259249}
0 commit comments