[shotwell/wip/gtk4: 19/45] Prefs: Use selected folder, not current




commit 152767889732bad252d615d54d9fd8615d466760
Author: Jens Georg <mail jensge org>
Date:   Tue Apr 5 21:47:20 2022 +0200

    Prefs: Use selected folder, not current
    
    Add image to button

 data/ui/preferences_dialog.ui | 18 ++++++++++++++++++
 src/dialogs/Preferences.vala  | 11 ++++++-----
 2 files changed, 24 insertions(+), 5 deletions(-)
---
diff --git a/data/ui/preferences_dialog.ui b/data/ui/preferences_dialog.ui
index d93cec6d..6f8598ed 100644
--- a/data/ui/preferences_dialog.ui
+++ b/data/ui/preferences_dialog.ui
@@ -25,6 +25,24 @@
                     <property name="column_spacing">8</property>
                     <child>
                       <object class="GtkButton" id="library_dir_button">
+                        <child>
+                          <object class="GtkBox">
+                            <property name="orientation">horizontal</property>
+                            <property name="spacing">6</property>
+                            <child type="start">
+                              <object class="GtkImage">
+                                <property name="icon-name">folder-symbolic</property>
+                                <property name="halign">start</property>
+                              </object>
+                            </child>
+                            <child type="end">
+                              <object class="GtkLabel" id="library_dir_text">
+                                <property name="halign">start</property>
+                                <property name="hexpand">true</property>
+                              </object>
+                            </child>
+                          </object>
+                        </child>
                         <layout>
                           <property name="column">1</property>
                           <property name="row">4</property>
diff --git a/src/dialogs/Preferences.vala b/src/dialogs/Preferences.vala
index 923230bd..d0d09f35 100644
--- a/src/dialogs/Preferences.vala
+++ b/src/dialogs/Preferences.vala
@@ -30,6 +30,8 @@ public class PreferencesDialog : Gtk.Dialog {
     [GtkChild]
     private unowned Gtk.Button library_dir_button;
     [GtkChild]
+    private unowned Gtk.Label library_dir_text;
+    [GtkChild]
     private unowned Gtk.ComboBoxText dir_pattern_combo;
     [GtkChild]
     private unowned Gtk.Entry dir_pattern_entry;
@@ -154,7 +156,7 @@ public class PreferencesDialog : Gtk.Dialog {
         populate_app_combo_box(raw_editor_combo, PhotoFileFormat.RAW.get_mime_types(),
             Config.Facade.get_instance().get_external_raw_app(), out external_raw_apps);
 
-        library_dir_button.set_label(AppDirs.get_import_dir().get_path());
+        library_dir_text.set_label(AppDirs.get_import_dir().get_path());
 
         setup_dir_pattern(dir_pattern_combo, dir_pattern_entry);
 
@@ -277,7 +279,6 @@ public class PreferencesDialog : Gtk.Dialog {
 
         preferences_dialog.populate_preference_options();
         preferences_dialog.show();
-        //TODO preferences_dialog.library_dir_button.set_current_folder(AppDirs.get_import_dir().get_path());
 
         // Ticket #3001: Cause the dialog to become active if the user chooses 'Preferences'
         // from the menus a second time.
@@ -414,9 +415,9 @@ public class PreferencesDialog : Gtk.Dialog {
         file_chooser.show ();
         file_chooser.response.connect ((foo, response) => {
             print(foo.get_type().name());
-            var path = file_chooser.get_current_folder().get_path();
-            AppDirs.set_import_dir(file_chooser.get_current_folder().get_path());
-            library_dir_button.set_label (path);
+            var path = file_chooser.get_file().get_path();
+            AppDirs.set_import_dir(path);
+            library_dir_text.set_label (path);
             file_chooser.destroy();
         });
     }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]