Skip to content

Commit 5ee22e8

Browse files
committed
Fix work without time
1 parent 89d4848 commit 5ee22e8

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

src/main.c

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -277,22 +277,27 @@ static gboolean battery_handler(Context* context)
277277

278278
g_debug("Get battery(%s) time", battery->name);
279279
if (get_battery_time(battery, status, &seconds, &error) == FALSE)
280-
LOG_WARNING_AND_RETURN(G_SOURCE_CONTINUE, error, "Cannot get battery(%s) time", battery->name);
281-
280+
{
281+
g_warning("Cannot get battery(%s) time", battery->name);
282+
seconds = 0;
283+
}
282284
battery_status_notification(battery, status, capacity, seconds, &notification);
285+
283286
break;
284287
case DISCHARGING_STATUS:
285-
g_debug("Battery(%s) got DISCHARGING_STATUS", battery->name);
286288
case NOT_CHARGING_STATUS:
287-
g_debug("Battery(%s) got NOT_CHARGING_STATUS", battery->name);
289+
g_debug("Battery(%s) got NOT_CHARGING_STATUS or DISCHARGING_STATUS", battery->name);
288290

289291
g_debug("Get battery(%s) capacity", battery->name);
290292
if (get_battery_capacity(battery, &capacity, &error) == FALSE)
291-
LOG_WARNING_AND_RETURN(G_SOURCE_CONTINUE, error, "Cannot get battery(%s) capacty", battery->name);
293+
LOG_WARNING_AND_RETURN(G_SOURCE_CONTINUE, error, "Cannot get battery(%s) capacity", battery->name);
292294

293295
g_debug("Get battery time");
294296
if (get_battery_time(battery, status, &seconds, &error) == FALSE)
295-
LOG_WARNING_AND_RETURN(G_SOURCE_CONTINUE, error, "Cannot get battery(%s) time", battery->name);
297+
{
298+
g_warning("Cannot get battery(%s) time", battery->name);
299+
seconds = 0;
300+
}
296301

297302
if (context->prev_status != status)
298303
{

0 commit comments

Comments
 (0)