@@ -35,7 +35,7 @@ PowerProfilesDaemon::PowerProfilesDaemon(const std::string& id, const Json::Valu
35
35
} else {
36
36
// Connect active profile callback
37
37
powerProfileChangeSignal_ = power_profiles_proxy_->signal_properties_changed ().connect (
38
- sigc::mem_fun (*this , &PowerProfilesDaemon::profileChanged_cb ));
38
+ sigc::mem_fun (*this , &PowerProfilesDaemon::profileChangedCb ));
39
39
populateInitState ();
40
40
dp.emit ();
41
41
}
@@ -45,9 +45,9 @@ PowerProfilesDaemon::PowerProfilesDaemon(const std::string& id, const Json::Valu
45
45
// vector to store the profiles ain't the smartest move
46
46
// complexity-wise, but it makes toggling between the mode easy. This
47
47
// 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);
51
51
if (activeProfile_ == availableProfiles_.end ()) {
52
52
throw std::runtime_error (" FATAL, can't find the active profile in the available profiles list" );
53
53
}
@@ -77,7 +77,7 @@ void PowerProfilesDaemon::populateInitState() {
77
77
78
78
// Find the index of the current activated mode (to toggle)
79
79
std::string str = profileStr.get ();
80
- switchToProfile_ (str);
80
+ switchToProfile (str);
81
81
82
82
update ();
83
83
}
@@ -91,15 +91,15 @@ PowerProfilesDaemon::~PowerProfilesDaemon() {
91
91
}
92
92
}
93
93
94
- void PowerProfilesDaemon::profileChanged_cb (
94
+ void PowerProfilesDaemon::profileChangedCb (
95
95
const Gio::DBus::Proxy::MapChangedProperties& changedProperties,
96
96
const std::vector<Glib::ustring>& invalidatedProperties) {
97
97
if (auto activeProfileVariant = changedProperties.find (" ActiveProfile" );
98
98
activeProfileVariant != changedProperties.end ()) {
99
99
std::string activeProfile =
100
100
Glib::VariantBase::cast_dynamic<Glib::Variant<std::string>>(activeProfileVariant->second )
101
101
.get ();
102
- switchToProfile_ (activeProfile);
102
+ switchToProfile (activeProfile);
103
103
update ();
104
104
}
105
105
}
@@ -134,9 +134,9 @@ bool PowerProfilesDaemon::handleToggle(GdkEventButton* const& e) {
134
134
using VarStr = Glib::Variant<Glib::ustring>;
135
135
using SetPowerProfileVar = Glib::Variant<std::tuple<Glib::ustring, Glib::ustring, VarStr>>;
136
136
VarStr activeProfileVariant = VarStr::create (activeProfile_->name );
137
- auto call_args = SetPowerProfileVar::create (
137
+ auto callArgs = SetPowerProfileVar::create (
138
138
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 );
140
140
power_profiles_proxy_->call_sync (" org.freedesktop.DBus.Properties.Set" , container);
141
141
142
142
update ();
0 commit comments