🎨 clang-tidy

This commit is contained in:
Benjamin Voisin 2024-05-09 20:59:25 +02:00
parent 3b87b83076
commit 21751b2faa
No known key found for this signature in database
GPG Key ID: C5C8EDD125FBFD78
4 changed files with 13 additions and 10 deletions

View File

@ -2,9 +2,9 @@
#include <glibmm/dispatcher.h> #include <glibmm/dispatcher.h>
#include <glibmm/markup.h> #include <glibmm/markup.h>
#include <gtkmm.h>
#include <gtkmm/eventbox.h> #include <gtkmm/eventbox.h>
#include <json/json.h> #include <json/json.h>
#include <gtkmm.h>
#include "IModule.hpp" #include "IModule.hpp"

View File

@ -9,7 +9,9 @@ namespace waybar {
ALabel::ALabel(const Json::Value& config, const std::string& name, const std::string& id, ALabel::ALabel(const Json::Value& config, const std::string& name, const std::string& id,
const std::string& format, uint16_t interval, bool ellipsize, bool enable_click, const std::string& format, uint16_t interval, bool ellipsize, bool enable_click,
bool enable_scroll) bool enable_scroll)
: AModule(config, name, id, config["format-alt"].isString() || config["menu"].isString() || enable_click, enable_scroll), : AModule(config, name, id,
config["format-alt"].isString() || config["menu"].isString() || enable_click,
enable_scroll),
format_(config_["format"].isString() ? config_["format"].asString() : format), format_(config_["format"].isString() ? config_["format"].asString() : format),
interval_(config_["interval"] == "once" interval_(config_["interval"] == "once"
? std::chrono::seconds::max() ? std::chrono::seconds::max()
@ -59,11 +61,13 @@ ALabel::ALabel(const Json::Value& config, const std::string& name, const std::st
submenus_ = std::map<std::string, GtkMenuItem*>(); submenus_ = std::map<std::string, GtkMenuItem*>();
menuActionsMap_ = std::map<std::string, std::string>(); menuActionsMap_ = std::map<std::string, std::string>();
// Linking actions to the GTKMenu based on // Linking actions to the GTKMenu based on
for (Json::Value::const_iterator it = config_["menu-actions"].begin(); it != config_["menu-actions"].end(); ++it) { for (Json::Value::const_iterator it = config_["menu-actions"].begin();
it != config_["menu-actions"].end(); ++it) {
std::string key = it.key().asString(); std::string key = it.key().asString();
submenus_[key] = GTK_MENU_ITEM(gtk_builder_get_object(builder, key.c_str())); submenus_[key] = GTK_MENU_ITEM(gtk_builder_get_object(builder, key.c_str()));
menuActionsMap_[key] = it->asString(); menuActionsMap_[key] = it->asString();
g_signal_connect(submenus_[key], "activate", G_CALLBACK(handleGtkMenuEvent), (gpointer) menuActionsMap_[key].c_str()); g_signal_connect(submenus_[key], "activate", G_CALLBACK(handleGtkMenuEvent),
(gpointer)menuActionsMap_[key].c_str());
} }
} }

View File

@ -139,7 +139,6 @@ bool AModule::handleUserEvent(GdkEventButton* const& e) {
// Popup the menu // Popup the menu
gtk_widget_show_all(GTK_WIDGET(menu_)); gtk_widget_show_all(GTK_WIDGET(menu_));
gtk_menu_popup_at_pointer(GTK_MENU(menu_), reinterpret_cast<GdkEvent*>(e)); gtk_menu_popup_at_pointer(GTK_MENU(menu_), reinterpret_cast<GdkEvent*>(e));
} }
// Second call user scripts // Second call user scripts
if (!format.empty()) { if (!format.empty()) {