diff options
Diffstat (limited to 'src')
-rwxr-xr-x | src/common.c | 32 | ||||
-rwxr-xr-x | src/notifications/noti.c | 10 | ||||
-rwxr-xr-x | src/notifications/noti_section.c | 20 |
3 files changed, 60 insertions, 2 deletions
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); |