summaryrefslogtreecommitdiff
path: root/src/util/util.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/util/util.c')
-rw-r--r--src/util/util.c47
1 files changed, 47 insertions, 0 deletions
diff --git a/src/util/util.c b/src/util/util.c
index 3e9c86d..c698a3d 100644
--- a/src/util/util.c
+++ b/src/util/util.c
@@ -16,6 +16,7 @@
#include <stdbool.h>
#include <Elementary.h>
+#include <app_control.h>
#include <app_debug.h>
#include <app_contents.h>
@@ -33,6 +34,52 @@ bool util_check_movie_type(const char *str)
return strcmp(str, VIDEO_COPYRIGHT);
}
+bool util_launch_request(const char *appid, const char *key, const char *value)
+{
+ app_control_h app_ctrl;
+ int r;
+
+ r = app_control_create(&app_ctrl);
+ if (r != APP_CONTROL_ERROR_NONE) {
+ _ERR("failed to create app control handle");
+ return false;
+ }
+
+ r = app_control_set_operation(app_ctrl, APP_CONTROL_OPERATION_DEFAULT);
+ if (r != APP_CONTROL_ERROR_NONE) {
+ _ERR("failed to set app control operation");
+ app_control_destroy(app_ctrl);
+ return false;
+ }
+
+ if (key && value) {
+ r = app_control_add_extra_data(app_ctrl, key, value);
+ if (r != APP_CONTROL_ERROR_NONE) {
+ _ERR("failed to add extra data");
+ app_control_destroy(app_ctrl);
+ return false;
+ }
+ }
+
+ r = app_control_set_app_id(app_ctrl, appid);
+ if (r != APP_CONTROL_ERROR_NONE) {
+ _ERR("failed to set app control app id");
+ app_control_destroy(app_ctrl);
+ return false;
+ }
+
+ r = app_control_send_launch_request(app_ctrl, NULL, NULL);
+ if (r != APP_CONTROL_ERROR_NONE) {
+ _ERR("failed to send app control launch request");
+ app_control_destroy(app_ctrl);
+ return false;
+ }
+
+ app_control_destroy(app_ctrl);
+
+ return true;
+}
+
Evas_Object *util_add_button(Evas_Object *base, const char *style,
const char *text)
{