diff options
author | Ted Gould <ted@gould.cx> | 2010-06-21 14:13:54 -0500 |
---|---|---|
committer | Ted Gould <ted@gould.cx> | 2010-06-21 14:13:54 -0500 |
commit | 3439224475debe3d7e8977a0a15a4a9c728fc8b7 (patch) | |
tree | f993851a278addc0965c014f44eadcd1292c55ea /src/application-service-appstore.c | |
parent | 0f7ba97faf10422fd32628636c81563b04d8a6fc (diff) | |
parent | 20f0c1d8e534fc1b1d0824baa2aa5464d2b0f998 (diff) | |
download | libayatana-appindicator-3439224475debe3d7e8977a0a15a4a9c728fc8b7.tar.gz libayatana-appindicator-3439224475debe3d7e8977a0a15a4a9c728fc8b7.tar.bz2 libayatana-appindicator-3439224475debe3d7e8977a0a15a4a9c728fc8b7.zip |
Import upstream version 0.2.1
Diffstat (limited to 'src/application-service-appstore.c')
-rw-r--r-- | src/application-service-appstore.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/application-service-appstore.c b/src/application-service-appstore.c index 66943b5..15abea3 100644 --- a/src/application-service-appstore.c +++ b/src/application-service-appstore.c @@ -243,7 +243,21 @@ 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_ref(APP_INDICATOR_TYPE_INDICATOR_STATUS)); + g_return_val_if_fail(klass != NULL, APP_INDICATOR_STATUS_PASSIVE); + + AppIndicatorStatus retval = APP_INDICATOR_STATUS_PASSIVE; + + GEnumValue * val = g_enum_get_value_by_nick(klass, status_string); + if (val == NULL) { + g_warning("Unrecognized status '%s' assuming passive.", status_string); + } else { + retval = (AppIndicatorStatus)val->value; + } + + g_type_class_unref(klass); + + return retval; } /* A small helper function to get the position of an application |