From 2952bc4e1726e594915dcf12b4f33a3aebbbb51a Mon Sep 17 00:00:00 2001 From: "hhh.kwon" Date: Fri, 16 Nov 2012 19:52:37 +0900 Subject: [PATCH] Sync magnolia to RSA. Change-Id: I0a9edb4c3d78d4e4d5eedb7c9da02a97bca3ec4c --- CMakeLists.txt | 1 + packaging/org.tizen.volume.spec | 1 + po/CMakeLists.txt | 2 +- src/_button.c | 22 ++++++++++++-- src/_logic.c | 11 +++---- src/_logic.h | 2 ++ src/_sound.c | 51 +++++++++++++++++---------------- src/_util_efl.c | 6 ++-- src/volume.h | 8 ++++-- 9 files changed, 65 insertions(+), 39 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6ea1b59..0fcf918 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -45,6 +45,7 @@ pkg_check_modules(pkgs REQUIRED glib-2.0 ui-gadget-1 notification + capi-system-info ) FOREACH(flag ${pkgs_CFLAGS}) diff --git a/packaging/org.tizen.volume.spec b/packaging/org.tizen.volume.spec index 2682e7d..de5a60a 100755 --- a/packaging/org.tizen.volume.spec +++ b/packaging/org.tizen.volume.spec @@ -14,6 +14,7 @@ BuildRequires: pkgconfig(dlog) BuildRequires: pkgconfig(svi) BuildRequires: pkgconfig(ui-gadget-1) BuildRequires: pkgconfig(notification) +BuildRequires: pkgconfig(capi-system-info) BuildRequires: cmake BuildRequires: edje-bin diff --git a/po/CMakeLists.txt b/po/CMakeLists.txt index a717272..17eb8ff 100644 --- a/po/CMakeLists.txt +++ b/po/CMakeLists.txt @@ -1,6 +1,6 @@ # for i18n -SET(POFILES ar.po bg.po ca.po cs.po da.po de_DE.po el_GR.po en.po en_GB.po en_US.po es_ES.po fi.po fr_FR.po he.po hi.po hr.po hu.po id.po it_IT.po ja_JP.po ko_KR.po lt.po lv.po ms.po nl_NL.po no.po pl.po pt_PT.po ro.po ru_RU.po sk.po sl.po sr.po sv.po th.po tr_TR.po uk.po vi.po zh_CN.po zh_HK.po zh_TW.po) +SET(POFILES hy.po az.po eu.po bg.po ca.po zh_CN.po zh_HK.po zh_TW.po hr.po cs.po da.po nl_NL.po en.po en_US.po et.po fi.po fr_FR.po gl.po ka.po de_DE.po el_GR.po hu.po is.po ga.po it_IT.po ja_JP.po kk.po ko_KR.po lv.po lt.po mk.po nb.po pl.po pt_PT.po pt_BR.po ro.po ru_RU.po sr.po sk.po sl.po es_ES.po es_US.po sv.po tr_TR.po uk.po uz.po ar.po zh_SG.po hi.po en_PH.po fr_CA.po) SET(MSGFMT "/usr/bin/msgfmt") diff --git a/src/_button.c b/src/_button.c index 155e7ab..bc37b56 100755 --- a/src/_button.c +++ b/src/_button.c @@ -16,12 +16,19 @@ #include +#include #include "_util_log.h" #include "volume.h" #include "_sound.h" #include "_logic.h" +enum { + IDLELOCK_OFF = 0x0, + IDLELOCK_ON, + IDLELOCK_MAX, +}; + static void button_ug_layout_cb(ui_gadget_h ug, enum ug_mode mode, void *priv) { @@ -61,7 +68,6 @@ static void button_ug_destroy_cb(ui_gadget_h ug, void *priv) elm_win_indicator_mode_set(ad->win, ELM_WIN_INDICATOR_HIDE); _close_volume(ad); - elm_exit(); } ui_gadget_h create_button_ug(void *data) @@ -69,13 +75,25 @@ ui_gadget_h create_button_ug(void *data) ui_gadget_h ug = NULL; struct ug_cbs cbs = {0}; struct appdata *ad = (struct appdata *)data; + int vconf_status = -1; + int lock = -1, type = -1; retvm_if(ad == NULL, 0, "Invalid argument:appdata is NULL\n"); cbs.layout_cb = button_ug_layout_cb; cbs.destroy_cb = button_ug_destroy_cb; cbs.priv = (void *)data; - ecore_x_netwm_window_type_set(elm_win_xwindow_get(ad->win), ECORE_X_WINDOW_TYPE_NORMAL); + vconf_get_int(VCONFKEY_PWLOCK_STATE, &vconf_status); + + lock = _get_vconf_idlelock(); + type = _get_volume_type(); + + if(vconf_status == VCONFKEY_PWLOCK_BOOTING_LOCK || (lock == IDLELOCK_ON && type == VOLUME_TYPE_MEDIA)){ + ecore_x_netwm_window_type_set(elm_win_xwindow_get(ad->win), ECORE_X_WINDOW_TYPE_NOTIFICATION); + } + else{ + ecore_x_netwm_window_type_set(elm_win_xwindow_get(ad->win), ECORE_X_WINDOW_TYPE_NORMAL); + } utilx_set_window_opaque_state(ecore_x_display_get(), elm_win_xwindow_get(ad->win), UTILX_OPAQUE_STATE_ON); ug = ug_create(NULL, "setting-profile-efl", UG_MODE_FULLVIEW, NULL, &cbs); diff --git a/src/_logic.c b/src/_logic.c index 63f1684..3bdd8c0 100755 --- a/src/_logic.c +++ b/src/_logic.c @@ -24,6 +24,7 @@ #include #include #include +#include #include"_logic.h" #include "volume.h" @@ -408,7 +409,8 @@ int _volume_popup_resize(void *data, int angle) else rotation = angle; - ecore_x_window_size_get(ecore_x_window_root_first_get(), &w, &h); + system_info_get_value_int(SYSTEM_INFO_KEY_SCREEN_WIDTH, &w); + system_info_get_value_int(SYSTEM_INFO_KEY_SCREEN_HEIGHT, &h); switch(rotation){ case 90 : @@ -671,7 +673,6 @@ int _app_reset(bundle *b, void *data) int ret = -1, status = -1, val = 0; int type = MM_ERROR_SOUND_VOLUME_CAPTURE_ONLY; int lock = IDLELOCK_ON; - int w, h; Evas_Object *win, *sl, *ic, *ic_settings; /* volume-app layout */ Elm_Theme *th; @@ -681,6 +682,7 @@ int _app_reset(bundle *b, void *data) retvm_if(ad == NULL, -1, "Invalid argument: appdata is NULL\n"); ad->flag_touching = EINA_FALSE; + ad->noti_seen = EINA_FALSE; _init_mm_sound(ad); status = _check_status(&lock, &type); @@ -716,11 +718,6 @@ int _app_reset(bundle *b, void *data) elm_theme_extension_add(th, EDJ_APP); block = _add_layout(win, EDJ_APP, GRP_VOLUME_BLOCKEVENTS); - ecore_x_window_size_get( - ecore_x_window_root_first_get(), - &w, &h); - evas_object_resize(block, w, h); - evas_object_show(block); edje_object_signal_callback_add(elm_layout_edje_get(block), "clicked", "*", _block_clicked_cb, ad); outer = _add_layout(win, EDJ_APP, GRP_VOLUME_LAYOUT); inner = _add_layout(win, EDJ_APP, GRP_VOLUME_CONTENT); diff --git a/src/_logic.h b/src/_logic.h index 0d9051b..0faa99d 100755 --- a/src/_logic.h +++ b/src/_logic.h @@ -21,6 +21,8 @@ #include "volume.h" #include +int _get_vconf_idlelock(void); +volume_type_t _get_volume_type(void); int _close_volume(void *data); int _app_create(struct appdata *ad); int _app_pause(struct appdata *ad); diff --git a/src/_sound.c b/src/_sound.c index 0873d5c..ce8cf06 100755 --- a/src/_sound.c +++ b/src/_sound.c @@ -135,44 +135,43 @@ Eina_Bool _delete_message_ticker_notification(void *data) struct appdata *ad = (struct appdata *)data; retvm_if(ad == NULL, -1, "Invalid argument: appdata is NULL\n"); - if(ad->noti){ - noti_err = notification_delete(ad->noti); + if(ad->noti_id != 0) + { + noti_err = notification_delete_by_priv_id(PKGNAME, NOTIFICATION_TYPE_NOTI, ad->noti_id); retvm_if(noti_err != NOTIFICATION_ERROR_NONE, ECORE_CALLBACK_RENEW, "Fail to notification_delete : %d\n", noti_err); } - ad->noti = NULL; + ad->noti_id = 0; return ECORE_CALLBACK_CANCEL; } -notification_h _insert_message_ticker_notification(const char* pTickerMsg, const char* pLocaleTickerMsg) +int _insert_message_ticker_notification(void) { notification_h noti = NULL; notification_error_e noti_err = NOTIFICATION_ERROR_NONE; + int priv_id = 0; noti = notification_new(NOTIFICATION_TYPE_NOTI, NOTIFICATION_GROUP_ID_NONE, NOTIFICATION_PRIV_ID_NONE); - retvm_if(noti == NULL, NULL, "notification_new is failed\n"); + retvm_if(noti == NULL, 0, "notification_new is failed\n"); noti_err = notification_set_application(noti, PKGNAME); - retvm_if(noti_err != NOTIFICATION_ERROR_NONE, NULL, "Fail to notification_set_application : %d\n", noti_err); + retvm_if(noti_err != NOTIFICATION_ERROR_NONE, 0, "Fail to notification_set_application : %d\n", noti_err); noti_err = notification_set_image(noti, NOTIFICATION_IMAGE_TYPE_ICON, IMG_VOLUME_PACKAGE_ICON); - retvm_if(noti_err != NOTIFICATION_ERROR_NONE, NULL, "Fail to notification_set_image : %d\n", noti_err); + retvm_if(noti_err != NOTIFICATION_ERROR_NONE, 0, "Fail to notification_set_image : %d\n", noti_err); - noti_err = notification_set_text_domain(noti, "volume-app", LOCALEDIR); - retvm_if(noti_err != NOTIFICATION_ERROR_NONE, NULL, "Fail to notification_set_text_domain : %d\n", noti_err); + noti_err = notification_set_text_domain(noti, PACKAGE, LOCALEDIR); + retvm_if(noti_err != NOTIFICATION_ERROR_NONE, 0, "Fail to notification_set_text_domain : %d\n", noti_err); - noti_err = notification_set_text(noti, NOTIFICATION_TEXT_TYPE_TITLE, pTickerMsg, T_(pLocaleTickerMsg), NOTIFICATION_VARIABLE_TYPE_NONE); - retvm_if(noti_err != NOTIFICATION_ERROR_NONE, NULL, "Fail to notification_set_text : %d\n", noti_err); + noti_err = notification_set_text(noti, NOTIFICATION_TEXT_TYPE_CONTENT, STR_MEDIA_MSG, IDS_MEDIA_MSG, NOTIFICATION_VARIABLE_TYPE_NONE); + retvm_if(noti_err != NOTIFICATION_ERROR_NONE, 0, "Fail to notification_set_text : %d\n", noti_err); - noti_err = notification_set_text(noti, NOTIFICATION_TEXT_TYPE_CONTENT_FOR_DISPLAY_OPTION_IS_OFF, pTickerMsg, T_(pLocaleTickerMsg), NOTIFICATION_VARIABLE_TYPE_NONE); - retvm_if(noti_err != NOTIFICATION_ERROR_NONE, NULL, "Fail to notification_set_text : %d\n", noti_err); + noti_err = notification_set_text(noti, NOTIFICATION_TEXT_TYPE_TITLE, STR_WARNING_MSG, IDS_WARNING_MSG, NOTIFICATION_VARIABLE_TYPE_NONE); + retvm_if(noti_err != NOTIFICATION_ERROR_NONE, 0, "Fail to notification_set_text : %d\n", noti_err); - noti_err = notification_set_display_applist(noti, NOTIFICATION_DISPLAY_APP_TICKER); - retvm_if(noti_err != NOTIFICATION_ERROR_NONE, NULL, "Fail to notification_set_display_applist : %d\n", noti_err); + noti_err = notification_insert(noti, &priv_id); + retvm_if(noti_err != NOTIFICATION_ERROR_NONE, 0, "Fail to notification_set_text_domain : %d\n", noti_err); - noti_err = notification_insert(noti, NULL); - retvm_if(noti_err != NOTIFICATION_ERROR_NONE, NULL, "Fail to notification_set_text_domain : %d\n", noti_err); - - return noti; + return priv_id; } void _set_device_warning(void *data, int val, int device) @@ -182,19 +181,22 @@ void _set_device_warning(void *data, int val, int device) switch (device) { case SYSTEM_AUDIO_ROUTE_PLAYBACK_DEVICE_EARPHONE: - if (val >= 10) { - if(ad->noti == NULL){ - ad->noti = _insert_message_ticker_notification(IDS_WARNING_MSG, STR_WARNING_MSG); + if (val >= 10 && ad->type == VOLUME_TYPE_MEDIA) { + if(ad->noti_id == 0 && ad->noti_seen == EINA_FALSE){ + ad->noti_id = _insert_message_ticker_notification(); + DEL_TIMER(ad->warntimer); + ADD_TIMER(ad->warntimer, 2.0, _delete_message_ticker_notification, data); + ad->noti_seen = EINA_TRUE; } - DEL_TIMER(ad->warntimer); - ADD_TIMER(ad->warntimer, 2.0, _delete_message_ticker_notification, data); } else { _delete_message_ticker_notification(data); + ad->noti_seen = EINA_FALSE; } break; default: _delete_message_ticker_notification(data); + ad->noti_seen = EINA_FALSE; break; } } @@ -261,6 +263,7 @@ void _mm_func(void *data) retm_if(ad->win == NULL, "Failed to get window\n"); /* function could be activated when window exists */ + ad->type = _get_volume_type(); ad->step = _get_step(ad->type); mm_sound_route_get_playing_device(&device); mm_sound_volume_get_value(ad->type, (unsigned int*)(&val)); diff --git a/src/_util_efl.c b/src/_util_efl.c index e685847..323b30b 100755 --- a/src/_util_efl.c +++ b/src/_util_efl.c @@ -17,6 +17,7 @@ #include #include +#include #include "volume.h" #include "_util_log.h" @@ -30,9 +31,8 @@ Evas_Object *_add_window(const char *name) elm_win_title_set(eo, name); elm_win_borderless_set(eo, EINA_TRUE); elm_win_alpha_set(eo, EINA_TRUE); - ecore_x_window_size_get( - ecore_x_window_root_first_get(), - &w, &h); + system_info_get_value_int(SYSTEM_INFO_KEY_SCREEN_WIDTH, &w); + system_info_get_value_int(SYSTEM_INFO_KEY_SCREEN_HEIGHT, &h); if(w == -1 || h == -1){ _E("ecore_x_window_seiz_get() is failed\n"); return NULL; diff --git a/src/volume.h b/src/volume.h index 786284a..91843aa 100755 --- a/src/volume.h +++ b/src/volume.h @@ -31,7 +31,7 @@ #endif #if !defined(RESDIR) -# define RESDIR "/usr/apps/com.samsung.volume/res" +# define RESDIR "/usr/apps/org.samsung.volume/res" #endif #if !defined(LOCALEDIR) @@ -65,6 +65,9 @@ #define IDS_WARNING_MSG "IDS_COM_BODY_HIGH_VOLUMES_MAY_HARM_YOUR_HEARING_IF_YOU_LISTEN_FOR_A_LONG_TIME" #define STR_WARNING_MSG "High volumes may harm your hearing if you listen for a long time" +#define IDS_MEDIA_MSG "IDS_COM_BODY_MEDIA" +#define STR_MEDIA_MSG "Media" + #define S_(str) dgettext("sys_string", str) #define T_(str) dgettext(PACKAGE, str) @@ -92,7 +95,8 @@ struct appdata int angle; /* ticker notification handler */ - notification_h noti; + int noti_id; + bool noti_seen; /* ug handler */ ui_gadget_h ug; -- 2.34.1