[latexila] Simplify the file browser settings



commit 6c94b7c51d4969d109a0804aa4d1a4f233c4c486
Author: SÃbastien Wilmet <swilmet gnome org>
Date:   Wed Aug 8 02:29:46 2012 +0200

    Simplify the file browser settings
    
    Before, it was possible to list the file's extensions that are displayed
    in the file browser. But is it really useful?
    
    What most users want, I think, is simply to be able to hide the build
    files (those for clean-up: .log .toc â). By default the build files are
    hidden.
    
    The setting for showing/hiding hidden files is kept (the files that
    begins with a dot).

 data/org.gnome.latexila.gschema.xml |   20 +++----------
 src/file_browser.vala               |   22 ++++-----------
 src/preferences_dialog.vala         |   21 ++------------
 src/ui/preferences_dialog.ui        |   50 +++-------------------------------
 4 files changed, 19 insertions(+), 94 deletions(-)
---
diff --git a/data/org.gnome.latexila.gschema.xml b/data/org.gnome.latexila.gschema.xml
index 6f6adc6..6a788c7 100644
--- a/data/org.gnome.latexila.gschema.xml
+++ b/data/org.gnome.latexila.gschema.xml
@@ -166,25 +166,15 @@
       <summary>Current directory</summary>
       <description>URI of the file browser current directory</description>
     </key>
-    <key name="show-all-files" type="b">
-      <default>true</default>
-      <summary>Show all files</summary>
-      <description>Show all files except hidden files</description>
-    </key>
-    <key name="show-all-files-except" type="b">
-      <default>true</default>
-      <summary>Show all files except clean-up</summary>
-      <description>Show all files except those for clean-up (see preferences.latex.clean-extensions)</description>
+    <key name="show-build-files" type="b">
+      <default>false</default>
+      <summary>Show build files</summary>
+      <description>Show files with an extension present in preferences.latex.clean-extensions.</description>
     </key>
     <key name="show-hidden-files" type="b">
       <default>false</default>
       <summary>Show hidden files</summary>
-      <description>Show hidden files (beginnig with a dot). show-all-files must be true.</description>
-    </key>
-    <key name="file-extensions" type="s">
-      <default>'.tex .bib .pdf .dvi .ps'</default>
-      <summary>File extensions</summary>
-      <description>Show only files with one of these extensions. show-all-files must be false. The extensions (with the dot) must be separated with one space</description>
+      <description>Show files beginning with a dot.</description>
     </key>
   </schema>
 
