[gnome-games/wip/exalm/svg330] gamepad-view: Fix gamepad svg loading with old librsvg
- From: Alexander Mikhaylenko <alexm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-games/wip/exalm/svg330] gamepad-view: Fix gamepad svg loading with old librsvg
- Date: Sat, 22 Sep 2018 16:44:21 +0000 (UTC)
commit c58d6b3b325df7d90c3da7c0f113bcf513c52483
Author: Alexander Mikhaylenko <exalm7659 gmail com>
Date: Sat Sep 22 21:40:24 2018 +0500
gamepad-view: Fix gamepad svg loading with old librsvg
For some reason loading with 'new Rsvg.Handle.from_file()' fails, while
loading gresource manually and creating handle via 'from_data()' works, so
let's go with that.
Also remove 'resource:' prefix from paths, since they aren't needed
anymore.
src/ui/gamepad-configurer.vala | 2 +-
src/ui/gamepad-view.vala | 5 ++++-
src/ui/keyboard-configurer.vala | 2 +-
3 files changed, 6 insertions(+), 3 deletions(-)
---
diff --git a/src/ui/gamepad-configurer.vala b/src/ui/gamepad-configurer.vala
index c124c2ea..bf0262c4 100644
--- a/src/ui/gamepad-configurer.vala
+++ b/src/ui/gamepad-configurer.vala
@@ -51,7 +51,7 @@ private class Games.GamepadConfigurer : Gtk.Box {
};
private const GamepadViewConfiguration STANDARD_GAMEPAD_VIEW_CONFIGURATION = {
- "resource:///org/gnome/Games/gamepads/standard-gamepad.svg", STANDARD_GAMEPAD_INPUT_PATHS
+ "/org/gnome/Games/gamepads/standard-gamepad.svg", STANDARD_GAMEPAD_INPUT_PATHS
};
private enum State {
diff --git a/src/ui/gamepad-view.vala b/src/ui/gamepad-view.vala
index 340af6b4..98a3817b 100644
--- a/src/ui/gamepad-view.vala
+++ b/src/ui/gamepad-view.vala
@@ -12,7 +12,10 @@ private class Games.GamepadView : Gtk.DrawingArea {
}
public void set_configuration (GamepadViewConfiguration configuration) throws Error {
- handle = new Rsvg.Handle.from_file (configuration.svg_path);
+ var bytes = resources_lookup_data (configuration.svg_path, ResourceLookupFlags.NONE);
+ var data = bytes.get_data ();
+
+ handle = new Rsvg.Handle.from_data (data);
set_size_request (handle.width, handle.height);
this.configuration = configuration;
input_highlights = new bool[configuration.input_paths.length];
diff --git a/src/ui/keyboard-configurer.vala b/src/ui/keyboard-configurer.vala
index 990a9150..a66b5af3 100644
--- a/src/ui/keyboard-configurer.vala
+++ b/src/ui/keyboard-configurer.vala
@@ -41,7 +41,7 @@ private class Games.KeyboardConfigurer : Gtk.Box {
};
private const GamepadViewConfiguration KEYBOARD_GAMEPAD_VIEW_CONFIGURATION = {
- "resource:///org/gnome/Games/gamepads/standard-gamepad.svg", KEYBOARD_GAMEPAD_INPUT_PATHS
+ "/org/gnome/Games/gamepads/standard-gamepad.svg", KEYBOARD_GAMEPAD_INPUT_PATHS
};
private enum State {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]