[meld] preferences: Move symlink ignoring to GSettings



commit 738bd4dc828753456dc9d8456b50cc168444b2eb
Author: Kai Willadsen <kai willadsen gmail com>
Date:   Sat Nov 23 12:13:42 2013 +1000

    preferences: Move symlink ignoring to GSettings

 data/org.gnome.meld.gschema.xml |    5 +++++
 data/ui/preferences.ui          |    1 -
 meld/dirdiff.py                 |   14 +++++++++++---
 meld/preferences.py             |    8 +-------
 4 files changed, 17 insertions(+), 11 deletions(-)
---
diff --git a/data/org.gnome.meld.gschema.xml b/data/org.gnome.meld.gschema.xml
index d8bc5a5..cb66f8e 100644
--- a/data/org.gnome.meld.gschema.xml
+++ b/data/org.gnome.meld.gschema.xml
@@ -64,6 +64,11 @@
           <summary>Columns to display</summary>
           <description>List of column names in folder comparison and whether they should be 
displayed.</description>
       </key>
+      <key name="folder-ignore-symlinks" type="b">
+          <default>false</default>
+          <summary>Ignore symbolic links</summary>
+          <description>If true, folder comparisons do not follow symbolic links when traversing the folder 
tree.</description>
+      </key>
       <key name="folder-shallow-comparison" type="b">
           <default>false</default>
           <summary>Use shallow comparison</summary>
diff --git a/data/ui/preferences.ui b/data/ui/preferences.ui
index f14a351..8ea2c9c 100644
--- a/data/ui/preferences.ui
+++ b/data/ui/preferences.ui
@@ -752,7 +752,6 @@
                             <property name="use_underline">True</property>
                             <property name="xalign">0</property>
                             <property name="draw_indicator">True</property>
-                            <signal name="toggled" handler="on_checkbutton_ignore_symlinks_toggled" 
swapped="no"/>
                           </object>
                           <packing>
                             <property name="expand">False</property>
diff --git a/meld/dirdiff.py b/meld/dirdiff.py
index 255b4a5..b5b05c8 100644
--- a/meld/dirdiff.py
+++ b/meld/dirdiff.py
@@ -258,6 +258,12 @@ class DirDiff(melddoc.MeldDoc, gnomeglade.Component):
         nick="Columns to display",
         blurb="List of columns to display in folder comparison",
     )
+    ignore_symlinks = GObject.property(
+        type=bool,
+        nick="Ignore symbolic links",
+        blurb="Whether to follow symbolic links when comparing folders",
+        default=False,
+    )
     shallow_comparison = GObject.property(
         type=bool,
         nick="Use shallow comparison",
@@ -409,12 +415,14 @@ class DirDiff(melddoc.MeldDoc, gnomeglade.Component):
                 action_name = self.state_actions[s][1]
                 self.actiongroup.get_action(action_name).set_active(True)
 
+        settings.bind('folder-columns', self, 'columns',
+                      Gio.SettingsBindFlags.DEFAULT)
+        settings.bind('folder-ignore-symlinks', self, 'ignore-symlinks',
+                      Gio.SettingsBindFlags.DEFAULT)
         settings.bind('folder-shallow-comparison', self, 'shallow-comparison',
                       Gio.SettingsBindFlags.DEFAULT)
         settings.bind('folder-time-resolution', self, 'time-resolution',
                       Gio.SettingsBindFlags.DEFAULT)
-        settings.bind('folder-columns', self, 'columns',
-                      Gio.SettingsBindFlags.DEFAULT)
 
         self.update_comparator()
         self.connect("notify::shallow-comparison", self.update_comparator)
@@ -732,7 +740,7 @@ class DirDiff(melddoc.MeldDoc, gnomeglade.Component):
                         continue
 
                     if stat.S_ISLNK(s.st_mode):
-                        if self.prefs.ignore_symlinks:
+                        if self.props.ignore_symlinks:
                             continue
                         key = (s.st_dev, s.st_ino)
                         if key in symlinks_followed:
diff --git a/meld/preferences.py b/meld/preferences.py
index 76b4c3c..58a9b3a 100644
--- a/meld/preferences.py
+++ b/meld/preferences.py
@@ -192,6 +192,7 @@ class PreferencesDialog(gnomeglade.Component):
             ('use-system-editor', self.system_editor_checkbutton, 'active'),
             ('custom-editor-command', self.custom_edit_command_entry, 'text'),
             ('folder-shallow-comparison', self.checkbutton_shallow_compare, 'active'),
+            ('folder-ignore-symlinks', self.checkbutton_ignore_symlinks, 'active'),
             ('vc-show-commit-margin', self.checkbutton_show_commit_margin, 'active'),
             ('vc-commit-margin', self.spinbutton_commit_margin, 'value'),
             ('vc-break-commit-message', self.checkbutton_break_commit_lines, 'active'),
@@ -228,7 +229,6 @@ class PreferencesDialog(gnomeglade.Component):
         self.filefilter = FilterList(self.prefs, "filters",
                                      filters.FilterEntry.SHELL)
         self.file_filters_tab.pack_start(self.filefilter.widget, True, True, 0)
-        self.checkbutton_ignore_symlinks.set_active( self.prefs.ignore_symlinks)
 
         # text filters
         self.textfilter = FilterList(self.prefs, "regexes",
@@ -279,11 +279,6 @@ class PreferencesDialog(gnomeglade.Component):
     def on_checkbutton_show_whitespace_toggled(self, check):
         self.prefs.show_whitespace = check.get_active()
 
-    #
-    # filters
-    #
-    def on_checkbutton_ignore_symlinks_toggled(self, check):
-        self.prefs.ignore_symlinks = check.get_active()
     def on_checkbutton_ignore_blank_lines_toggled(self, check):
         self.prefs.ignore_blank_lines = check.get_active()
 
@@ -308,7 +303,6 @@ class MeldPreferences(prefs.Preferences):
         "show_whitespace": prefs.Value(prefs.BOOL, False),
         "edit_wrap_lines" : prefs.Value(prefs.INT, 0),
         "text_codecs": prefs.Value(prefs.STRING, "utf8 latin1"),
-        "ignore_symlinks": prefs.Value(prefs.BOOL,0),
         "vc_console_visible": prefs.Value(prefs.BOOL, 0),
         "filters" : prefs.Value(prefs.STRING,
             #TRANSLATORS: translate this string ONLY to the first "\t", leave it and the following parts 
intact


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