MCPcopy Create free account
hub / github.com/Alexays/Waybar / getData

Method getData

src/modules/gamemode.cpp:122–142  ·  view source on GitHub ↗

Gets the DBus ClientCount

Source from the content-addressed store, hash-verified

120
121// Gets the DBus ClientCount
122void Gamemode::getData() {
123 if (gamemodeRunning && gamemode_proxy) {
124 try {
125 // Get game count
126 auto parameters = Glib::VariantContainerBase(
127 g_variant_new("(ss)", dbus_get_interface.c_str(), "ClientCount"));
128 Glib::VariantContainerBase data = gamemode_proxy->call_sync("Get", parameters);
129 if (data && data.is_of_type(Glib::VariantType("(v)"))) {
130 Glib::VariantBase variant;
131 g_variant_get(data.gobj_copy(), "(v)", &variant);
132 if (variant && variant.is_of_type(Glib::VARIANT_TYPE_INT32)) {
133 g_variant_get(variant.gobj_copy(), "i", &gameCount);
134 return;
135 }
136 }
137 } catch (Glib::Error& e) {
138 spdlog::error("Gamemode Error {}", e.what().c_str());
139 }
140 }
141 gameCount = 0;
142}
143
144// Whenever the DBus ClientCount changes
145void Gamemode::notify_cb(const Glib::ustring& sender_name, const Glib::ustring& signal_name,

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected