[gnome-shell/wip/carlosg/fix-pad-svg: 2/2] padOsd: Use non-deprecated librsvg API to create handle
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/wip/carlosg/fix-pad-svg: 2/2] padOsd: Use non-deprecated librsvg API to create handle
- Date: Fri, 26 Apr 2019 11:32:36 +0000 (UTC)
commit 0cf1017b072634b8ed6a904e8cae654906569862
Author: Carlos Garnacho <carlosg gnome org>
Date: Fri Apr 26 13:03:42 2019 +0200
padOsd: Use non-deprecated librsvg API to create handle
On one hand, we were using a path instead of an URI on
rsvg_handle_set_base_uri(). This broke at some point in librsvg
(presumably for the best, handling paths there sounds non-standard)
leaving a blank svg (As the base image wouldn't be accessed).
On the other hand, we use this with the deprecated rsvg_handle_write()
which we should drift away from.
Using rsvg_handle_new_from_stream_sync() neatly solves both. We use
newer API based on input streams and GFiles, and it internally does
the right thing, bringing the pad OSD back to life.
Closes: https://gitlab.gnome.org/GNOME/gnome-shell/issues/1220
js/ui/padOsd.js | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
---
diff --git a/js/ui/padOsd.js b/js/ui/padOsd.js
index 760f48a37..a4af47297 100644
--- a/js/ui/padOsd.js
+++ b/js/ui/padOsd.js
@@ -374,12 +374,12 @@ var PadDiagram = GObject.registerClass({
svgData += this._cssString();
svgData += this._wrappingSvgFooter();
- let handle = new Rsvg.Handle();
- handle.set_base_uri(GLib.path_get_dirname(this._imagePath));
- handle.write(svgData);
- handle.close();
+ let istream = new Gio.MemoryInputStream();
+ istream.add_bytes(new GLib.Bytes(svgData));
- return handle;
+ return Rsvg.Handle.new_from_stream_sync(istream,
+ Gio.File.new_for_path(this._imagePath),
+ 0, null);
}
_updateDiagramScale() {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]