[meld] filediff: Update signals to not use implicit gnomeglade connection



commit 7537e860e8c437ffd49588b0cd556eeb80994b3c
Author: Kai Willadsen <kai willadsen gmail com>
Date:   Sat Sep 7 15:45:30 2013 +1000

    filediff: Update signals to not use implicit gnomeglade connection

 data/ui/filediff.ui |    4 ++++
 meld/filediff.py    |   28 ++++++++++++++--------------
 2 files changed, 18 insertions(+), 14 deletions(-)
---
diff --git a/data/ui/filediff.ui b/data/ui/filediff.ui
index 8d45dde..96084f9 100644
--- a/data/ui/filediff.ui
+++ b/data/ui/filediff.ui
@@ -188,6 +188,7 @@
     <child>
       <object class="GtkVBox" id="filediff">
         <property name="visible">True</property>
+        <signal handler="on_key_press_event" name="key_press_event"/>
         <child>
           <object class="GtkTable" id="table">
             <property name="visible">True</property>
@@ -339,6 +340,7 @@
                     <property name="can_focus">False</property>
                     <property name="window_placement">GTK_CORNER_TOP_RIGHT</property>
                     <property name="window_placement_set">True</property>
+                    <signal handler="on_scrolledwindow_size_allocate" name="size-allocate"/>
                     <child>
                       <object class="MeldSourceView" id="textview0">
                         <property name="visible">True</property>
@@ -415,6 +417,7 @@
                   <object class="GtkScrolledWindow" id="scrolledwindow2">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
+                    <signal handler="on_scrolledwindow_size_allocate" name="size-allocate"/>
                     <child>
                       <object class="MeldSourceView" id="textview2">
                         <property name="visible">True</property>
@@ -453,6 +456,7 @@
                   <object class="GtkScrolledWindow" id="scrolledwindow1">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
+                    <signal handler="on_scrolledwindow_size_allocate" name="size-allocate"/>
                     <child>
                       <object class="MeldSourceView" id="textview1">
                         <property name="visible">True</property>
diff --git a/meld/filediff.py b/meld/filediff.py
index aaf1d22..b785002 100644
--- a/meld/filediff.py
+++ b/meld/filediff.py
@@ -177,7 +177,11 @@ class FileDiff(melddoc.MeldDoc, gnomeglade.Component):
         gtk.binding_entry_remove(srcviewer.GtkTextView, gtk.keysyms.z,
                                  gtk.gdk.CONTROL_MASK | gtk.gdk.SHIFT_MASK)
         for v in self.textview:
-            v.set_buffer(meldbuffer.MeldBuffer())
+            buf = meldbuffer.MeldBuffer()
+            buf.connect('begin_user_action',
+                        self.on_textbuffer_begin_user_action)
+            buf.connect('end_user_action', self.on_textbuffer_end_user_action)
+            v.set_buffer(buf)
             v.set_show_line_numbers(self.prefs.show_line_numbers)
             v.set_insert_spaces_instead_of_tabs(self.prefs.spaces_instead_of_tabs)
             v.set_wrap_mode(self.prefs.edit_wrap_lines)
@@ -581,9 +585,9 @@ class FileDiff(melddoc.MeldDoc, gnomeglade.Component):
         for mergedfile in merger.merge_2_files(src, dst):
             pass
         self._sync_vscroll_lock = True
-        self.on_textbuffer__begin_user_action()
+        self.on_textbuffer_begin_user_action()
         self.textbuffer[dst].set_text(mergedfile)
-        self.on_textbuffer__end_user_action()
+        self.on_textbuffer_end_user_action()
         def resync():
             self._sync_vscroll_lock = False
             self._sync_vscroll(self.scrolledwindow[src].get_vadjustment(), src)
@@ -597,9 +601,9 @@ class FileDiff(melddoc.MeldDoc, gnomeglade.Component):
         for mergedfile in merger.merge_3_files(False):
             pass
         self._sync_vscroll_lock = True
-        self.on_textbuffer__begin_user_action()
+        self.on_textbuffer_begin_user_action()
         self.textbuffer[dst].set_text(mergedfile)
-        self.on_textbuffer__end_user_action()
+        self.on_textbuffer_end_user_action()
         def resync():
             self._sync_vscroll_lock = False
             self._sync_vscroll(self.scrolledwindow[0].get_vadjustment(), 0)
@@ -891,10 +895,10 @@ class FileDiff(melddoc.MeldDoc, gnomeglade.Component):
         if self.undosequence.can_redo():
             self.undosequence.redo()
 
-    def on_textbuffer__begin_user_action(self, *buffer):
+    def on_textbuffer_begin_user_action(self, *buffer):
         self.undosequence.begin_group()
 
-    def on_textbuffer__end_user_action(self, *buffer):
+    def on_textbuffer_end_user_action(self, *buffer):
         self.undosequence.end_group()
 
     def on_text_insert_text(self, buf, it, text, textlen):
@@ -968,11 +972,7 @@ class FileDiff(melddoc.MeldDoc, gnomeglade.Component):
     def on_find_previous_activate(self, *args):
         self.findbar.start_find_previous(self.focus_pane)
 
-    def on_filediff__key_press_event(self, entry, event):
-        if event.keyval == gtk.keysyms.Escape:
-            self.findbar.hide()
-
-    def on_scrolledwindow__size_allocate(self, scrolledwindow, allocation):
+    def on_scrolledwindow_size_allocate(self, scrolledwindow, allocation):
         index = self.scrolledwindow.index(scrolledwindow)
         if index == 0 or index == 1:
             self.linkmap[0].queue_draw()
@@ -1905,10 +1905,10 @@ class FileDiff(melddoc.MeldDoc, gnomeglade.Component):
         dst_end = b1.get_iter_at_line_or_eof(chunk[4])
         t0 = text_type(b0.get_text(src_start, src_end, False), 'utf8')
         mark0 = b1.create_mark(None, dst_start, True)
-        self.on_textbuffer__begin_user_action()
+        self.on_textbuffer_begin_user_action()
         b1.delete(dst_start, dst_end)
         new_end = b1.insert_at_line(chunk[3], t0)
-        self.on_textbuffer__end_user_action()
+        self.on_textbuffer_end_user_action()
         mark1 = b1.create_mark(None, new_end, True)
         # FIXME: If the inserted chunk ends up being an insert chunk, then
         # this animation is not visible; this happens often in three-way diffs


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