[gnome-builder] todo: avoid use of lambda for callback



commit d6fcf7c70ccd13f75da161f38ea58292d7761e31
Author: Christian Hergert <chergert redhat com>
Date:   Fri Oct 28 14:28:06 2016 -0700

    todo: avoid use of lambda for callback

 plugins/todo/todo_plugin/__init__.py |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/plugins/todo/todo_plugin/__init__.py b/plugins/todo/todo_plugin/__init__.py
index be6c3bc..0bc0096 100644
--- a/plugins/todo/todo_plugin/__init__.py
+++ b/plugins/todo/todo_plugin/__init__.py
@@ -89,7 +89,9 @@ class TodoWorkbenchAddin(GObject.Object, Ide.WorkbenchAddin):
         # can be navigated to quickly.
         self.mine(file, prepend=True)
 
-    def post(self, items, prepend=False):
+    def _post_from_main(self, args):
+        items, prepend = args
+
         context = self.workbench.get_context()
         vcs = context.get_vcs()
 
@@ -162,7 +164,7 @@ class TodoWorkbenchAddin(GObject.Object, Ide.WorkbenchAddin):
             if item.props.file and not skip:
                 items.append(item)
 
-            GLib.timeout_add(0, lambda: self.post(items, prepend=prepend))
+            GLib.idle_add(self._post_from_main, (items, prepend))
 
         threading.Thread(target=communicate, args=[p], name='todo-thread').start()
 


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