1 # Copyright (C) 2009 Canonical
6 # This program is free software; you can redistribute it and/or modify it under
7 # the terms of the GNU General Public License as published by the Free Software
8 # Foundation; either version 2 of the License, or (at your option) any later
11 # This program is distributed in the hope that it will be useful, but WITHOUT
12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13 # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
16 # You should have received a copy of the GNU General Public License along with
17 # this program; if not, write to the Free Software Foundation, Inc.,
18 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
31 class InstalledFilter(object):
32 def __init__(self, cache):
34 def filter(self, pkgname):
35 if self.cache.has_key(pkgname) and self.cache[pkgname].isInstalled:
39 if __name__ == "__main__":
40 logging.basicConfig(level=logging.DEBUG)
42 xapian_base_path = "/var/cache/app-install"
43 pathname = os.path.join(xapian_base_path, "xapian")
44 db = xapian.Database(pathname)
46 # additional icons come from app-install-data
47 icons = gtk.icon_theme_get_default()
48 icons.append_search_path("/usr/share/app-install/icons/")
51 installed_filter = InstalledFilter(cache)
54 store = AppStore(db, icons, filter=installed_filter.filter)
58 scroll = gtk.ScrolledWindow()
62 entry.connect("changed", on_entry_changed, (db, view))
65 box.pack_start(entry, expand=False)
66 box.pack_start(scroll)
71 win.set_size_request(400,400)