diff options
author | shivamv <shivam.v2@samsung.com> | 2021-06-04 13:59:16 +0530 |
---|---|---|
committer | shivamv <shivam.v2@samsung.com> | 2021-06-04 13:59:16 +0530 |
commit | 0e1523390e93df5f95c8eeea8331096d56113e59 (patch) | |
tree | 93c5e1e6f976b18fbf9b101010db295c5e5607b5 | |
parent | 1978d7d51b65b7a9d308aa3614206fb11184a1c5 (diff) | |
download | quickpanel-tizen.tar.gz quickpanel-tizen.tar.bz2 quickpanel-tizen.zip |
Added Power Button to noti-section.tizen_8.0_m2_releasetizen_7.0_src.m2_releasetizen_6.5_src.m2_releasesubmit/tizen_6.5/20211029.123901submit/tizen_6.5/20211028.164201submit/tizen/20220811.051502submit/tizen/20220805.081005submit/tizen/20220805.020745submit/tizen/20210604.103126tizen_8.0tizen_7.0_hotfixtizen_7.0tizen_6.5tizen
Change-Id: I4756321da191a443168d9d7592dc7f26430ac47a
Signed-off-by: shivamv <shivam.v2@samsung.com>
-rwxr-xr-x | inc/common.h | 1 | ||||
-rwxr-xr-x | inc/noti.h | 1 | ||||
-rwxr-xr-x | res/edje/quickpanel_noti_section.edc | 12 | ||||
-rwxr-xr-x | res/images_icon/icon_power.png | bin | 0 -> 630 bytes | |||
-rwxr-xr-x | src/common.c | 32 | ||||
-rwxr-xr-x | src/notifications/noti.c | 10 | ||||
-rwxr-xr-x | src/notifications/noti_section.c | 20 |
7 files changed, 74 insertions, 2 deletions
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, @@ -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 Binary files differnew file mode 100755 index 0000000..037679e --- /dev/null +++ b/res/images_icon/icon_power.png 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 <sys/stat.h> - +#include<app.h> #include <Elementary.h> #include <app_manager.h> #include <package_manager.h> @@ -28,6 +28,8 @@ #include <app_control_internal.h> #include <bundle_internal.h> #include <notification.h> +#include <bundle_internal.h> +#include <syspopup_caller.h> #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); |