meld r1323 - trunk



Author: vincele
Date: Sat Apr  4 13:34:50 2009
New Revision: 1323
URL: http://svn.gnome.org/viewvc/meld?rev=1323&view=rev

Log:
Remove safe_apply() as it does not seem useful


Modified:
   trunk/meldapp.py
   trunk/misc.py

Modified: trunk/meldapp.py
==============================================================================
--- trunk/meldapp.py	(original)
+++ trunk/meldapp.py	Sat Apr  4 13:34:50 2009
@@ -792,10 +792,10 @@
             #self.append_filediff( ("ntest/file9a", "ntest/file9b") )
 
     def on_menu_edit_down_activate(self, *args):
-        misc.safe_apply( self.current_doc(), "next_diff", gtk.gdk.SCROLL_DOWN )
+        self.current_doc().next_diff(gtk.gdk.SCROLL_DOWN)
 
     def on_menu_edit_up_activate(self, *args):
-        misc.safe_apply( self.current_doc(), "next_diff", gtk.gdk.SCROLL_UP )
+        self.current_doc().next_diff(gtk.gdk.SCROLL_UP)
 
     def on_toolbar_stop_clicked(self, *args):
         self.current_doc().stop()

Modified: trunk/misc.py
==============================================================================
--- trunk/misc.py	(original)
+++ trunk/misc.py	Sat Apr  4 13:34:50 2009
@@ -231,21 +231,6 @@
     pipe.tochild.close()
     return pipe.wait()
 
-def safe_apply(obj, method, args):
-    """Call 'obj.method(args)' if 'obj' has an attribute named 'method'.
-
-    If 'obj' has no method 'method' this is a no-op.
-    """
-    try:
-        m = getattr(obj, method)
-    except AttributeError:
-        pass
-    else:
-        # allow single arguments to be passed as is.
-        if type(args) != type(()):
-            args = (args,)
-        apply(m, args)
-
 def clamp(val, lower, upper):
     """Clamp 'val' to the inclusive range [lower,upper].
     """



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