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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
|
/*
* Copyright (C) 2010, Nokia <ivan.frade@nokia.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
/* All apps using libtracker-sparql will call one of these constructors, so
* we take the opportunity to call tracker_get_debug_flags(). This has the
* effect of printing the 'help' message if TRACKER_DEBUG=help is set.
*/
public static Tracker.Sparql.Connection tracker_sparql_connection_bus_new (string service, string? object_path, DBusConnection? conn) throws Tracker.Sparql.Error, IOError, DBusError, GLib.Error {
Tracker.get_debug_flags ();
var context = new GLib.MainContext ();
var loop = new GLib.MainLoop(context);
GLib.Error? error = null;
Tracker.Sparql.Connection? sparql_conn = null;
context.push_thread_default ();
tracker_sparql_connection_bus_new_async.begin(service, object_path, conn, null, (o, res) => {
try {
sparql_conn = tracker_sparql_connection_bus_new_async.end(res);
} catch (Error e) {
error = e;
}
loop.quit();
});
loop.run ();
context.pop_thread_default ();
if (error != null)
throw error;
return sparql_conn;
}
public static async Tracker.Sparql.Connection tracker_sparql_connection_bus_new_async (string service, string? object_path, DBusConnection? conn, Cancellable? cancellable) throws Tracker.Sparql.Error, IOError, DBusError, GLib.Error {
GLib.DBusConnection dbus_conn;
string path;
Tracker.get_debug_flags ();
if (conn != null)
dbus_conn = conn;
else
dbus_conn = yield GLib.Bus.get (GLib.BusType.SESSION, cancellable);
if (object_path != null)
path = object_path;
else
path = "/org/freedesktop/Tracker3/Endpoint";
return yield new Tracker.Bus.Connection (service, path, dbus_conn, cancellable);
}
public static Tracker.Sparql.Connection tracker_sparql_connection_new (Tracker.Sparql.ConnectionFlags flags, File? store, File? ontology, Cancellable? cancellable = null) throws GLib.Error, Tracker.Sparql.Error, IOError {
Tracker.get_debug_flags ();
var conn = new Tracker.Direct.Connection (flags, store, ontology);
conn.init (cancellable);
return conn;
}
public static async Tracker.Sparql.Connection tracker_sparql_connection_new_async (Tracker.Sparql.ConnectionFlags flags, File? store, File ontology, Cancellable? cancellable = null) throws GLib.Error, Tracker.Sparql.Error, IOError {
Tracker.get_debug_flags ();
var conn = new Tracker.Direct.Connection (flags, store, ontology);
yield conn.init_async (Priority.DEFAULT, cancellable);
return conn;
}
|