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 From 83f6141bd91e5fdfdc74e2a6d344ee100651bb38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Tue, 19 May 2015 20:33:41 +0200 Subject: GnomeSessionManager: Request ScreenSaver (de)activation on VT changes Connect to login1 session active property, and monitor its state. When the session is active we can safely request the screensaver to stop. Fixes LP: #1405349 (bzr r3964.2.2) --- UnityCore/GnomeSessionManager.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'UnityCore') diff --git a/UnityCore/GnomeSessionManager.cpp b/UnityCore/GnomeSessionManager.cpp index 8ecff4d36..9a0fe1fd8 100644 --- a/UnityCore/GnomeSessionManager.cpp +++ b/UnityCore/GnomeSessionManager.cpp @@ -104,7 +104,8 @@ GnomeManager::Impl::Impl(GnomeManager* manager, bool test_mode) login_proxy_ = std::make_shared(test_mode_ ? testing::DBUS_NAME : "org.freedesktop.login1", "/org/freedesktop/login1/session/" + glib::gchar_to_string(session_id), "org.freedesktop.login1.Session", - test_mode_ ? G_BUS_TYPE_SESSION : G_BUS_TYPE_SYSTEM); + test_mode_ ? G_BUS_TYPE_SESSION : G_BUS_TYPE_SYSTEM, + G_DBUS_PROXY_FLAGS_GET_INVALIDATED_PROPERTIES); login_proxy_->Connect("Lock", [this](GVariant*){ manager_->PromptLockScreen(); @@ -113,6 +114,10 @@ GnomeManager::Impl::Impl(GnomeManager* manager, bool test_mode) login_proxy_->Connect("Unlock", [this](GVariant*){ manager_->unlock_requested.emit(); }); + + login_proxy_->ConnectProperty("Active", [this] (GVariant* active) { + manager_->screensaver_requested.emit(!glib::Variant(active).GetBool()); + }); } { -- cgit v1.2.3