refactor: style issue

This commit is contained in:
Alexis 2018-08-18 15:05:18 +02:00
parent b1fd4d7b82
commit 27dfffa4e3
7 changed files with 7 additions and 12 deletions

View File

@ -8,7 +8,7 @@ namespace waybar {
class ALabel : public IModule { class ALabel : public IModule {
public: public:
ALabel(Json::Value); ALabel(Json::Value);
virtual ~ALabel(); virtual ~ALabel() = default;
virtual auto update() -> void; virtual auto update() -> void;
virtual operator Gtk::Widget &(); virtual operator Gtk::Widget &();
protected: protected:

View File

@ -11,7 +11,7 @@ class Custom : public ALabel {
Custom(const std::string&, Json::Value); Custom(const std::string&, Json::Value);
auto update() -> void; auto update() -> void;
private: private:
const std::string name_; const std::string& name_;
waybar::util::SleeperThread thread_; waybar::util::SleeperThread thread_;
}; };

View File

@ -9,11 +9,6 @@ waybar::ALabel::ALabel(Json::Value config)
} }
} }
waybar::ALabel::~ALabel()
{
// Nothing here
}
auto waybar::ALabel::update() -> void auto waybar::ALabel::update() -> void
{ {
// Nothing here // Nothing here

View File

@ -81,7 +81,7 @@ void waybar::Client::bindInterfaces()
int waybar::Client::main(int /*argc*/, char* /*argv*/[]) int waybar::Client::main(int /*argc*/, char* /*argv*/[])
{ {
bindInterfaces(); bindInterfaces();
gtk_main.run(); Gtk::Main::run();
bars.clear(); bars.clear();
zxdg_output_manager_v1_destroy(xdg_output_manager); zxdg_output_manager_v1_destroy(xdg_output_manager);
zwlr_layer_shell_v1_destroy(layer_shell); zwlr_layer_shell_v1_destroy(layer_shell);

View File

@ -16,7 +16,7 @@ waybar::modules::Battery::Battery(Json::Value config)
if (batteries_.empty()) { if (batteries_.empty()) {
throw std::runtime_error("No batteries."); throw std::runtime_error("No batteries.");
} }
auto fd = inotify_init(); auto fd = inotify_init1(IN_CLOEXEC);
if (fd == -1) { if (fd == -1) {
throw std::runtime_error("Unable to listen batteries."); throw std::runtime_error("Unable to listen batteries.");
} }

View File

@ -15,7 +15,7 @@ auto waybar::modules::Cpu::update() -> void
{ {
struct sysinfo info = {0}; struct sysinfo info = {0};
if (sysinfo(&info) == 0) { if (sysinfo(&info) == 0) {
float f_load = 1.f / (1U << SI_LOAD_SHIFT); float f_load = 1.f / (1u << SI_LOAD_SHIFT);
uint16_t load = info.loads[0] * f_load * 100 / get_nprocs(); uint16_t load = info.loads[0] * f_load * 100 / get_nprocs();
auto format = config_["format"] ? config_["format"].asString() : "{}%"; auto format = config_["format"] ? config_["format"].asString() : "{}%";
label_.set_text(fmt::format(format, load)); label_.set_text(fmt::format(format, load));

View File

@ -234,9 +234,9 @@ int waybar::modules::Network::getExternalInterface()
} while (true); } while (true);
out: out:
if (req) if (req != nullptr)
free(req); free(req);
if (resp) if (resp != nullptr)
free(resp); free(resp);
return ifidx; return ifidx;
} }