Skip to content

Commit 34c5cb6

Browse files
authored
Add files via upload
1 parent d94771b commit 34c5cb6

File tree

6 files changed

+35
-12
lines changed

6 files changed

+35
-12
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,9 @@ Might require a Gnome restart. Press `ALT+F2` and type `r` and hit enter.
7373
Use the GitHub [Issues](https://github.com/Ory0n/Resource_Monitor/issues) tracker to report issues or ask for features.
7474

7575
# Change Log
76+
**version 5 (May 24, 2019)**
77+
- Schema Bug fixed.
78+
7679
**version 4 (May 2, 2019)**
7780
- Network Bugs fixed.
7881

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3
1+
5

extension.js

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ const Lang = imports.lang;
2727
const GLib = imports.gi.GLib;
2828
const Gio = imports.gi.Gio;
2929
const NM = imports.gi.NM;
30+
const ExtensionUtils = imports.misc.extensionUtils;
31+
const Me = ExtensionUtils.getCurrentExtension();
3032

3133
let button;
3234
let box;
@@ -45,17 +47,24 @@ let timer;
4547
let timeVal;
4648

4749
let settings;
48-
const schema = 'com.github.Ory0n.Resource_Monitor';
4950

5051
let displayIcons, enCpu, enRam, enDisk, enHide, enEth, enWlan;
5152

5253
let sig0, sig1, sig2, sig3, sig4, sig5, sig6, sig7, sig8, sig9, sig10, sig11, sig12, sig13, sigButton;
5354

5455
function getSchema() {
55-
if (Gio.Settings.list_schemas().indexOf(schema) == -1)
56-
throw ("Schema \"%s\" not found.").format(schema);
56+
if (Gio.Settings.list_schemas().indexOf(Me.metadata["settings-schema"]) == -1) {
57+
let schemaSource = Gio.SettingsSchemaSource.new_from_directory(Me.path + "/schemas", Gio.SettingsSchemaSource.get_default(), false);
5758

58-
return new Gio.Settings({ schema: schema });
59+
let schemaObj = schemaSource.lookup(Me.metadata["settings-schema"], true);
60+
if(!schemaObj) {
61+
throw new Error("Schema " + Me.metadata["settings-schema"] + " could not be found for extension " + Me.uuid + ". Please check your installation.");
62+
}
63+
64+
return new Gio.Settings({ settings_schema: schemaObj });
65+
}
66+
67+
return new Gio.Settings({ schema: Me.metadata["settings-schema"] });
5968
}
6069

6170
function openSystemMonitor() {

metadata.json

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,11 @@
44
"description": "Monitor the use of system resources like cpu, ram, disk, network and display them in gnome shell top bar.",
55
"name": "Resource Monitor",
66
"shell-version": [
7-
"3.30.1"
7+
"3.30",
8+
"3.32"
89
],
910
"url": "https://github.com/Ory0n/Resource_Monitor/",
11+
"settings-schema": "com.github.Ory0n.Resource_Monitor",
1012
"uuid": "Resource_Monitor@Ory0n",
11-
"version": 5
12-
}
13+
"version": 6
14+
}

prefs.js

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,10 @@ const Gtk = imports.gi.Gtk;
2121
const Lang = imports.lang;
2222
const Gio = imports.gi.Gio;
2323
const GLib = imports.gi.GLib;
24+
const ExtensionUtils = imports.misc.extensionUtils;
25+
const Me = ExtensionUtils.getCurrentExtension();
2426

2527
let settings;
26-
const schema = 'com.github.Ory0n.Resource_Monitor';
2728

2829
function updateTimer(object, value) {
2930
settings.set_int('timer', value.get_value());
@@ -82,10 +83,18 @@ function selectDisk(object, value) {
8283
}
8384

8485
function init() {
85-
if (Gio.Settings.list_schemas().indexOf(schema) == -1)
86-
throw ("Schema \"%s\" not found.").format(schema);
86+
if (Gio.Settings.list_schemas().indexOf(Me.metadata["settings-schema"]) == -1) {
87+
let schemaSource = Gio.SettingsSchemaSource.new_from_directory(Me.path + "/schemas", Gio.SettingsSchemaSource.get_default(), false);
8788

88-
settings = new Gio.Settings({ schema: schema });
89+
let schemaObj = schemaSource.lookup(Me.metadata["settings-schema"], true);
90+
if(!schemaObj) {
91+
throw new Error("Schema " + Me.metadata["settings-schema"] + " could not be found for extension " + Me.uuid + ". Please check your installation.");
92+
}
93+
94+
return new Gio.Settings({ settings_schema: schemaObj });
95+
}
96+
97+
return new Gio.Settings({ schema: Me.metadata["settings-schema"] });
8998
}
9099

91100
function PatternsPrefs() {

schemas/gschemas.compiled

-12 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)