Launch Home app. when press Super_L 43/49143/1 accepted/tizen/tv/20151007.081620 submit/tizen/20151007.073635
authorjinwoo.shin <jw0227.shin@samsung.com>
Wed, 7 Oct 2015 07:05:54 +0000 (16:05 +0900)
committerjinwoo.shin <jw0227.shin@samsung.com>
Wed, 7 Oct 2015 07:05:54 +0000 (16:05 +0900)
Change-Id: I0acaafb8ac1957d53efb3dfac975cfca332e1deb
Signed-off-by: jinwoo.shin <jw0227.shin@samsung.com>
include/util.h
src/main.c
src/util.c

index 805aec0..66ed9c0 100644 (file)
@@ -30,5 +30,6 @@ Evas_Object *util_add_button(Evas_Object *parent, const char *part,
 Evas_Object *util_add_toast(Evas_Object *parent, char *text);
 void util_draw_channel_info(Evas_Object *obj,
                const struct tv_channel_info *channel_info);
+void util_launch_home(void);
 
 #endif
index 160a63d..95985bf 100644 (file)
@@ -122,6 +122,12 @@ static Eina_Bool _event(void *data, Evas_Object *obj, Evas_Object *src,
                }
        }
 
+       if (type == EVAS_CALLBACK_KEY_DOWN &&
+                       !strcmp(keyname, KEY_SUPER_L)) {
+               util_launch_home();
+               return EINA_TRUE;
+       }
+
        return EINA_FALSE;
 }
 
index 888fc02..979231a 100644 (file)
  * limitations under the License.
  */
 
+#include <app.h>
 #include <Elementary.h>
 #include <app_debug.h>
+#include <app_define.h>
 #include <viewmgr.h>
 
 #include "define.h"
@@ -364,3 +366,39 @@ void util_draw_channel_info(Evas_Object *obj,
                                UPDATE_TYPE_TIMER, &op);
        }
 }
+
+void util_launch_home(void)
+{
+       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;
+       }
+
+       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;
+       }
+
+       r = app_control_set_app_id(app_ctrl, APP_ID_HOME);
+       if (r != APP_CONTROL_ERROR_NONE) {
+               _ERR("failed to set app control app id");
+               app_control_destroy(app_ctrl);
+               return;
+       }
+
+       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;
+       }
+
+       app_control_destroy(app_ctrl);
+}
+