Untitled
By: a guest | Aug 22nd, 2010 | Syntax:
C# | Size: 1.82 KB | Hits: 178 | Expires: Never
using System;
using NDesk.DBus;
using Gdk;
using System.Collections.Generic;
using Mono.Posix;
[NDesk.DBus.Interface ("org.gnome.zeitgeist.Log")]
interface ILogger
{
string[] FindRelatedUris(long[] timerange, ZGEvent[] events, ZGEvent[] results, int storage, int numEvents, int resultType);
}
struct ZGEvent
{
public string[] metadata { get; set; }
public string[][] subjects { get; set; }
public byte[] payload { get; set; }
public ZGEvent(string[] metadata, string[][] subjects, byte[] payload)
{
this.metadata = metadata;
this.subjects = subjects;
this.payload = payload;
}
}
public class MyProgram
{
public MyProgram (string[] args)
{
BusG.Init();
Test();
}
private static ILogger zeitgeist_proxy =
Bus.Session.GetObject<ILogger>("org.gnome.zeitgeist.Engine",
new ObjectPath("/org/gnome/zeitgeist/log/activity"));
public static void Main (string[] args)
{
new MyProgram (args);
}
private void Test()
{
//Make sure you change the uri to something logged by zeitgeist
string uri = "file:///home/seif/Desktop/test.py";
Console.WriteLine("*** "+uri);
ZGEvent e = new ZGEvent();
e.metadata = new string[5];
e.metadata[0] = "";
e.metadata[1] = "";
e.metadata[2] = "";
e.metadata[3] = "";
e.metadata[4] = "";
string[] subject = new string[7];
subject[0] = uri;
subject[1] = "";
subject[2] = "";
subject[3] = "";
subject[4] = "";
subject[5] = "";
subject[6] = "";
e.subjects = new string[][] { subject };
e.payload = new byte[0];
ZGEvent[] events = new ZGEvent[]{e};
long[] timestamps = new long[]{0,9999999999999};
string[] results = zeitgeist_proxy.FindRelatedUris(timestamps, events, new ZGEvent[0], 2, 10, 0);
Console.WriteLine(results);
}
}