Re: [Deskbar] tracker deskbar handler



I'm CC'ing deskbar-applet-list, for future referance. I hope you don't mind.

2006/7/25, Eyal Oren < eyal oren deri org>:
On 07/25/06/07/06 08:45 +0200, Mikkel Kamstrup Erlandsen wrote:
>- Do you know where I can read the Tracker DBUS API? I'd like the handler
>to do an AND query on multiple keywords (I get hundreds of
>results), but I don't easily see what to change in the
>tracker_iface.SearchMetadataText parameters
>In the tracker source, tracker/data/tracker-introspect.xml
thanks. I don't understand the relation between the introspect.xml and the
method calls in the handler, e.g. you call
tracker_iface.SearchMetadataText, but that method does not appear in the
introspect.xml. Do you know how the DBUS methods are mapped to Python
methods (I'm not a python programmer)?

As far as my understanding goes Tracker should AND together each term in the search string in SearchMetadatText. About the tracker-introspect.xml, I just recall that the cvs version has changed significantly since 0.0.4 which the deskbar plugin relies on currently. You should probably check one of the older versions instead:

http://cvs.gnome.org/viewcvs/tracker/data/tracker-introspect.xml?rev=1.3&view=markup

Btw, how do you debug this stuff? Can you run it from command line?

See below.

I'm now
just removing-adding the deskbar after every change. How do I see the print
statements, to investigate what's going on? They don't appear anywhere of
course when running the deskbar as panel applet.

You can run deskbar from the command line. If you installed in /usr, then just run "/usr/lib/deskbar-applet/deskbar-applet -w". The -w is for window mode. If you run it without -w it starts in applet mode. When running in applet mode it will appear to stop after starting up (without showing anything), but if you then add deskbar-applet to the panel it will load from you currently running applet-mode deskbar.

If you've downloaded a devel tarball or are using cvs, you can ofcourse just run "deskbar/deskbar-applet -w" from the source dir.

And do you know how to do a conjunctive keyword query with tracker? I'm not
sure what it does when I give it two keywords, sometimes it seems to do a
conjunction, but sometimes not.

Tracker defaults to ORing together. You can add a + in front of the term you wish to AND. You can also search entire phrases "by quoting".

Regarding running the tracker handler from the command line...

 Append this code to the end of of the tracker handler, then you can run it from the command line like, "python tracker.py hello".

if __name__ == "__main__":

    def query_ready_callback (handler, qstring, matches):
        print "Got response."
        for match in matches:
            print match.name
        mainloop.quit ()

    import sys
    handler = TrackerFileSearchHandler ()
    handler.initialize ()
    handler.connect ("query-ready", query_ready_callback)
    handler.query_async (sys.argv[1]) # note the _async, this is internal deskbar voodoo, directly calling query() won't give you a "query-ready" signal.
   
    # DBUS needs a main loop to do async magic
    mainloop = gobject.MainLoop ()
    mainloop.run ()


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