mirror of
https://github.com/rad4day/Waybar.git
synced 2023-12-21 10:22:59 +01:00
refactor: don't print an error when a watcher is already present
This commit is contained in:
parent
131dae5818
commit
e4756cf24e
@ -14,8 +14,8 @@ Watcher::Watcher()
|
|||||||
watcher_(sn_watcher_skeleton_new()) {}
|
watcher_(sn_watcher_skeleton_new()) {}
|
||||||
|
|
||||||
Watcher::~Watcher() {
|
Watcher::~Watcher() {
|
||||||
if (bus_name_id_ > 0) {
|
if (bus_name_id_ != 0) {
|
||||||
g_bus_unown_name(bus_name_id_);
|
Gio::DBus::unown_name(bus_name_id_);
|
||||||
bus_name_id_ = 0;
|
bus_name_id_ = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -36,7 +36,10 @@ void Watcher::busAcquired(const Glib::RefPtr<Gio::DBus::Connection>& conn, Glib:
|
|||||||
g_dbus_interface_skeleton_export(
|
g_dbus_interface_skeleton_export(
|
||||||
G_DBUS_INTERFACE_SKELETON(watcher_), conn->gobj(), "/StatusNotifierWatcher", &error);
|
G_DBUS_INTERFACE_SKELETON(watcher_), conn->gobj(), "/StatusNotifierWatcher", &error);
|
||||||
if (error != nullptr) {
|
if (error != nullptr) {
|
||||||
|
// Don't print an error when a watcher is already present
|
||||||
|
if (error->code != 2) {
|
||||||
std::cerr << error->message << std::endl;
|
std::cerr << error->message << std::endl;
|
||||||
|
}
|
||||||
g_error_free(error);
|
g_error_free(error);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user