GS 3.24 compatibility
* item actor * Gio.File.load_bytes not available
This commit is contained in:
parent
075b080aaf
commit
4e0455af34
11
files.js
11
files.js
|
|
@ -64,7 +64,16 @@ var Image = new Lang.Class({
|
||||||
get bytes() {
|
get bytes() {
|
||||||
if (!this._bytes) {
|
if (!this._bytes) {
|
||||||
if (this.file)
|
if (this.file)
|
||||||
this._bytes = this.file.load_bytes(null)[0];
|
try {
|
||||||
|
// load_bytes available in GLib 2.56+
|
||||||
|
this._bytes = this.file.load_bytes(null)[0];
|
||||||
|
} catch(e) {
|
||||||
|
let [success_, contents] = this.file.load_contents(null);
|
||||||
|
if (contents instanceof Uint8Array)
|
||||||
|
this._bytes = ByteArray.toGBytes(contents);
|
||||||
|
else
|
||||||
|
this._bytes = contents.toGBytes();
|
||||||
|
}
|
||||||
else
|
else
|
||||||
this._bytes = new GLib.Bytes(GLib.base64_decode(this.base64));
|
this._bytes = new GLib.Bytes(GLib.base64_decode(this.base64));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
8
menu.js
8
menu.js
|
|
@ -156,10 +156,10 @@ var DrawingMenu = new Lang.Class({
|
||||||
|
|
||||||
this.actionButtons = [];
|
this.actionButtons = [];
|
||||||
let groupItem = new PopupMenu.PopupBaseMenuItem({ reactive: false, can_focus: false, style_class: "draw-on-your-screen-menu-group-item" });
|
let groupItem = new PopupMenu.PopupBaseMenuItem({ reactive: false, can_focus: false, style_class: "draw-on-your-screen-menu-group-item" });
|
||||||
groupItem.add_child(this._createActionButton(_("Undo"), this.area.undo.bind(this.area), 'edit-undo-symbolic'));
|
getActor(groupItem).add_child(this._createActionButton(_("Undo"), this.area.undo.bind(this.area), 'edit-undo-symbolic'));
|
||||||
groupItem.add_child(this._createActionButton(_("Redo"), this.area.redo.bind(this.area), 'edit-redo-symbolic'));
|
getActor(groupItem).add_child(this._createActionButton(_("Redo"), this.area.redo.bind(this.area), 'edit-redo-symbolic'));
|
||||||
groupItem.add_child(this._createActionButton(_("Erase"), this.area.deleteLastElement.bind(this.area), 'edit-clear-all-symbolic'));
|
getActor(groupItem).add_child(this._createActionButton(_("Erase"), this.area.deleteLastElement.bind(this.area), 'edit-clear-all-symbolic'));
|
||||||
groupItem.add_child(this._createActionButton(_("Smooth"), this.area.smoothLastElement.bind(this.area), this.smoothIcon));
|
getActor(groupItem).add_child(this._createActionButton(_("Smooth"), this.area.smoothLastElement.bind(this.area), this.smoothIcon));
|
||||||
this.menu.addMenuItem(groupItem);
|
this.menu.addMenuItem(groupItem);
|
||||||
this._addSeparator(this.menu, true);
|
this._addSeparator(this.menu, true);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue