From fac1100fff4b848690b00994cbbbba925bad94a3 Mon Sep 17 00:00:00 2001 From: Marco Martin Date: Tue, 17 Mar 2015 19:13:28 +0100 Subject: [PATCH] make sure to not emit immutabilityChanged at startup if the immutability doesn't actuall change at startup, don't emit immutabilityChanged even tough each applet needs one ImmutableConstraint at start to correctly initialize stuff Change-Id: Id1fd40ffd62c09a2b092d13d7fb4c556cfb34994 --- src/plasma/applet.cpp | 7 ++++++- src/plasma/private/applet_p.cpp | 1 + src/plasma/private/applet_p.h | 1 + 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/plasma/applet.cpp b/src/plasma/applet.cpp index 590befde1..2dda38109 100644 --- a/src/plasma/applet.cpp +++ b/src/plasma/applet.cpp @@ -521,7 +521,12 @@ void Applet::flushPendingConstraintsEvents() action->setEnabled(canConfig); } - emit immutabilityChanged(immutability()); + //an immutable constraint will alwasy happen at startup + //make sure don't emit a change signal for nothing + if (d->oldImmutability != immutability()) { + emit immutabilityChanged(immutability()); + } + d->oldImmutability = immutability(); } // now take care of constraints in special subclass: Contaiment diff --git a/src/plasma/private/applet_p.cpp b/src/plasma/private/applet_p.cpp index 337924a6b..2cbfd0661 100644 --- a/src/plasma/private/applet_p.cpp +++ b/src/plasma/private/applet_p.cpp @@ -53,6 +53,7 @@ AppletPrivate::AppletPrivate(KService::Ptr service, const KPluginInfo *info, int : appletId(uniqueID), q(applet), immutability(Types::Mutable), + oldImmutability(Types::Mutable), appletDescription(info ? *info : KPluginInfo(service)), icon(appletDescription.isValid() ? appletDescription.icon() : QString()), mainConfig(0), diff --git a/src/plasma/private/applet_p.h b/src/plasma/private/applet_p.h index 13aae16b0..e1aaef677 100644 --- a/src/plasma/private/applet_p.h +++ b/src/plasma/private/applet_p.h @@ -81,6 +81,7 @@ public: // applet attributes Types::ImmutabilityType immutability; + Types::ImmutabilityType oldImmutability; QString launchErrorMessage; // applet info we keep around in case its needed