Rebased onto current master and fixed the privacy module build: - privacy_item.hpp no longer includes privacy.hpp (it does not use the Privacy class); this broke the circular include that left PrivacyItem undeclared when privacy.hpp was reached first from privacy_item.cpp. - privacy_item.cpp now includes gtkmm/label.h explicitly, since Gtk::Label was previously only pulled in transitively via privacy.hpp.
74 lines
2.0 KiB
C++
74 lines
2.0 KiB
C++
#pragma once
|
|
|
|
#include <json/value.h>
|
|
|
|
#include <string>
|
|
|
|
#include "gtkmm/box.h"
|
|
#include "gtkmm/image.h"
|
|
#include "gtkmm/revealer.h"
|
|
#include "util/pipewire/privacy_node_info.hpp"
|
|
|
|
using waybar::util::PipewireBackend::PrivacyNodeType;
|
|
using waybar::util::PipewireBackend::PWPrivacyNodeInfo;
|
|
|
|
namespace waybar::modules::privacy {
|
|
|
|
class PrivacyItem : public Gtk::Revealer {
|
|
protected:
|
|
PrivacyItem(const Json::Value& config_, enum PrivacyNodeType privacy_type_,
|
|
Gtk::Orientation orientation, const std::string& pos, const uint icon_size,
|
|
const uint transition_duration);
|
|
|
|
public:
|
|
virtual void set_tooltip() = 0;
|
|
|
|
enum PrivacyNodeType privacy_type;
|
|
|
|
void set_in_use(bool in_use);
|
|
|
|
uint tooltipIconSize = 24;
|
|
Gtk::Box tooltip_window;
|
|
|
|
private:
|
|
sigc::connection signal_conn;
|
|
|
|
bool init = false;
|
|
bool in_use = false;
|
|
|
|
// Config
|
|
std::string iconName = "image-missing-symbolic";
|
|
bool tooltip = true;
|
|
|
|
Gtk::Box box_;
|
|
Gtk::Image icon_;
|
|
|
|
void update_tooltip();
|
|
};
|
|
|
|
class GeoCluePrivacyItem : public PrivacyItem {
|
|
public:
|
|
GeoCluePrivacyItem(const Json::Value& config_, Gtk::Orientation orientation,
|
|
const std::string& pos, const uint icon_size, const uint transition_duration)
|
|
: PrivacyItem(config_, util::PipewireBackend::PRIVACY_NODE_TYPE_LOCATION, orientation, pos,
|
|
icon_size, transition_duration) {}
|
|
|
|
void set_tooltip() override;
|
|
};
|
|
|
|
class PWPrivacyItem : public PrivacyItem {
|
|
public:
|
|
PWPrivacyItem(const Json::Value& config_, enum PrivacyNodeType privacy_type_,
|
|
std::list<PWPrivacyNodeInfo*>* nodes_, Gtk::Orientation orientation,
|
|
const std::string& pos, const uint icon_size, const uint transition_duration)
|
|
: PrivacyItem(config_, privacy_type_, orientation, pos, icon_size, transition_duration),
|
|
nodes(nodes_) {}
|
|
|
|
void set_tooltip() override;
|
|
|
|
private:
|
|
std::list<PWPrivacyNodeInfo*>* nodes;
|
|
};
|
|
|
|
} // namespace waybar::modules::privacy
|