diff options
| author | Marco Trevisan (Treviño) <mail@3v1n0.net> | 2015-05-19 20:21:31 +0200 |
|---|---|---|
| committer | Marco Trevisan (Treviño) <mail@3v1n0.net> | 2015-05-19 20:21:31 +0200 |
| commit | af6ca0d9bd1a72b38a5df1f1d4f08c10ead0542b (patch) | |
| tree | 22da2f5fc85c5d5e2b40883997d7a87ac1f6249a /UnityCore | |
| parent | ee3c2a1e2efeb2f4d59aa8f35a5cb0ad70c9ac84 (diff) | |
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)
Diffstat (limited to 'UnityCore')
| -rw-r--r-- | UnityCore/GLibDBusProxy.cpp | 19 |
1 files changed, 16 insertions, 3 deletions
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<void, GDBusProxy*, const char*, const char*, GVariant*> g_signal_connection_; - glib::Signal<void, GDBusProxy*, GVariant*, GStrv*> g_property_signal_; + glib::Signal<void, GDBusProxy*, GVariant*, GStrv> g_property_signal_; glib::Signal<void, GDBusProxy*, GParamSpec*> name_owner_signal_; glib::Source::UniquePtr reconnect_timeout_; sigc::signal<void> 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, |
