[kupfer] plugin.locate: add "ignore case" option



commit c50d7b796bb1895e994a3b982964beb5dc6b3a09
Author: Karol BÄ?dkowski <karol bedkowsk+gh gmail com>
Date:   Tue Oct 13 14:25:31 2009 +0200

    plugin.locate: add "ignore case" option

 kupfer/plugin/locate.py |   16 ++++++++++++----
 1 files changed, 12 insertions(+), 4 deletions(-)
---
diff --git a/kupfer/plugin/locate.py b/kupfer/plugin/locate.py
index 353eda8..75f9318 100644
--- a/kupfer/plugin/locate.py
+++ b/kupfer/plugin/locate.py
@@ -2,7 +2,7 @@ import os
 
 from kupfer.objects import Action, Source, Leaf
 from kupfer.objects import (TextLeaf, ConstructFileLeaf, FileLeaf)
-from kupfer import icons
+from kupfer import icons, plugin_support
 
 
 __kupfer_name__ = _("Locate Files")
@@ -12,7 +12,14 @@ __kupfer_actions__ = (
 __description__ = _("Search filesystem using locate")
 __version__ = ""
 __author__ = "Ulrik Sverdrup <ulrik sverdrup gmail com>"
-
+__kupfer_settings__ = plugin_support.PluginSettings(
+	{
+		"key" : "ignore_case",
+		"label": _("Ignore case distinctions when searching files"),
+		"type": bool,
+		"value": True,
+	},
+)
 
 class Locate (Action):
 	def __init__(self):
@@ -39,8 +46,9 @@ class LocateQuerySource (Source):
 		self.max_items = 500
 
 	def get_items(self):
-		command = "locate --quiet --null --limit %d '%s'" % \
-				(self.max_items, self.query)
+		ignore_case = '--ignore-case' if __kupfer_settings__["ignore_case"] else ''
+		command = "locate --quiet --null --limit %d %s '%s'" % \
+				(self.max_items, ignore_case, self.query)
 		locate_output = os.popen(command).read()
 		files = locate_output.split("\x00")[:-1]
 		for filestr in files:



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