[meld] Only refresh directory comparisons when the active filters list changes
- From: Kai Willadsen <kaiw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [meld] Only refresh directory comparisons when the active filters list changes
- Date: Tue, 15 Feb 2011 09:09:45 +0000 (UTC)
commit 4b67cf566f5210722a0904d0028d72a714b3e1af
Author: Kai Willadsen <kai willadsen gmail com>
Date: Sat Feb 12 08:08:04 2011 +1000
Only refresh directory comparisons when the active filters list changes
meld/dirdiff.py | 12 ++++++++++--
1 files changed, 10 insertions(+), 2 deletions(-)
---
diff --git a/meld/dirdiff.py b/meld/dirdiff.py
index a2c4967..29fb476 100644
--- a/meld/dirdiff.py
+++ b/meld/dirdiff.py
@@ -234,6 +234,7 @@ class DirDiff(melddoc.MeldDoc, gnomeglade.Component):
self.actiongroup.set_translation_domain("meld")
self.actiongroup.add_actions(actions)
self.actiongroup.add_toggle_actions(toggleactions)
+ self.name_filters = []
self.create_name_filters()
# FIXME: also handle text-filters-changed
app.connect("file-filters-changed", self.on_file_filters_changed)
@@ -323,11 +324,16 @@ class DirDiff(melddoc.MeldDoc, gnomeglade.Component):
def on_file_filters_changed(self, app):
self._cleanup_filter_menu_button(self.ui_manager)
- self.create_name_filters()
+ relevant_change = self.create_name_filters()
self._create_filter_menu_button(self.ui_manager)
- self.refresh()
+ if relevant_change:
+ self.refresh()
def create_name_filters(self):
+ old_active = set([f.filter_string for f in self.name_filters if f.active])
+ new_active = set([f.filter_string for f in app.file_filters if f.active])
+ active_filters_changed = old_active != new_active
+
self.name_filters = [copy.copy(f) for f in app.file_filters]
actions = []
disabled_actions = []
@@ -346,6 +352,8 @@ class DirDiff(melddoc.MeldDoc, gnomeglade.Component):
for name in disabled_actions:
self.filter_actiongroup.get_action(name).set_sensitive(False)
+ return active_filters_changed
+
def _do_to_others(self, master, objects, methodname, args):
if not hasattr(self, "do_to_others_lock"):
self.do_to_others_lock = 1
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]