mirror of
				https://github.com/rad4day/Waybar.git
				synced 2025-10-28 23:12:29 +01:00 
			
		
		
		
	fix(Tray): add item if not exist
This commit is contained in:
		| @@ -130,8 +130,13 @@ std::tuple<std::string, std::string> Host::getBusNameAndObjectPath(const std::st | ||||
|  | ||||
| void Host::addRegisteredItem(std::string service) { | ||||
|   auto [bus_name, object_path] = getBusNameAndObjectPath(service); | ||||
|   items_.emplace_back(new Item(bus_name, object_path, config_)); | ||||
|   on_add_(items_.back()); | ||||
|   auto it = std::find_if(items_.begin(), items_.end(), [&bus_name, &object_path](const auto& item) { | ||||
|     return bus_name == item->bus_name && object_path == item->object_path; | ||||
|   }); | ||||
|   if (it == items_.end()) { | ||||
|     items_.emplace_back(new Item(bus_name, object_path, config_)); | ||||
|     on_add_(items_.back()); | ||||
|   } | ||||
| } | ||||
|  | ||||
| } | ||||
| }  // namespace waybar::modules::SNI | ||||
| @@ -28,7 +28,9 @@ Watcher::~Watcher() { | ||||
|     g_slist_free_full(items_, gfWatchFree); | ||||
|     items_ = nullptr; | ||||
|   } | ||||
|   g_dbus_interface_skeleton_unexport(G_DBUS_INTERFACE_SKELETON(watcher_)); | ||||
|   auto iface = G_DBUS_INTERFACE_SKELETON(watcher_); | ||||
|   auto conn = g_dbus_interface_skeleton_get_connection(iface); | ||||
|   g_dbus_interface_skeleton_unexport_from_connection(iface, conn); | ||||
| } | ||||
|  | ||||
| void Watcher::busAcquired(const Glib::RefPtr<Gio::DBus::Connection>& conn, Glib::ustring name) { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Alex
					Alex