[gnome-games/wip/exalm/svg] 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/svg] gamepad-view: Fix gamepad svg loading with old librsvg
- Date: Sat, 22 Sep 2018 16:43:45 +0000 (UTC)
commit 2bac7c1d7b9a4b17d292481b9c0c8eb087596914
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-view.vala | 5 ++++-
src/ui/preferences-subpage-gamepad.vala | 2 +-
src/ui/preferences-subpage-keyboard.vala | 2 +-
3 files changed, 6 insertions(+), 3 deletions(-)
---
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/preferences-subpage-gamepad.vala b/src/ui/preferences-subpage-gamepad.vala
index 492fdf27..5d75cb5d 100644
--- a/src/ui/preferences-subpage-gamepad.vala
+++ b/src/ui/preferences-subpage-gamepad.vala
@@ -51,7 +51,7 @@ private class Games.PreferencesSubpageGamepad: Gtk.Box, PreferencesSubpage {
};
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/preferences-subpage-keyboard.vala b/src/ui/preferences-subpage-keyboard.vala
index 5a867446..71b5f0f1 100644
--- a/src/ui/preferences-subpage-keyboard.vala
+++ b/src/ui/preferences-subpage-keyboard.vala
@@ -41,7 +41,7 @@ private class Games.PreferencesSubpageKeyboard: Gtk.Box, PreferencesSubpage {
};
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]