summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilip Withnall <philip@tecnocode.co.uk>2019-01-25 14:42:52 +0000
committerPhilip Withnall <philip@tecnocode.co.uk>2019-01-25 14:42:52 +0000
commitcc95f819e243881cac0bc68f79077c370ff83110 (patch)
treeea781227e21dbebda93c42d8ae85571bd5a967d5
parent1275ddb794f9abb83af3efda0221014095ff6d4f (diff)
parentcd7bba985e6afd08f0cfcbc603b53df5402fa2cd (diff)
downloadglib-cc95f819e243881cac0bc68f79077c370ff83110.tar.gz
Merge branch '424-gdbus-proxy-debugging' into 'master'
gdbusproxy: Add G_DBUS_DEBUG=proxy support Closes #424 See merge request GNOME/glib!618
-rw-r--r--gio/gdbusprivate.c11
-rw-r--r--gio/gdbusprivate.h1
-rw-r--r--gio/gdbusproxy.c22
3 files changed, 25 insertions, 9 deletions
diff --git a/gio/gdbusprivate.c b/gio/gdbusprivate.c
index b5f8b6509..c2a04ae12 100644
--- a/gio/gdbusprivate.c
+++ b/gio/gdbusprivate.c
@@ -1817,6 +1817,7 @@ _g_dbus_worker_flush_sync (GDBusWorker *worker,
#define G_DBUS_DEBUG_RETURN (1<<7)
#define G_DBUS_DEBUG_EMISSION (1<<8)
#define G_DBUS_DEBUG_ADDRESS (1<<9)
+#define G_DBUS_DEBUG_PROXY (1<<10)
static gint _gdbus_debug_flags = 0;
@@ -1890,6 +1891,13 @@ _g_dbus_debug_address (void)
return (_gdbus_debug_flags & G_DBUS_DEBUG_ADDRESS) != 0;
}
+gboolean
+_g_dbus_debug_proxy (void)
+{
+ _g_dbus_initialize ();
+ return (_gdbus_debug_flags & G_DBUS_DEBUG_PROXY) != 0;
+}
+
G_LOCK_DEFINE_STATIC (print_lock);
void
@@ -1938,7 +1946,8 @@ _g_dbus_initialize (void)
{ "incoming", G_DBUS_DEBUG_INCOMING },
{ "return", G_DBUS_DEBUG_RETURN },
{ "emission", G_DBUS_DEBUG_EMISSION },
- { "address", G_DBUS_DEBUG_ADDRESS }
+ { "address", G_DBUS_DEBUG_ADDRESS },
+ { "proxy", G_DBUS_DEBUG_PROXY }
};
_gdbus_debug_flags = g_parse_debug_string (debug, keys, G_N_ELEMENTS (keys));
diff --git a/gio/gdbusprivate.h b/gio/gdbusprivate.h
index 0d85c1d85..a319166ee 100644
--- a/gio/gdbusprivate.h
+++ b/gio/gdbusprivate.h
@@ -91,6 +91,7 @@ gboolean _g_dbus_debug_incoming (void);
gboolean _g_dbus_debug_return (void);
gboolean _g_dbus_debug_emission (void);
gboolean _g_dbus_debug_address (void);
+gboolean _g_dbus_debug_proxy (void);
void _g_dbus_debug_print_lock (void);
void _g_dbus_debug_print_unlock (void);
diff --git a/gio/gdbusproxy.c b/gio/gdbusproxy.c
index 6a1be4220..0ab117854 100644
--- a/gio/gdbusproxy.c
+++ b/gio/gdbusproxy.c
@@ -1235,11 +1235,14 @@ on_name_owner_changed_get_all_cb (GDBusConnection *connection,
*
* Either way, apps can know about this by using
* get_cached_property_names() or get_cached_property().
- *
- * TODO: handle G_DBUS_DEBUG flag 'proxy' and, if enabled, log the
- * fact that GetAll() failed
*/
- //g_debug ("error: %d %d %s", error->domain, error->code, error->message);
+ if (G_UNLIKELY (_g_dbus_debug_proxy ()))
+ {
+ g_debug ("error: %d %d %s",
+ error->domain,
+ error->code,
+ error->message);
+ }
g_error_free (error);
}
@@ -1432,11 +1435,14 @@ async_init_get_all_cb (GDBusConnection *connection,
*
* Either way, apps can know about this by using
* get_cached_property_names() or get_cached_property().
- *
- * TODO: handle G_DBUS_DEBUG flag 'proxy' and, if enabled, log the
- * fact that GetAll() failed
*/
- //g_debug ("error: %d %d %s", error->domain, error->code, error->message);
+ if (G_UNLIKELY (_g_dbus_debug_proxy ()))
+ {
+ g_debug ("error: %d %d %s",
+ error->domain,
+ error->code,
+ error->message);
+ }
g_error_free (error);
}