diff --git a/gio/gdbusproxy.c b/gio/gdbusproxy.c index 07b7f8e31..4e24d1f59 100644 --- a/gio/gdbusproxy.c +++ b/gio/gdbusproxy.c @@ -445,6 +445,10 @@ static void g_dbus_proxy_init (GDBusProxy *proxy) { proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, G_TYPE_DBUS_PROXY, GDBusProxyPrivate); + proxy->priv->properties = g_hash_table_new_full (g_str_hash, + g_str_equal, + g_free, + (GDestroyNotify) g_variant_unref); } /* ---------------------------------------------------------------------------------------------------- */ @@ -452,18 +456,16 @@ g_dbus_proxy_init (GDBusProxy *proxy) /** * g_dbus_proxy_get_cached_property_names: * @proxy: A #GDBusProxy. - * @error: Return location for error or %NULL. * * Gets the names of all cached properties on @proxy. * - * Returns: A %NULL-terminated array of strings or %NULL if @error is set. Free with - * g_strfreev(). + * Returns: A %NULL-terminated array of strings or %NULL if @proxy has + * no cached properties. Free the returned array with g_strfreev(). * * Since: 2.26 */ gchar ** -g_dbus_proxy_get_cached_property_names (GDBusProxy *proxy, - GError **error) +g_dbus_proxy_get_cached_property_names (GDBusProxy *proxy) { gchar **names; GPtrArray *p; @@ -471,18 +473,10 @@ g_dbus_proxy_get_cached_property_names (GDBusProxy *proxy, const gchar *key; g_return_val_if_fail (G_IS_DBUS_PROXY (proxy), NULL); - g_return_val_if_fail (error == NULL || *error == NULL, NULL); names = NULL; - - if (proxy->priv->flags & G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES) - { - g_set_error (error, - G_IO_ERROR, - G_IO_ERROR_FAILED, - _("Properties are not available (proxy created with G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES)")); - goto out; - } + if (g_hash_table_size (proxy->priv->properties) == 0) + goto out; p = g_ptr_array_new (); @@ -790,11 +784,6 @@ process_get_all_reply (GDBusProxy *proxy, goto out; } - proxy->priv->properties = g_hash_table_new_full (g_str_hash, - g_str_equal, - g_free, - (GDestroyNotify) g_variant_unref); - g_variant_iter_init (&iter, g_variant_get_child_value (result, 0)); while ((item = g_variant_iter_next_value (&iter)) != NULL) { diff --git a/gio/gdbusproxy.h b/gio/gdbusproxy.h index f86055593..48688531e 100644 --- a/gio/gdbusproxy.h +++ b/gio/gdbusproxy.h @@ -127,8 +127,7 @@ GVariant *g_dbus_proxy_get_cached_property (GDBusProxy *pr void g_dbus_proxy_set_cached_property (GDBusProxy *proxy, const gchar *property_name, GVariant *value); -gchar **g_dbus_proxy_get_cached_property_names (GDBusProxy *proxy, - GError **error); +gchar **g_dbus_proxy_get_cached_property_names (GDBusProxy *proxy); void g_dbus_proxy_call (GDBusProxy *proxy, const gchar *method_name, GVariant *parameters, diff --git a/gio/tests/gdbus-example-watch-proxy.c b/gio/tests/gdbus-example-watch-proxy.c index 972a66dec..4f4195fd0 100644 --- a/gio/tests/gdbus-example-watch-proxy.c +++ b/gio/tests/gdbus-example-watch-proxy.c @@ -26,7 +26,7 @@ print_properties (GDBusProxy *proxy) g_print (" properties:\n"); - property_names = g_dbus_proxy_get_cached_property_names (proxy, NULL); + property_names = g_dbus_proxy_get_cached_property_names (proxy); for (n = 0; property_names != NULL && property_names[n] != NULL; n++) { const gchar *key = property_names[n];