refactor: AModule

This commit is contained in:
Alex
2019-06-15 14:57:52 +02:00
parent dabe2bebbb
commit 340ec7be91
20 changed files with 255 additions and 274 deletions

View File

@ -28,7 +28,7 @@ class Pulseaudio : public ALabel {
pa_threaded_mainloop* mainloop_;
pa_mainloop_api* mainloop_api_;
pa_context* context_;
bool scrolling_;
std::mutex mutex_;
// SINK
uint32_t sink_idx_{0};
uint16_t volume_;

View File

@ -1,7 +1,7 @@
#pragma once
#include <fmt/format.h>
#include "IModule.hpp"
#include "AModule.hpp"
#include "bar.hpp"
#include "modules/sni/host.hpp"
#include "modules/sni/watcher.hpp"
@ -9,19 +9,17 @@
namespace waybar::modules::SNI {
class Tray : public IModule {
class Tray : public AModule {
public:
Tray(const std::string&, const Bar&, const Json::Value&);
~Tray() = default;
auto update() -> void;
operator Gtk::Widget&();
private:
void onAdd(std::unique_ptr<Item>& item);
void onRemove(std::unique_ptr<Item>& item);
static inline std::size_t nb_hosts_ = 0;
const Json::Value& config_;
Gtk::Box box_;
SNI::Watcher watcher_;
SNI::Host host_;

View File

@ -26,7 +26,6 @@ class Window : public ALabel, public sigc::trackable {
void getTree();
const Bar& bar_;
std::mutex mutex_;
std::string window_;
int windowId_;
std::string app_id_;

View File

@ -3,7 +3,7 @@
#include <fmt/format.h>
#include <gtkmm/button.h>
#include <gtkmm/label.h>
#include "IModule.hpp"
#include "AModule.hpp"
#include "bar.hpp"
#include "client.hpp"
#include "modules/sway/ipc/client.hpp"
@ -12,12 +12,11 @@
namespace waybar::modules::sway {
class Workspaces : public IModule, public sigc::trackable {
class Workspaces : public AModule, public sigc::trackable {
public:
Workspaces(const std::string&, const waybar::Bar&, const Json::Value&);
~Workspaces() = default;
auto update() -> void;
operator Gtk::Widget&();
private:
void onCmd(const struct Ipc::ipc_response&);
@ -33,15 +32,11 @@ class Workspaces : public IModule, public sigc::trackable {
bool handleScroll(GdkEventScroll*);
const Bar& bar_;
const Json::Value& config_;
std::vector<Json::Value> workspaces_;
std::vector<std::string> workspaces_order_;
std::mutex mutex_;
Gtk::Box box_;
util::JsonParser parser_;
bool scrolling_;
std::unordered_map<std::string, Gtk::Button> buttons_;
gdouble distance_scrolled_;
util::SleeperThread thread_;
Ipc ipc_;