[kupfer] Make Rescan async
- From: Ulrik Sverdrup <usverdrup src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [kupfer] Make Rescan async
- Date: Tue, 6 Apr 2010 18:22:54 +0000 (UTC)
commit 91cea5e05e051d2ca9d664191dea37f1e22337af
Author: Karol BÄ?dkowski <karol bedkowski gmail com>
Date: Tue Apr 6 16:42:53 2010 +0200
Make Rescan async
kupfer/plugin/core/__init__.py | 16 +++++++++++++++-
1 files changed, 15 insertions(+), 1 deletions(-)
---
diff --git a/kupfer/plugin/core/__init__.py b/kupfer/plugin/core/__init__.py
index 9291a2e..8db508f 100644
--- a/kupfer/plugin/core/__init__.py
+++ b/kupfer/plugin/core/__init__.py
@@ -20,6 +20,7 @@ from kupfer import objects
from kupfer.obj.base import InvalidLeafError
from kupfer import interface
from kupfer import pretty
+from kupfer import task
def _is_debug():
@@ -100,6 +101,15 @@ class CopyToClipboard (Action):
return "gtk-copy"
+class RescanActionTask(task.ThreadTask):
+ def __init__(self, source):
+ task.ThreadTask.__init__(self)
+ self.source = source
+
+ def thread_do(self):
+ self.source.get_leaves(force_update=True)
+
+
class Rescan (Action):
"""A source action: Rescan a source! """
rank_adjust = -5
@@ -110,10 +120,14 @@ class Rescan (Action):
if not leaf.has_content():
raise InvalidLeafError("Must have content")
source = leaf.content_source()
- source.get_leaves(force_update=True)
+ return RescanActionTask(source)
+
+ def is_async(self):
+ return True
def get_description(self):
return _("Force reindex of this source")
+
def get_icon_name(self):
return "gtk-refresh"
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]