summaryrefslogtreecommitdiff
path: root/UnityCore
diff options
authorhandsome_feng <445865575@qq.com>2015-11-23 17:24:10 +0800
committerhandsome_feng <445865575@qq.com>2015-11-23 17:24:10 +0800
commit0ba4ad707833928adc16d697bd9a3fefa40598bf (patch)
tree8202d6b2a6fa575e4d4fbaa0acce2556cc921165 /UnityCore
parentd6a56f9b78ef585784c2b72810316ff28635881b (diff)
Modified UserIconFile(), Add DesktopType to UnitySettings,Add some nux::Property in textinput
(bzr r4016.2.26)
Diffstat (limited to 'UnityCore')
-rw-r--r--UnityCore/GnomeSessionManager.cpp48
-rw-r--r--UnityCore/GnomeSessionManager.h2
-rw-r--r--UnityCore/GnomeSessionManagerImpl.h3
-rw-r--r--UnityCore/SessionManager.h3
4 files changed, 17 insertions, 39 deletions
diff --git a/UnityCore/GnomeSessionManager.cpp b/UnityCore/GnomeSessionManager.cpp
index 47afdec0a..5a8af8b99 100644
--- a/UnityCore/GnomeSessionManager.cpp
+++ b/UnityCore/GnomeSessionManager.cpp
@@ -155,6 +155,13 @@ 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);
+ }
+
CallLogindMethod("CanHibernate", nullptr, [this] (GVariant* variant, glib::Error const& err) {
if (err)
{
@@ -440,7 +447,7 @@ void GnomeManager::Impl::CallDisplayManagerSeatMethod(std::string const& method,
proxy->CallBegin(method, parameters, [this, proxy] (GVariant*, glib::Error const& e) {
if (e)
{
- LOG_ERROR(logger) << "Fallback call failed: " << e.Message();
+ LOG_ERROR(logger) << "DisplayManager Seat call failed: " << e.Message();
}
});
}
@@ -506,40 +513,9 @@ bool GnomeManager::Impl::HasInhibitors()
return inhibitors.GetBool();
}
-std::string GnomeManager::Impl::UserIconFile()
+void GnomeManager::Impl::UserIconFile(std::function<void(GVariant*)> callback)
{
- if (test_mode_)
- return std::string("/usr/share/pixmaps/faces/fish.jpg") ;
- glib::Error error;
- glib::Object<GDBusConnection> system_bus(g_bus_get_sync(G_BUS_TYPE_SYSTEM, nullptr, &error));
-
- if (error)
- {
- LOG_ERROR(logger)<<"Unable to get system bus: "<< error;
- return "";
- }
-
- glib::Variant IconFile(g_dbus_connection_call_sync (system_bus,
- "org.freedesktop.Accounts",
- g_strdup_printf("/org/freedesktop/Accounts/User%i", getuid()),
- "org.freedesktop.DBus.Properties",
- "Get",
- g_variant_new("(ss)",
- "org.freedesktop.Accounts.User",
- "IconFile"),
- G_VARIANT_TYPE("(v)"),
- G_DBUS_CALL_FLAGS_NONE,
- -1,
- nullptr,
- &error));
-
- if (error)
- {
- LOG_ERROR(logger)<<"Couldn't find user icon in accounts service: "<< error;
- return "";
- }
-
- return IconFile.GetString();
+ dm_seat_proxy_->GetProperty("IconFile", callback);
}
bool GnomeManager::Impl::IsUserInGroup(std::string const& user_name, std::string const& group_name)
@@ -587,9 +563,9 @@ std::string GnomeManager::HostName() const
return glib::gchar_to_string(g_get_host_name());
}
-std::string GnomeManager::UserIconFile() const
+void GnomeManager::UserIconFile(std::function<void(GVariant*)> callback) const
{
- return impl_->UserIconFile();
+ impl_->UserIconFile(callback);
}
void GnomeManager::ScreenSaverActivate()
diff --git a/UnityCore/GnomeSessionManager.h b/UnityCore/GnomeSessionManager.h
index 46dd54f64..84d7851a0 100644
--- a/UnityCore/GnomeSessionManager.h
+++ b/UnityCore/GnomeSessionManager.h
@@ -36,7 +36,7 @@ public:
std::string RealName() const;
std::string UserName() const;
std::string HostName() const;
- std::string UserIconFile() const;
+ void UserIconFile(std::function<void(GVariant*)>) const;
void ScreenSaverActivate();
void ScreenSaverDeactivate();
diff --git a/UnityCore/GnomeSessionManagerImpl.h b/UnityCore/GnomeSessionManagerImpl.h
index 764e407f6..efdc44ceb 100644
--- a/UnityCore/GnomeSessionManagerImpl.h
+++ b/UnityCore/GnomeSessionManagerImpl.h
@@ -54,7 +54,7 @@ struct GnomeManager::Impl
bool HasInhibitors();
void EnsureCancelPendingAction();
void LockScreen(bool prompt);
- std::string UserIconFile();
+ void UserIconFile(std::function<void(GVariant*)> callback);
GVariant* OnShellMethodCall(std::string const& method, GVariant* parameters);
void CallGnomeSessionMethod(std::string const& method, GVariant* parameters = nullptr,
@@ -80,6 +80,7 @@ struct GnomeManager::Impl
glib::DBusProxy::Ptr login_proxy_;
glib::DBusProxy::Ptr presence_proxy_;
glib::DBusProxy::Ptr dm_proxy_;
+ glib::DBusProxy::Ptr dm_seat_proxy_;
int open_sessions_;
};
diff --git a/UnityCore/SessionManager.h b/UnityCore/SessionManager.h
index 0d5a04e81..f7a6fac72 100644
--- a/UnityCore/SessionManager.h
+++ b/UnityCore/SessionManager.h
@@ -23,6 +23,7 @@
#include <sigc++/sigc++.h>
#include <memory>
+#include <glib.h>
#include <NuxCore/Property.h>
namespace unity
@@ -44,7 +45,7 @@ public:
virtual std::string RealName() const = 0;
virtual std::string UserName() const = 0;
virtual std::string HostName() const = 0;
- virtual std::string UserIconFile() const = 0;
+ virtual void UserIconFile(std::function<void(GVariant*)>) const = 0;
virtual void ScreenSaverActivate() = 0;
virtual void ScreenSaverDeactivate() = 0;