extern const int LB_SYS_EVENT_PAUSED;
extern const int LB_SYS_EVENT_RESUMED;
+#define LB_DESC_TYPE_TEXT "text"
+#define LB_DESC_TYPE_IMAGE "image"
+#define LB_DESC_TYPE_SIGNAL "signal"
+#define LB_DESC_TYPE_INFO "info"
+#define LB_DESC_TYPE_DRAG "drag"
+#define LB_DESC_TYPE_SCRIPT "script"
+
/*!
* \brief
* Extra event informatino for livebox_content_event interface function
extern int livebox_desc_set_size(struct livebox_desc *handle, const char *id, int w, int h);
/*!
- * \brief Add a new block
+ * \breif Set the target id of given block
+ * Only available for the script block
* \param[in] handle
+ * \param[in] idx
* \param[in] id
+ * \return ret
+ */
+extern int livebox_desc_set_id(struct livebox_desc *handle, int idx, const char *id);
+
+/*!
+ * \brief Add a new block
+ * \param[in] handle
+ * \param[in] id ID of source script object
* \param[in] type image|text|script|signal|...
* \param[in] part target part to update with given content(data)
* \param[in] data content for specified part
#include <dlog.h>
#include <livebox-service.h>
+#include <provider.h>
#include <provider_buffer.h>
#include "debug.h"
char *group;
char *id;
char *file;
+ char *target_id;
};
struct livebox_desc {
DbgPrint("id=%s\n", block->id);
}
+ if (block->target_id) {
+ fprintf(handle->fp, "target=%s\n", block->target_id);
+ DbgPrint("target=%s\n", block->target_id);
+ }
+
fprintf(handle->fp, "}\n");
DbgPrint("}\n");
free(block->data);
free(block->group);
free(block->id);
+ free(block->target_id);
free(block);
}
if (!block)
return -ENOMEM;
- block->type = strdup("info");
+ block->type = strdup(LB_DESC_TYPE_INFO);
if (!block->type) {
free(block);
return -ENOMEM;
if (!block)
return -ENOMEM;
- block->type = strdup("info");
+ block->type = strdup(LB_DESC_TYPE_INFO);
if (!block->type) {
free(block);
return -ENOMEM;
return ret;
}
+EAPI int livebox_desc_set_id(struct livebox_desc *handle, int idx, const char *id)
+{
+ struct dlist *l;
+ struct block *block;
+
+ dlist_foreach(handle->block_list, l, block) {
+ if (block->idx == idx) {
+ if (strcasecmp(block->type, LB_DESC_TYPE_SCRIPT)) {
+ ErrPrint("Invalid block is used\n");
+ return -EINVAL;
+ }
+
+ free(block->target_id);
+ block->target_id = NULL;
+
+ if (!id || !strlen(id))
+ return 0;
+
+ block->target_id = strdup(id);
+ if (!block->target_id) {
+ ErrPrint("Heap: %s\n", strerror(errno));
+ return -ENOMEM;
+ }
+
+ return 0;
+ }
+ }
+
+ return -ENOENT;
+}
+
/*!
* \return idx
*/
free(block->data);
free(block->group);
free(block->id);
+ free(block->target_id);
free(block);
return 0;
}