on xenial help sign in
performance improvements
1dee16bMichael Zanetti
plugins/AccountsService/AccountsService.cpp+1−1
@@ -152,7 +152,7 @@ void AccountsService::updateEnableIndicatorsWhileLocked()
152
152
153void AccountsService::updateBackgroundFile()
153void AccountsService::updateBackgroundFile()
154{
154{
155− auto backgroundFile = m_service->getUserProperty(m_user, "org.freedesktop.Accounts.User", "BackgroundFile").toString();
155+ QString backgroundFile = m_service->getUserProperty(m_user, "org.freedesktop.Accounts.User", "BackgroundFile").toString();
156 if (m_backgroundFile != backgroundFile) {
156 if (m_backgroundFile != backgroundFile) {
157 m_backgroundFile = backgroundFile;
157 m_backgroundFile = backgroundFile;
158 Q_EMIT backgroundFileChanged();
158 Q_EMIT backgroundFileChanged();
plugins/AccountsService/AccountsServiceDBusAdaptor.cpp+11−2
@@ -25,7 +25,8 @@
25AccountsServiceDBusAdaptor::AccountsServiceDBusAdaptor(QObject* parent)
25AccountsServiceDBusAdaptor::AccountsServiceDBusAdaptor(QObject* parent)
26 : QObject(parent),
26 : QObject(parent),
27 m_accountsManager(nullptr),
27 m_accountsManager(nullptr),
28− m_users()
28+ m_users(),
29+ m_ignoreNextChanged(false)
29{
30{
30 QDBusConnection connection = QDBusConnection::SM_BUSNAME();
31 QDBusConnection connection = QDBusConnection::SM_BUSNAME();
31 QDBusConnectionInterface *interface = connection.interface();
32 QDBusConnectionInterface *interface = connection.interface();
@@ -75,11 +76,19 @@ void AccountsServiceDBusAdaptor::propertiesChangedSlot(const QString &interface,
75 combined.removeDuplicates();
76 combined.removeDuplicates();
76
77
77 Q_EMIT propertiesChanged(getUserForPath(message().path()), interface, combined);
78 Q_EMIT propertiesChanged(getUserForPath(message().path()), interface, combined);
79+
80+ // In case a non-builtin property changes, we're getting propertiesChanged *and* changed
81+ // As the generic changed requires asking back over DBus, it's quite slow to process.
82+ // We don't want to trigger that when we know it's not a built-in property change.
83+ m_ignoreNextChanged = true;
78}
84}
79
85
80void AccountsServiceDBusAdaptor::maybeChangedSlot()
86void AccountsServiceDBusAdaptor::maybeChangedSlot()
81{
87{
88+ if (!m_ignoreNextChanged) {
82− Q_EMIT maybeChanged(getUserForPath(message().path()));
89+ Q_EMIT maybeChanged(getUserForPath(message().path()));
90+ }
91+ m_ignoreNextChanged = false;
83}
92}
84
93
85QString AccountsServiceDBusAdaptor::getUserForPath(const QString &path)
94QString AccountsServiceDBusAdaptor::getUserForPath(const QString &path)
plugins/AccountsService/AccountsServiceDBusAdaptor.h+2
@@ -61,6 +61,8 @@ private:
61
61
62 QDBusInterface *m_accountsManager;
62 QDBusInterface *m_accountsManager;
63 QMap<QString, QDBusInterface *> m_users;
63 QMap<QString, QDBusInterface *> m_users;
64+
65+ bool m_ignoreNextChanged;
64};
66};
65
67
66#endif
68#endif
plugins/Unity/Launcher/gsettings.cpp+8−1
@@ -59,12 +59,19 @@ void GSettings::setStoredApplications(const QStringList &storedApplications)
59 Q_FOREACH(const QString &entry, storedApplications) {
59 Q_FOREACH(const QString &entry, storedApplications) {
60 gSettingsList << QString("appid://%1").arg(entry);
60 gSettingsList << QString("appid://%1").arg(entry);
61 }
61 }
62+ // GSettings will emit a changed signal to ourselves. Let's cache the items
63+ // and only forward the changed signal when the list did actually change.
64+ m_cachedItems = gSettingsList;
62 m_gSettings->set("items", gSettingsList);
65 m_gSettings->set("items", gSettingsList);
63}
66}
64
67
65void GSettings::onSettingsChanged(const QString &key)
68void GSettings::onSettingsChanged(const QString &key)
66{
69{
67 if (key == "items") {
70 if (key == "items") {
71+ QStringList cachedItems = m_gSettings->get("items").toStringList();
72+ if (m_cachedItems != cachedItems) {
73+ m_cachedItems = cachedItems;
68− Q_EMIT changed();
74+ Q_EMIT changed();
75+ }
69 }
76 }
70}
77}
plugins/Unity/Launcher/gsettings.h+1
@@ -41,6 +41,7 @@ private Q_SLOTS:
41
41
42private:
42private:
43 QGSettings *m_gSettings;
43 QGSettings *m_gSettings;
44+ QStringList m_cachedItems;
44};
45};
45
46
46#endif
47#endif