Skip to content

Commit

Permalink
compatibility for gnome 42.4
Browse files Browse the repository at this point in the history
  • Loading branch information
biji committed Sep 27, 2022
1 parent 1889c6a commit 9f6d11e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
12 changes: 7 additions & 5 deletions extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -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<lines.length;i++) {
line = lines[i];
line = line.trim();
let fields = line.split(/\W+/);
if (fields.length<=2) break;
Expand All @@ -104,7 +107,6 @@ function parseStat() {
countUp = countUp + parseInt(fields[9]);
}
}
fstream.close(null);

if (lastCount === 0) lastCount = count;
if (lastCountUp === 0) lastCountUp = countUp;
Expand Down
5 changes: 3 additions & 2 deletions metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@
"3.38",
"40",
"41",
"42"
"42",
"43"
],
"url": "https://github.com/biji/simplenetspeed",
"uuid": "[email protected]",
"version": 28
"version": 29
}

0 comments on commit 9f6d11e

Please sign in to comment.