| 125 | } |
| 126 | |
| 127 | static void |
| 128 | battery_proxy_new_cb (GObject *source, GAsyncResult *result, |
| 129 | signal_user_data_t *ud) |
| 130 | { |
| 131 | GDBusProxy *proxy; |
| 132 | GVariant *is_present; |
| 133 | GError *error = NULL; |
| 134 | |
| 135 | proxy = g_dbus_proxy_new_for_bus_finish(result, &error); |
| 136 | if (proxy != NULL) |
| 137 | { |
| 138 | is_present = g_dbus_proxy_get_cached_property(proxy, "IsPresent"); |
| 139 | if (g_variant_get_boolean(is_present)) |
| 140 | { |
| 141 | g_signal_connect(proxy, "g-properties-changed", |
| 142 | G_CALLBACK(battery_level_cb), ud); |
| 143 | show_power_widgets(battery_widgets); |
| 144 | battery_proxy = proxy; |
| 145 | } |
| 146 | else |
| 147 | { |
| 148 | g_debug("No battery present. Disconnecting UPower proxy."); |
| 149 | g_clear_object(&proxy); |
| 150 | g_clear_object(&upower_proxy); |
| 151 | } |
| 152 | g_variant_unref(is_present); |
| 153 | } |
| 154 | else |
| 155 | { |
| 156 | g_debug("Could not get DisplayDevice proxy: %s", error->message); |
| 157 | g_error_free(error); |
| 158 | g_clear_object(&upower_proxy); |
| 159 | } |
| 160 | } |
| 161 | |
| 162 | static void |
| 163 | battery_proxy_new_async (signal_user_data_t *ud) |
nothing calls this directly
no test coverage detected