summaryrefslogtreecommitdiff
path: root/UnityCore
diff options
authorMarco Trevisan (Treviño) <mail@3v1n0.net>2015-09-10 15:06:19 +0200
committerMarco Trevisan (Treviño) <mail@3v1n0.net>2015-09-10 15:06:19 +0200
commit1a0be689b9dd7be61a1da11ecd308e7872dbf899 (patch)
treec0863bf134126053df763018777d39a0d3388966 /UnityCore
parented1dfd5ceab547a4537b4a4140f62fed359738d7 (diff)
parent41a17df331fe2df36319aaddc2172a1ee9a70753 (diff)
Merging with lp:~azzar1/unity/lp-1485559
(bzr r3964.6.9)
Diffstat (limited to 'UnityCore')
-rw-r--r--UnityCore/GLibDBusProxy.cpp19
-rw-r--r--UnityCore/GnomeSessionManager.cpp7
2 files changed, 22 insertions, 4 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,
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<glib::DBusProxy>(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());
+ });
}
{