X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=src%2Fafm-system-daemon.c;h=ab87c97cf3f84320f6bf263788919082bfee082c;hb=50dd441a11440201e1da9da81a7103677e2282ad;hp=f02ff3dc21bdaf5effa0cbd636867ecdc0510f43;hpb=bb15844347ed0d53a795d24dce7035ab27df4e53;p=src%2Fapp-framework-main.git diff --git a/src/afm-system-daemon.c b/src/afm-system-daemon.c index f02ff3d..ab87c97 100644 --- a/src/afm-system-daemon.c +++ b/src/afm-system-daemon.c @@ -31,6 +31,7 @@ #include "afm-db.h" #include "wgt-info.h" #include "wgtpkg-install.h" +#include "wgtpkg-uninstall.h" static const char appname[] = "afm-system-daemon"; static const char *rootdir = NULL; @@ -117,7 +118,34 @@ static void on_install(struct jreq *jreq, struct json_object *req) static void on_uninstall(struct jreq *jreq, struct json_object *req) { - jbus_reply_error_s(jreq, "\"not yet implemented\""); + const char *idaver; + const char *root; + int rc; + + /* scan the request */ + switch (json_object_get_type(req)) { + case json_type_string: + idaver = json_object_get_string(req); + root = rootdir; + break; + case json_type_object: + idaver = j_get_string(req, "id", NULL); + if (idaver != NULL) { + root = j_get_string(req, "root", rootdir); + break; + } + default: + jbus_reply_error_s(jreq, error_bad_request); + return; + } + + /* install the widget */ + rc = uninstall_widget(idaver, root); + if (rc) { + jbus_reply_error_s(jreq, "\"uninstallation had error\""); + return; + } + jbus_reply_s(jreq, "true"); } static int daemonize()