[meld] Update text filters in FileDiff and refresh (closes bgo#596161)
- From: Kai Willadsen <kaiw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [meld] Update text filters in FileDiff and refresh (closes bgo#596161)
- Date: Tue, 15 Feb 2011 09:09:50 +0000 (UTC)
commit 2d5c3630d3c87200747929c2205545e5853b2ff0
Author: Kai Willadsen <kai willadsen gmail com>
Date: Sun Feb 13 08:15:52 2011 +1000
Update text filters in FileDiff and refresh (closes bgo#596161)
This is the last part of bug 596161. Previous commits new fixed file
filters not being used in DirDiff, and this extends the fix to
FileDiff.
meld/filediff.py | 19 +++++++++++++++++++
1 files changed, 19 insertions(+), 0 deletions(-)
---
diff --git a/meld/filediff.py b/meld/filediff.py
index 6443374..65a1f54 100644
--- a/meld/filediff.py
+++ b/meld/filediff.py
@@ -16,6 +16,7 @@
### Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
import codecs
+import copy
import os
from gettext import gettext as _
import re
@@ -206,6 +207,9 @@ class FileDiff(melddoc.MeldDoc, gnomeglade.Component):
self.textbuffer = [v.get_buffer() for v in self.textview]
self.bufferdata = [MeldBufferData() for b in self.textbuffer]
self.buffer_texts = [BufferLines(b) for b in self.textbuffer]
+ self.text_filters = []
+ self.create_text_filters()
+ app.connect("text-filters-changed", self.on_text_filters_changed)
self.buffer_filtered = [BufferLines(b, self._filter_text) for
b in self.textbuffer]
for (i, w) in enumerate(self.scrolledwindow):
@@ -302,6 +306,21 @@ class FileDiff(melddoc.MeldDoc, gnomeglade.Component):
if self.textview_focussed:
self.scheduler.add_task(self.textview_focussed.grab_focus)
+ def on_text_filters_changed(self, app):
+ relevant_change = self.create_text_filters()
+ if relevant_change:
+ self.set_files([None] * self.num_panes) # Refresh
+
+ def create_text_filters(self):
+ # In contrast to file filters, ordering of text filters can matter
+ old_active = [f.filter_string for f in self.text_filters if f.active]
+ new_active = [f.filter_string for f in app.text_filters if f.active]
+ active_filters_changed = old_active != new_active
+
+ self.text_filters = [copy.copy(f) for f in app.text_filters]
+
+ return active_filters_changed
+
def _disconnect_buffer_handlers(self):
for textview in self.textview:
textview.set_editable(0)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]