From: Brandon Lewis Date: Thu, 8 Jul 2010 13:54:27 +0000 (+0200) Subject: use gtype to get the enum value for the nick X-Git-Tag: 1.19.3~493^2~2766 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f64bc157bc57bf6148201ebd3d0e956dc83987bb;p=platform%2Fupstream%2Fgstreamer.git use gtype to get the enum value for the nick --- diff --git a/ges/ges-timeline-transition.c b/ges/ges-timeline-transition.c index b63e59f..fb57264 100644 --- a/ges/ges-timeline-transition.c +++ b/ges/ges-timeline-transition.c @@ -200,11 +200,19 @@ GESTimelineTransition * ges_timeline_transition_new_for_nick (gchar * nick) { GEnumValue *value; + GEnumClass *klass; + GESTimelineTransition *ret = NULL; - for (value = &transition_types[0]; value->value_name; value++) - if (!strcmp (nick, value->value_nick)) - return g_object_new (GES_TYPE_TIMELINE_TRANSITION, "vtype", - (gint) value->value, NULL); + klass = G_ENUM_CLASS (g_type_class_ref (GES_VIDEO_TRANSITION_TYPE_TYPE)); + if (!klass) + return NULL; + + value = g_enum_get_value_by_nick (klass, nick); + if (value) { + ret = g_object_new (GES_TYPE_TIMELINE_TRANSITION, "vtype", + (gint) value->value, NULL); + } - return NULL; + g_type_class_unref (klass); + return ret; }