summaryrefslogtreecommitdiff
diff options
-rw-r--r--UnityCore/GnomeSessionManager.cpp24
-rw-r--r--unity-shared/GnomeFileManager.cpp6
-rw-r--r--unity-shared/UpstartWrapper.cpp17
3 files changed, 30 insertions, 17 deletions
diff --git a/UnityCore/GnomeSessionManager.cpp b/UnityCore/GnomeSessionManager.cpp
index 4c59ece30..5f87fed8f 100644
--- a/UnityCore/GnomeSessionManager.cpp
+++ b/UnityCore/GnomeSessionManager.cpp
@@ -77,6 +77,8 @@ const std::string SUPPRESS_DIALOGS_KEY = "suppress-logout-restart-shutdown";
const std::string GNOME_LOCKDOWN_OPTIONS = "org.gnome.desktop.lockdown";
const std::string DISABLE_LOCKSCREEN_KEY = "disable-lock-screen";
+
+GDBusProxyFlags DEFAULT_CALL_FLAGS = static_cast<GDBusProxyFlags>(G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES|G_DBUS_PROXY_FLAGS_DO_NOT_CONNECT_SIGNALS|G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START_AT_CONSTRUCTION);
}
GnomeManager::Impl::Impl(GnomeManager* manager, bool test_mode)
@@ -130,7 +132,9 @@ GnomeManager::Impl::Impl(GnomeManager* manager, bool test_mode)
{
presence_proxy_ = std::make_shared<glib::DBusProxy>(test_mode_ ? testing::DBUS_NAME : "org.gnome.SessionManager",
"/org/gnome/SessionManager/Presence",
- "org.gnome.SessionManager.Presence");
+ "org.gnome.SessionManager.Presence",
+ G_BUS_TYPE_SESSION,
+ G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES);
presence_proxy_->Connect("StatusChanged", [this](GVariant* variant) {
enum class PresenceStatus : unsigned
@@ -166,7 +170,8 @@ GnomeManager::Impl::Impl(GnomeManager* manager, bool test_mode)
dm_seat_proxy_ = std::make_shared<glib::DBusProxy>("org.freedesktop.Accounts",
("/org/freedesktop/Accounts/User" + std::to_string(getuid())).c_str(),
"org.freedesktop.Accounts.User",
- G_BUS_TYPE_SYSTEM);
+ G_BUS_TYPE_SYSTEM,
+ G_DBUS_PROXY_FLAGS_DO_NOT_CONNECT_SIGNALS);
}
CallLogindMethod("CanHibernate", nullptr, [this] (GVariant* variant, glib::Error const& err) {
@@ -374,7 +379,8 @@ void GnomeManager::Impl::CallGnomeSessionMethod(std::string const& method, GVari
glib::DBusProxy::CallFinishedCallback const& cb)
{
auto proxy = std::make_shared<glib::DBusProxy>(test_mode_ ? testing::DBUS_NAME : "org.gnome.SessionManager",
- "/org/gnome/SessionManager", "org.gnome.SessionManager");
+ "/org/gnome/SessionManager", "org.gnome.SessionManager",
+ G_BUS_TYPE_SESSION, DEFAULT_CALL_FLAGS);
// By passing the proxy to the lambda we ensure that it will be smartly handled
proxy->CallBegin(method, parameters, [proxy, cb] (GVariant* ret, glib::Error const& e) {
@@ -392,7 +398,8 @@ void GnomeManager::Impl::CallUPowerMethod(std::string const& method, glib::DBusP
{
auto proxy = std::make_shared<glib::DBusProxy>(test_mode_ ? testing::DBUS_NAME : "org.freedesktop.UPower",
"/org/freedesktop/UPower", "org.freedesktop.UPower",
- test_mode_ ? G_BUS_TYPE_SESSION : G_BUS_TYPE_SYSTEM);
+ test_mode_ ? G_BUS_TYPE_SESSION : G_BUS_TYPE_SYSTEM,
+ DEFAULT_CALL_FLAGS);
proxy->CallBegin(method, nullptr, [proxy, cb] (GVariant *ret, glib::Error const& e) {
if (e)
@@ -411,7 +418,8 @@ void GnomeManager::Impl::CallLogindMethod(std::string const& method, GVariant* p
auto proxy = std::make_shared<glib::DBusProxy>(test_mode_ ? testing::DBUS_NAME : "org.freedesktop.login1",
"/org/freedesktop/login1",
"org.freedesktop.login1.Manager",
- test_mode_ ? G_BUS_TYPE_SESSION : G_BUS_TYPE_SYSTEM);
+ test_mode_ ? G_BUS_TYPE_SESSION : G_BUS_TYPE_SYSTEM,
+ DEFAULT_CALL_FLAGS);
// By passing the proxy to the lambda we ensure that it will be smartly handled
proxy->CallBegin(method, parameters, [proxy, cb, method] (GVariant* ret, glib::Error const& e) {
@@ -432,7 +440,8 @@ void GnomeManager::Impl::CallConsoleKitMethod(std::string const& method, GVarian
auto proxy = std::make_shared<glib::DBusProxy>(test_mode_ ? testing::DBUS_NAME : "org.freedesktop.ConsoleKit",
"/org/freedesktop/ConsoleKit/Manager",
"org.freedesktop.ConsoleKit.Manager",
- test_mode_ ? G_BUS_TYPE_SESSION : G_BUS_TYPE_SYSTEM);
+ test_mode_ ? G_BUS_TYPE_SESSION : G_BUS_TYPE_SYSTEM,
+ DEFAULT_CALL_FLAGS);
// By passing the proxy to the lambda we ensure that it will be smartly handled
proxy->CallBegin(method, parameters, [this, proxy] (GVariant*, glib::Error const& e) {
@@ -450,7 +459,8 @@ void GnomeManager::Impl::CallDisplayManagerSeatMethod(std::string const& method,
auto proxy = std::make_shared<glib::DBusProxy>(test_mode_ ? testing::DBUS_NAME : "org.freedesktop.DisplayManager",
glib::gchar_to_string(xdg_seat_path),
"org.freedesktop.DisplayManager.Seat",
- test_mode_ ? G_BUS_TYPE_SESSION : G_BUS_TYPE_SYSTEM);
+ test_mode_ ? G_BUS_TYPE_SESSION : G_BUS_TYPE_SYSTEM,
+ DEFAULT_CALL_FLAGS);
proxy->CallBegin(method, parameters, [this, proxy] (GVariant*, glib::Error const& e) {
if (e)
{
diff --git a/unity-shared/GnomeFileManager.cpp b/unity-shared/GnomeFileManager.cpp
index 4ec6e51f2..df3534720 100644
--- a/unity-shared/GnomeFileManager.cpp
+++ b/unity-shared/GnomeFileManager.cpp
@@ -45,7 +45,7 @@ struct GnomeFileManager::Impl
{
Impl(GnomeFileManager* parent)
: parent_(parent)
- , filemanager_proxy_("org.freedesktop.FileManager1", "/org/freedesktop/FileManager1", "org.freedesktop.FileManager1")
+ , filemanager_proxy_("org.freedesktop.FileManager1", "/org/freedesktop/FileManager1", "org.freedesktop.FileManager1", G_BUS_TYPE_SESSION, G_DBUS_PROXY_FLAGS_DO_NOT_CONNECT_SIGNALS)
{
auto callback = sigc::mem_fun(this, &Impl::OnOpenLocationsXidsUpdated);
filemanager_proxy_.GetProperty("XUbuntuOpenLocationsXids", callback);
@@ -54,8 +54,10 @@ struct GnomeFileManager::Impl
glib::DBusProxy::Ptr NautilusOperationsProxy() const
{
+ auto flags = static_cast<GDBusProxyFlags>(G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES|G_DBUS_PROXY_FLAGS_DO_NOT_CONNECT_SIGNALS);
return std::make_shared<glib::DBusProxy>(NAUTILUS_NAME, NAUTILUS_PATH,
- "org.gnome.Nautilus.FileOperations");
+ "org.gnome.Nautilus.FileOperations",
+ G_BUS_TYPE_SESSION, flags);
}
void OnOpenLocationsXidsUpdated(GVariant* value)
diff --git a/unity-shared/UpstartWrapper.cpp b/unity-shared/UpstartWrapper.cpp
index daf49e7dc..b5986b918 100644
--- a/unity-shared/UpstartWrapper.cpp
+++ b/unity-shared/UpstartWrapper.cpp
@@ -37,22 +37,23 @@ public:
void Emit(std::string const& name);
private:
- glib::DBusProxy::Ptr upstart_proxy_;
+ bool test_mode_;
};
UpstartWrapper::Impl::Impl(bool test_mode)
+ : test_mode_(test_mode)
+{}
+
+void UpstartWrapper::Impl::Emit(std::string const& name)
{
auto flags = static_cast<GDBusProxyFlags>(G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES |
G_DBUS_PROXY_FLAGS_DO_NOT_CONNECT_SIGNALS);
- upstart_proxy_ = std::make_shared<unity::glib::DBusProxy>(test_mode ? "com.canonical.Unity.Test.Upstart" : DBUS_SERVICE_UPSTART,
- DBUS_PATH_UPSTART, DBUS_INTERFACE_UPSTART,
- G_BUS_TYPE_SESSION, flags);
-}
+ auto proxy = std::make_shared<unity::glib::DBusProxy>(test_mode_ ? "com.canonical.Unity.Test.Upstart" : DBUS_SERVICE_UPSTART,
+ DBUS_PATH_UPSTART, DBUS_INTERFACE_UPSTART,
+ G_BUS_TYPE_SESSION, flags);
-void UpstartWrapper::Impl::Emit(std::string const& name)
-{
- upstart_proxy_->Call("EmitEvent", g_variant_new("(sasb)", name.c_str(), nullptr, 0));
+ proxy->Call("EmitEvent", g_variant_new("(sasb)", name.c_str(), nullptr, 0), [proxy] (GVariant*) {});
}
//