modules/upower: use smart pointer to avoid memory leak
This commit is contained in:
parent
8c57756556
commit
a73669be6a
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
#include <libupower-glib/upower.h>
|
#include <libupower-glib/upower.h>
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
|
|
||||||
#include "gtkmm/box.h"
|
#include "gtkmm/box.h"
|
||||||
|
@ -16,7 +17,7 @@ class UPowerTooltip : public Gtk::Window {
|
||||||
|
|
||||||
const std::string getDeviceIcon(UpDeviceKind& kind);
|
const std::string getDeviceIcon(UpDeviceKind& kind);
|
||||||
|
|
||||||
Gtk::Box* contentBox;
|
std::unique_ptr<Gtk::Box> contentBox;
|
||||||
|
|
||||||
uint iconSize;
|
uint iconSize;
|
||||||
uint tooltipSpacing;
|
uint tooltipSpacing;
|
||||||
|
|
|
@ -9,11 +9,10 @@
|
||||||
namespace waybar::modules::upower {
|
namespace waybar::modules::upower {
|
||||||
UPowerTooltip::UPowerTooltip(uint iconSize_, uint tooltipSpacing_, uint tooltipPadding_)
|
UPowerTooltip::UPowerTooltip(uint iconSize_, uint tooltipSpacing_, uint tooltipPadding_)
|
||||||
: Gtk::Window(),
|
: Gtk::Window(),
|
||||||
|
contentBox(std::make_unique<Gtk::Box>(Gtk::ORIENTATION_VERTICAL)),
|
||||||
iconSize(iconSize_),
|
iconSize(iconSize_),
|
||||||
tooltipSpacing(tooltipSpacing_),
|
tooltipSpacing(tooltipSpacing_),
|
||||||
tooltipPadding(tooltipPadding_) {
|
tooltipPadding(tooltipPadding_) {
|
||||||
contentBox = new Gtk::Box(Gtk::ORIENTATION_VERTICAL);
|
|
||||||
|
|
||||||
// Sets the Tooltip Padding
|
// Sets the Tooltip Padding
|
||||||
contentBox->set_margin_top(tooltipPadding);
|
contentBox->set_margin_top(tooltipPadding);
|
||||||
contentBox->set_margin_bottom(tooltipPadding);
|
contentBox->set_margin_bottom(tooltipPadding);
|
||||||
|
|
Loading…
Reference in New Issue