[retro-gtk] video-filter: Add from_string()
- From: Adrien Plazas <aplazas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [retro-gtk] video-filter: Add from_string()
- Date: Wed, 22 Feb 2017 18:34:35 +0000 (UTC)
commit cdca751ab3d6f34791f5d6e972c9f3ebbf1d9909
Author: theawless <theawless gmail com>
Date: Tue Feb 21 00:30:39 2017 +0530
video-filter: Add from_string()
Parse the string to get the corresponding filter. In case of a failure,
return the default one.
https://bugzilla.gnome.org/show_bug.cgi?id=777987
retro-gtk/video/video-filter.vala | 9 ++++++++-
1 files changed, 8 insertions(+), 1 deletions(-)
---
diff --git a/retro-gtk/video/video-filter.vala b/retro-gtk/video/video-filter.vala
index 218359b..17b135b 100644
--- a/retro-gtk/video/video-filter.vala
+++ b/retro-gtk/video/video-filter.vala
@@ -2,5 +2,12 @@
public enum Retro.VideoFilter {
SMOOTH,
- SHARP,
+ SHARP;
+
+ public static VideoFilter from_string (string filter) {
+ var enumc = (EnumClass) typeof (VideoFilter).class_ref ();
+ var eval = enumc.get_value_by_nick (filter);
+
+ return eval == null ? VideoFilter.SMOOTH : (VideoFilter) eval.value;
+ }
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]