From acff875a4508b02177c3fec60cc47a0a6589cd81 Mon Sep 17 00:00:00 2001 From: "changjoo.lee" Date: Fri, 13 May 2016 14:42:25 +0900 Subject: [PATCH] Added unmount popup and removed useless source Change-Id: I379e7dd69a33cc40730974ac53b1cf4180ccdae4 Signed-off-by: changjoo.lee --- packaging/org.tizen.poweroff-syspopup.manifest | 5 - src/mmc/mmc-mobile.c | 59 +++++++++ src/po/en.po | 11 +- src/po/en_PH.po | 11 +- src/po/en_US.po | 11 +- src/poweroff/CMakeLists.txt | 68 ---------- src/poweroff/org.tizen.poweroff-syspopup.xml | 12 -- src/poweroff/poweroff.c | 166 ------------------------- 8 files changed, 89 insertions(+), 254 deletions(-) delete mode 100644 packaging/org.tizen.poweroff-syspopup.manifest delete mode 100755 src/poweroff/CMakeLists.txt delete mode 100755 src/poweroff/org.tizen.poweroff-syspopup.xml delete mode 100755 src/poweroff/poweroff.c diff --git a/packaging/org.tizen.poweroff-syspopup.manifest b/packaging/org.tizen.poweroff-syspopup.manifest deleted file mode 100644 index 75b0fa5..0000000 --- a/packaging/org.tizen.poweroff-syspopup.manifest +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/src/mmc/mmc-mobile.c b/src/mmc/mmc-mobile.c index e167748..fd9ee3b 100755 --- a/src/mmc/mmc-mobile.c +++ b/src/mmc/mmc-mobile.c @@ -30,6 +30,7 @@ #define DD_SIGNAL_REMOVE_MMC "RemoveMmc" static const struct popup_ops mount_error_ops; +static const struct popup_ops unmount_error_ops; static const struct popup_ops mount_read_only_ops; static const struct popup_ops check_smack_ops; static const struct popup_ops ode_encrypt_ops; @@ -40,6 +41,9 @@ static void remove_other_mmc_popups(const struct popup_ops *ops) if (ops != &mount_error_ops) unload_simple_popup(&mount_error_ops); + if (ops != &unmount_error_ops) + unload_simple_popup(&unmount_error_ops); + if (ops != &mount_read_only_ops) unload_simple_popup(&mount_read_only_ops); @@ -71,6 +75,16 @@ static bool mmc_mounted(void) return true; } +static bool mmc_unmounted(void) +{ + int val; + + if (vconf_get_int(VCONFKEY_SYSMAN_MMC_UNMOUNT, &val) == 0 + && val == VCONFKEY_SYSMAN_MMC_UNMOUNT_FAILED) + return false; + return true; +} + static void send_mount_signal(char *signal) { int ret; @@ -133,6 +147,11 @@ static bool skip_mount_error_popup(bundle *b, const struct popup_ops *ops) return mmc_mounted(); } +static bool skip_unmount_error_popup(bundle *b, const struct popup_ops *ops) +{ + return mmc_unmounted(); +} + static bool skip_ode_popup(bundle *b, const struct popup_ops *ops) { return !mmc_inserted(); @@ -184,6 +203,17 @@ static void mmc_mount_status_changed(keynode_t *in_key, void *data) terminate_if_no_popup(); } +static void mmc_unmount_status_changed(keynode_t *in_key, void *data) +{ + const struct popup_ops *ops = data; + + if (vconf_keynode_get_int(in_key) == VCONFKEY_SYSMAN_MMC_UNMOUNT_FAILED) + return; + + unload_simple_popup(ops); + terminate_if_no_popup(); +} + static void register_mmc_mount_handler(const struct popup_ops *ops) { if (vconf_notify_key_changed(VCONFKEY_SYSMAN_MMC_MOUNT, @@ -197,6 +227,19 @@ static void unregister_mmc_mount_handler(const struct popup_ops *ops) mmc_mount_status_changed); } +static void register_mmc_unmount_handler(const struct popup_ops *ops) +{ + if (vconf_notify_key_changed(VCONFKEY_SYSMAN_MMC_UNMOUNT, + mmc_unmount_status_changed, (void *)ops) != 0) + _E("Failed to register mmc mount handler"); +} + +static void unregister_mmc_unmount_handler(const struct popup_ops *ops) +{ + vconf_ignore_key_changed(VCONFKEY_SYSMAN_MMC_UNMOUNT, + mmc_unmount_status_changed); +} + static int launch_mmc_popup(bundle *b, const struct popup_ops *ops) { remove_other_mmc_popups(ops); @@ -205,6 +248,9 @@ static int launch_mmc_popup(bundle *b, const struct popup_ops *ops) if (ops == &mount_error_ops) register_mmc_mount_handler(ops); + if (ops == &unmount_error_ops) + register_mmc_unmount_handler(ops); + if (ops == &ode_encrypt_ops || ops == &ode_decrypt_ops) register_ode_handler(ops); @@ -215,18 +261,30 @@ static int launch_mmc_popup(bundle *b, const struct popup_ops *ops) static void terminate_mmc_popup(const struct popup_ops *ops) { unregister_mmc_mount_handler(ops); + unregister_mmc_unmount_handler(ops); unregister_ode_handler(ops); } static const struct popup_ops mount_error_ops = { .name = "mounterr",//"mmc_mount_error", .show = load_simple_popup, + .title = "IDS_DN_BODY_UNABLETO_MOUNT_SD_CARD", .content = "IDS_DN_POP_FAILED_TO_MOUNT_SD_CARD_REINSERT_OR_FORMAT_SD_CARD", .left_text = "IDS_COM_SK_OK", .skip = skip_mount_error_popup, .pre = launch_mmc_popup, }; +static const struct popup_ops unmount_error_ops = { + .name = "unmounterr",//"mmc_unmount_error", + .show = load_simple_popup, + .title = "IDS_DN_BODY_UNABLETO_UNMOUNT_SD_CARD", + .content = "IDS_DN_POP_FAILED_TO_UNMOUNT_SD_CARD_REINSERT_OR_TRY_LATER", + .left_text = "IDS_COM_SK_OK", + .skip = skip_unmount_error_popup, + .pre = launch_mmc_popup, +}; + static const struct popup_ops mount_read_only_ops = { .name = "mountrdonly",//"mmc_mount_read_only", .show = load_simple_popup, @@ -275,6 +333,7 @@ static const struct popup_ops ode_decrypt_ops = { static __attribute__ ((constructor)) void register_mmc_popup(void) { register_popup(&mount_error_ops); + register_popup(&unmount_error_ops); register_popup(&mount_read_only_ops); register_popup(&check_smack_ops); register_popup(&ode_encrypt_ops); diff --git a/src/po/en.po b/src/po/en.po index 21e1dcd..7d6b80b 100755 --- a/src/po/en.po +++ b/src/po/en.po @@ -98,7 +98,10 @@ msgid "IDS_DN_POP_ENCRYPTING_SD_CARD_ING" msgstr "Encrypting SD card..." msgid "IDS_DN_POP_FAILED_TO_MOUNT_SD_CARD_REINSERT_OR_FORMAT_SD_CARD" -msgstr "Failed to mount SD card. Reinsert or format SD card." +msgstr "Remove and reinsert or format your SD card. And then try again." + +msgid "IDS_DN_POP_FAILED_TO_UNMOUNT_SD_CARD_REINSERT_OR_TRY_LATER" +msgstr "SD card may be in use. Please try it again later." msgid "IDS_HS_BUTTON_POWER_OFF_ABB2" msgstr "Power off" @@ -252,3 +255,9 @@ msgstr "Restart" msgid "IDS_ST_POP_DEVICE_WILL_RESTART" msgstr "Device will restart." + +msgid "IDS_DN_BODY_UNABLETO_MOUNT_SD_CARD" +msgstr "Unable to mount SD card" + +msgid "IDS_DN_BODY_UNABLETO_UNMOUNT_SD_CARD" +msgstr "Unable to unmount SD card" \ No newline at end of file diff --git a/src/po/en_PH.po b/src/po/en_PH.po index dca55db..a3b4b08 100755 --- a/src/po/en_PH.po +++ b/src/po/en_PH.po @@ -98,7 +98,10 @@ msgid "IDS_DN_POP_ENCRYPTING_SD_CARD_ING" msgstr "Encrypting SD card..." msgid "IDS_DN_POP_FAILED_TO_MOUNT_SD_CARD_REINSERT_OR_FORMAT_SD_CARD" -msgstr "Failed to mount SD card. Reinsert or format SD card." +msgstr "Remove and reinsert or format your SD card. And then try again." + +msgid "IDS_DN_POP_FAILED_TO_UNMOUNT_SD_CARD_REINSERT_OR_TRY_LATER" +msgstr "SD card may be in use. Please try it again later." msgid "IDS_HS_BUTTON_POWER_OFF_ABB2" msgstr "Power off" @@ -252,3 +255,9 @@ msgstr "Restart" msgid "IDS_ST_POP_DEVICE_WILL_RESTART" msgstr "Device will restart." + +msgid "IDS_DN_BODY_UNABLETO_MOUNT_SD_CARD" +msgstr "Unable to mount SD card" + +msgid "IDS_DN_BODY_UNABLETO_UNMOUNT_SD_CARD" +msgstr "Unable to unmount SD card" \ No newline at end of file diff --git a/src/po/en_US.po b/src/po/en_US.po index a6343ac..36f56dd 100755 --- a/src/po/en_US.po +++ b/src/po/en_US.po @@ -98,7 +98,10 @@ msgid "IDS_DN_POP_ENCRYPTING_SD_CARD_ING" msgstr "Encrypting SD card..." msgid "IDS_DN_POP_FAILED_TO_MOUNT_SD_CARD_REINSERT_OR_FORMAT_SD_CARD" -msgstr "Failed to mount SD card. Reinsert or format SD card." +msgstr "Remove and reinsert or format your SD card. And then try again." + +msgid "IDS_DN_POP_FAILED_TO_UNMOUNT_SD_CARD_REINSERT_OR_TRY_LATER" +msgstr "SD card may be in use. Please try it again later." msgid "IDS_HS_BUTTON_POWER_OFF_ABB2" msgstr "Power off" @@ -252,3 +255,9 @@ msgstr "Restart" msgid "IDS_ST_POP_DEVICE_WILL_RESTART" msgstr "Device will restart." + +msgid "IDS_DN_BODY_UNABLETO_MOUNT_SD_CARD" +msgstr "Unable to mount SD card" + +msgid "IDS_DN_BODY_UNABLETO_UNMOUNT_SD_CARD" +msgstr "Unable to unmount SD card" \ No newline at end of file diff --git a/src/poweroff/CMakeLists.txt b/src/poweroff/CMakeLists.txt deleted file mode 100755 index 12b9aa8..0000000 --- a/src/poweroff/CMakeLists.txt +++ /dev/null @@ -1,68 +0,0 @@ -CMAKE_MINIMUM_REQUIRED(VERSION 2.6) - -IF("${POWEROFF_POPUP}" STREQUAL "off") - RETURN() -ENDIF("${POWEROFF_POPUP}" STREQUAL "off") - -SET(POWEROFF_SRCS ${COMMON_SRCS} poweroff.c) - -INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}) -INCLUDE_DIRECTORIES(${COMMON_DIR}) - -SET(VENDOR "tizen") -SET(PACKAGE "poweroff-syspopup") -SET(EXECNAME "poweroff-popup") -SET(PKGNAME "org.${VENDOR}.${PACKAGE}") -SET(POWEROFF_PREFIX "${TZ_SYS_RO_APP}/${PKGNAME}") -SET(BINDIR "${POWEROFF_PREFIX}/bin") -SET(RESDIR "${POWEROFF_PREFIX}/res") -SET(MANIFESTDIR "${TZ_SYS_RO_SHARE}/packages") - -SET(PKG_MODULES - appcore-efl - elementary - dlog - deviced - evas - ecore - edbus - glib-2.0 - vconf - syspopup - syspopup-caller - feedback - efl-extension -) - -IF("${DPMS}" STREQUAL "x") -SET(PKG_MODULES ${PKG_MODULES} - ecore-x - utilX -) -ENDIF("${DPMS}" STREQUAL "x") - -INCLUDE(FindPkgConfig) -pkg_check_modules(poweroff_pkgs REQUIRED ${PKG_MODULES}) - -FOREACH(flag ${poweroff_pkgs_CFLAGS}) - SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}") -ENDFOREACH(flag) - -SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -O2 -g -Wall -fpie") -SET(CMAKE_C_FLAGS_DEBUG "-O0 -g -fpie") -SET(CMAKE_C_FLAGS_RELEASE "-O2 -fpie") - -ADD_DEFINITIONS("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"") -ADD_DEFINITIONS("-DPACKAGE=\"${PACKAGE}\"") -ADD_DEFINITIONS("-DRESDIR=\"${RESDIR}\"") - -SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -pie") - -ADD_EXECUTABLE(${EXECNAME} ${POWEROFF_SRCS}) -TARGET_LINK_LIBRARIES(${EXECNAME} ${poweroff_pkgs_LDFLAGS}) - -INSTALL(TARGETS ${EXECNAME} DESTINATION ${TZ_SYS_RO_APP}/${PKGNAME}/bin) -INSTALL(FILES ${CMAKE_SOURCE_DIR}/src/poweroff/${PKGNAME}.xml DESTINATION ${MANIFESTDIR}) - -INSTALL(FILES ${CMAKE_SOURCE_DIR}/circle_btn_check.png DESTINATION ${RESDIR}) -INSTALL(FILES ${CMAKE_SOURCE_DIR}/circle_btn_delete.png DESTINATION ${RESDIR}) diff --git a/src/poweroff/org.tizen.poweroff-syspopup.xml b/src/poweroff/org.tizen.poweroff-syspopup.xml deleted file mode 100755 index a10e188..0000000 --- a/src/poweroff/org.tizen.poweroff-syspopup.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - Taeyoung Kim - System popup application (power off system popup) - - - - - http://tizen.org/privilege/power - - diff --git a/src/poweroff/poweroff.c b/src/poweroff/poweroff.c deleted file mode 100755 index cba5971..0000000 --- a/src/poweroff/poweroff.c +++ /dev/null @@ -1,166 +0,0 @@ -/* - * system-popup - * - * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * -*/ - -#include "popup-common.h" - -#define SYSTEMD_STOP_POWER_OFF 4 - -#define POWER_BUS_NAME "org.tizen.system.deviced" -#define POWER_OBJECT_PATH "/Org/Tizen/System/DeviceD/Power" -#define POWER_INTERFACE_NAME POWER_BUS_NAME".power" - -#define POWER_METHOD "reboot" -#define POWER_OPERATION_OFF "poweroff" - -static void remove_popup(const struct popup_ops *ops); -static void pm_state_changed(keynode_t *key, void *data); -static void event_back_key_up(void *data, Evas_Object *obj, void *event_info); -static void register_handlers(const struct popup_ops *ops); -static void unregister_handlers(const struct popup_ops *ops); -static int poweroff_launch(bundle *b, const struct popup_ops *ops); -static void poweroff_terminate(const struct popup_ops *ops); -static void poweroff_clicked(const struct popup_ops *ops); -static __attribute__ ((constructor)) void poweroff_register_popup(void); - -static void remove_popup(const struct popup_ops *ops) -{ - static bool terminating = false; - - if (terminating) - return; - - terminating = true; - - unload_simple_popup(ops); - popup_terminate(); -} - -static void pm_state_changed(keynode_t *key, void *data) -{ - const struct popup_ops *ops = data; - - if (!key) - return; - - if (vconf_keynode_get_int(key) != VCONFKEY_PM_STATE_LCDOFF) - return; - - remove_popup(ops); -} - -static void event_back_key_up(void *data, Evas_Object *obj, void *event_info) -{ - const struct popup_ops *ops = data; - remove_popup(ops); -} - -static void register_handlers(const struct popup_ops *ops) -{ - Evas_Object *win; - - if (vconf_notify_key_changed( - VCONFKEY_PM_STATE, - pm_state_changed, - (void *)ops) != 0) - _E("Failed to register vconf"); - - win = get_window(); - if (win) - eext_object_event_callback_add(win, EEXT_CALLBACK_BACK, event_back_key_up, (void*)ops); -} - -static void unregister_handlers(const struct popup_ops *ops) -{ - Evas_Object *win; - - vconf_ignore_key_changed(VCONFKEY_PM_STATE, pm_state_changed); - - win = get_window(); - if (win) - eext_object_event_callback_del(win, EEXT_CALLBACK_BACK, event_back_key_up); -} - -static int poweroff_launch(bundle *b, const struct popup_ops *ops) -{ - register_handlers(ops); - return 0; -} - -static void poweroff_terminate(const struct popup_ops *ops) -{ - unregister_handlers(ops); -} - -static void poweroff_clicked(const struct popup_ops *ops) -{ - Evas_Object *rect, *win; - Evas_Coord w, h, size; - static int bPowerOff = 0; - char *param[2]; - char data[8]; - int ret; - - if (bPowerOff == 1) - return; - bPowerOff = 1; - - unload_simple_popup(ops); - - win = get_window(); - if (!win) - popup_terminate(); - - rect = evas_object_rectangle_add(evas_object_evas_get(win)); - evas_object_geometry_get(win, NULL, NULL, &w, &h); - size = max(w, h); - evas_object_resize(rect, size, size); - evas_object_color_set(rect, 0, 0, 0, 255); - evas_object_show(rect); - - if (vconf_set_int(VCONFKEY_SYSMAN_POWER_OFF_STATUS, SYSTEMD_STOP_POWER_OFF) != 0) - _E("Failed to request poweroff to deviced"); - - param[0] = POWER_OPERATION_OFF; - snprintf(data, sizeof(data), "0"); - param[1] = data; - ret = popup_dbus_method_sync(POWER_BUS_NAME, - POWER_OBJECT_PATH, - POWER_INTERFACE_NAME, - POWER_METHOD, - "si", param); - if (ret < 0) - _E("Failed to request poweroff to deviced (%d)", ret); -} - -static const struct popup_ops poweroff_ops = { - .name = "poweroff", - .show = load_simple_popup, - .title = "IDS_ST_BODY_POWER_OFF", - .content = "IDS_TPLATFORM_BODY_POWER_OFF_THE_DEVICE_Q", - .left_text = "IDS_COM_SK_CANCEL", - .right_text = "IDS_HS_BUTTON_POWER_OFF_ABB2", - .right = poweroff_clicked, - .pre = poweroff_launch, - .terminate = poweroff_terminate, -}; - -static __attribute__ ((constructor)) void poweroff_register_popup(void) -{ - register_popup(&poweroff_ops); -} -- 2.7.4