File: find-events-alt.vala

package info (click to toggle)
libzeitgeist 0.3.18-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd, wheezy
  • size: 3,216 kB
  • ctags: 1,360
  • sloc: sh: 11,081; ansic: 7,399; makefile: 269; xml: 121; python: 64
file content (38 lines) | stat: -rw-r--r-- 1,005 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
using Zeitgeist;

namespace ZeitgeistExample
{

	public async void find_events (Zeitgeist.Log zg)
	{
     	Event ev = new Event.full (Zeitgeist.ZG_ACCESS_EVENT,
    	                           Zeitgeist.ZG_USER_ACTIVITY,
    	                           "");
    	
    	PtrArray events = new PtrArray();
    	events.add ((ev as Object).ref());
    	
    	var results = yield zg.find_events (new TimeRange.anytime(),
    	                                    (owned)events,
    	                                    StorageState.ANY,
    	                                    10,
    	                                    ResultType.MOST_POPULAR_SUBJECTS,
    	                                    null);
    	foreach (var e in results)
    		{
    			print (" * %s\n", e.get_subject(0).get_uri());
    		}
	}

	public static int main (string[] args)
	{
		var zg = new Zeitgeist.Log();
		find_events.begin (zg);
		
		MainLoop mainloop = new MainLoop(null, false);
    	mainloop.run();
    	
    	return 0;
	}

}