Gets the DBus ClientCount
| 120 | |
| 121 | // Gets the DBus ClientCount |
| 122 | void 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 |
| 145 | void Gamemode::notify_cb(const Glib::ustring& sender_name, const Glib::ustring& signal_name, |
nothing calls this directly
no outgoing calls
no test coverage detected