Re: [Tracker] [PATCH] Port tracker from libdevkit-power-gobject to libupower-glib

2010-04-25 Thread Michael Biebl
2010/4/14 Martyn Russell :
> On 14/04/10 09:11, Philip Van Hoof wrote:
>>
>> On Wed, 2010-04-14 at 04:32 +0200, Michael Biebl wrote:
>>>
>>> The attached patch ports tracker from libdevkit-power-gobject to
>>> libupower-glib.
>>>
>>> The patch is based on my latest patch series, so does not directly
>>> apply on top of master.
>>> If you prefer, I can rebase the patch on master and resend it.
>>
>>
>> Please do

Attached is new patch rebased on current master.

>>> fwiw, I set the minimum version of libupower-glib to 0.9.2, because
>>> that is the version I tested the patch with. It most likely should
>>> also work with earlier releases like 0.9.0 if that is a concern.
>
> Hmm, from a brief Google for the packages hitting the next Ubuntu version,
> 0.9.0 looks like the version they're shipping with. I would try to use that
> if possible.

I've set the minimum version to 0.9.0 on your request.

Updated patch is attached. I'd appreciate a review.

Michael


-- 
Why is it that all of the instruments seeking intelligent life in the
universe are pointed away from Earth?
From edaedffd693a83d0692ab981587f6f95dc932c13 Mon Sep 17 00:00:00 2001
From: Michael Biebl 
Date: Wed, 14 Apr 2010 03:49:31 +0200
Subject: [PATCH] Port from libdevkit-power-gobject to libupower-glib

---
 configure.ac|   54 +++---
 src/libtracker-common/Makefile.am   |   11 +-
 src/libtracker-common/tracker-power-devicekit.c |  247 ---
 src/libtracker-common/tracker-power-upower.c|  247 +++
 src/miners/fs/tracker-miner-files.c |   16 +-
 5 files changed, 287 insertions(+), 288 deletions(-)
 delete mode 100644 src/libtracker-common/tracker-power-devicekit.c
 create mode 100644 src/libtracker-common/tracker-power-upower.c

diff --git a/configure.ac b/configure.ac
index a90af4a..361d6bb 100644
--- a/configure.ac
+++ b/configure.ac
@@ -139,7 +139,7 @@ GTK_REQUIRED=2.18.0
 LIBXML2_REQUIRED=2.6
 LIBNOTIFY_REQUIRED=0.4.3
 HAL_REQUIRED=0.5
-DEVKIT_POWER_REQUIRED=007
+UPOWER_REQUIRED=0.9.0
 GDKPIXBUF_REQUIRED=2.12.0
 QUILL_REQUIRED=1.0.0
 UNAC_REQUIRED=1.0.0
@@ -398,36 +398,36 @@ fi
 
 
 ##
-# Check for DeviceKit-power
+# Check for UPower
 ##
 
-AC_ARG_ENABLE(devkit_power,
-	  AS_HELP_STRING([--disable-devkit-power],
-			 [disable DeviceKit-power support for AC power detection [[default=auto]]]),,
-	  [enable_devkit_power=auto])
-
-if test "x$enable_devkit_power" != "xno"; then
-   PKG_CHECK_MODULES(DEVKIT_POWER,
-		 [devkit-power-gobject >= $DEVKIT_POWER_REQUIRED],
-		 [have_devkit_power=yes] ,
-		 [have_devkit_power=no])
-   AC_SUBST(DEVKIT_POWER_CFLAGS)
-   AC_SUBST(DEVKIT_POWER_LIBS)
-
-   if test "x$have_devkit_power" = "xyes"; then
-  AC_DEFINE(HAVE_DEVKIT_POWER, [], [Define if we have DEVKIT_POWER])
+AC_ARG_ENABLE(upower,
+	  AS_HELP_STRING([--disable-upower],
+			 [disable UPower support for AC power detection [[default=auto]]]),,
+	  [enable_upower=auto])
+
+if test "x$enable_upower" != "xno"; then
+   PKG_CHECK_MODULES(UPOWER,
+		 [upower-glib >= $UPOWER_REQUIRED],
+		 [have_upower=yes] ,
+		 [have_upower=no])
+   AC_SUBST(UPOWER_CFLAGS)
+   AC_SUBST(UPOWER_LIBS)
+
+   if test "x$have_upower" = "xyes"; then
+  AC_DEFINE(HAVE_UPOWER, [], [Define if we have UPOWER])
fi
 else
-   have_devkit_power="no  (disabled)"
+   have_upower="no  (disabled)"
 fi
 
-if test "x$enable_devkit_power" = "xyes"; then
-   if test "x$have_devkit_power" != "xyes"; then
-  AC_MSG_ERROR([Couldn't find devkit_power >= $DEVKIT_POWER_REQUIRED.])
+if test "x$enable_upower" = "xyes"; then
+   if test "x$have_upower" != "xyes"; then
+  AC_MSG_ERROR([Couldn't find upower >= $UPOWER_REQUIRED.])
fi
 fi
 
-AM_CONDITIONAL(HAVE_DEVKIT_POWER, test "x$have_devkit_power" = "xyes")
+AM_CONDITIONAL(HAVE_UPOWER, test "x$have_upower" = "xyes")
 
 ##
 # Check for HAL
@@ -438,7 +438,7 @@ AC_ARG_ENABLE(hal,
 			 [disable HAL support for AC power detection [[default=auto]]]),,
 	  [enable_hal=auto])
 
-if test "x$have_devkit_power" != "xyes" && test "x$enable_hal" != "xno"; then
+if test "x$have_upower" != "xyes" && test "x$enable_hal" != "xno"; then
PKG_CHECK_MODULES(HAL,
  [hal >= $HAL_REQUIRED],
 		 [have_hal=yes] ,
@@ -454,8 +454,8 @@ else
 fi
 
 if test "x$enable_hal" = "xyes"; then
-   if test "x$have_devkit_power" = "xyes"; then
-  AC_MSG_ERROR([Only one of DeviceKit-power and HAL can be used.])
+   if test "x$have_upower" = "xyes"; then
+  AC_MSG_ERROR([Only one of UPower and HAL can be used.])
elif test "x$have_hal" != "xyes"; then
   AC_MSG_ERROR([Couldn't find hal >= $HAL_REQUIRED.])
fi
@@ -1749,8 +1749,8 @@ Build Configuration:
 	Enable unit tests:			$have_unit_tes

Re: [Tracker] nie:plainTextContent, Unicode normalization and Word breaks

2010-04-25 Thread Jamie McCracken
On Sun, 2010-04-25 at 22:34 +0200, Aleksander Morgado wrote:
> Hi Jamie,
> 
> > > I think it makes sense to fix this. Just to be clear, does this mean we 
> > > don't need Pango in libtracker-fts/tracker-parser.c to determine word 
> > > breaks for CJK?
> > 
> > Thats not broken so would not recommend trying to "fix" that
> > 
> > IMHO, The tracker_text_normalize() in the extractor should just do utf8
> > validation. It should not attempt word breaking as thats cpu expensive
> > and being done by the parser already
> > 
> 
> But then how can we limit the extracted text based on the number of
> words?

Well IMHO It should be limited by bytes in the extractor not words (as
per 0.6.x) - this is cheap and works well

The parser will do the word limits when it breaks/normalizes them

So really just need to guestimate bytes to extract if a word limit is
specified - the extractor does not need to be precise here and if you
assumed say average byte count of a word was 20 bytes the you will
probably be ok. If the extractor extracts too many words the parser will
still limit it to the precise number of words so no harm is done

Of course others may have other ideas but it does sound daft to me to
word break everything twice 

jamie

___
tracker-list mailing list
tracker-list@gnome.org
http://mail.gnome.org/mailman/listinfo/tracker-list


Re: [Tracker] nie:plainTextContent, Unicode normalization and Word breaks

2010-04-25 Thread Aleksander Morgado
Hi Jamie,

> > I think it makes sense to fix this. Just to be clear, does this mean we 
> > don't need Pango in libtracker-fts/tracker-parser.c to determine word 
> > breaks for CJK?
> 
> Thats not broken so would not recommend trying to "fix" that
> 
> IMHO, The tracker_text_normalize() in the extractor should just do utf8
> validation. It should not attempt word breaking as thats cpu expensive
> and being done by the parser already
> 

But then how can we limit the extracted text based on the number of
words?

Cheers,
-- 
Aleksander

___
tracker-list mailing list
tracker-list@gnome.org
http://mail.gnome.org/mailman/listinfo/tracker-list