1st raw version installable and searching
This commit is contained in:
parent
28d35e16c1
commit
721653634b
@ -4,7 +4,6 @@ EXTRA_DIST = \
|
|||||||
bin/unity-recoll-daemon.in \
|
bin/unity-recoll-daemon.in \
|
||||||
data/recoll.lens.in \
|
data/recoll.lens.in \
|
||||||
data/recoll-lens.svg \
|
data/recoll-lens.svg \
|
||||||
data/unity-lens-recoll.menu.in \
|
|
||||||
data/unity-lens-recoll.service.in \
|
data/unity-lens-recoll.service.in \
|
||||||
$(docs_DATA) \
|
$(docs_DATA) \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
@ -28,10 +27,10 @@ docs_DATA = \
|
|||||||
######################################################
|
######################################################
|
||||||
# Lens code
|
# Lens code
|
||||||
######################################################
|
######################################################
|
||||||
lensdir = $(datadir)/unity-lens-recoll/recoll
|
lensdir = $(datadir)/unity-lens-recoll/recollscope
|
||||||
lens_PYTHON = \
|
lens_PYTHON = \
|
||||||
recoll/__init__.py \
|
recollscope/__init__.py \
|
||||||
recoll/apps.py \
|
recollscope/rclsearch.py \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
libexec_SCRIPTS = \
|
libexec_SCRIPTS = \
|
||||||
@ -61,12 +60,3 @@ dbusdir = $(datadir)/dbus-1/services
|
|||||||
dbus_DATA = \
|
dbus_DATA = \
|
||||||
data/unity-lens-recoll.service \
|
data/unity-lens-recoll.service \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
######################################################
|
|
||||||
# XDG .menu file
|
|
||||||
######################################################
|
|
||||||
menudir = $(sysconfdir)/xdg/menus
|
|
||||||
menu_DATA = \
|
|
||||||
data/unity-lens-recoll.menu \
|
|
||||||
$(NULL)
|
|
||||||
|
|
||||||
|
|||||||
@ -38,7 +38,6 @@ DIST_COMMON = README $(am__configure_deps) $(lens_PYTHON) \
|
|||||||
$(srcdir)/Makefile.am $(srcdir)/Makefile.in \
|
$(srcdir)/Makefile.am $(srcdir)/Makefile.in \
|
||||||
$(top_srcdir)/bin/unity-recoll-daemon.in \
|
$(top_srcdir)/bin/unity-recoll-daemon.in \
|
||||||
$(top_srcdir)/configure $(top_srcdir)/data/recoll.lens.in \
|
$(top_srcdir)/configure $(top_srcdir)/data/recoll.lens.in \
|
||||||
$(top_srcdir)/data/unity-lens-recoll.menu.in \
|
|
||||||
$(top_srcdir)/data/unity-lens-recoll.service.in AUTHORS \
|
$(top_srcdir)/data/unity-lens-recoll.service.in AUTHORS \
|
||||||
COPYING ChangeLog INSTALL NEWS install-sh missing py-compile
|
COPYING ChangeLog INSTALL NEWS install-sh missing py-compile
|
||||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||||
@ -50,7 +49,7 @@ am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
|
|||||||
configure.lineno config.status.lineno
|
configure.lineno config.status.lineno
|
||||||
mkinstalldirs = $(install_sh) -d
|
mkinstalldirs = $(install_sh) -d
|
||||||
CONFIG_CLEAN_FILES = bin/unity-recoll-daemon data/recoll.lens \
|
CONFIG_CLEAN_FILES = bin/unity-recoll-daemon data/recoll.lens \
|
||||||
data/unity-lens-recoll.menu data/unity-lens-recoll.service
|
data/unity-lens-recoll.service
|
||||||
CONFIG_CLEAN_VPATH_FILES =
|
CONFIG_CLEAN_VPATH_FILES =
|
||||||
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
|
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
|
||||||
am__vpath_adj = case $$p in \
|
am__vpath_adj = case $$p in \
|
||||||
@ -75,14 +74,12 @@ am__base_list = \
|
|||||||
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
|
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
|
||||||
am__installdirs = "$(DESTDIR)$(libexecdir)" "$(DESTDIR)$(lensdir)" \
|
am__installdirs = "$(DESTDIR)$(libexecdir)" "$(DESTDIR)$(lensdir)" \
|
||||||
"$(DESTDIR)$(dbusdir)" "$(DESTDIR)$(docsdir)" \
|
"$(DESTDIR)$(dbusdir)" "$(DESTDIR)$(docsdir)" \
|
||||||
"$(DESTDIR)$(dotlensdir)" "$(DESTDIR)$(iconsdir)" \
|
"$(DESTDIR)$(dotlensdir)" "$(DESTDIR)$(iconsdir)"
|
||||||
"$(DESTDIR)$(menudir)"
|
|
||||||
SCRIPTS = $(libexec_SCRIPTS)
|
SCRIPTS = $(libexec_SCRIPTS)
|
||||||
SOURCES =
|
SOURCES =
|
||||||
DIST_SOURCES =
|
DIST_SOURCES =
|
||||||
py_compile = $(top_srcdir)/py-compile
|
py_compile = $(top_srcdir)/py-compile
|
||||||
DATA = $(dbus_DATA) $(docs_DATA) $(dotlens_DATA) $(icons_DATA) \
|
DATA = $(dbus_DATA) $(docs_DATA) $(dotlens_DATA) $(icons_DATA)
|
||||||
$(menu_DATA)
|
|
||||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||||
distdir = $(PACKAGE)-$(VERSION)
|
distdir = $(PACKAGE)-$(VERSION)
|
||||||
top_distdir = $(distdir)
|
top_distdir = $(distdir)
|
||||||
@ -183,7 +180,6 @@ EXTRA_DIST = \
|
|||||||
bin/unity-recoll-daemon.in \
|
bin/unity-recoll-daemon.in \
|
||||||
data/recoll.lens.in \
|
data/recoll.lens.in \
|
||||||
data/recoll-lens.svg \
|
data/recoll-lens.svg \
|
||||||
data/unity-lens-recoll.menu.in \
|
|
||||||
data/unity-lens-recoll.service.in \
|
data/unity-lens-recoll.service.in \
|
||||||
$(docs_DATA) \
|
$(docs_DATA) \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
@ -207,10 +203,10 @@ docs_DATA = \
|
|||||||
######################################################
|
######################################################
|
||||||
# Lens code
|
# Lens code
|
||||||
######################################################
|
######################################################
|
||||||
lensdir = $(datadir)/unity-lens-recoll/recoll
|
lensdir = $(datadir)/unity-lens-recoll/recollscope
|
||||||
lens_PYTHON = \
|
lens_PYTHON = \
|
||||||
recoll/__init__.py \
|
recollscope/__init__.py \
|
||||||
recoll/apps.py \
|
recollscope/rclsearch.py \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
libexec_SCRIPTS = \
|
libexec_SCRIPTS = \
|
||||||
@ -244,15 +240,6 @@ dbus_DATA = \
|
|||||||
data/unity-lens-recoll.service \
|
data/unity-lens-recoll.service \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
|
|
||||||
######################################################
|
|
||||||
# XDG .menu file
|
|
||||||
######################################################
|
|
||||||
menudir = $(sysconfdir)/xdg/menus
|
|
||||||
menu_DATA = \
|
|
||||||
data/unity-lens-recoll.menu \
|
|
||||||
$(NULL)
|
|
||||||
|
|
||||||
all: all-am
|
all: all-am
|
||||||
|
|
||||||
.SUFFIXES:
|
.SUFFIXES:
|
||||||
@ -294,8 +281,6 @@ bin/unity-recoll-daemon: $(top_builddir)/config.status $(top_srcdir)/bin/unity-r
|
|||||||
cd $(top_builddir) && $(SHELL) ./config.status $@
|
cd $(top_builddir) && $(SHELL) ./config.status $@
|
||||||
data/recoll.lens: $(top_builddir)/config.status $(top_srcdir)/data/recoll.lens.in
|
data/recoll.lens: $(top_builddir)/config.status $(top_srcdir)/data/recoll.lens.in
|
||||||
cd $(top_builddir) && $(SHELL) ./config.status $@
|
cd $(top_builddir) && $(SHELL) ./config.status $@
|
||||||
data/unity-lens-recoll.menu: $(top_builddir)/config.status $(top_srcdir)/data/unity-lens-recoll.menu.in
|
|
||||||
cd $(top_builddir) && $(SHELL) ./config.status $@
|
|
||||||
data/unity-lens-recoll.service: $(top_builddir)/config.status $(top_srcdir)/data/unity-lens-recoll.service.in
|
data/unity-lens-recoll.service: $(top_builddir)/config.status $(top_srcdir)/data/unity-lens-recoll.service.in
|
||||||
cd $(top_builddir) && $(SHELL) ./config.status $@
|
cd $(top_builddir) && $(SHELL) ./config.status $@
|
||||||
install-libexecSCRIPTS: $(libexec_SCRIPTS)
|
install-libexecSCRIPTS: $(libexec_SCRIPTS)
|
||||||
@ -450,26 +435,6 @@ uninstall-iconsDATA:
|
|||||||
test -n "$$files" || exit 0; \
|
test -n "$$files" || exit 0; \
|
||||||
echo " ( cd '$(DESTDIR)$(iconsdir)' && rm -f" $$files ")"; \
|
echo " ( cd '$(DESTDIR)$(iconsdir)' && rm -f" $$files ")"; \
|
||||||
cd "$(DESTDIR)$(iconsdir)" && rm -f $$files
|
cd "$(DESTDIR)$(iconsdir)" && rm -f $$files
|
||||||
install-menuDATA: $(menu_DATA)
|
|
||||||
@$(NORMAL_INSTALL)
|
|
||||||
test -z "$(menudir)" || $(MKDIR_P) "$(DESTDIR)$(menudir)"
|
|
||||||
@list='$(menu_DATA)'; test -n "$(menudir)" || list=; \
|
|
||||||
for p in $$list; do \
|
|
||||||
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
|
|
||||||
echo "$$d$$p"; \
|
|
||||||
done | $(am__base_list) | \
|
|
||||||
while read files; do \
|
|
||||||
echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(menudir)'"; \
|
|
||||||
$(INSTALL_DATA) $$files "$(DESTDIR)$(menudir)" || exit $$?; \
|
|
||||||
done
|
|
||||||
|
|
||||||
uninstall-menuDATA:
|
|
||||||
@$(NORMAL_UNINSTALL)
|
|
||||||
@list='$(menu_DATA)'; test -n "$(menudir)" || list=; \
|
|
||||||
files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
|
|
||||||
test -n "$$files" || exit 0; \
|
|
||||||
echo " ( cd '$(DESTDIR)$(menudir)' && rm -f" $$files ")"; \
|
|
||||||
cd "$(DESTDIR)$(menudir)" && rm -f $$files
|
|
||||||
tags: TAGS
|
tags: TAGS
|
||||||
TAGS:
|
TAGS:
|
||||||
|
|
||||||
@ -628,7 +593,7 @@ check-am: all-am
|
|||||||
check: check-am
|
check: check-am
|
||||||
all-am: Makefile $(SCRIPTS) $(DATA)
|
all-am: Makefile $(SCRIPTS) $(DATA)
|
||||||
installdirs:
|
installdirs:
|
||||||
for dir in "$(DESTDIR)$(libexecdir)" "$(DESTDIR)$(lensdir)" "$(DESTDIR)$(dbusdir)" "$(DESTDIR)$(docsdir)" "$(DESTDIR)$(dotlensdir)" "$(DESTDIR)$(iconsdir)" "$(DESTDIR)$(menudir)"; do \
|
for dir in "$(DESTDIR)$(libexecdir)" "$(DESTDIR)$(lensdir)" "$(DESTDIR)$(dbusdir)" "$(DESTDIR)$(docsdir)" "$(DESTDIR)$(dotlensdir)" "$(DESTDIR)$(iconsdir)"; do \
|
||||||
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
|
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
|
||||||
done
|
done
|
||||||
install: install-am
|
install: install-am
|
||||||
@ -679,7 +644,7 @@ info: info-am
|
|||||||
info-am:
|
info-am:
|
||||||
|
|
||||||
install-data-am: install-dbusDATA install-docsDATA install-dotlensDATA \
|
install-data-am: install-dbusDATA install-docsDATA install-dotlensDATA \
|
||||||
install-iconsDATA install-lensPYTHON install-menuDATA
|
install-iconsDATA install-lensPYTHON
|
||||||
|
|
||||||
install-dvi: install-dvi-am
|
install-dvi: install-dvi-am
|
||||||
|
|
||||||
@ -727,7 +692,7 @@ ps-am:
|
|||||||
|
|
||||||
uninstall-am: uninstall-dbusDATA uninstall-docsDATA \
|
uninstall-am: uninstall-dbusDATA uninstall-docsDATA \
|
||||||
uninstall-dotlensDATA uninstall-iconsDATA uninstall-lensPYTHON \
|
uninstall-dotlensDATA uninstall-iconsDATA uninstall-lensPYTHON \
|
||||||
uninstall-libexecSCRIPTS uninstall-menuDATA
|
uninstall-libexecSCRIPTS
|
||||||
|
|
||||||
.MAKE: install-am install-strip
|
.MAKE: install-am install-strip
|
||||||
|
|
||||||
@ -740,14 +705,13 @@ uninstall-am: uninstall-dbusDATA uninstall-docsDATA \
|
|||||||
install-dotlensDATA install-dvi install-dvi-am install-exec \
|
install-dotlensDATA install-dvi install-dvi-am install-exec \
|
||||||
install-exec-am install-html install-html-am install-iconsDATA \
|
install-exec-am install-html install-html-am install-iconsDATA \
|
||||||
install-info install-info-am install-lensPYTHON \
|
install-info install-info-am install-lensPYTHON \
|
||||||
install-libexecSCRIPTS install-man install-menuDATA \
|
install-libexecSCRIPTS install-man install-pdf install-pdf-am \
|
||||||
install-pdf install-pdf-am install-ps install-ps-am \
|
install-ps install-ps-am install-strip installcheck \
|
||||||
install-strip installcheck installcheck-am installdirs \
|
installcheck-am installdirs maintainer-clean \
|
||||||
maintainer-clean maintainer-clean-generic mostlyclean \
|
maintainer-clean-generic mostlyclean mostlyclean-generic pdf \
|
||||||
mostlyclean-generic pdf pdf-am ps ps-am uninstall uninstall-am \
|
pdf-am ps ps-am uninstall uninstall-am uninstall-dbusDATA \
|
||||||
uninstall-dbusDATA uninstall-docsDATA uninstall-dotlensDATA \
|
uninstall-docsDATA uninstall-dotlensDATA uninstall-iconsDATA \
|
||||||
uninstall-iconsDATA uninstall-lensPYTHON \
|
uninstall-lensPYTHON uninstall-libexecSCRIPTS
|
||||||
uninstall-libexecSCRIPTS uninstall-menuDATA
|
|
||||||
|
|
||||||
|
|
||||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||||
|
|||||||
@ -8,10 +8,10 @@ if os.path.isfile(os.path.join(execpath, "..", "configure.ac")):
|
|||||||
print "Running from source tree"
|
print "Running from source tree"
|
||||||
sys.path.insert (0, os.path.join(execpath, ".."))
|
sys.path.insert (0, os.path.join(execpath, ".."))
|
||||||
else:
|
else:
|
||||||
sys.path.insert (0, os.path.join("@DATADIR@", "unity-lens-bliss"))
|
sys.path.insert (0, os.path.join("@DATADIR@", "unity-lens-recoll"))
|
||||||
del execpath
|
del execpath
|
||||||
|
|
||||||
import bliss.apps
|
import recollscope.rclsearch
|
||||||
from gi.repository import GLib, GObject, Gio
|
from gi.repository import GLib, GObject, Gio
|
||||||
|
|
||||||
# NOTE: If we used the normal 'dbus' module for Python we'll get
|
# NOTE: If we used the normal 'dbus' module for Python we'll get
|
||||||
@ -26,7 +26,7 @@ from gi.repository import GLib, GObject, Gio
|
|||||||
#
|
#
|
||||||
# The primary bus name we grab *must* match what we specify in our .lens file
|
# The primary bus name we grab *must* match what we specify in our .lens file
|
||||||
#
|
#
|
||||||
BUS_NAME = "net.launchpad.UnityLensBliss.Lens"
|
BUS_NAME = "org.recoll.UnityLensRecoll.Lens"
|
||||||
|
|
||||||
session_bus_connection = Gio.bus_get_sync (Gio.BusType.SESSION, None)
|
session_bus_connection = Gio.bus_get_sync (Gio.BusType.SESSION, None)
|
||||||
session_bus = Gio.DBusProxy.new_sync (session_bus_connection, 0, None,
|
session_bus = Gio.DBusProxy.new_sync (session_bus_connection, 0, None,
|
||||||
@ -47,13 +47,13 @@ if result != 1 :
|
|||||||
def create_lens ():
|
def create_lens ():
|
||||||
# The path for the Lens *must* also match the one in our .lens file
|
# The path for the Lens *must* also match the one in our .lens file
|
||||||
from gi.repository import Unity
|
from gi.repository import Unity
|
||||||
lens = Unity.Lens.new ("/net/launchpad/unitylensbliss/lens", "bliss")
|
lens = Unity.Lens.new ("/org/recoll/unitylensrecoll/lens", "recoll")
|
||||||
|
|
||||||
lens.props.search_hint = "Search for apps"
|
lens.props.search_hint = "Recoll search string"
|
||||||
lens.props.visible = True;
|
lens.props.visible = True;
|
||||||
lens.props.search_in_global = True;
|
lens.props.search_in_global = True;
|
||||||
|
|
||||||
# Populate categories
|
# Populate categories TODO FIX THIS
|
||||||
cats = []
|
cats = []
|
||||||
cats.append (Unity.Category.new ("Applications",
|
cats.append (Unity.Category.new ("Applications",
|
||||||
Gio.ThemedIcon.new("keyboard"),
|
Gio.ThemedIcon.new("keyboard"),
|
||||||
@ -66,7 +66,7 @@ def create_lens ():
|
|||||||
return lens
|
return lens
|
||||||
|
|
||||||
lens = create_lens ()
|
lens = create_lens ()
|
||||||
lens.add_local_scope (bliss.apps.Scope())
|
lens.add_local_scope (recollscope.rclsearch.Scope())
|
||||||
# add more local scopes here (remote dbus scopes added automagically)
|
# add more local scopes here (remote dbus scopes added automagically)
|
||||||
lens.export ()
|
lens.export ()
|
||||||
|
|
||||||
|
|||||||
57
src/desktop/unity-lens-recoll/configure
vendored
57
src/desktop/unity-lens-recoll/configure
vendored
@ -1,8 +1,8 @@
|
|||||||
#! /bin/sh
|
#! /bin/sh
|
||||||
# Guess values for system-dependent variables and create Makefiles.
|
# Guess values for system-dependent variables and create Makefiles.
|
||||||
# Generated by GNU Autoconf 2.68 for unity-lens-bliss 0.1.3.
|
# Generated by GNU Autoconf 2.68 for unity-lens-recoll 0.1.1.
|
||||||
#
|
#
|
||||||
# Report bugs to <https://launchpad.net/unity-lens-bliss>.
|
# Report bugs to <https://www.recoll.org>.
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
|
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
|
||||||
@ -238,10 +238,10 @@ fi
|
|||||||
$as_echo "$0: be upgraded to zsh 4.3.4 or later."
|
$as_echo "$0: be upgraded to zsh 4.3.4 or later."
|
||||||
else
|
else
|
||||||
$as_echo "$0: Please tell bug-autoconf@gnu.org and
|
$as_echo "$0: Please tell bug-autoconf@gnu.org and
|
||||||
$0: https://launchpad.net/unity-lens-bliss about your
|
$0: https://www.recoll.org about your system, including any
|
||||||
$0: system, including any error possibly output before this
|
$0: error possibly output before this message. Then install
|
||||||
$0: message. Then install a modern shell, or manually run
|
$0: a modern shell, or manually run the script under such a
|
||||||
$0: the script under such a shell if you do have one."
|
$0: shell if you do have one."
|
||||||
fi
|
fi
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
@ -557,11 +557,11 @@ MFLAGS=
|
|||||||
MAKEFLAGS=
|
MAKEFLAGS=
|
||||||
|
|
||||||
# Identity of this package.
|
# Identity of this package.
|
||||||
PACKAGE_NAME='unity-lens-bliss'
|
PACKAGE_NAME='unity-lens-recoll'
|
||||||
PACKAGE_TARNAME='unity-lens-bliss'
|
PACKAGE_TARNAME='unity-lens-recoll'
|
||||||
PACKAGE_VERSION='0.1.3'
|
PACKAGE_VERSION='0.1.1'
|
||||||
PACKAGE_STRING='unity-lens-bliss 0.1.3'
|
PACKAGE_STRING='unity-lens-recoll 0.1.1'
|
||||||
PACKAGE_BUGREPORT='https://launchpad.net/unity-lens-bliss'
|
PACKAGE_BUGREPORT='https://www.recoll.org'
|
||||||
PACKAGE_URL=''
|
PACKAGE_URL=''
|
||||||
|
|
||||||
ac_subst_vars='LTLIBOBJS
|
ac_subst_vars='LTLIBOBJS
|
||||||
@ -1188,7 +1188,7 @@ if test "$ac_init_help" = "long"; then
|
|||||||
# Omit some internal or obsolete options to make the list less imposing.
|
# Omit some internal or obsolete options to make the list less imposing.
|
||||||
# This message is too long to be a string in the A/UX 3.1 sh.
|
# This message is too long to be a string in the A/UX 3.1 sh.
|
||||||
cat <<_ACEOF
|
cat <<_ACEOF
|
||||||
\`configure' configures unity-lens-bliss 0.1.3 to adapt to many kinds of systems.
|
\`configure' configures unity-lens-recoll 0.1.1 to adapt to many kinds of systems.
|
||||||
|
|
||||||
Usage: $0 [OPTION]... [VAR=VALUE]...
|
Usage: $0 [OPTION]... [VAR=VALUE]...
|
||||||
|
|
||||||
@ -1237,7 +1237,7 @@ Fine tuning of the installation directories:
|
|||||||
--localedir=DIR locale-dependent data [DATAROOTDIR/locale]
|
--localedir=DIR locale-dependent data [DATAROOTDIR/locale]
|
||||||
--mandir=DIR man documentation [DATAROOTDIR/man]
|
--mandir=DIR man documentation [DATAROOTDIR/man]
|
||||||
--docdir=DIR documentation root
|
--docdir=DIR documentation root
|
||||||
[DATAROOTDIR/doc/unity-lens-bliss]
|
[DATAROOTDIR/doc/unity-lens-recoll]
|
||||||
--htmldir=DIR html documentation [DOCDIR]
|
--htmldir=DIR html documentation [DOCDIR]
|
||||||
--dvidir=DIR dvi documentation [DOCDIR]
|
--dvidir=DIR dvi documentation [DOCDIR]
|
||||||
--pdfdir=DIR pdf documentation [DOCDIR]
|
--pdfdir=DIR pdf documentation [DOCDIR]
|
||||||
@ -1255,11 +1255,11 @@ fi
|
|||||||
|
|
||||||
if test -n "$ac_init_help"; then
|
if test -n "$ac_init_help"; then
|
||||||
case $ac_init_help in
|
case $ac_init_help in
|
||||||
short | recursive ) echo "Configuration of unity-lens-bliss 0.1.3:";;
|
short | recursive ) echo "Configuration of unity-lens-recoll 0.1.1:";;
|
||||||
esac
|
esac
|
||||||
cat <<\_ACEOF
|
cat <<\_ACEOF
|
||||||
|
|
||||||
Report bugs to <https://launchpad.net/unity-lens-bliss>.
|
Report bugs to <https://www.recoll.org>.
|
||||||
_ACEOF
|
_ACEOF
|
||||||
ac_status=$?
|
ac_status=$?
|
||||||
fi
|
fi
|
||||||
@ -1322,7 +1322,7 @@ fi
|
|||||||
test -n "$ac_init_help" && exit $ac_status
|
test -n "$ac_init_help" && exit $ac_status
|
||||||
if $ac_init_version; then
|
if $ac_init_version; then
|
||||||
cat <<\_ACEOF
|
cat <<\_ACEOF
|
||||||
unity-lens-bliss configure 0.1.3
|
unity-lens-recoll configure 0.1.1
|
||||||
generated by GNU Autoconf 2.68
|
generated by GNU Autoconf 2.68
|
||||||
|
|
||||||
Copyright (C) 2010 Free Software Foundation, Inc.
|
Copyright (C) 2010 Free Software Foundation, Inc.
|
||||||
@ -1339,7 +1339,7 @@ cat >config.log <<_ACEOF
|
|||||||
This file contains any messages produced by compilers while
|
This file contains any messages produced by compilers while
|
||||||
running configure, to aid debugging if configure makes a mistake.
|
running configure, to aid debugging if configure makes a mistake.
|
||||||
|
|
||||||
It was created by unity-lens-bliss $as_me 0.1.3, which was
|
It was created by unity-lens-recoll $as_me 0.1.1, which was
|
||||||
generated by GNU Autoconf 2.68. Invocation command line was
|
generated by GNU Autoconf 2.68. Invocation command line was
|
||||||
|
|
||||||
$ $0 $@
|
$ $0 $@
|
||||||
@ -2153,8 +2153,8 @@ fi
|
|||||||
|
|
||||||
|
|
||||||
# Define the identity of the package.
|
# Define the identity of the package.
|
||||||
PACKAGE='unity-lens-bliss'
|
PACKAGE='unity-lens-recoll'
|
||||||
VERSION='0.1.3'
|
VERSION='0.1.1'
|
||||||
|
|
||||||
|
|
||||||
cat >>confdefs.h <<_ACEOF
|
cat >>confdefs.h <<_ACEOF
|
||||||
@ -2462,7 +2462,7 @@ $as_echo "$am_cv_python_pyexecdir" >&6; }
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
ac_config_files="$ac_config_files bin/unity-bliss-daemon data/bliss.lens data/unity-lens-bliss.menu data/unity-lens-bliss.service Makefile"
|
ac_config_files="$ac_config_files bin/unity-recoll-daemon data/recoll.lens data/unity-lens-recoll.service Makefile"
|
||||||
|
|
||||||
cat >confcache <<\_ACEOF
|
cat >confcache <<\_ACEOF
|
||||||
# This file is a shell script that caches the results of configure
|
# This file is a shell script that caches the results of configure
|
||||||
@ -3019,7 +3019,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
|
|||||||
# report actual input values of CONFIG_FILES etc. instead of their
|
# report actual input values of CONFIG_FILES etc. instead of their
|
||||||
# values after options handling.
|
# values after options handling.
|
||||||
ac_log="
|
ac_log="
|
||||||
This file was extended by unity-lens-bliss $as_me 0.1.3, which was
|
This file was extended by unity-lens-recoll $as_me 0.1.1, which was
|
||||||
generated by GNU Autoconf 2.68. Invocation command line was
|
generated by GNU Autoconf 2.68. Invocation command line was
|
||||||
|
|
||||||
CONFIG_FILES = $CONFIG_FILES
|
CONFIG_FILES = $CONFIG_FILES
|
||||||
@ -3066,13 +3066,13 @@ Usage: $0 [OPTION]... [TAG]...
|
|||||||
Configuration files:
|
Configuration files:
|
||||||
$config_files
|
$config_files
|
||||||
|
|
||||||
Report bugs to <https://launchpad.net/unity-lens-bliss>."
|
Report bugs to <https://www.recoll.org>."
|
||||||
|
|
||||||
_ACEOF
|
_ACEOF
|
||||||
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
|
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
|
||||||
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
|
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
|
||||||
ac_cs_version="\\
|
ac_cs_version="\\
|
||||||
unity-lens-bliss config.status 0.1.3
|
unity-lens-recoll config.status 0.1.1
|
||||||
configured by $0, generated by GNU Autoconf 2.68,
|
configured by $0, generated by GNU Autoconf 2.68,
|
||||||
with options \\"\$ac_cs_config\\"
|
with options \\"\$ac_cs_config\\"
|
||||||
|
|
||||||
@ -3185,10 +3185,9 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
|
|||||||
for ac_config_target in $ac_config_targets
|
for ac_config_target in $ac_config_targets
|
||||||
do
|
do
|
||||||
case $ac_config_target in
|
case $ac_config_target in
|
||||||
"bin/unity-bliss-daemon") CONFIG_FILES="$CONFIG_FILES bin/unity-bliss-daemon" ;;
|
"bin/unity-recoll-daemon") CONFIG_FILES="$CONFIG_FILES bin/unity-recoll-daemon" ;;
|
||||||
"data/bliss.lens") CONFIG_FILES="$CONFIG_FILES data/bliss.lens" ;;
|
"data/recoll.lens") CONFIG_FILES="$CONFIG_FILES data/recoll.lens" ;;
|
||||||
"data/unity-lens-bliss.menu") CONFIG_FILES="$CONFIG_FILES data/unity-lens-bliss.menu" ;;
|
"data/unity-lens-recoll.service") CONFIG_FILES="$CONFIG_FILES data/unity-lens-recoll.service" ;;
|
||||||
"data/unity-lens-bliss.service") CONFIG_FILES="$CONFIG_FILES data/unity-lens-bliss.service" ;;
|
|
||||||
"Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
|
"Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
|
||||||
|
|
||||||
*) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
|
*) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
|
||||||
@ -3653,7 +3652,7 @@ fi
|
|||||||
|
|
||||||
{ $as_echo "$as_me:${as_lineno-$LINENO}:
|
{ $as_echo "$as_me:${as_lineno-$LINENO}:
|
||||||
|
|
||||||
unity-lens-bliss
|
unity-lens-recoll
|
||||||
--------------------
|
--------------------
|
||||||
|
|
||||||
Prefix : ${prefix}
|
Prefix : ${prefix}
|
||||||
@ -3661,7 +3660,7 @@ fi
|
|||||||
" >&5
|
" >&5
|
||||||
$as_echo "$as_me:
|
$as_echo "$as_me:
|
||||||
|
|
||||||
unity-lens-bliss
|
unity-lens-recoll
|
||||||
--------------------
|
--------------------
|
||||||
|
|
||||||
Prefix : ${prefix}
|
Prefix : ${prefix}
|
||||||
|
|||||||
@ -18,7 +18,6 @@ AC_SUBST(LIBEXECDIR)
|
|||||||
AC_OUTPUT([
|
AC_OUTPUT([
|
||||||
bin/unity-recoll-daemon
|
bin/unity-recoll-daemon
|
||||||
data/recoll.lens
|
data/recoll.lens
|
||||||
data/unity-lens-recoll.menu
|
|
||||||
data/unity-lens-recoll.service
|
data/unity-lens-recoll.service
|
||||||
Makefile
|
Makefile
|
||||||
])
|
])
|
||||||
|
|||||||
@ -1,12 +1,11 @@
|
|||||||
[Lens]
|
[Lens]
|
||||||
DBusName=net.launchpad.UnityLensBliss.Lens
|
DBusName=org.recoll.UnityLensRecoll.Lens
|
||||||
DBusPath=/net/launchpad/unitylensbliss/lens
|
DBusPath=/org/recoll/unitylensrecoll/lens
|
||||||
Name=Apps Lens
|
Name=Recoll Lens
|
||||||
Icon=@DATADIR@/unity-lens-bliss/bliss-lens.svg
|
Icon=@DATADIR@/unity-lens-recoll/recoll-lens.svg
|
||||||
Description=Easily find and launch apps
|
Description=Search documents indexed by Recoll
|
||||||
SearchHint=Type to search
|
SearchHint=Type to search
|
||||||
Shortcut=a
|
Shortcut=a
|
||||||
|
|
||||||
[Desktop Entry]
|
[Desktop Entry]
|
||||||
X-Ubuntu-Gettext-Domain=unity-lens-bliss
|
X-Ubuntu-Gettext-Domain=unity-lens-recoll
|
||||||
|
|
||||||
|
|||||||
@ -1,173 +0,0 @@
|
|||||||
<!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"
|
|
||||||
"http://www.freedesktop.org/standards/menu-spec/1.0/menu.dtd">
|
|
||||||
|
|
||||||
<Menu>
|
|
||||||
|
|
||||||
<Name>Applications</Name>
|
|
||||||
<Directory>X-GNOME-Menu-Applications.directory</Directory>
|
|
||||||
|
|
||||||
<!-- Scan legacy dirs first, as later items take priority -->
|
|
||||||
<LegacyDir>/etc/X11/applnk</LegacyDir>
|
|
||||||
<LegacyDir>/usr/share/gnome/apps</LegacyDir>
|
|
||||||
|
|
||||||
<!-- Read standard .directory and .desktop file locations -->
|
|
||||||
<DefaultAppDirs/>
|
|
||||||
<DefaultDirectoryDirs/>
|
|
||||||
|
|
||||||
<!-- Read in overrides and child menus from applications-merged/ -->
|
|
||||||
<DefaultMergeDirs/>
|
|
||||||
|
|
||||||
<!-- Add a link to the control center -->
|
|
||||||
<Include>
|
|
||||||
<Filename>gnomecc.desktop</Filename>
|
|
||||||
</Include>
|
|
||||||
|
|
||||||
<!-- All Applications -->
|
|
||||||
<Menu>
|
|
||||||
<Name>All Applications</Name>
|
|
||||||
<Directory>X-GNOME-Menu-Applications.directory</Directory>
|
|
||||||
<Include>
|
|
||||||
<And>
|
|
||||||
<All/>
|
|
||||||
<Not><Category>Settings</Category></Not>
|
|
||||||
<Not><Category>System</Category></Not>
|
|
||||||
<Not><Category>Screensaver</Category></Not>
|
|
||||||
</And>
|
|
||||||
</Include>
|
|
||||||
</Menu>
|
|
||||||
|
|
||||||
<Menu>
|
|
||||||
<Name>Accessories</Name>
|
|
||||||
<Directory>Utility.directory</Directory>
|
|
||||||
<Include>
|
|
||||||
<And>
|
|
||||||
<Category>Utility</Category>
|
|
||||||
<Not><Category>Accessibility</Category></Not>
|
|
||||||
</And>
|
|
||||||
</Include>
|
|
||||||
</Menu>
|
|
||||||
|
|
||||||
|
|
||||||
<Menu>
|
|
||||||
<Name>Universal Access</Name>
|
|
||||||
<Directory>Utility-Accessibility.directory</Directory>
|
|
||||||
<Include>
|
|
||||||
<And>
|
|
||||||
<Category>Accessibility</Category>
|
|
||||||
<Not><Category>Settings</Category></Not>
|
|
||||||
</And>
|
|
||||||
</Include>
|
|
||||||
</Menu>
|
|
||||||
|
|
||||||
|
|
||||||
<Menu>
|
|
||||||
<Name>Developer Tools</Name>
|
|
||||||
<Include>
|
|
||||||
<Or>
|
|
||||||
<Category>Development</Category>
|
|
||||||
</Or>
|
|
||||||
<Filename>emacs.desktop</Filename>
|
|
||||||
</Include>
|
|
||||||
</Menu>
|
|
||||||
|
|
||||||
|
|
||||||
<Menu>
|
|
||||||
<Name>Education</Name>
|
|
||||||
<Directory>Education.directory</Directory>
|
|
||||||
<Include>
|
|
||||||
<And>
|
|
||||||
<Category>Education</Category>
|
|
||||||
<Not><Category>Science</Category></Not>
|
|
||||||
</And>
|
|
||||||
</Include>
|
|
||||||
</Menu>
|
|
||||||
|
|
||||||
|
|
||||||
<Menu>
|
|
||||||
<Name>Science & Engineering</Name>
|
|
||||||
<Include>
|
|
||||||
<Or>
|
|
||||||
<Category>Science</Category>
|
|
||||||
<Category>Engineering</Category>
|
|
||||||
</Or>
|
|
||||||
</Include>
|
|
||||||
</Menu>
|
|
||||||
|
|
||||||
<Menu>
|
|
||||||
<Name>Games</Name>
|
|
||||||
<Directory>Game.directory</Directory>
|
|
||||||
<Include>
|
|
||||||
<And>
|
|
||||||
<Category>Game</Category>
|
|
||||||
</And>
|
|
||||||
</Include>
|
|
||||||
</Menu>
|
|
||||||
|
|
||||||
|
|
||||||
<Menu>
|
|
||||||
<Name>Graphics</Name>
|
|
||||||
<Directory>Graphics.directory</Directory>
|
|
||||||
<Include>
|
|
||||||
<And>
|
|
||||||
<Category>Graphics</Category>
|
|
||||||
</And>
|
|
||||||
</Include>
|
|
||||||
</Menu>
|
|
||||||
|
|
||||||
<Menu>
|
|
||||||
<Name>Internet</Name>
|
|
||||||
<Directory>Network.directory</Directory>
|
|
||||||
<Include>
|
|
||||||
<And>
|
|
||||||
<Category>Network</Category>
|
|
||||||
</And>
|
|
||||||
</Include>
|
|
||||||
</Menu>
|
|
||||||
|
|
||||||
|
|
||||||
<Menu>
|
|
||||||
<Name>Multimedia</Name>
|
|
||||||
<Directory>AudioVideo.directory</Directory>
|
|
||||||
<Include>
|
|
||||||
<And>
|
|
||||||
<Category>AudioVideo</Category>
|
|
||||||
</And>
|
|
||||||
</Include>
|
|
||||||
</Menu>
|
|
||||||
|
|
||||||
|
|
||||||
<Menu>
|
|
||||||
<Name>Office</Name>
|
|
||||||
<Directory>Office.directory</Directory>
|
|
||||||
<Include>
|
|
||||||
<And>
|
|
||||||
<Category>Office</Category>
|
|
||||||
</And>
|
|
||||||
</Include>
|
|
||||||
</Menu>
|
|
||||||
|
|
||||||
<Menu>
|
|
||||||
<Name>Themes & Tweaks</Name>
|
|
||||||
<Include><Category>Settings</Category></Include>
|
|
||||||
</Menu>
|
|
||||||
|
|
||||||
<!-- System Tools-->
|
|
||||||
<!-- Note: Software Center uses an OnlyUnallocated clause to generate
|
|
||||||
the System section. We can't do that because we have the All Apps
|
|
||||||
section. Let's cross fingers and hope we match somewhat
|
|
||||||
-->
|
|
||||||
<Menu>
|
|
||||||
<Name>System</Name>
|
|
||||||
<Directory>System.directory</Directory>
|
|
||||||
<Directory>Settings.directory</Directory>
|
|
||||||
<Directory>Settings-System.directory</Directory>
|
|
||||||
<Include>
|
|
||||||
<Or>
|
|
||||||
<Category>System</Category>
|
|
||||||
<Category>Security</Category>
|
|
||||||
<Filename>gnomecc.desktop</Filename>
|
|
||||||
</Or>
|
|
||||||
</Include>
|
|
||||||
</Menu> <!-- End System Tools -->
|
|
||||||
|
|
||||||
</Menu> <!-- End Applications -->
|
|
||||||
@ -1,3 +1,3 @@
|
|||||||
[D-BUS Service]
|
[D-BUS Service]
|
||||||
Name=net.launchpad.UnityLensBliss.Lens
|
Name=org.recoll.UnityLensRecoll.Lens
|
||||||
Exec=@LIBEXECDIR@/unity-bliss-daemon
|
Exec=@LIBEXECDIR@/unity-recoll-daemon
|
||||||
|
|||||||
@ -1,334 +0,0 @@
|
|||||||
#
|
|
||||||
# IDEAS AND COMMENTS
|
|
||||||
#
|
|
||||||
# - We should probably cache all App instances on startup to avoid recreating
|
|
||||||
# themon each search. Listen to the "changed" signal on the GMenu tree to
|
|
||||||
# update
|
|
||||||
#
|
|
||||||
# - Matching and scoring algorithm is really lame. Could be more efficient,
|
|
||||||
# and calculate the scores better
|
|
||||||
#
|
|
||||||
# - Bear in mind when looking at this code that this is *meant* to be simple :-)
|
|
||||||
#
|
|
||||||
|
|
||||||
import sys
|
|
||||||
from gi.repository import GLib, GObject, Gio
|
|
||||||
from gi.repository import Dee
|
|
||||||
from gi.repository import GMenu
|
|
||||||
from gi.repository import Unity
|
|
||||||
|
|
||||||
# These category ids must match the order in which we add them to the lens
|
|
||||||
CATEGORY_ALL = 0
|
|
||||||
|
|
||||||
class App:
|
|
||||||
"""Simple representation of an item in the result model.
|
|
||||||
This class implements simple comparisons, sorting, and hashing
|
|
||||||
methods to integrate with the Python routines for these things
|
|
||||||
"""
|
|
||||||
def __init__ (self, uri, icon, cat_id, mime,
|
|
||||||
display_name, comment, dnd_uri, score = 0):
|
|
||||||
self.uri = uri
|
|
||||||
self.icon = icon
|
|
||||||
self.cat_id = cat_id
|
|
||||||
self.mime = mime
|
|
||||||
self.display_name = display_name
|
|
||||||
self.comment = comment
|
|
||||||
self.dnd_uri = dnd_uri
|
|
||||||
self.score = score
|
|
||||||
|
|
||||||
def __lt__ (self, other):
|
|
||||||
if self.score :
|
|
||||||
return self.score > other.score # scores sort reverse
|
|
||||||
return self.display_name < other.display_name
|
|
||||||
|
|
||||||
def __gt__ (self, other):
|
|
||||||
if other.score :
|
|
||||||
return self.score < other.score # scores sort reverse
|
|
||||||
return self.display_name < other.display_name
|
|
||||||
|
|
||||||
def __eq__ (self, other):
|
|
||||||
return self.uri == other.uri
|
|
||||||
|
|
||||||
def __ne__ (self, other):
|
|
||||||
return self.uri != other.uri
|
|
||||||
|
|
||||||
def __hash__ (self):
|
|
||||||
return hash(self.uri)
|
|
||||||
|
|
||||||
class Scope (Unity.Scope):
|
|
||||||
|
|
||||||
def __init__ (self):
|
|
||||||
Unity.Scope.__init__ (self, dbus_path="/net/launchpad/unitylensbliss/scope/main")
|
|
||||||
|
|
||||||
# Listen for changes and requests
|
|
||||||
self.connect ("notify::active-search", self._on_search_changed)
|
|
||||||
self.connect ("notify::active-global-search", self._on_global_search_changed)
|
|
||||||
self.connect ("activate-uri", self.activate_uri)
|
|
||||||
|
|
||||||
self.apps_tree = GMenu.Tree.new ("unity-lens-bliss.menu", GMenu.TreeFlags.NONE)
|
|
||||||
self.apps_tree.load_sync ()
|
|
||||||
|
|
||||||
self._current_browse_node = None
|
|
||||||
|
|
||||||
def get_search_string (self):
|
|
||||||
search = self.props.active_search
|
|
||||||
return search.props.search_string if search else None
|
|
||||||
|
|
||||||
def get_global_search_string (self):
|
|
||||||
search = self.props.active_global_search
|
|
||||||
return search.props.search_string if search else None
|
|
||||||
|
|
||||||
def search_finished (self):
|
|
||||||
search = self.props.active_search
|
|
||||||
if search:
|
|
||||||
search.emit("finished")
|
|
||||||
|
|
||||||
def global_search_finished (self):
|
|
||||||
search = self.props.active_global_search
|
|
||||||
if search:
|
|
||||||
search.emit("finished")
|
|
||||||
|
|
||||||
def activate_uri (self, scope, uri):
|
|
||||||
"""Activation handler to enable browsing of app directories"""
|
|
||||||
|
|
||||||
print "Activate: %s" % uri
|
|
||||||
|
|
||||||
# For all else than appdir:// uris we defer launching to Unity
|
|
||||||
if not uri.startswith ("appdir://"):
|
|
||||||
# Reset browsing state when an app is launched
|
|
||||||
self.reset ()
|
|
||||||
return Unity.ActivationResponse.new (Unity.HandledType.NOT_HANDLED,
|
|
||||||
uri)
|
|
||||||
|
|
||||||
if self._current_browse_node is None:
|
|
||||||
print >> sys.stderr, "Error: Unexpected browsing request for %s", uri
|
|
||||||
return Unity.ActivationResponse.new (Unity.HandledType.NOT_HANDLED,
|
|
||||||
uri)
|
|
||||||
|
|
||||||
# Extract directory id from the uri and find the corresponding
|
|
||||||
# item in the currently browsed node
|
|
||||||
menu_id = uri[9:]
|
|
||||||
|
|
||||||
if menu_id == "..":
|
|
||||||
self._current_browse_node = self._current_browse_node.get_parent ()
|
|
||||||
self._do_browse (self.props.results_model) # FIXME: Broken for global search
|
|
||||||
return Unity.ActivationResponse.new (Unity.HandledType.SHOW_DASH,
|
|
||||||
uri)
|
|
||||||
|
|
||||||
tree_iter = self._current_browse_node.iter ()
|
|
||||||
item_type = tree_iter.next ();
|
|
||||||
while (item_type != GMenu.TreeItemType.INVALID):
|
|
||||||
if item_type == GMenu.TreeItemType.DIRECTORY:
|
|
||||||
d = tree_iter.get_directory ()
|
|
||||||
if menu_id == d.get_menu_id ():
|
|
||||||
self._current_browse_node = d
|
|
||||||
self._do_browse (self.props.results_model) # FIXME: Broken for global search
|
|
||||||
return Unity.ActivationResponse.new (Unity.HandledType.SHOW_DASH,
|
|
||||||
uri)
|
|
||||||
else:
|
|
||||||
pass
|
|
||||||
item_type = tree_iter.next ();
|
|
||||||
|
|
||||||
# We didn't find the expected folder. Reset the browsing state
|
|
||||||
self.reset ()
|
|
||||||
print >> sys.stderr, "Error: Unable to browse appdir '%s'", menu_id
|
|
||||||
return Unity.ActivationResponse.new (Unity.HandledType.NOT_HANDLED,
|
|
||||||
uri)
|
|
||||||
|
|
||||||
def reset (self):
|
|
||||||
self._current_browse_node = None
|
|
||||||
self._do_browse (self.props.results_model)
|
|
||||||
self._do_browse (self.props.global_results_model)
|
|
||||||
|
|
||||||
def _on_search_changed (self, scope, param_spec):
|
|
||||||
search = self.get_search_string()
|
|
||||||
results = scope.props.results_model
|
|
||||||
|
|
||||||
print "Search changed to: '%s'" % search
|
|
||||||
|
|
||||||
self._update_results_model (search, results)
|
|
||||||
self.search_finished()
|
|
||||||
|
|
||||||
def _on_global_search_changed (self, scope, param_spec):
|
|
||||||
search = self.get_global_search_string()
|
|
||||||
results = scope.props.global_results_model
|
|
||||||
|
|
||||||
print "Global search changed to: '%s'" % search
|
|
||||||
|
|
||||||
self._update_results_model (search, results)
|
|
||||||
self.global_search_finished()
|
|
||||||
|
|
||||||
def _update_results_model (self, search_string, model):
|
|
||||||
if search_string:
|
|
||||||
self._do_search (search_string, model)
|
|
||||||
else:
|
|
||||||
self._do_browse (model)
|
|
||||||
|
|
||||||
def _do_browse (self, model):
|
|
||||||
model.clear ()
|
|
||||||
|
|
||||||
collector = set ()
|
|
||||||
|
|
||||||
if self._current_browse_node is None:
|
|
||||||
self._current_browse_node = self.apps_tree.get_root_directory ()
|
|
||||||
elif self._current_browse_node.get_parent ():
|
|
||||||
self._collect_back_dir (collector)
|
|
||||||
|
|
||||||
tree_iter = self._current_browse_node.iter ()
|
|
||||||
item_type = tree_iter.next ();
|
|
||||||
while (item_type != GMenu.TreeItemType.INVALID):
|
|
||||||
if item_type == GMenu.TreeItemType.ENTRY:
|
|
||||||
self._collect_app (collector, tree_iter.get_entry ())
|
|
||||||
elif item_type == GMenu.TreeItemType.DIRECTORY:
|
|
||||||
self._collect_dir (collector, tree_iter.get_directory ())
|
|
||||||
else:
|
|
||||||
pass # we skip separators and other stuff
|
|
||||||
item_type = tree_iter.next ();
|
|
||||||
|
|
||||||
# Sort alphabetically
|
|
||||||
results = sorted (collector)
|
|
||||||
|
|
||||||
for app in results:
|
|
||||||
model.append (app.uri,
|
|
||||||
app.icon,
|
|
||||||
app.cat_id,
|
|
||||||
app.mime,
|
|
||||||
app.display_name,
|
|
||||||
app.comment,
|
|
||||||
app.dnd_uri)
|
|
||||||
|
|
||||||
def _do_search (self, search_string, model):
|
|
||||||
model.clear ()
|
|
||||||
|
|
||||||
# Reset browsing mode
|
|
||||||
self._current_browse_node = None
|
|
||||||
|
|
||||||
# Use a set to collect results to avoid duplicates
|
|
||||||
# Apps are compared by app.uri to make this work
|
|
||||||
collector = set ()
|
|
||||||
self._search_visit_directory (search_string,
|
|
||||||
collector,
|
|
||||||
self.apps_tree.get_root_directory ())
|
|
||||||
# Sort by score
|
|
||||||
results = sorted (collector)
|
|
||||||
|
|
||||||
for app in results:
|
|
||||||
model.append (app.uri,
|
|
||||||
app.icon,
|
|
||||||
app.cat_id,
|
|
||||||
app.mime,
|
|
||||||
app.display_name,
|
|
||||||
app.comment,
|
|
||||||
app.dnd_uri)
|
|
||||||
|
|
||||||
|
|
||||||
def _search_visit_directory (self, search_string, collector, tree_dir):
|
|
||||||
tree_iter = tree_dir.iter ()
|
|
||||||
item_type = tree_iter.next ();
|
|
||||||
while (item_type != GMenu.TreeItemType.INVALID):
|
|
||||||
if item_type == GMenu.TreeItemType.ENTRY:
|
|
||||||
self._search_visit_entry (search_string,
|
|
||||||
collector,
|
|
||||||
tree_iter.get_entry ())
|
|
||||||
elif item_type == GMenu.TreeItemType.DIRECTORY:
|
|
||||||
self._search_visit_directory (search_string,
|
|
||||||
collector,
|
|
||||||
tree_iter.get_directory())
|
|
||||||
else:
|
|
||||||
pass # we skip separators and other stuff
|
|
||||||
item_type = tree_iter.next ();
|
|
||||||
|
|
||||||
def _search_visit_entry (self, search_string, collector, tree_entry):
|
|
||||||
if not search_string:
|
|
||||||
self._collect_app (collector, tree_entry)
|
|
||||||
return
|
|
||||||
|
|
||||||
app_info = tree_entry.get_app_info ()
|
|
||||||
search_string = search_string.lower().strip()
|
|
||||||
|
|
||||||
score = 1.0
|
|
||||||
score *= self._test_string (search_string,
|
|
||||||
app_info.get_description (),
|
|
||||||
1.1)
|
|
||||||
|
|
||||||
score *= self._test_string (search_string,
|
|
||||||
app_info.get_display_name (),
|
|
||||||
2.0)
|
|
||||||
|
|
||||||
score *= self._test_string (search_string,
|
|
||||||
app_info.get_name (),
|
|
||||||
2.0)
|
|
||||||
|
|
||||||
score *= self._test_string (search_string,
|
|
||||||
app_info.get_executable (),
|
|
||||||
3.0)
|
|
||||||
|
|
||||||
if score > 1.0:
|
|
||||||
self._collect_app (collector, tree_entry, score)
|
|
||||||
|
|
||||||
def _test_string (self, search_string, target_string, boost):
|
|
||||||
"""Tests if search_string matches target_string and returns a
|
|
||||||
boost factor calculated from the input boost and the quality of
|
|
||||||
the match.
|
|
||||||
Returns 1.0 on no match"""
|
|
||||||
if not target_string:
|
|
||||||
return 1
|
|
||||||
|
|
||||||
target_string = target_string.lower()
|
|
||||||
|
|
||||||
if target_string.startswith(search_string):
|
|
||||||
return boost * 2
|
|
||||||
elif search_string in target_string:
|
|
||||||
return boost
|
|
||||||
|
|
||||||
return 1
|
|
||||||
|
|
||||||
def _collect_app (self, collector, tree_entry, score = 0):
|
|
||||||
app_info = tree_entry.get_app_info ()
|
|
||||||
app = App ("application://" + tree_entry.get_desktop_file_id (), # uri
|
|
||||||
app_info.get_icon().to_string (), # string formatted GIcon
|
|
||||||
CATEGORY_ALL, # numeric category id
|
|
||||||
"application/x-desktop", # mimetype
|
|
||||||
app_info.get_display_name () or "???", # display name
|
|
||||||
app_info.get_description () or "No description", # comment
|
|
||||||
tree_entry.get_desktop_file_path () or "", # dnd uri
|
|
||||||
score) # score
|
|
||||||
|
|
||||||
collector.add (app)
|
|
||||||
|
|
||||||
def _collect_dir (self, collector, tree_dir, score = 0):
|
|
||||||
# Create folder icon with app category emblem if the dir has an icon,
|
|
||||||
# else just use a folder icon
|
|
||||||
if tree_dir.get_icon ():
|
|
||||||
emblem = Gio.Emblem.new (tree_dir.get_icon ())
|
|
||||||
icon = Gio.EmblemedIcon.new (Gio.ThemedIcon.new ("folder"),
|
|
||||||
emblem)
|
|
||||||
else:
|
|
||||||
emblem = Gio.Emblem.new (Gio.ThemedIcon.new ("gtk-execute"))
|
|
||||||
icon = Gio.EmblemedIcon.new (Gio.ThemedIcon.new ("folder"),
|
|
||||||
emblem)
|
|
||||||
|
|
||||||
app = App ("appdir://" + tree_dir.get_menu_id (), # uri
|
|
||||||
icon.to_string (), # string formatted GIcon
|
|
||||||
CATEGORY_ALL, # numeric category id
|
|
||||||
"application/x-desktop", # mimetype
|
|
||||||
tree_dir.get_name () or "???", # display name
|
|
||||||
tree_dir.get_comment () or "No description", # comment
|
|
||||||
tree_dir.get_desktop_file_path () or "", # dnd uri
|
|
||||||
score) # score
|
|
||||||
|
|
||||||
collector.add (app)
|
|
||||||
|
|
||||||
def _collect_back_dir (self, collector):
|
|
||||||
icon = Gio.ThemedIcon.new ("gtk-go-back-ltr")
|
|
||||||
app = App ("appdir://..", # uri
|
|
||||||
icon.to_string (), # string formatted GIcon
|
|
||||||
CATEGORY_ALL, # numeric category id
|
|
||||||
"application/x-desktop", # mimetype
|
|
||||||
"Back", # display name
|
|
||||||
"Back to previous application directory", # comment
|
|
||||||
"", # dnd uri
|
|
||||||
100000) # score
|
|
||||||
|
|
||||||
collector.add (app)
|
|
||||||
|
|
||||||
113
src/desktop/unity-lens-recoll/recollscope/rclsearch.py
Executable file
113
src/desktop/unity-lens-recoll/recollscope/rclsearch.py
Executable file
@ -0,0 +1,113 @@
|
|||||||
|
|
||||||
|
import sys
|
||||||
|
from gi.repository import GLib, GObject, Gio
|
||||||
|
from gi.repository import Unity
|
||||||
|
|
||||||
|
import recoll
|
||||||
|
|
||||||
|
# These category ids must match the order in which we add them to the lens
|
||||||
|
CATEGORY_ALL = 0
|
||||||
|
|
||||||
|
class Scope (Unity.Scope):
|
||||||
|
|
||||||
|
def __init__ (self):
|
||||||
|
Unity.Scope.__init__ (self, dbus_path="/org/recoll/unitylensrecoll/scope/main")
|
||||||
|
|
||||||
|
# Listen for changes and requests
|
||||||
|
self.connect ("notify::active-search", self._on_search_changed)
|
||||||
|
self.connect ("notify::active-global-search", self._on_global_search_changed)
|
||||||
|
self.connect ("activate-uri", self.activate_uri)
|
||||||
|
|
||||||
|
# Bliss loaded the apps_tree menu here, let's connect to
|
||||||
|
# the index
|
||||||
|
self.db = recoll.connect()
|
||||||
|
|
||||||
|
self._current_browse_node = None
|
||||||
|
|
||||||
|
def get_search_string (self):
|
||||||
|
search = self.props.active_search
|
||||||
|
return search.props.search_string if search else None
|
||||||
|
|
||||||
|
def get_global_search_string (self):
|
||||||
|
search = self.props.active_global_search
|
||||||
|
return search.props.search_string if search else None
|
||||||
|
|
||||||
|
def search_finished (self):
|
||||||
|
search = self.props.active_search
|
||||||
|
if search:
|
||||||
|
search.emit("finished")
|
||||||
|
|
||||||
|
def global_search_finished (self):
|
||||||
|
search = self.props.active_global_search
|
||||||
|
if search:
|
||||||
|
search.emit("finished")
|
||||||
|
|
||||||
|
def activate_uri (self, scope, uri):
|
||||||
|
"""Activation handler to enable browsing of app directories"""
|
||||||
|
|
||||||
|
print "Activate: %s" % uri
|
||||||
|
|
||||||
|
# Defer all activations to Unity
|
||||||
|
# Reset browsing state when an app is launched
|
||||||
|
self.reset ()
|
||||||
|
return Unity.ActivationResponse.new (Unity.HandledType.NOT_HANDLED,
|
||||||
|
uri)
|
||||||
|
|
||||||
|
|
||||||
|
def reset (self):
|
||||||
|
self._current_browse_node = None
|
||||||
|
self._do_browse (self.props.results_model)
|
||||||
|
self._do_browse (self.props.global_results_model)
|
||||||
|
|
||||||
|
def _on_search_changed (self, scope, param_spec):
|
||||||
|
search = self.get_search_string()
|
||||||
|
results = scope.props.results_model
|
||||||
|
|
||||||
|
print "Search changed to: '%s'" % search
|
||||||
|
|
||||||
|
self._update_results_model (search, results)
|
||||||
|
self.search_finished()
|
||||||
|
|
||||||
|
def _on_global_search_changed (self, scope, param_spec):
|
||||||
|
search = self.get_global_search_string()
|
||||||
|
results = scope.props.global_results_model
|
||||||
|
|
||||||
|
print "Global search changed to: '%s'" % search
|
||||||
|
|
||||||
|
self._update_results_model (search, results)
|
||||||
|
self.global_search_finished()
|
||||||
|
|
||||||
|
def _update_results_model (self, search_string, model):
|
||||||
|
if search_string:
|
||||||
|
self._do_search (search_string, model)
|
||||||
|
else:
|
||||||
|
self._do_browse (model)
|
||||||
|
|
||||||
|
def _do_browse (self, model):
|
||||||
|
model.clear ()
|
||||||
|
self.search_finished()
|
||||||
|
|
||||||
|
def _do_search (self, search_string, model):
|
||||||
|
model.clear ()
|
||||||
|
|
||||||
|
# Reset browsing mode
|
||||||
|
self._current_browse_node = None
|
||||||
|
|
||||||
|
# Do the recoll thing
|
||||||
|
query = self.db.query()
|
||||||
|
nres = query.execute(search_string)
|
||||||
|
if nres > 20:
|
||||||
|
nres = 20
|
||||||
|
while query.next >= 0 and query.next < nres:
|
||||||
|
doc = query.fetchone()
|
||||||
|
titleorfilename = doc.title
|
||||||
|
if titleorfilename == "":
|
||||||
|
titleorfilename = doc.filename
|
||||||
|
model.append (doc.url,
|
||||||
|
"",
|
||||||
|
CATEGORY_ALL,
|
||||||
|
doc.mimetype,
|
||||||
|
titleorfilename,
|
||||||
|
titleorfilename,
|
||||||
|
doc.url)
|
||||||
|
|
||||||
Loading…
x
Reference in New Issue
Block a user