Skip to content

Commit

Permalink
Replace ByteArray with TextDecoder; fix import of St.IconTheme
Browse files Browse the repository at this point in the history
Thanks to @justperfection:gnome.org in Matrix #extensions:gnome.org
for the TextDecoder solution.

The IconTheme solution was mine, so it's likely missing something
  • Loading branch information
Benjamin Kahn committed Nov 22, 2023
1 parent 6bc7f82 commit eab7b7d
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,7 @@ import * as PopupMenu from 'resource:///org/gnome/shell/ui/popupMenu.js';
import * as Panel from 'resource:///org/gnome/shell/ui/panel.js';
import * as Util from 'resource:///org/gnome/shell/misc/util.js';

/*
"ByteArray" does not appear to have an import in Gnome Shell 45 yet
Or I'm missing it as I hack and slash through this.
const ByteArray = imports.byteArray;
*/
let ByteArrayReplacement = new TextDecoder('utf-8');

import {Extension, gettext as _} from 'resource:///org/gnome/shell/extensions/extension.js';
let extensionPath;
Expand Down Expand Up @@ -127,7 +123,7 @@ const ConnectionManager = new Lang.Class({
if (GLib.file_test(this._configFile, GLib.FileTest.EXISTS) ) {

let filedata = GLib.file_get_contents(this._configFile);
let jsondata = JSON.parse(ByteArray.toString(filedata[1]));
let jsondata = JSON.parse(ByteArrayReplacement.decode(filedata[1]));
let root = jsondata['Root'];

// Global Settings
Expand Down Expand Up @@ -369,7 +365,7 @@ function disable() {
function init(extensionMeta) {
extensionPath = extensionMeta.path;

let theme = imports.gi.Gtk.IconTheme.get_default();
let theme = St.IconTheme.new();
theme.append_search_path(extensionPath);

}
Expand Down

0 comments on commit eab7b7d

Please sign in to comment.