GTK4: Migration bluetooth
Signed-off-by: Viktar Lukashonak <myxabeer@gmail.com>pull/2956/head
parent
293f34e07f
commit
b4a28042d8
|
@ -4,11 +4,6 @@
|
|||
#ifdef WANT_RFKILL
|
||||
#include "util/rfkill.hpp"
|
||||
#endif
|
||||
#include <gio/gio.h>
|
||||
|
||||
#include <optional>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace waybar::modules {
|
||||
|
||||
|
|
|
@ -191,6 +191,7 @@ inc_dirs = ['include']
|
|||
if is_linux
|
||||
add_project_arguments('-DHAVE_CPU_LINUX', language: 'cpp')
|
||||
add_project_arguments('-DHAVE_MEMORY_LINUX', language: 'cpp')
|
||||
add_project_arguments('-DHAVE_SYSTEMD_MONITOR', language: 'cpp')
|
||||
src_files += files('src/modules/battery.cpp',
|
||||
'src/modules/cpu.cpp',
|
||||
'src/modules/cpu_frequency/common.cpp',
|
||||
|
@ -198,8 +199,10 @@ if is_linux
|
|||
'src/modules/cpu_usage/common.cpp',
|
||||
'src/modules/cpu_usage/linux.cpp',
|
||||
'src/modules/memory/common.cpp',
|
||||
'src/modules/memory/linux.cpp')
|
||||
'src/modules/memory/linux.cpp',
|
||||
'src/modules/bluetooth.cpp')
|
||||
man_files += files('man/waybar-battery.5.scd',
|
||||
'man/waybar-bluetooth.5.scd',
|
||||
'man/waybar-cpu.5.scd',
|
||||
'man/waybar-memory.5.scd')
|
||||
elif is_dragonfly or is_freebsd or is_netbsd or is_openbsd
|
||||
|
|
|
@ -280,15 +280,15 @@ gtk4 todo
|
|||
if (ref == "sndio") {
|
||||
return new waybar::modules::Sndio(id, config_[name]);
|
||||
}
|
||||
#endif
|
||||
#endif*/
|
||||
#ifdef HAVE_GIO_UNIX
|
||||
if (ref == "bluetooth") {
|
||||
return new waybar::modules::Bluetooth(id, config_[name]);
|
||||
}
|
||||
}/*
|
||||
if (ref == "inhibitor") {
|
||||
return new waybar::modules::Inhibitor(id, bar_, config_[name]);
|
||||
}
|
||||
#endif
|
||||
}*/
|
||||
#endif/*
|
||||
#ifdef HAVE_LIBJACK
|
||||
if (ref == "jack") {
|
||||
return new waybar::modules::JACK(id, config_[name]);
|
||||
|
|
|
@ -1,13 +1,8 @@
|
|||
#include "modules/bluetooth.hpp"
|
||||
|
||||
#include <fmt/format.h>
|
||||
#include <spdlog/spdlog.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <sstream>
|
||||
|
||||
#include "util/scope_guard.hpp"
|
||||
|
||||
#include <spdlog/spdlog.h>
|
||||
|
||||
namespace {
|
||||
|
||||
using GDBusManager = std::unique_ptr<GDBusObjectManager, void (*)(GDBusObjectManager*)>;
|
||||
|
@ -200,10 +195,10 @@ auto waybar::modules::Bluetooth::update() -> void {
|
|||
}
|
||||
|
||||
auto update_style_context = [this](const std::string& style_class, bool in_next_state) {
|
||||
if (in_next_state && !label_.get_style_context()->has_class(style_class)) {
|
||||
label_.get_style_context()->add_class(style_class);
|
||||
} else if (!in_next_state && label_.get_style_context()->has_class(style_class)) {
|
||||
label_.get_style_context()->remove_class(style_class);
|
||||
if (in_next_state && !Gtk::Label::get_style_context()->has_class(style_class)) {
|
||||
Gtk::Label::get_style_context()->add_class(style_class);
|
||||
} else if (!in_next_state && Gtk::Label::get_style_context()->has_class(style_class)) {
|
||||
Gtk::Label::get_style_context()->remove_class(style_class);
|
||||
}
|
||||
};
|
||||
update_style_context("discoverable", cur_controller_ ? cur_controller_->discoverable : false);
|
||||
|
@ -216,10 +211,10 @@ auto waybar::modules::Bluetooth::update() -> void {
|
|||
state_ = state;
|
||||
|
||||
if (format_.empty()) {
|
||||
event_box_.hide();
|
||||
Gtk::Label::hide();
|
||||
} else {
|
||||
event_box_.show();
|
||||
label_.set_markup(fmt::format(
|
||||
Gtk::Label::show();
|
||||
Gtk::Label::set_markup(fmt::format(
|
||||
fmt::runtime(format_), fmt::arg("status", state_),
|
||||
fmt::arg("num_connections", connected_devices_.size()),
|
||||
fmt::arg("controller_address", cur_controller_ ? cur_controller_->address : "null"),
|
||||
|
@ -264,7 +259,7 @@ auto waybar::modules::Bluetooth::update() -> void {
|
|||
device_enumerate_.erase(0, 1);
|
||||
}
|
||||
}
|
||||
label_.set_tooltip_text(fmt::format(
|
||||
Gtk::Label::set_tooltip_text(fmt::format(
|
||||
fmt::runtime(tooltip_format), fmt::arg("status", state_),
|
||||
fmt::arg("num_connections", connected_devices_.size()),
|
||||
fmt::arg("controller_address", cur_controller_ ? cur_controller_->address : "null"),
|
||||
|
|
Loading…
Reference in New Issue