@@ -148,8 +148,42 @@ public class Screenshot.SaveDialog : Granite.Dialog {
148148 margin_top = 18
149149 };
150150
151- var location = new Gtk .FileChooserButton (_(" Select Screenshots Folder…" ), Gtk . FileChooserAction . SELECT_FOLDER );
152- location.set_current_folder (folder_dir );
151+ var folder_name = new Gtk .Label (" " ) {
152+ halign = Gtk . Align . START ,
153+ hexpand = true
154+ };
155+
156+ var folder_icon = new Gtk .Image () {
157+ pixel_size = 16
158+ };
159+
160+ if (folder_dir == Environment .get_home_dir ()) {
161+ folder_name. label = " Home" ;
162+ folder_icon. gicon = new ThemedIcon (" user-home" );
163+ } else if (folder_dir == "/") {
164+ folder_name. label = " File System" ;
165+ folder_icon. gicon = new ThemedIcon (" drive-harddisk" );
166+ } else {
167+ folder_name. label = Path . get_basename (folder_dir);
168+ folder_icon. gicon = new ThemedIcon (" folder" );
169+ }
170+
171+ var arrow = new Gtk .Image () {
172+ gicon = new ThemedIcon (" pan-down-symbolic" ),
173+ halign = Gtk . Align . END
174+ };
175+
176+ var location_button_indicator = new Gtk .Box (Gtk . Orientation . HORIZONTAL , 0 );
177+ location_button_indicator.add (folder_icon );
178+ location_button_indicator.add (folder_name );
179+ location_button_indicator.add (arrow );
180+
181+ var location_button = new Gtk .Button ();
182+ location_button.add (location_button_indicator );
183+
184+ var location_dialog = new Gtk .FileChooserNative (_(" Select Screenshots Folder…" ), this ,
185+ Gtk . FileChooserAction . SELECT_FOLDER , " Open" , " Cancel" );
186+ location_dialog.set_current_folder (folder_dir );
153187
154188 var content = this.get_content_area () as Gtk.Box;
155189 content. valign = Gtk . Align . START ;
@@ -165,7 +199,7 @@ public class Screenshot.SaveDialog : Granite.Dialog {
165199 content.add (format_label );
166200 content.add (format_cmb );
167201 content.add (location_label );
168- content.add (location );
202+ content.add (location_button );
169203
170204 var clipboard_btn = (Gtk . Button ) add_button (_ ("Copy to Clipboard "), 0);
171205
@@ -207,11 +241,28 @@ public class Screenshot.SaveDialog : Granite.Dialog {
207241 settings. set_string (" format" , format_cmb. get_active_text ());
208242 });
209243
210- location.selection_changed.connect (() => {
211- SList<string> uris = location. get_uris ();
212- foreach (unowned string uri in uris) {
213- settings. set_string (" folder-dir" , Uri . unescape_string (uri. substring (7 , - 1 )));
214- folder_dir = settings. get_string (" folder-dir" );
244+ location_button.clicked.connect (() => {
245+ location_dialog. run ();
246+ });
247+
248+ location_dialog.response.connect ((response ) => {
249+ if (response == Gtk . ResponseType . ACCEPT ) {
250+ SList<string> uris = location_dialog. get_uris ();
251+ foreach (unowned string uri in uris) {
252+ settings. set_string (" folder-dir" , Uri . unescape_string (uri. substring (7 , - 1 )));
253+ folder_dir = settings. get_string (" folder-dir" );
254+ }
255+
256+ if (folder_dir == Environment . get_home_dir ()) {
257+ folder_name. label = " Home" ;
258+ folder_icon. gicon = new ThemedIcon (" user-home" );
259+ } else if (folder_dir == " /" ) {
260+ folder_name. label = " File System" ;
261+ folder_icon. gicon = new ThemedIcon (" drive-harddisk" );
262+ } else {
263+ folder_name. label = Path . get_basename (folder_dir);
264+ folder_icon. gicon = new ThemedIcon (" folder" );
265+ }
215266 }
216267 });
217268 }
0 commit comments