diff --git a/src/file_browser.vala b/src/file_browser.vala
index 4fcea42..1a06939 100644
--- a/src/file_browser.vala
+++ b/src/file_browser.vala
@@ -75,10 +75,8 @@ public class FileBrowser : Grid
     private void init_settings ()
     {
         _settings = new GLib.Settings ("org.gnome.latexila.preferences.file-browser");
-        _settings.changed["show-all-files"].connect (refresh);
-        _settings.changed["show-all-files-except"].connect (refresh);
+        _settings.changed["show-build-files"].connect (refresh);
         _settings.changed["show-hidden-files"].connect (refresh);
-        _settings.changed["file-extensions"].connect (delayed_refresh);
 
         _latex_settings = new GLib.Settings ("org.gnome.latexila.preferences.latex");
         _latex_settings.changed["clean-extensions"].connect (delayed_refresh);
@@ -314,15 +312,10 @@ public class FileBrowser : Grid
 
         /* Get settings */
 
-        bool show_all = _settings.get_boolean ("show-all-files");
-        bool show_hidden = show_all && _settings.get_boolean ("show-hidden-files");
-        bool show_all_except = show_all &&
-            _settings.get_boolean ("show-all-files-except");
+        bool show_build_files = _settings.get_boolean ("show-build-files");
+        bool show_hidden_files = _settings.get_boolean ("show-hidden-files");
 
-        string exts = _settings.get_string ("file-extensions");
-        string[] extensions = exts.split (" ");
-
-        exts = _latex_settings.get_string ("clean-extensions");
+        string exts = _latex_settings.get_string ("clean-extensions");
         string[] clean_extensions = exts.split (" ");
 
         /* Get the directory enumerator */
@@ -358,7 +351,7 @@ public class FileBrowser : Grid
                 break;
 
             string basename = info.get_display_name ();
-            if (basename[0] == '.' && ! show_hidden)
+            if (basename[0] == '.' && ! show_hidden_files)
                 continue;
 
             FileType type = info.get_file_type ();
@@ -370,10 +363,7 @@ public class FileBrowser : Grid
 
             string extension = Utils.get_extension (basename);
 
-            if (show_all_except && ! (extension in clean_extensions))
-                continue;
-
-            if (! show_all && ! (extension in extensions))
+            if (! show_build_files && extension in clean_extensions)
                 continue;
 
             string stock_id = get_extension_stock_id (extension);
diff --git a/src/preferences_dialog.vala b/src/preferences_dialog.vala
index b3bc987..5d9b07e 100644
--- a/src/preferences_dialog.vala
+++ b/src/preferences_dialog.vala
@@ -314,28 +314,13 @@ public class PreferencesDialog : Dialog
         latex_settings.bind ("clean-extensions", clean_up_entry, "text",
             SettingsBindFlags.DEFAULT);
 
-        var file_browser_show_all = builder.get_object ("file_browser_show_all");
-        fb_settings.bind ("show-all-files", file_browser_show_all, "active",
+        var file_browser_show_build = builder.get_object ("file_browser_show_build");
+        fb_settings.bind ("show-build-files", file_browser_show_build, "active",
             SettingsBindFlags.DEFAULT);
 
-        Widget file_browser_except =
-            builder.get_object ("file_browser_except") as Widget;
-        fb_settings.bind ("show-all-files-except", file_browser_except, "active",
-            SettingsBindFlags.DEFAULT);
-
-        Widget file_browser_show_hidden =
-            builder.get_object ("file_browser_show_hidden") as Widget;
+        var file_browser_show_hidden = builder.get_object ("file_browser_show_hidden");
         fb_settings.bind ("show-hidden-files", file_browser_show_hidden, "active",
             SettingsBindFlags.DEFAULT);
-
-        set_sensitivity (fb_settings, "show-all-files", file_browser_except);
-        set_sensitivity (fb_settings, "show-all-files", file_browser_show_hidden);
-
-        Widget file_browser_entry =
-            builder.get_object ("file_browser_entry") as Widget;
-        fb_settings.bind ("file-extensions", file_browser_entry, "text",
-            SettingsBindFlags.DEFAULT);
-        set_sensitivity (fb_settings, "show-all-files", file_browser_entry, false);
     }
 
     private void set_sensitivity (GLib.Settings settings, string key, Widget widget,
diff --git a/src/ui/preferences_dialog.ui b/src/ui/preferences_dialog.ui
index 8b70c87..d546819 100644
--- a/src/ui/preferences_dialog.ui
+++ b/src/ui/preferences_dialog.ui
@@ -553,8 +553,8 @@
                   </packing>
                 </child>
                 <child>
-                  <object class="GtkCheckButton" id="file_browser_show_all">
-                    <property name="label" translatable="yes">Show all files</property>
+                  <object class="GtkCheckButton" id="file_browser_show_build">
+                    <property name="label" translatable="yes">Show build files</property>
                     <property name="use_action_appearance">False</property>
                     <property name="visible">True</property>
                     <property name="can_focus">True</property>
@@ -572,32 +572,13 @@
                   </packing>
                 </child>
                 <child>
-                  <object class="GtkCheckButton" id="file_browser_except">
-                    <property name="label" translatable="yes">Except those for clean-up</property>
-                    <property name="use_action_appearance">False</property>
-                    <property name="visible">True</property>
-                    <property name="can_focus">True</property>
-                    <property name="receives_default">False</property>
-                    <property name="margin_left">24</property>
-                    <property name="use_action_appearance">False</property>
-                    <property name="xalign">0</property>
-                    <property name="draw_indicator">True</property>
-                  </object>
-                  <packing>
-                    <property name="left_attach">0</property>
-                    <property name="top_attach">2</property>
-                    <property name="width">1</property>
-                    <property name="height">1</property>
-                  </packing>
-                </child>
-                <child>
                   <object class="GtkCheckButton" id="file_browser_show_hidden">
-                    <property name="label" translatable="yes">Show hidden files (beginning with a dot)</property>
+                    <property name="label" translatable="yes">Show hidden files</property>
                     <property name="use_action_appearance">False</property>
                     <property name="visible">True</property>
                     <property name="can_focus">True</property>
                     <property name="receives_default">False</property>
-                    <property name="margin_left">24</property>
+                    <property name="margin_left">12</property>
                     <property name="use_action_appearance">False</property>
                     <property name="use_underline">True</property>
                     <property name="xalign">0</property>
@@ -605,28 +586,7 @@
                   </object>
                   <packing>
                     <property name="left_attach">0</property>
-                    <property name="top_attach">3</property>
-                    <property name="width">1</property>
-                    <property name="height">1</property>
-                  </packing>
-                </child>
-                <child>
-                  <object class="GtkEntry" id="file_browser_entry">
-                    <property name="visible">True</property>
-                    <property name="can_focus">True</property>
-                    <property name="has_tooltip">True</property>
-                    <property name="tooltip_markup" translatable="yes">Show only files with these extensions</property>
-                    <property name="tooltip_text" translatable="yes">Show only files with these extensions</property>
-                    <property name="margin_left">12</property>
-                    <property name="hexpand">True</property>
-                    <property name="invisible_char">â</property>
-                    <property name="invisible_char_set">True</property>
-                    <property name="primary_icon_activatable">False</property>
-                    <property name="secondary_icon_activatable">False</property>
-                  </object>
-                  <packing>
-                    <property name="left_attach">0</property>
-                    <property name="top_attach">4</property>
+                    <property name="top_attach">2</property>
                     <property name="width">1</property>
                     <property name="height">1</property>
                   </packing>



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