Skip to content

Commit 9f6d11e

Browse files
committed
compatibility for gnome 42.4
1 parent 1889c6a commit 9f6d11e

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

Diff for: extension.js

+7-5
Original file line numberDiff line numberDiff line change
@@ -79,14 +79,17 @@ function chooseLabel() {
7979
function parseStat() {
8080
try {
8181
let input_file = Gio.file_new_for_path('/proc/net/dev');
82-
let fstream = input_file.read(null);
83-
let dstream = Gio.DataInputStream.new(fstream);
82+
83+
let [, contents, etag] = input_file.load_contents(null);
84+
contents = byteArrayToString(contents);
85+
let lines = contents.split('\n');
8486

8587
let count = 0;
8688
let countUp = 0;
8789
let line;
88-
while (([line, len] = dstream.read_line(null)) != null && line != null) {
89-
line = byteArrayToString(line);
90+
91+
for (let i=0;i<lines.length;i++) {
92+
line = lines[i];
9093
line = line.trim();
9194
let fields = line.split(/\W+/);
9295
if (fields.length<=2) break;
@@ -104,7 +107,6 @@ function parseStat() {
104107
countUp = countUp + parseInt(fields[9]);
105108
}
106109
}
107-
fstream.close(null);
108110

109111
if (lastCount === 0) lastCount = count;
110112
if (lastCountUp === 0) lastCountUp = countUp;

Diff for: metadata.json

+3-2
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,10 @@
99
"3.38",
1010
"40",
1111
"41",
12-
"42"
12+
"42",
13+
"43"
1314
],
1415
"url": "https://github.com/biji/simplenetspeed",
1516
"uuid": "[email protected]",
16-
"version": 28
17+
"version": 29
1718
}

0 commit comments

Comments
 (0)