All pastes #475916 Raw Edit

Untitled

public text v1 · immutable
·published 2007-05-07 19:36 UTC
rendered paste body
[Interface("org.freedesktop.xesam.search")]
public interface ISearch {
	string NewSession();
}

public class Search : ISearch {
	static private bool Debug = true;
	// Start worrying about threads?
	private int sessionCount = 0;
	private Dictionary<int, Session> sessions = new Dictionary<int, Session>();

	private Session GetSession(string session)
	{
		return sessions[Convert.ToInt32(session)];
	}

	public string NewSession()
	{
		Session session = new Session();
		session.VendorId = "Beagle";
		// XXX: populate this from the Beagle daemon
		//session.VendorVersion = "0";
		session.VendorDisplay = "The Beagle sesktop search tool";
		// XXX: populate fieldnames, extensions
		sessions.Add(sessionCount, session);
		Console.Error.WriteLine("NewSession() -- {0}", sessionCount);
		return Convert.ToString(sessionCount++);
	}

...

}

class XesamServer {
	public static int Main(string[] args)
	{
		Bus bus = Bus.Session;
		ObjectPath opath = new ObjectPath("/org/freedesktop/xesam/searcer/main");
		string service = "org.freedesktop.xesam.searcher";
		Xesam.Search search = new Xesam.Search();

		bus.Register(service, opath, search);
		RequestNameReply nameReply = bus.RequestName(service);
		Console.WriteLine ("RequestNameReply: " + nameReply);

		while (true)
			bus.Iterate ();

		return 0;
	}
}