Skip to content

Commit f99f08b

Browse files
committed
modules/power-profiles-daemon: apply clang-tidy suggestions
1 parent 968f469 commit f99f08b

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

include/modules/power_profiles_daemon.hpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,15 @@ class PowerProfilesDaemon : public ALabel {
1717
PowerProfilesDaemon(const std::string&, const Json::Value&);
1818
~PowerProfilesDaemon();
1919
auto update() -> void override;
20-
void profileChanged_cb(const Gio::DBus::Proxy::MapChangedProperties&,
21-
const std::vector<Glib::ustring>&);
20+
void profileChangedCb(const Gio::DBus::Proxy::MapChangedProperties&,
21+
const std::vector<Glib::ustring>&);
2222
void populateInitState();
2323
virtual bool handleToggle(GdkEventButton* const& e);
2424

2525
private:
2626
// Look for a profile name in the list of available profiles and
2727
// switch activeProfile_ to it.
28-
void switchToProfile_(std::string);
28+
void switchToProfile(std::string const&);
2929
// Used to toggle/display the profiles
3030
std::vector<Profile> availableProfiles_;
3131
// Points to the active profile in the profiles list

src/modules/power_profiles_daemon.cpp

+9-9
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ PowerProfilesDaemon::PowerProfilesDaemon(const std::string& id, const Json::Valu
3535
} else {
3636
// Connect active profile callback
3737
powerProfileChangeSignal_ = power_profiles_proxy_->signal_properties_changed().connect(
38-
sigc::mem_fun(*this, &PowerProfilesDaemon::profileChanged_cb));
38+
sigc::mem_fun(*this, &PowerProfilesDaemon::profileChangedCb));
3939
populateInitState();
4040
dp.emit();
4141
}
@@ -45,9 +45,9 @@ PowerProfilesDaemon::PowerProfilesDaemon(const std::string& id, const Json::Valu
4545
// vector to store the profiles ain't the smartest move
4646
// complexity-wise, but it makes toggling between the mode easy. This
4747
// vector is 3 elements max, we'll be fine :P
48-
void PowerProfilesDaemon::switchToProfile_(std::string str) {
49-
auto pred = [str](Profile p) { return p.name == str; };
50-
activeProfile_ = std::find_if(availableProfiles_.begin(), availableProfiles_.end(), pred);
48+
void PowerProfilesDaemon::switchToProfile(std::string const& str) {
49+
auto pred = [str](Profile const& p) { return p.name == str; };
50+
this->activeProfile_ = std::find_if(availableProfiles_.begin(), availableProfiles_.end(), pred);
5151
if (activeProfile_ == availableProfiles_.end()) {
5252
throw std::runtime_error("FATAL, can't find the active profile in the available profiles list");
5353
}
@@ -77,7 +77,7 @@ void PowerProfilesDaemon::populateInitState() {
7777

7878
// Find the index of the current activated mode (to toggle)
7979
std::string str = profileStr.get();
80-
switchToProfile_(str);
80+
switchToProfile(str);
8181

8282
update();
8383
}
@@ -91,15 +91,15 @@ PowerProfilesDaemon::~PowerProfilesDaemon() {
9191
}
9292
}
9393

94-
void PowerProfilesDaemon::profileChanged_cb(
94+
void PowerProfilesDaemon::profileChangedCb(
9595
const Gio::DBus::Proxy::MapChangedProperties& changedProperties,
9696
const std::vector<Glib::ustring>& invalidatedProperties) {
9797
if (auto activeProfileVariant = changedProperties.find("ActiveProfile");
9898
activeProfileVariant != changedProperties.end()) {
9999
std::string activeProfile =
100100
Glib::VariantBase::cast_dynamic<Glib::Variant<std::string>>(activeProfileVariant->second)
101101
.get();
102-
switchToProfile_(activeProfile);
102+
switchToProfile(activeProfile);
103103
update();
104104
}
105105
}
@@ -134,9 +134,9 @@ bool PowerProfilesDaemon::handleToggle(GdkEventButton* const& e) {
134134
using VarStr = Glib::Variant<Glib::ustring>;
135135
using SetPowerProfileVar = Glib::Variant<std::tuple<Glib::ustring, Glib::ustring, VarStr>>;
136136
VarStr activeProfileVariant = VarStr::create(activeProfile_->name);
137-
auto call_args = SetPowerProfileVar::create(
137+
auto callArgs = SetPowerProfileVar::create(
138138
std::make_tuple("net.hadess.PowerProfiles", "ActiveProfile", activeProfileVariant));
139-
auto container = Glib::VariantBase::cast_dynamic<Glib::VariantContainerBase>(call_args);
139+
auto container = Glib::VariantBase::cast_dynamic<Glib::VariantContainerBase>(callArgs);
140140
power_profiles_proxy_->call_sync("org.freedesktop.DBus.Properties.Set", container);
141141

142142
update();

0 commit comments

Comments
 (0)