From: shivamv Date: Fri, 4 Jun 2021 08:29:16 +0000 (+0530) Subject: Added Power Button to noti-section. X-Git-Tag: submit/tizen/20210604.103126^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fheads%2Ftizen_8.0;p=profile%2Fiot%2Fapps%2Fnative%2Fquickpanel.git Added Power Button to noti-section. Change-Id: I4756321da191a443168d9d7592dc7f26430ac47a Signed-off-by: shivamv --- diff --git a/inc/common.h b/inc/common.h index d66c2c1..46e02aa 100755 --- a/inc/common.h +++ b/inc/common.h @@ -111,6 +111,7 @@ extern char *quickpanel_common_ui_get_appinfo_icon(const char *pkgid); extern void quickpanel_common_inform_launch_app_result(const char *pkgname, int retcode); extern int quickpanel_common_send_message_to_app(const char *app_id, const char *operation, const char *key, const char *value); extern int quickpanel_common_launch_app(char *app_id, void *data); +extern void _launch_powerkey_syspopup(void); enum app_subdir { APP_DIR_DATA, diff --git a/inc/noti.h b/inc/noti.h index b6071bc..a0d69d2 100755 --- a/inc/noti.h +++ b/inc/noti.h @@ -35,6 +35,7 @@ extern void quickpanel_noti_set_clear_all_status(); extern void quickpanel_noti_on_clear_all_clicked(void *data, Evas_Object *obj, void *info); extern void quickpanel_noti_on_noti_setting_clicked(void *data, Evas_Object *obj, void *info); extern void quickpanel_setting_clicked(void *data, Evas_Object *obj, void *info); +extern void quickpanel_power_button_clicked(void* data, Evas_Object* obj, void* info); extern int quickpanel_noti_get_type_count(notification_type_e noti_type); extern void quickpanel_noti_update_by_system_time_changed_setting_cb(system_settings_key_e key, void *data); extern void quickpanel_noti_update_by_system_time_changed_vconf_cb(keynode_t *key, void *data); diff --git a/res/edje/quickpanel_noti_section.edc b/res/edje/quickpanel_noti_section.edc index 72f3a1b..6246a9e 100755 --- a/res/edje/quickpanel_noti_section.edc +++ b/res/edje/quickpanel_noti_section.edc @@ -445,6 +445,18 @@ rel2 { to_x: "rect.settings"; to_y: "base"; relative: 1.0 1.0; } } } + part { name: "power_button_swallow"; + type: SWALLOW; + scale: 1; + description { state: "default" 0.0; + min: 48 48; + max: 48 48; + fixed: 1 1; + align: 0.0 0.0; + rel1 { to_x: "voice_control_swallow"; to_y: "base"; relative: 1.0 0.0; } + rel2 { to_x: "voice_control_swallow"; to_y: "base"; relative: 1.0 1.0; } + } + } part { name: "spacer_settings"; type: SPACER; diff --git a/res/images_icon/icon_power.png b/res/images_icon/icon_power.png new file mode 100755 index 0000000..037679e Binary files /dev/null and b/res/images_icon/icon_power.png differ diff --git a/src/common.c b/src/common.c index 85e9460..04626ad 100755 --- a/src/common.c +++ b/src/common.c @@ -17,7 +17,7 @@ #include - +#include #include #include #include @@ -28,6 +28,8 @@ #include #include #include +#include +#include #include "common.h" @@ -537,6 +539,34 @@ HAPI int quickpanel_common_launch_app(char *app_id, void *data) return ret; } +HAPI void _launch_powerkey_syspopup(void) +{ + + int ret; + bundle* b_handle = NULL; + + DBG(""); + + char* syspopup_content_key = "_SYSPOPUP_CONTENT_"; + char* syspopup_content_value = "powerkey"; + char* syspopup_name = "powerkey-syspopup"; + + b_handle = bundle_create(); + if (b_handle == NULL) + return; + + + bundle_add(b_handle, syspopup_content_key, syspopup_content_value); + ret = syspopup_launch(syspopup_name, b_handle); + if (ret < 0) { + ERR("failed to launch powerkey syspopup (%s):%d\n", "powerkey-syspopup", ret); + bundle_free(b_handle); + return; + } + bundle_free(b_handle); + INFO("%s-%s-%s", syspopup_content_key, syspopup_content_value, syspopup_name); +} + const char *util_get_file_path(enum app_subdir dir, const char *relative) { static char buf[PATH_MAX]; diff --git a/src/notifications/noti.c b/src/notifications/noti.c index 4a951ad..13a0f55 100755 --- a/src/notifications/noti.c +++ b/src/notifications/noti.c @@ -1184,6 +1184,16 @@ HAPI void quickpanel_setting_clicked(void *data, Evas_Object *obj, void *info) quickpanel_uic_close_quickpanel(true, 1); } +HAPI void quickpanel_power_button_clicked(void* data, Evas_Object* obj, void* info) +{ + DBG("Power Button clicked"); + + quickpanel_media_play_feedback(); + + _launch_powerkey_syspopup(); + +} + HAPI void quickpanel_noti_on_noti_setting_clicked(void *data, Evas_Object *obj, void *info) { DBG("Noti Setting clicked"); diff --git a/src/notifications/noti_section.c b/src/notifications/noti_section.c index d45c026..4b8e125 100755 --- a/src/notifications/noti_section.c +++ b/src/notifications/noti_section.c @@ -196,12 +196,30 @@ HAPI void quickpanel_noti_section_create(Evas_Object *parent) elm_image_file_set(icon, buffer, NULL); evas_object_size_hint_min_set(icon, ELM_SCALE_SIZE(40), ELM_SCALE_SIZE(40)); evas_object_size_hint_max_set(icon, ELM_SCALE_SIZE(40), ELM_SCALE_SIZE(40)); - evas_object_size_hint_align_set(icon, 1.0, 0.5); + evas_object_size_hint_align_set(icon, 0.5, 0.5); elm_object_part_content_set(vc_button, "icon", icon); elm_object_part_content_set(section, "voice_control_swallow", vc_button); evas_object_show(vc_button); + + Evas_Object* power_button = elm_button_add(section); + elm_object_style_set(power_button, "focus"); + evas_object_size_hint_weight_set(power_button, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + + snprintf(buffer, 1024, "%s%s%s", path, "images_icon/", "icon_power.png"); + Evas_Object* power_icon = elm_image_add(power_button); + elm_image_file_set(power_icon, buffer, NULL); + evas_object_size_hint_min_set(power_icon, ELM_SCALE_SIZE(40), ELM_SCALE_SIZE(40)); + evas_object_size_hint_max_set(power_icon, ELM_SCALE_SIZE(40), ELM_SCALE_SIZE(40)); + evas_object_size_hint_align_set(power_icon, 1.0, 0.5); + + elm_object_part_content_set(power_button, "icon", power_icon); + + elm_object_part_content_set(section, "power_button_swallow", power_button); + evas_object_smart_callback_add(power_button, "clicked", quickpanel_power_button_clicked, NULL); + evas_object_show(power_button); + free(path);