def __init__(self, modules_dir): super(CoreImpl, self).__init__() self._loaded_modules = 0 self._inited_modules = 0 self._start_query_id = 0 self._last_query = None self._stop_queries = True self._threadpool = ThreadPool(5) self._mateconf = GconfStore.get_instance() self._history = DeskbarHistory.get_instance(self._mateconf.get_max_history_items()) self._mateconf.connect("max-history-items-changed", lambda s, num: self._history.set_max_history_items(num)) self._setup_module_loader(modules_dir) self._setup_module_list() self._disabled_module_list = DisabledModuleList() self._module_loader.connect ("module-not-initialized", self._disabled_module_list.add) self._module_installer = ModuleInstaller(self._module_loader) self._mateconf.connect("default-browser-changed", self._on_default_browser_changed) #prevent double notifications self.browser = None
def __init__(self, modules_dir): super(CoreImpl, self).__init__() self._loaded_modules = 0 self._inited_modules = 0 self._start_query_id = 0 self._last_query = None self._stop_queries = True self._threadpool = ThreadPool(5) self._mateconf = GconfStore.get_instance() self._history = DeskbarHistory.get_instance( self._mateconf.get_max_history_items()) self._mateconf.connect( "max-history-items-changed", lambda s, num: self._history.set_max_history_items(num)) self._setup_module_loader(modules_dir) self._setup_module_list() self._disabled_module_list = DisabledModuleList() self._module_loader.connect("module-not-initialized", self._disabled_module_list.add) self._module_installer = ModuleInstaller(self._module_loader) self._mateconf.connect("default-browser-changed", self._on_default_browser_changed) #prevent double notifications self.browser = None
def query(self, query): result = [] # We need to take the position of the applet into consideration # this can be identified through the history sorting priority = len(DeskbarHistory.get_instance()) inc_priority = None if self._get_history_order() == gtk.SORT_DESCENDING: inc_priority = lambda x: x - 1 else: inc_priority = lambda x: x + 1 for timestamp, text, action in DeskbarHistory.get_instance(): if text.startswith(query): match_name = action.get_verb() % action.get_escaped_name(text) match = HistoryMatch(match_name, action) match.add_action(action) match.set_priority(self.get_priority() + priority) result.append(match) priority = inc_priority(priority) self._emit_query_ready(query, result)
def _get_history_order(self): col_id, order = DeskbarHistory.get_instance().get_sort_column_id() return order