From e589ecaddf4d14e9aeea5aed9f4076b1447cc926 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 17 Jun 2010 17:04:14 -0500 Subject: Reworking to make more clear and use the GEnumValue structure correctly. --- src/application-service-appstore.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/application-service-appstore.c b/src/application-service-appstore.c index 66943b5..c18ebe2 100644 --- a/src/application-service-appstore.c +++ b/src/application-service-appstore.c @@ -243,7 +243,13 @@ get_all_properties_cb (DBusGProxy * proxy, GHashTable * properties, GError * err static AppIndicatorStatus string_to_status(const gchar * status_string) { - return (AppIndicatorStatus) g_enum_get_value_by_nick((GEnumClass *)g_type_class_ref (APP_INDICATOR_TYPE_INDICATOR_STATUS), status_string); + GEnumClass * klass = G_ENUM_CLASS(g_type_class_peek_static(APP_INDICATOR_TYPE_INDICATOR_STATUS)); + g_return_val_if_fail(klass != NULL, APP_INDICATOR_STATUS_PASSIVE); + + GEnumValue * val = g_enum_get_value_by_nick(klass, status_string); + g_return_val_if_fail(val != NULL, APP_INDICATOR_STATUS_PASSIVE); + + return (AppIndicatorStatus)val->value; } /* A small helper function to get the position of an application -- cgit v1.2.3