Skip to content

Commit b73f837

Browse files
committed
REF: Make is_on_ac_power() less verbose
The status is already reported by `on_check_battery_powered()`. Should be ok for newer kernels and should avoid scaring users. Closes #14
1 parent 4e44970 commit b73f837

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

src/events.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -217,19 +217,16 @@ is_on_ac_power ()
217217
g_autoptr (GDir) dir = g_dir_open (DIRNAME, 0, &err);
218218

219219
if (err) {
220-
g_warning ("Cannot read battery status: %s", err->message);
220+
g_warning ("Cannot read battery/AC status: %s", err->message);
221221
return FALSE;
222222
}
223223

224224
while ((basename = g_dir_read_name (dir))) {
225225
g_autofree char *filename = g_build_filename (DIRNAME, basename, "online", NULL);
226226
g_autofree char *contents = NULL;
227227

228-
g_debug ("Reading '%s'", filename);
229-
if (! g_file_get_contents (filename, &contents, NULL, &err)) {
230-
g_debug ("Cannot read '%s': %s", filename, err->message);
228+
if (! g_file_get_contents (filename, &contents, NULL, NULL))
231229
continue;
232-
}
233230

234231
if (g_strcmp0 (g_strstrip (contents), "1") == 0)
235232
return TRUE;

0 commit comments

Comments
 (0)