diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/application-service-appstore.c | 43 | ||||
-rw-r--r-- | src/dbus-shared.h | 2 | ||||
-rw-r--r-- | src/gen-notification-approver.xml.c | 2 | ||||
-rw-r--r-- | src/notification-approver.xml | 2 |
4 files changed, 34 insertions, 15 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 diff --git a/src/dbus-shared.h b/src/dbus-shared.h index 71c063e..6144b9b 100644 --- a/src/dbus-shared.h +++ b/src/dbus-shared.h @@ -31,5 +31,5 @@ with this program. If not, see <http://www.gnu.org/licenses/>. #define NOTIFICATION_ITEM_DBUS_IFACE "org.kde.StatusNotifierItem" #define NOTIFICATION_ITEM_DEFAULT_OBJ "/StatusNotifierItem" -#define NOTIFICATION_APPROVER_DBUS_IFACE "org.ayatana.StatusNotifierApprover" +#define NOTIFICATION_APPROVER_DBUS_IFACE "com.canonical.StatusNotifierApprover" diff --git a/src/gen-notification-approver.xml.c b/src/gen-notification-approver.xml.c index 0844b94..3cd36cf 100644 --- a/src/gen-notification-approver.xml.c +++ b/src/gen-notification-approver.xml.c @@ -1,7 +1,7 @@ const char * _notification_approver = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" "<node name=\"/\">\n" -" <interface name=\"org.ayatana.StatusNotifierApprover\">\n" +" <interface name=\"com.canonical.StatusNotifierApprover\">\n" "\n" "<!-- Methods -->\n" " <method name=\"ApproveItem\">\n" diff --git a/src/notification-approver.xml b/src/notification-approver.xml index 4a8e39b..a72ca92 100644 --- a/src/notification-approver.xml +++ b/src/notification-approver.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <node name="/"> - <interface name="org.ayatana.StatusNotifierApprover"> + <interface name="com.canonical.StatusNotifierApprover"> <!-- Methods --> <method name="ApproveItem"> |