aboutsummaryrefslogtreecommitdiff
path: root/src/application-service-appstore.c
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2011-01-27 15:58:14 -0600
committerTed Gould <ted@gould.cx>2011-01-27 15:58:14 -0600
commit2c6ef4e38e32386cc19bb8e1eb094378ef1c58f1 (patch)
tree87a0ee95a7f19b4925491a83e1f2d4b1e9ce6687 /src/application-service-appstore.c
parent9dee1e2decb74007676089f5d86fde138d1aac9e (diff)
parent82c80cd622d65cdce1c1eef15a71baf8a3530f7f (diff)
downloadayatana-indicator-application-2c6ef4e38e32386cc19bb8e1eb094378ef1c58f1.tar.gz
ayatana-indicator-application-2c6ef4e38e32386cc19bb8e1eb094378ef1c58f1.tar.bz2
ayatana-indicator-application-2c6ef4e38e32386cc19bb8e1eb094378ef1c58f1.zip
Import upstream version 0.2.92
Diffstat (limited to 'src/application-service-appstore.c')
-rw-r--r--src/application-service-appstore.c43
1 files changed, 31 insertions, 12 deletions
diff --git a/src/application-service-appstore.c b/src/application-service-appstore.c
index 481d886..dd94561 100644
--- a/src/application-service-appstore.c
+++ b/src/application-service-appstore.c
@@ -1156,24 +1156,43 @@ static GVariant *
get_applications (ApplicationServiceAppstore * appstore)
{
ApplicationServiceAppstorePrivate * priv = appstore->priv;
+ GVariant * out = NULL;
- GVariantBuilder * builder = g_variant_builder_new (G_VARIANT_TYPE_ARRAY);
- GList * listpntr;
- gint position = 0;
+ if (g_list_length(priv->applications) > 0) {
+ GVariantBuilder builder;
+ GList * listpntr;
+ gint position = 0;
- for (listpntr = priv->applications; listpntr != NULL; listpntr = g_list_next(listpntr)) {
- Application * app = (Application *)listpntr->data;
- if (app->visible_state == VISIBLE_STATE_HIDDEN) {
- continue;
+ g_variant_builder_init(&builder, G_VARIANT_TYPE_ARRAY);
+
+ for (listpntr = priv->applications; listpntr != NULL; listpntr = g_list_next(listpntr)) {
+ Application * app = (Application *)listpntr->data;
+ if (app->visible_state == VISIBLE_STATE_HIDDEN) {
+ continue;
+ }
+
+ g_variant_builder_add (&builder, "(sisosss)", app->icon,
+ position++, app->dbus_name, app->menu,
+ app->icon_theme_path, app->label,
+ app->guide);
}
- g_variant_builder_add (builder, "(sisosss)", app->icon,
- position++, app->dbus_name, app->menu,
- app->icon_theme_path, app->label,
- app->guide);
+ out = g_variant_builder_end(&builder);
+ } else {
+ GError * error = NULL;
+ out = g_variant_parse(g_variant_type_new("a(sisosss)"), "[]", NULL, NULL, &error);
+ if (error != NULL) {
+ g_warning("Unable to parse '[]' as a 'a(sisosss)': %s", error->message);
+ out = NULL;
+ g_error_free(error);
+ }
}
- return g_variant_new("(a(sisosss))", builder);
+ if (out != NULL) {
+ return g_variant_new_tuple(&out, 1);
+ } else {
+ return NULL;
+ }
}
/* Removes and approver from our list of approvers and