using GLib; using DBus; public class DBusSample : GLib.Object { private DBus.Connection conn; private dynamic DBus.Object search; public void setup () throws DBus.Error, GLib.Error { // remove the space before SESSION, it is only required for this wiki conn = DBus.Bus.get (DBus.BusType. SESSION); search = conn.get_object ("org.freedesktop.Tracker", "/org/freedesktop/Tracker/Search", "org.freedesktop.Tracker.Search"); } public void run () throws DBus.Error, GLib.Error { string[][] result; uint i = 0; result = search.SqlQuery ("SELECT Path, Name, Size, Rank FROM 'file-meta'.Services LIMIT 1,100"); while (i < result.length) { weak string[] row = result[i]; foreach (weak string cell in row) { print (cell + " "); } print ("\n"); i++; } } static int main (string[] args) { var loop = new MainLoop (null, false); var test = new DBusSample (); try { Timer timer = new Timer(); test.setup (); timer.start (); test.run (); print ("%f seconds elapsed\n", timer.elapsed ()); // loop.quit(); } catch (DBus.Error e) { stderr.printf ("Failed to initialise: "+ e.message); return 1; } catch { stderr.printf ("Dynamic method failure"); return 1; } // loop.run (); return 0; } }