From af6ca0d9bd1a72b38a5df1f1d4f08c10ead0542b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Tue, 19 May 2015 20:21:31 +0200 Subject: GLibDBusProxy: Notify invalidated properties as well, by emitting a null value for them It's then up to the client to get the value. And plus fix the signature of the OnPropertyChanged callback. (bzr r3964.2.1) --- UnityCore/GLibDBusProxy.cpp | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'UnityCore') diff --git a/UnityCore/GLibDBusProxy.cpp b/UnityCore/GLibDBusProxy.cpp index 08fb489f1..fabef7d48 100644 --- a/UnityCore/GLibDBusProxy.cpp +++ b/UnityCore/GLibDBusProxy.cpp @@ -89,7 +89,7 @@ public: void OnProxyNameOwnerChanged(GDBusProxy*, GParamSpec*); void OnProxySignal(GDBusProxy* proxy, const char*, const char*, GVariant*); - void OnPropertyChanged(GDBusProxy*, GVariant*, GStrv*); + void OnPropertyChanged(GDBusProxy*, GVariant*, GStrv); static void OnProxyConnectCallback(GObject* source, GAsyncResult* res, gpointer impl); static void OnCallCallback(GObject* source, GAsyncResult* res, gpointer call_data); @@ -114,7 +114,7 @@ public: unsigned reconnection_attempts_; glib::Signal g_signal_connection_; - glib::Signal g_property_signal_; + glib::Signal g_property_signal_; glib::Signal name_owner_signal_; glib::Source::UniquePtr reconnect_timeout_; sigc::signal proxy_acquired; @@ -277,7 +277,7 @@ void DBusProxy::Impl::OnProxySignal(GDBusProxy* proxy, const char* sender_name, } } -void DBusProxy::Impl::OnPropertyChanged(GDBusProxy* proxy, GVariant* changed_props, GStrv* invalidated) +void DBusProxy::Impl::OnPropertyChanged(GDBusProxy* proxy, GVariant* changed_props, GStrv invalidated) { LOG_DEBUG(logger) << "Properties changed for proxy (" << object_path_ << ")"; @@ -303,6 +303,19 @@ void DBusProxy::Impl::OnPropertyChanged(GDBusProxy* proxy, GVariant* changed_pro g_variant_iter_free (iter); } + + for (const gchar *property_name = *invalidated; property_name; property_name = *(++invalidated)) + { + LOG_DEBUG(logger) << "Property: '" << property_name << "' invalidated"; + + auto handler_it = property_handlers_.find(property_name); + + if (handler_it != property_handlers_.end()) + { + for (ReplyCallback const& callback : handler_it->second) + callback(nullptr); + } + } } void DBusProxy::Impl::WaitForProxy(GCancellable* cancellable, -- cgit v1.2.3