[tracker/sam/debug-help] libtracker-sparql: Call tracker_get_debug_flags() on connection construct
- From: Sam Thursfield <sthursfield src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/sam/debug-help] libtracker-sparql: Call tracker_get_debug_flags() on connection construct
- Date: Tue, 1 Dec 2020 13:35:08 +0000 (UTC)
commit b1d468b453d014d543f0a15876f937a7004c8693
Author: Sam Thursfield <sam afuera me uk>
Date: Tue Dec 1 14:13:47 2020 +0100
libtracker-sparql: Call tracker_get_debug_flags() on connection construct
This ensures our TRACKER_DEBUG=help functionality always works.
src/libtracker-common/libtracker-common.vapi | 3 +++
src/libtracker-sparql/tracker-backend.vala | 10 ++++++++++
2 files changed, 13 insertions(+)
---
diff --git a/src/libtracker-common/libtracker-common.vapi b/src/libtracker-common/libtracker-common.vapi
index 9640b1999..9e4298897 100644
--- a/src/libtracker-common/libtracker-common.vapi
+++ b/src/libtracker-common/libtracker-common.vapi
@@ -97,6 +97,9 @@ namespace Tracker {
[CCode (cheader_filename = "libtracker-common/tracker-common.h")]
public void ioprio_init ();
+ [CCode (cheader_filename = "libtracker-common/tracker-debug.h")]
+ public uint get_debug_flags ();
+
[CCode (cname = "g_message", cheader_filename = "glib.h")]
[PrintfFormat]
public void message (string format, ...);
diff --git a/src/libtracker-sparql/tracker-backend.vala b/src/libtracker-sparql/tracker-backend.vala
index 9a84a648a..7ae95eaf8 100644
--- a/src/libtracker-sparql/tracker-backend.vala
+++ b/src/libtracker-sparql/tracker-backend.vala
@@ -17,7 +17,13 @@
* 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_remote_new (string url_base) {
+ Tracker.get_debug_flags ();
return new Tracker.Remote.Connection (url_base);
}
@@ -25,6 +31,8 @@ public static Tracker.Sparql.Connection tracker_sparql_connection_bus_new (strin
GLib.DBusConnection dbus_conn;
string path;
+ Tracker.get_debug_flags ();
+
if (conn != null)
dbus_conn = conn;
else
@@ -39,12 +47,14 @@ public static Tracker.Sparql.Connection tracker_sparql_connection_bus_new (strin
}
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;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]