const char error_not_found[] = "\"not found\"";
const char error_cant_start[] = "\"can't start\"";
-static void on_install(struct jreq *jreq, struct json_object *req)
+static void on_install(struct jreq *jreq, struct json_object *req, void *unused)
{
const char *wgtfile;
const char *root;
resp = json_object_new_object();
if(!resp || !j_add_string(resp, "added", wgt_info_desc(ifo)->idaver))
jbus_reply_error_s(jreq, "\"out of memory but installed!\"");
- else
+ else {
+ jbus_send_signal_s(jbus, "changed", "true");
jbus_reply_j(jreq, resp);
+ }
/* clean-up */
wgt_info_unref(ifo);
json_object_put(resp);
}
-
- /* still sends the signal */
- jbus_send_signal_s(jbus, "changed", "true");
}
-static void on_uninstall(struct jreq *jreq, struct json_object *req)
+static void on_uninstall(struct jreq *jreq, struct json_object *req, void *unused)
{
const char *idaver;
const char *root;
rc = uninstall_widget(idaver, root);
if (rc)
jbus_reply_error_s(jreq, "\"uninstallation had error\"");
- else
+ else {
+ jbus_send_signal_s(jbus, "changed", "true");
jbus_reply_s(jreq, "true");
-
- /* still sends the signal */
- jbus_send_signal_s(jbus, "changed", "true");
+ }
}
static int daemonize()
}
/* init service */
- jbus = create_jbus(0, AFM_SYSTEM_DBUS_PATH);
+ jbus = create_jbus_system(AFM_SYSTEM_DBUS_PATH);
if (!jbus) {
ERROR("create_jbus failed");
return 1;
}
- if(jbus_add_service_j(jbus, "install", on_install)
- || jbus_add_service_j(jbus, "uninstall", on_uninstall)) {
+ if(jbus_add_service_j(jbus, "install", on_install, NULL)
+ || jbus_add_service_j(jbus, "uninstall", on_uninstall, NULL)) {
ERROR("adding services failed");
return 1;
}