summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Nocera <hadess@hadess.net>2013-10-08 16:09:04 +0200
committerMartin Pitt <martinpitt@gnome.org>2013-10-08 16:47:30 +0200
commitecc4e379ccc2f1e3b9c8ce2853657c5726513c5e (patch)
tree493ebcf6cfa2e4b1ca12d3ab22da9eba8ec6e3c3
parentdb89e5a32bf2c16c0d3d00f6c8f0ef7e5e7efa8f (diff)
up-client: Don't error out gathering deprecated properties
We would error out when trying to get properties that are disabled by default (deprecated). Ignore those properties when building without the deprecations. This is still broken if the library is built with the deprecations enabled, but not the daemon isn't, but that's an edge case. https://bugs.freedesktop.org/show_bug.cgi?id=70283 Signed-off-by: Martin Pitt <martinpitt@gnome.org>
-rw-r--r--libupower-glib/up-client.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/libupower-glib/up-client.c b/libupower-glib/up-client.c
index 9d36cda..8e7a2d5 100644
--- a/libupower-glib/up-client.c
+++ b/libupower-glib/up-client.c
@@ -314,10 +314,12 @@ gboolean
up_client_get_properties_sync (UpClient *client, GCancellable *cancellable, GError **error)
{
gboolean ret = TRUE;
- gboolean allowed = FALSE;
gboolean prop_val;
GHashTable *props;
GValue *value;
+#ifdef ENABLE_DEPRECATED
+ gboolean allowed = FALSE;
+#endif
props = NULL;
@@ -343,6 +345,7 @@ up_client_get_properties_sync (UpClient *client, GCancellable *cancellable, GErr
g_free (client->priv->daemon_version);
client->priv->daemon_version = g_strdup (g_value_get_string (value));
+#ifdef ENABLE_DEPRECATED
value = g_hash_table_lookup (props, "CanSuspend");
if (value == NULL) {
g_warning ("No 'CanSuspend' property");
@@ -375,6 +378,7 @@ up_client_get_properties_sync (UpClient *client, GCancellable *cancellable, GErr
client->priv->can_hibernate = ret;
g_object_notify (G_OBJECT(client), "can-hibernate");
}
+#endif /* ENABLE_DEPRECATED */
value = g_hash_table_lookup (props, "LidIsClosed");
if (value == NULL) {