2
using System.Collections.Generic;
3
using Zeitgeist.Client;
5
using Zeitgeist.Datamodel;
9
public class DataSourceClient
11
public static List<DataSource> GetDataSources()
13
IDataSource srcInterface = GetDBusObject();
14
RawDataSource[] srcs = srcInterface.GetDataSources();
16
List<DataSource> srcList = new List<DataSource>();
18
foreach(RawDataSource src in srcs)
20
DataSource et = DataSource.FromRaw(src);
27
public static bool RegisterDataSources(string uniqueId, string name, string description, List<Event> events)
29
IDataSource srcInterface = GetDBusObject();
32
List<RawEvent> rawEventList = new List<RawEvent>();
33
foreach(Event src in events)
35
RawEvent evnt = src.GetRawEvent();
36
rawEventList.Add(evnt);
39
return srcInterface.RegisterDataSources(uniqueId, name, description, rawEventList.ToArray());
42
void SetDataSourceEnabled(string uniqueId, bool enabled)
44
IDataSource srcInterface = GetDBusObject();
46
srcInterface.SetDataSourceEnabled(uniqueId, enabled);
49
private static IDataSource GetDBusObject()
51
ObjectPath objPath = new ObjectPath("/org/gnome/zeitgeist/data_source_registry");
52
IDataSource log = Bus.Session.GetObject<IDataSource>("org.gnome.zeitgeist.Engine", objPath);