@@ -9,7 +9,12 @@ using Larawan.Widgets;
99
1010public class Larawan.Views.SettingsDialog : Granite .Dialog {
1111
12- EntryButton album_folder = null ;
12+ const double MAX_WINDOW_HEIGHT = 650 ;
13+ const double MAX_WINDOW_WIDTH = 650 ;
14+ const double MIN_WINDOW_HEIGHT = 300 ;
15+ const double MIN_WINDOW_WIDTH = 300 ;
16+
17+ AlbumPicker album_picker = null ;
1318 Switch shuffle_switch = null ;
1419 GLib . Settings settings;
1520 FileDialog file_dialog;
@@ -61,11 +66,11 @@ public class Larawan.Views.SettingsDialog : Granite.Dialog {
6166 }
6267
6368 private void bind_events () {
64- album_folder . clicked. connect (() = > {
69+ album_picker . clicked. connect (() = > {
6570 file_dialog. select_folder. begin (window, null , (obj, result) = > {
6671 try {
6772 File file = file_dialog. select_folder. end (result);
68- album_folder . text = file. get_path ();
73+ album_picker . value = file. get_path ();
6974 } catch (Error e) {
7075 info (e. message);
7176 }
@@ -81,7 +86,7 @@ public class Larawan.Views.SettingsDialog : Granite.Dialog {
8186
8287 private void bind_settings () {
8388 settings = new GLib .Settings (APP_ID );
84- settings. bind (" album-folder" , album_folder , " text " , SettingsBindFlags . DEFAULT );
89+ settings. bind (" album-folder" , album_picker , " value " , SettingsBindFlags . DEFAULT );
8590 settings. bind (" shuffle" , shuffle_switch, " active" , SettingsBindFlags . DEFAULT );
8691 settings. bind (" recursive" , recursive_switch, " active" , SettingsBindFlags . DEFAULT );
8792 settings. bind (" duration" , duration_scale. adjustment, " value" , SettingsBindFlags . DEFAULT );
@@ -95,9 +100,8 @@ public class Larawan.Views.SettingsDialog : Granite.Dialog {
95100 width_request = 150 ,
96101 hexpand = false
97102 };
98- album_folder = new EntryButton .from_icon_name (" folder-open" );
99- album_folder. readonly = true ;
100- album_folder. hexpand = true ;
103+ album_picker = new AlbumPicker .from_icon_name (" folder-open" );
104+ album_picker. hexpand = true ;
101105 string pictures_dir = Path . build_filename (Environment . get_home_dir (), " Pictures" );
102106
103107 file_dialog = new FileDialog () {
@@ -106,7 +110,7 @@ public class Larawan.Views.SettingsDialog : Granite.Dialog {
106110
107111 var album_folder_box = new Box (Orientation . HORIZONTAL , 10 );
108112 album_folder_box.append (folder_label );
109- album_folder_box.append (album_folder );
113+ album_folder_box.append (album_picker );
110114 root_box.append (album_folder_box );
111115 }
112116
@@ -192,7 +196,12 @@ public class Larawan.Views.SettingsDialog : Granite.Dialog {
192196 width_request = 150
193197 };
194198
195- window_width_scale = new Scale .with_range (Orientation . HORIZONTAL , 300 , 800 , 1 ) {
199+ window_width_scale = new Scale .with_range (
200+ Orientation . HORIZONTAL ,
201+ MIN_WINDOW_WIDTH ,
202+ MAX_WINDOW_WIDTH ,
203+ 1
204+ ) {
196205 digits = 0 ,
197206 draw_value = true ,
198207 hexpand = true ,
@@ -212,7 +221,12 @@ public class Larawan.Views.SettingsDialog : Granite.Dialog {
212221 width_request = 150
213222 };
214223
215- window_height_scale = new Scale .with_range (Orientation . HORIZONTAL , 300 , 800 , 1 ) {
224+ window_height_scale = new Scale .with_range (
225+ Orientation . HORIZONTAL ,
226+ MIN_WINDOW_HEIGHT ,
227+ MAX_WINDOW_HEIGHT ,
228+ 1
229+ ) {
216230 digits = 0 ,
217231 draw_value = true ,
218232 hexpand = true ,
0 commit comments