From 9f6d11e9caccda74368dd9af44bc60157546e09e Mon Sep 17 00:00:00 2001 From: biji Date: Tue, 27 Sep 2022 21:51:16 +0700 Subject: [PATCH] compatibility for gnome 42.4 --- extension.js | 12 +++++++----- metadata.json | 5 +++-- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/extension.js b/extension.js index 246a4c4..67eb63b 100644 --- a/extension.js +++ b/extension.js @@ -79,14 +79,17 @@ function chooseLabel() { function parseStat() { try { let input_file = Gio.file_new_for_path('/proc/net/dev'); - let fstream = input_file.read(null); - let dstream = Gio.DataInputStream.new(fstream); + + let [, contents, etag] = input_file.load_contents(null); + contents = byteArrayToString(contents); + let lines = contents.split('\n'); let count = 0; let countUp = 0; let line; - while (([line, len] = dstream.read_line(null)) != null && line != null) { - line = byteArrayToString(line); + + for (let i=0;i