diff options
author | youngsub ko <ys4610.ko@samsung.com> | 2013-04-05 16:19:11 +0900 |
---|---|---|
committer | youngsub ko <ys4610.ko@samsung.com> | 2013-04-05 16:19:11 +0900 |
commit | 1b0a3900a69b667f8c92ab16e9dc189b28ac12f8 (patch) | |
tree | 1e2d5534a00a303992b4d00b914846f524a4561f /daemon | |
parent | 87665f4212bae9d2e241db7a7b06c8f1d0befd9f (diff) | |
download | quickpanel-1b0a3900a69b667f8c92ab16e9dc189b28ac12f8.tar.gz quickpanel-1b0a3900a69b667f8c92ab16e9dc189b28ac12f8.tar.bz2 quickpanel-1b0a3900a69b667f8c92ab16e9dc189b28ac12f8.zip |
sync with private git
Diffstat (limited to 'daemon')
-rwxr-xr-x | daemon/common.c | 32 | ||||
-rwxr-xr-x | daemon/common.h | 7 | ||||
-rwxr-xr-x | daemon/device/brightness.c | 5 | ||||
-rwxr-xr-x | daemon/list_util.c | 18 | ||||
-rwxr-xr-x | daemon/media.c | 12 | ||||
-rwxr-xr-x | daemon/minictrl/minictrl.c | 2 | ||||
-rwxr-xr-x | daemon/modules.c | 20 | ||||
-rwxr-xr-x | daemon/notifications/noti.c | 134 | ||||
-rwxr-xr-x | daemon/notifications/noti_box.c | 83 | ||||
-rwxr-xr-x | daemon/notifications/noti_gridbox.c | 20 | ||||
-rwxr-xr-x | daemon/notifications/noti_list_item.c | 34 | ||||
-rwxr-xr-x | daemon/notifications/noti_listbox.c | 20 | ||||
-rwxr-xr-x | daemon/notifications/noti_node.c | 12 | ||||
-rwxr-xr-x | daemon/notifications/noti_section.c | 6 | ||||
-rwxr-xr-x | daemon/notifications/noti_util.c | 171 | ||||
-rwxr-xr-x | daemon/notifications/noti_util.h | 26 | ||||
-rwxr-xr-x | daemon/notifications/noti_win.c | 6 | ||||
-rwxr-xr-x | daemon/notifications/ticker.c | 59 | ||||
-rwxr-xr-x | daemon/quickpanel-ui.c | 35 | ||||
-rwxr-xr-x | daemon/quickpanel-ui.h | 2 |
20 files changed, 458 insertions, 246 deletions
diff --git a/daemon/common.c b/daemon/common.c new file mode 100755 index 0000000..47fd2e9 --- /dev/null +++ b/daemon/common.c @@ -0,0 +1,32 @@ +/* + * Copyright 2012 Samsung Electronics Co., Ltd + * + * Licensed under the Flora License, Version 1.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.tizenopensource.org/license + * + * 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 "common.h" +#include "quickpanel-ui.h" + +HAPI void quickpanel_util_char_replace(char *text, char s, char t) { + retif(text == NULL, , "invalid argument"); + + int i = 0, text_len = 0; + + text_len = strlen(text); + + for (i = 0; i < text_len; i++) { + if (*(text + i) == s) { + *(text + i) = t; + } + } +} diff --git a/daemon/common.h b/daemon/common.h index 79ffbb1..712a2ac 100755 --- a/daemon/common.h +++ b/daemon/common.h @@ -26,9 +26,11 @@ #define QP_FAIL (-1) #ifdef _DLOG_USED -#define LOG_TAG "quickpanel" +#define LOG_TAG "QUICKPANEL" #include <dlog.h> +#define HAPI __attribute__((visibility("hidden"))) + #define DBG(fmt , args...) \ do { \ LOGD("[%s : %d] "fmt"\n", __func__, __LINE__, ##args); \ @@ -110,4 +112,7 @@ } \ } while (0); + +void quickpanel_util_char_replace(char *text, char s, char t); + #endif /* __QP_COMMON_H_ */ diff --git a/daemon/device/brightness.c b/daemon/device/brightness.c index ddf4b45..76db218 100755 --- a/daemon/device/brightness.c +++ b/daemon/device/brightness.c @@ -342,6 +342,7 @@ static void _brightness_set_checker(void) static void _brightness_set_slider(void) { DBG(""); + int value = 0; Evas_Object *slider = NULL; Evas_Object *old_obj = NULL; brightness_ctrl_obj *ctrl_obj = g_ctrl_obj; @@ -371,7 +372,9 @@ static void _brightness_set_slider(void) slider = old_obj; } - elm_slider_value_set(slider, _brightness_get_level()); + value = _brightness_get_level(); + + elm_slider_value_set(slider, value); if (_brightness_get_automate_level()) { elm_object_disabled_set(slider, EINA_TRUE); diff --git a/daemon/list_util.c b/daemon/list_util.c index 4d436fd..73d8312 100755 --- a/daemon/list_util.c +++ b/daemon/list_util.c @@ -27,7 +27,7 @@ struct _qp_item_data { void *data; }; -qp_item_data *quickpanel_list_util_item_new(qp_item_type_e type, void *data) +HAPI qp_item_data *quickpanel_list_util_item_new(qp_item_type_e type, void *data) { qp_item_data *qid = NULL; @@ -43,7 +43,7 @@ qp_item_data *quickpanel_list_util_item_new(qp_item_type_e type, void *data) return qid; } -void quickpanel_list_util_item_set_tag(Evas_Object *item, qp_item_data *qid) +HAPI void quickpanel_list_util_item_set_tag(Evas_Object *item, qp_item_data *qid) { retif(item == NULL, , "invalid parameter"); retif(qid == NULL, , "invalid parameter"); @@ -51,7 +51,7 @@ void quickpanel_list_util_item_set_tag(Evas_Object *item, qp_item_data *qid) evas_object_data_set(item, E_DATA_ITEM_LABEL_H, qid); } -void quickpanel_list_util_item_del_tag(Evas_Object *item) +HAPI void quickpanel_list_util_item_del_tag(Evas_Object *item) { retif(item == NULL, , "invalid parameter"); @@ -63,7 +63,7 @@ void quickpanel_list_util_item_del_tag(Evas_Object *item) } } -void *quickpanel_list_util_item_get_data(qp_item_data *qid) +HAPI void *quickpanel_list_util_item_get_data(qp_item_data *qid) { void *user_data = NULL; @@ -75,7 +75,7 @@ void *quickpanel_list_util_item_get_data(qp_item_data *qid) return user_data; } -void quickpanel_list_util_item_set_data(qp_item_data *qid, void *data) +HAPI void quickpanel_list_util_item_set_data(qp_item_data *qid, void *data) { if (!qid) return ; @@ -83,7 +83,7 @@ void quickpanel_list_util_item_set_data(qp_item_data *qid, void *data) qid->data = data; } -int quickpanel_list_util_item_compare(const void *data1, const void *data2) +HAPI int quickpanel_list_util_item_compare(const void *data1, const void *data2) { int diff = 0; qp_item_data *qid1 = NULL; @@ -122,7 +122,7 @@ int quickpanel_list_util_item_compare(const void *data1, const void *data2) return diff; } -void quickpanel_list_util_item_unpack_by_type(Evas_Object *list +HAPI void quickpanel_list_util_item_unpack_by_type(Evas_Object *list , qp_item_type_e type) { retif(list == NULL, , "invalid parameter"); @@ -146,7 +146,7 @@ void quickpanel_list_util_item_unpack_by_type(Evas_Object *list } } -void quickpanel_list_util_item_unpack_by_object(Evas_Object *list +HAPI void quickpanel_list_util_item_unpack_by_object(Evas_Object *list , Evas_Object *item) { retif(list == NULL, , "invalid parameter"); @@ -185,7 +185,7 @@ static int __item_compare(const void *data1, const void *data2) } -void quickpanel_list_util_sort_insert(Evas_Object *list, +HAPI void quickpanel_list_util_sort_insert(Evas_Object *list, Evas_Object *new_obj) { retif(list == NULL, , "invalid parameter"); diff --git a/daemon/media.c b/daemon/media.c index 2c2cbda..0324eab 100755 --- a/daemon/media.c +++ b/daemon/media.c @@ -104,7 +104,7 @@ _quickpanel_player_error_cb(int error_code, void *user_data) _quickpanel_player_free(sound_player); } -void quickpanel_player_play(sound_type_e sound_type, const char *sound_file) +HAPI void quickpanel_player_play(sound_type_e sound_type, const char *sound_file) { player_h *sound_player = &g_sound_player; @@ -123,7 +123,7 @@ void quickpanel_player_play(sound_type_e sound_type, const char *sound_file) player_destroy(*sound_player); } - ret = player_set_sound_type(*sound_player, SOUND_TYPE_MEDIA); + ret = player_set_sound_type(*sound_player, sound_type); if (ret != PLAYER_ERROR_NONE) { ERR("player_set_sound_type() ERR: %x!!!!", ret); _quickpanel_player_free(sound_player); @@ -188,7 +188,7 @@ void quickpanel_player_play(sound_type_e sound_type, const char *sound_file) _quickpanel_player_timeout_cb, sound_player); } -void quickpanel_player_stop(void) +HAPI void quickpanel_player_stop(void) { _quickpanel_player_del_timeout_timer(); @@ -197,7 +197,7 @@ void quickpanel_player_stop(void) } } -int quickpanel_is_sound_enabled(void) +HAPI int quickpanel_is_sound_enabled(void) { int snd_status = 0; @@ -221,7 +221,7 @@ int quickpanel_is_sound_enabled(void) return 0; } -int quickpanel_is_vib_enabled(void) +HAPI int quickpanel_is_vib_enabled(void) { int vib_status = 0; @@ -233,7 +233,7 @@ int quickpanel_is_vib_enabled(void) return 0; } -void quickpanel_play_feedback(void) +HAPI void quickpanel_play_feedback(void) { int snd_enabled = quickpanel_is_sound_enabled(); int vib_enabled = quickpanel_is_vib_enabled(); diff --git a/daemon/minictrl/minictrl.c b/daemon/minictrl/minictrl.c index 1e1e85c..e74ae1f 100755 --- a/daemon/minictrl/minictrl.c +++ b/daemon/minictrl/minictrl.c @@ -179,7 +179,7 @@ static int _minictrl_is_ongoing(const char *str) } } -qp_item_type_e _minictrl_priority_to_type(minicontrol_priority_e priority) +static qp_item_type_e _minictrl_priority_to_type(minicontrol_priority_e priority) { qp_item_type_e type; diff --git a/daemon/modules.c b/daemon/modules.c index c3f0d5b..f064c0b 100755 --- a/daemon/modules.c +++ b/daemon/modules.c @@ -52,7 +52,7 @@ static QP_Module *modules[] = { &idletxt }; -int init_modules(void *data) +HAPI int init_modules(void *data) { int i; @@ -66,7 +66,7 @@ int init_modules(void *data) return QP_OK; } -int fini_modules(void *data) +HAPI int fini_modules(void *data) { int i; @@ -80,7 +80,7 @@ int fini_modules(void *data) return QP_OK; } -int suspend_modules(void *data) +HAPI int suspend_modules(void *data) { int i; @@ -94,7 +94,7 @@ int suspend_modules(void *data) return QP_OK; } -int resume_modules(void *data) +HAPI int resume_modules(void *data) { int i; @@ -108,7 +108,7 @@ int resume_modules(void *data) return QP_OK; } -int hib_enter_modules(void *data) +HAPI int hib_enter_modules(void *data) { int i; @@ -122,7 +122,7 @@ int hib_enter_modules(void *data) return QP_OK; } -int hib_leave_modules(void *data) +HAPI int hib_leave_modules(void *data) { int i; @@ -142,7 +142,7 @@ int hib_leave_modules(void *data) * ****************************************************************/ -void lang_change_modules(void *data) +HAPI void lang_change_modules(void *data) { int i; retif(data == NULL, , "Invalid parameter!"); @@ -153,7 +153,7 @@ void lang_change_modules(void *data) } } -void refresh_modules(void *data) +HAPI void refresh_modules(void *data) { int i; retif(data == NULL, , "Invalid parameter!"); @@ -169,7 +169,7 @@ void refresh_modules(void *data) * Quickpanel open/close Events * ****************************************************************/ -int qp_opened_modules(void *data) +HAPI int qp_opened_modules(void *data) { int i; @@ -183,7 +183,7 @@ int qp_opened_modules(void *data) return QP_OK; } -int qp_closed_modules(void *data) +HAPI int qp_closed_modules(void *data) { int i; diff --git a/daemon/notifications/noti.c b/daemon/notifications/noti.c index eb5e799..74c53a9 100755 --- a/daemon/notifications/noti.c +++ b/daemon/notifications/noti.c @@ -20,13 +20,7 @@ #include <vconf.h> #include <appcore-common.h> #include <app_service.h> -#include <runtime_info.h> #include <Ecore_X.h> - -#include <unicode/uloc.h> -#include <unicode/udat.h> -#include <unicode/udatpg.h> -#include <unicode/ustring.h> #include <notification.h> #include "quickpanel-ui.h" @@ -45,8 +39,6 @@ #define VCONFKEY_QUICKPANEL_STARTED "memory/private/"PACKAGE_NAME"/started" #endif /* VCONFKEY_QUICKPANEL_STARTED */ -#define QP_NOTI_DAY_DEC (24 * 60 * 60) - #define QP_NOTI_ONGOING_DBUS_PATH "/dbus/signal" #define QP_NOTI_ONGOING_DBUS_INTERFACE "notification.ongoing" @@ -296,116 +288,6 @@ static void _quickpanel_noti_item_content_update_cb(void *data, _quickpanel_noti_update_progressbar(data, noti); } -char *quickpanel_noti_get_time(time_t t, char *buf, int buf_len) -{ - UErrorCode status = U_ZERO_ERROR; - UDateTimePatternGenerator *generator; - UDateFormat *formatter; - UChar skeleton[40] = { 0 }; - UChar pattern[40] = { 0 }; - UChar formatted[40] = { 0 }; - int32_t patternCapacity, formattedCapacity; - int32_t skeletonLength, patternLength, formattedLength; - UDate date; - const char *locale; - const char customSkeleton[] = UDAT_YEAR_NUM_MONTH_DAY; - char bf1[32] = { 0, }; - bool is_24hour_enabled = FALSE; - - struct tm loc_time; - time_t today, yesterday; - int ret = 0; - - today = time(NULL); - localtime_r(&today, &loc_time); - - loc_time.tm_sec = 0; - loc_time.tm_min = 0; - loc_time.tm_hour = 0; - today = mktime(&loc_time); - - yesterday = today - QP_NOTI_DAY_DEC; - - localtime_r(&t, &loc_time); - - if (t >= yesterday && t < today) { - ret = snprintf(buf, buf_len, _S("IDS_COM_BODY_YESTERDAY")); - } else if (t < yesterday) { - /* set UDate from time_t */ - date = (UDate) t * 1000; - - /* get default locale */ - /* for thread saftey */ - uloc_setDefault(__secure_getenv("LC_TIME"), &status); - locale = uloc_getDefault(); - - /* open datetime pattern generator */ - generator = udatpg_open(locale, &status); - if (generator == NULL) - return NULL; - - /* calculate pattern string capacity */ - patternCapacity = - (int32_t) (sizeof(pattern) / sizeof((pattern)[0])); - - /* ascii to unicode for input skeleton */ - u_uastrcpy(skeleton, customSkeleton); - - /* get skeleton length */ - skeletonLength = strlen(customSkeleton); - - /* get best pattern using skeleton */ - patternLength = - udatpg_getBestPattern(generator, skeleton, skeletonLength, - pattern, patternCapacity, &status); - - /* open datetime formatter using best pattern */ - formatter = - udat_open(UDAT_IGNORE, UDAT_DEFAULT, locale, NULL, -1, - pattern, patternLength, &status); - if (formatter == NULL) { - udatpg_close(generator); - return NULL; - } - - /* calculate formatted string capacity */ - formattedCapacity = - (int32_t) (sizeof(formatted) / sizeof((formatted)[0])); - - /* formatting date using formatter by best pattern */ - formattedLength = - udat_format(formatter, date, formatted, formattedCapacity, - NULL, &status); - - /* unicode to ascii to display */ - u_austrcpy(bf1, formatted); - - /* close datetime pattern generator */ - udatpg_close(generator); - - /* close datetime formatter */ - udat_close(formatter); - - ret = snprintf(buf, buf_len, "%s", bf1); - } else { - ret = runtime_info_get_value_bool( - RUNTIME_INFO_KEY_24HOUR_CLOCK_FORMAT_ENABLED, &is_24hour_enabled); - if (ret == RUNTIME_INFO_ERROR_NONE && is_24hour_enabled == TRUE) { - ret = strftime(buf, buf_len, "%H:%M", &loc_time); - } else { - strftime(bf1, sizeof(bf1), "%l:%M", &loc_time); - - if (loc_time.tm_hour >= 0 && loc_time.tm_hour < 12) - ret = snprintf(buf, buf_len, "%s%s", bf1, "AM"); - else - ret = snprintf(buf, buf_len, "%s%s", bf1, "PM"); - } - - } - - return ret <= 0 ? NULL : buf; -} - static void _quickpanel_noti_ani_image_control(Eina_Bool on) { const Eina_List *l = NULL; @@ -715,7 +597,7 @@ static void _quickpanel_noti_section_remove(void) } } -void _quickpanel_noti_box_deleted_cb(void *data, Evas_Object *obj) { +static void _quickpanel_noti_box_deleted_cb(void *data, Evas_Object *obj) { int priv_id = -1; retif(data == NULL, , "Invalid parameter!"); @@ -730,7 +612,7 @@ void _quickpanel_noti_box_deleted_cb(void *data, Evas_Object *obj) { } } -void _quickpanel_list_box_deleted_cb(void *data, Evas_Object *obj) { +static void _quickpanel_list_box_deleted_cb(void *data, Evas_Object *obj) { int priv_id = -1; retif(data == NULL, , "Invalid parameter!"); @@ -812,7 +694,7 @@ static void _quickpanel_noti_noti_add(Evas_Object *list, void *data, int is_prep data, noti_box, g_noti_gridbox); } -void _quickpanel_noti_update_notilist(struct appdata *ad) +static void _quickpanel_noti_update_notilist(struct appdata *ad) { Evas_Object *list = NULL; notification_h noti = NULL; @@ -1256,14 +1138,14 @@ static int quickpanel_noti_fini(void *data) /* Unregister event handler */ _quickpanel_noti_unregister_event_handler(data); - if (g_noti_node != NULL) { - noti_node_destroy(&g_noti_node); - } - _quickpanel_noti_clear_list_all(); _quickpanel_noti_fini(ad); + if (g_noti_node != NULL) { + noti_node_destroy(&g_noti_node); + } + return QP_OK; } @@ -1304,7 +1186,7 @@ static void quickpanel_noti_refresh(void *data) { } } -void quickpanel_noti_lang_changed(void *data) +static void quickpanel_noti_lang_changed(void *data) { struct appdata *ad = data; diff --git a/daemon/notifications/noti_box.c b/daemon/notifications/noti_box.c index 0b2f818..864a360 100755 --- a/daemon/notifications/noti_box.c +++ b/daemon/notifications/noti_box.c @@ -24,10 +24,14 @@ #include "noti_box.h" #include "noti_node.h" #include "noti.h" +#include "noti_util.h" #define IMAGE_NO_RESIZE 0 #define IMAGE_RESIZE 1 +#define TEXT_NO_CR 0 +#define TEXT_CR 1 + static void _noti_box_call_item_cb(Evas_Object *noti_box, const char *emission) { retif(noti_box == NULL, , "invalid parameter"); retif(emission == NULL, , "invalid parameter"); @@ -71,7 +75,8 @@ static void _signal_cb(void *data, Evas_Object *o, const char *emission, const c _noti_box_call_item_cb(o, emission); } -Evas_Object *noti_box_create(Evas_Object *parent, notification_ly_type_e layout) { + +HAPI Evas_Object *noti_box_create(Evas_Object *parent, notification_ly_type_e layout) { Evas_Object *box = NULL; box = elm_layout_add(parent); @@ -186,10 +191,11 @@ static void _set_image(Evas_Object *noti_box, notification_h noti, } static int _set_text(Evas_Object *noti_box, notification_h noti, - notification_text_type_e text_type, const char *part, int is_need_effect) { + notification_text_type_e text_type, const char *part, int is_need_effect, int is_support_cr) { char buf[128] = { 0, }; char *text = NULL; + char *text_utf8 = NULL; time_t time = 0; if (notification_get_time_from_text(noti, text_type, &time) == NOTIFICATION_ERROR_NONE) { @@ -203,7 +209,20 @@ static int _set_text(Evas_Object *noti_box, notification_h noti, if (text != NULL) { if (strlen(text) > 0) { - elm_object_part_text_set(noti_box, part, text); + + if (is_support_cr == TEXT_CR) { + text_utf8 = elm_entry_utf8_to_markup(text); + if (text_utf8 != NULL) { + elm_object_part_text_set(noti_box, part, text_utf8); + free(text_utf8); + } else { + elm_object_part_text_set(noti_box, part, text); + } + } else { + quickpanel_util_char_replace(text, _NEWLINE, _SPACE); + elm_object_part_text_set(noti_box, part, text); + } + if (is_need_effect == 1) elm_object_signal_emit(noti_box, "object.show.effect", part); else @@ -285,32 +304,32 @@ static void _noti_box_set_layout_single(Evas_Object *noti_box, bindtextdomain(domain, dir); _set_text(noti_box, noti, NOTIFICATION_TEXT_TYPE_TITLE, - "object.text.title", is_need_effect); + "object.text.title", is_need_effect, TEXT_CR); if (is_contents_only == 1) { _set_text(noti_box, noti, NOTIFICATION_TEXT_TYPE_CONTENT, - "object.text.contents.multiline", is_need_effect); + "object.text.contents.multiline", is_need_effect, TEXT_CR); } else { _set_text(noti_box, noti, NOTIFICATION_TEXT_TYPE_CONTENT, - "object.text.contents", is_need_effect); + "object.text.contents", is_need_effect, TEXT_NO_CR); if (is_sub_info_1_only == 1) { _set_text(noti_box, noti, NOTIFICATION_TEXT_TYPE_INFO_1, - "object.text.info.1.multiline", is_need_effect); + "object.text.info.1.multiline", is_need_effect, TEXT_CR); } else { if (_check_text_null(noti, NOTIFICATION_TEXT_TYPE_INFO_1) == 0) { if (_check_text_null(noti, NOTIFICATION_TEXT_TYPE_INFO_SUB_1) == 1) { _set_text(noti_box, noti, NOTIFICATION_TEXT_TYPE_INFO_1, - "object.text.info.1", is_need_effect); + "object.text.info.1", is_need_effect, TEXT_NO_CR); } else { _set_text(noti_box, noti, NOTIFICATION_TEXT_TYPE_INFO_1, - "object.text.info.1.short", is_need_effect); + "object.text.info.1.short", is_need_effect, TEXT_NO_CR); _set_text(noti_box, noti, NOTIFICATION_TEXT_TYPE_INFO_SUB_1, - "object.text.info.sub.1", is_need_effect); + "object.text.info.sub.1", is_need_effect, TEXT_NO_CR); } } _set_text(noti_box, noti, NOTIFICATION_TEXT_TYPE_INFO_2, - "object.text.info.2", is_need_effect); + "object.text.info.2", is_need_effect, TEXT_NO_CR); } } @@ -370,44 +389,44 @@ static void _noti_box_set_layout_multi(Evas_Object *noti_box, bindtextdomain(domain, dir); _set_text(noti_box, noti, NOTIFICATION_TEXT_TYPE_TITLE, - "object.text.title", is_need_effect); + "object.text.title", is_need_effect, TEXT_CR); if (_check_text_null(noti, NOTIFICATION_TEXT_TYPE_EVENT_COUNT) == 0) { _set_text(noti_box, noti, NOTIFICATION_TEXT_TYPE_CONTENT, - "object.text.contents.short", is_need_effect); + "object.text.contents.short", is_need_effect, TEXT_NO_CR); length = _set_text(noti_box, noti, NOTIFICATION_TEXT_TYPE_EVENT_COUNT, - "object.text.count", is_need_effect); + "object.text.count", is_need_effect, TEXT_NO_CR); length = (length >= 5) ? 5 : length; snprintf(buf, sizeof(buf), "box.count.%d", length); elm_object_signal_emit(noti_box, buf, "box.prog"); } else { _set_text(noti_box, noti, NOTIFICATION_TEXT_TYPE_CONTENT, - "object.text.contents", is_need_effect); + "object.text.contents", is_need_effect, TEXT_NO_CR); } if (is_sub_info_1_only == 1) { _set_text(noti_box, noti, NOTIFICATION_TEXT_TYPE_INFO_1, - "object.text.info.1.multiline", is_need_effect); + "object.text.info.1.multiline", is_need_effect, TEXT_CR); } else { if (_check_text_null(noti, NOTIFICATION_TEXT_TYPE_INFO_1) == 0) { if (_check_text_null(noti, NOTIFICATION_TEXT_TYPE_INFO_SUB_1) == 1) { _set_text(noti_box, noti, NOTIFICATION_TEXT_TYPE_INFO_1, - "object.text.info.1", is_need_effect); + "object.text.info.1", is_need_effect, TEXT_NO_CR); } else { _set_text(noti_box, noti, NOTIFICATION_TEXT_TYPE_INFO_1, - "object.text.info.1.short", is_need_effect); + "object.text.info.1.short", is_need_effect, TEXT_NO_CR); _set_text(noti_box, noti, NOTIFICATION_TEXT_TYPE_INFO_SUB_1, - "object.text.info.sub.1", is_need_effect); + "object.text.info.sub.1", is_need_effect, TEXT_NO_CR); } } if (_check_text_null(noti, NOTIFICATION_TEXT_TYPE_INFO_2) == 0) { if (_check_text_null(noti, NOTIFICATION_TEXT_TYPE_INFO_SUB_2) == 1) { _set_text(noti_box, noti, NOTIFICATION_TEXT_TYPE_INFO_2, - "object.text.info.2", is_need_effect); + "object.text.info.2", is_need_effect, TEXT_NO_CR); } else { _set_text(noti_box, noti, NOTIFICATION_TEXT_TYPE_INFO_2, - "object.text.info.2.short", is_need_effect); + "object.text.info.2.short", is_need_effect, TEXT_NO_CR); _set_text(noti_box, noti, NOTIFICATION_TEXT_TYPE_INFO_SUB_2, - "object.text.info.sub.2", is_need_effect); + "object.text.info.sub.2", is_need_effect, TEXT_NO_CR); } } } @@ -456,9 +475,9 @@ static void _noti_box_set_layout_thumbnail(Evas_Object *noti_box, bindtextdomain(domain, dir); _set_text(noti_box, noti, NOTIFICATION_TEXT_TYPE_TITLE, - "object.text.title", is_need_effect); + "object.text.title", is_need_effect, TEXT_CR); _set_text(noti_box, noti, NOTIFICATION_TEXT_TYPE_CONTENT, - "object.text.contents", is_need_effect); + "object.text.contents", is_need_effect, TEXT_NO_CR); if (_check_image_null(noti, NOTIFICATION_IMAGE_TYPE_THUMBNAIL) == 0) { _set_image(noti_box, noti, NOTIFICATION_IMAGE_TYPE_ICON, @@ -522,7 +541,7 @@ static void _noti_box_set_layout(Evas_Object *noti_box, notification_h noti, } } -void noti_box_remove(Evas_Object *noti_box) { +HAPI void noti_box_remove(Evas_Object *noti_box) { retif(noti_box == NULL, , "invalid parameter"); @@ -538,7 +557,7 @@ void noti_box_remove(Evas_Object *noti_box) { evas_object_del(noti_box); } -void noti_box_set_status(Evas_Object *noti_box, int status) { +HAPI void noti_box_set_status(Evas_Object *noti_box, int status) { retif(noti_box == NULL, , "invalid parameter"); noti_box_h *noti_box_h = evas_object_data_get(noti_box, E_DATA_NOTI_BOX_H); @@ -548,7 +567,7 @@ void noti_box_set_status(Evas_Object *noti_box, int status) { } } -int noti_box_get_status(Evas_Object *noti_box) { +HAPI int noti_box_get_status(Evas_Object *noti_box) { retif(noti_box == NULL, STATE_NORMAL, "invalid parameter"); noti_box_h *noti_box_h = evas_object_data_get(noti_box, E_DATA_NOTI_BOX_H); @@ -560,7 +579,7 @@ int noti_box_get_status(Evas_Object *noti_box) { return STATE_DELETING; } -void noti_box_node_set(Evas_Object *noti_box, void *data) { +HAPI void noti_box_node_set(Evas_Object *noti_box, void *data) { retif(noti_box == NULL, , "invalid parameter"); retif(data == NULL, , "invalid parameter"); @@ -576,7 +595,7 @@ void noti_box_node_set(Evas_Object *noti_box, void *data) { } } -void *noti_box_node_get(Evas_Object *noti_box) { +HAPI void *noti_box_node_get(Evas_Object *noti_box) { retif(noti_box == NULL, NULL, "invalid parameter"); noti_box_h *noti_box_data = evas_object_data_get(noti_box, E_DATA_NOTI_BOX_H); @@ -588,7 +607,7 @@ void *noti_box_node_get(Evas_Object *noti_box) { return NULL; } -void noti_box_set_item_selected_cb(Evas_Object *noti_box, +HAPI void noti_box_set_item_selected_cb(Evas_Object *noti_box, void(*selected_cb)(void *data, Evas_Object *obj)) { retif(noti_box == NULL, , "invalid parameter"); retif(selected_cb == NULL, , "invalid parameter"); @@ -596,7 +615,7 @@ void noti_box_set_item_selected_cb(Evas_Object *noti_box, evas_object_data_set(noti_box, E_DATA_CB_SELECTED_ITEM, selected_cb); } -void noti_box_set_item_button_1_cb(Evas_Object *noti_box, +HAPI void noti_box_set_item_button_1_cb(Evas_Object *noti_box, void(*button_1_cb)(void *data, Evas_Object *obj)) { retif(noti_box == NULL, , "invalid parameter"); retif(button_1_cb == NULL, , "invalid parameter"); @@ -604,7 +623,7 @@ void noti_box_set_item_button_1_cb(Evas_Object *noti_box, evas_object_data_set(noti_box, E_DATA_CB_BUTTON_1, button_1_cb); } -void noti_box_set_item_deleted_cb(Evas_Object *noti_box, +HAPI void noti_box_set_item_deleted_cb(Evas_Object *noti_box, void(*deleted_cb)(void *data, Evas_Object *obj)) { retif(noti_box == NULL, , "invalid parameter"); retif(deleted_cb == NULL, , "invalid parameter"); diff --git a/daemon/notifications/noti_gridbox.c b/daemon/notifications/noti_gridbox.c index 80c9ab7..906c08f 100755 --- a/daemon/notifications/noti_gridbox.c +++ b/daemon/notifications/noti_gridbox.c @@ -124,7 +124,7 @@ static void _gridbox_layout(Evas_Object *o, Evas_Object_Box_Data *priv, off_y + info_layout->child_h + info_layout->padding_bottom); } -Evas_Object *gridbox_create(Evas_Object *parent, void *data) { +HAPI Evas_Object *gridbox_create(Evas_Object *parent, void *data) { retif(parent == NULL, NULL, "invalid parameter"); retif(data == NULL, NULL, "invalid parameter"); @@ -185,7 +185,7 @@ Evas_Object *gridbox_create(Evas_Object *parent, void *data) { return gridbox; } -void gridbox_remove(Evas_Object *gridbox) { +HAPI void gridbox_remove(Evas_Object *gridbox) { retif(gridbox == NULL, , "invalid parameter"); @@ -208,7 +208,7 @@ void gridbox_remove(Evas_Object *gridbox) { free(info_layout_landscape); } -void gridbox_set_item_deleted_cb(Evas_Object *gridbox, +HAPI void gridbox_set_item_deleted_cb(Evas_Object *gridbox, void(*deleted_cb)(void *data, Evas_Object *obj)) { retif(gridbox == NULL, , "invalid parameter"); retif(deleted_cb == NULL, , "invalid parameter"); @@ -229,7 +229,7 @@ static void _gridbox_call_item_deleted_cb(Evas_Object *gridbox, void *data, } } -void gridbox_add_item(Evas_Object *gridbox, Evas_Object *item, int is_prepend) { +HAPI void gridbox_add_item(Evas_Object *gridbox, Evas_Object *item, int is_prepend) { const char *signal = NULL; retif(gridbox == NULL, , "invalid parameter"); @@ -287,7 +287,7 @@ static void _gridbox_remove_item_anim_cb(void *data, Elm_Transit *transit) { info_animation = NULL; } -void gridbox_remove_item(Evas_Object *gridbox, Evas_Object *item, int with_animation) { +HAPI void gridbox_remove_item(Evas_Object *gridbox, Evas_Object *item, int with_animation) { DBG("remove:%p", item); retif(gridbox == NULL, , "invalid parameter"); retif(item == NULL, , "invalid parameter"); @@ -326,7 +326,7 @@ void gridbox_remove_item(Evas_Object *gridbox, Evas_Object *item, int with_anima } } -void gridbox_remove_all_item(Evas_Object *gridbox, int with_animation) { +HAPI void gridbox_remove_all_item(Evas_Object *gridbox, int with_animation) { DBG(""); retif(gridbox == NULL, , "invalid parameter"); @@ -344,13 +344,13 @@ void gridbox_remove_all_item(Evas_Object *gridbox, int with_animation) { } } -void gridbox_update_item(Evas_Object *gridbox, Evas_Object *item) { +HAPI void gridbox_update_item(Evas_Object *gridbox, Evas_Object *item) { retif(gridbox == NULL, , "invalid parameter"); retif(item == NULL, , "invalid parameter"); } -void gridbox_remove_and_add_item(Evas_Object *gridbox, Evas_Object *item +HAPI void gridbox_remove_and_add_item(Evas_Object *gridbox, Evas_Object *item ,void (*update_cb)(Evas_Object *list, void *data, int is_prepend) ,void *container, void *data, int pos) { @@ -386,14 +386,14 @@ void gridbox_remove_and_add_item(Evas_Object *gridbox, Evas_Object *item elm_transit_go(transit); } -void gridbox_finalize_rotation_cb(void *data) { +HAPI void gridbox_finalize_rotation_cb(void *data) { retif(data == NULL, , "invalid parameter"); Evas_Object *gridbox = data; elm_box_recalculate(gridbox); } -void gridbox_rotation(Evas_Object *gridbox, int angle) { +HAPI void gridbox_rotation(Evas_Object *gridbox, int angle) { const char *signal = NULL; retif(gridbox == NULL, , "invalid parameter"); diff --git a/daemon/notifications/noti_list_item.c b/daemon/notifications/noti_list_item.c index 3bc9b23..94ce281 100755 --- a/daemon/notifications/noti_list_item.c +++ b/daemon/notifications/noti_list_item.c @@ -24,6 +24,7 @@ #include "noti_list_item.h" #include "noti_node.h" #include "noti.h" +#include "noti_util.h" #define QP_DEFAULT_ICON ICONDIR"/quickpanel_icon_default.png" @@ -388,6 +389,7 @@ static void _noti_list_item_ongoing_set_text(Evas_Object *noti_list_item) notification_h noti = NULL; notification_error_e noti_err = NOTIFICATION_ERROR_NONE; char *text = NULL; + char *text_utf8 = NULL; char *domain = NULL; char *dir = NULL; char *pkgname = NULL; @@ -436,6 +438,7 @@ static void _noti_list_item_ongoing_set_text(Evas_Object *noti_list_item) &text); if (noti_err == NOTIFICATION_ERROR_NONE && text != NULL) { + quickpanel_util_char_replace(text, _NEWLINE, _SPACE); _set_text_to_part(noti_list_item, "elm.text.title", text); } @@ -444,9 +447,17 @@ static void _noti_list_item_ongoing_set_text(Evas_Object *noti_list_item) &text); if (noti_err == NOTIFICATION_ERROR_NONE && text != NULL) { if (layout == NOTIFICATION_LY_ONGOING_EVENT) { - _set_text_to_part(noti_list_item, "elm.text.content.multiline", text); + text_utf8 = elm_entry_utf8_to_markup(text); + if (text_utf8 != NULL) { + _set_text_to_part(noti_list_item, "elm.text.content.multiline", text_utf8); + free(text_utf8); + } else { + _set_text_to_part(noti_list_item, "elm.text.content.multiline", text); + } + elm_object_signal_emit(noti_list_item, "elm,state,elm.text.content.multiline,active", "elm"); } else { + quickpanel_util_char_replace(text, _NEWLINE, _SPACE); _set_text_to_part(noti_list_item, "elm.text.content", text); elm_object_signal_emit(noti_list_item, "elm,state,elm.text.content,active", "elm"); } @@ -457,6 +468,7 @@ static void _noti_list_item_ongoing_set_text(Evas_Object *noti_list_item) text = _noti_get_progress(noti, buf, sizeof(buf)); if (text != NULL) { + quickpanel_util_char_replace(text, _NEWLINE, _SPACE); _set_text_to_part(noti_list_item, "elm.text.time", text); } } @@ -505,7 +517,7 @@ static void _signal_cb(void *data, Evas_Object *o, const char *emission, const c _noti_list_item_call_item_cb(o, emission); } -Evas_Object *noti_list_item_create(Evas_Object *parent, notification_ly_type_e layout) { +HAPI Evas_Object *noti_list_item_create(Evas_Object *parent, notification_ly_type_e layout) { Evas_Object *box = NULL; retif(parent == NULL, NULL, "Invalid parameter!"); @@ -588,7 +600,7 @@ static void _noti_list_item_set_layout(Evas_Object *noti_list_item, notification } } -void noti_list_item_remove(Evas_Object *noti_list_item) { +HAPI void noti_list_item_remove(Evas_Object *noti_list_item) { retif(noti_list_item == NULL, , "invalid parameter"); @@ -605,7 +617,7 @@ void noti_list_item_remove(Evas_Object *noti_list_item) { evas_object_del(noti_list_item); } -void noti_list_item_update(Evas_Object *noti_list_item) { +HAPI void noti_list_item_update(Evas_Object *noti_list_item) { retif(noti_list_item == NULL, , "invalid parameter"); _noti_list_item_ongoing_set_progressbar(noti_list_item); @@ -613,7 +625,7 @@ void noti_list_item_update(Evas_Object *noti_list_item) { _noti_list_item_ongoing_set_text(noti_list_item); } -void noti_list_item_set_status(Evas_Object *noti_list_item, int status) { +HAPI void noti_list_item_set_status(Evas_Object *noti_list_item, int status) { retif(noti_list_item == NULL, , "invalid parameter"); noti_list_item_h *noti_list_item_h = evas_object_data_get(noti_list_item, E_DATA_NOTI_LIST_ITEM_H); @@ -623,7 +635,7 @@ void noti_list_item_set_status(Evas_Object *noti_list_item, int status) { } } -int noti_list_item_get_status(Evas_Object *noti_list_item) { +HAPI int noti_list_item_get_status(Evas_Object *noti_list_item) { retif(noti_list_item == NULL, STATE_NORMAL, "invalid parameter"); noti_list_item_h *noti_list_item_h = evas_object_data_get(noti_list_item, E_DATA_NOTI_LIST_ITEM_H); @@ -635,7 +647,7 @@ int noti_list_item_get_status(Evas_Object *noti_list_item) { return STATE_DELETING; } -void noti_list_item_node_set(Evas_Object *noti_list_item, void *data) { +HAPI void noti_list_item_node_set(Evas_Object *noti_list_item, void *data) { retif(noti_list_item == NULL, , "invalid parameter"); retif(data == NULL, , "invalid parameter"); @@ -651,7 +663,7 @@ void noti_list_item_node_set(Evas_Object *noti_list_item, void *data) { } } -void *noti_list_item_node_get(Evas_Object *noti_list_item) { +HAPI void *noti_list_item_node_get(Evas_Object *noti_list_item) { retif(noti_list_item == NULL, NULL, "invalid parameter"); noti_list_item_h *noti_list_item_data = evas_object_data_get(noti_list_item, E_DATA_NOTI_LIST_ITEM_H); @@ -663,7 +675,7 @@ void *noti_list_item_node_get(Evas_Object *noti_list_item) { return NULL; } -void noti_list_item_set_item_selected_cb(Evas_Object *noti_list_item, +HAPI void noti_list_item_set_item_selected_cb(Evas_Object *noti_list_item, void(*selected_cb)(void *data, Evas_Object *obj)) { retif(noti_list_item == NULL, , "invalid parameter"); retif(selected_cb == NULL, , "invalid parameter"); @@ -671,7 +683,7 @@ void noti_list_item_set_item_selected_cb(Evas_Object *noti_list_item, evas_object_data_set(noti_list_item, E_DATA_NOTI_LIST_CB_SELECTED_ITEM, selected_cb); } -void noti_list_item_set_item_button_1_cb(Evas_Object *noti_list_item, +HAPI void noti_list_item_set_item_button_1_cb(Evas_Object *noti_list_item, void(*button_1_cb)(void *data, Evas_Object *obj)) { retif(noti_list_item == NULL, , "invalid parameter"); retif(button_1_cb == NULL, , "invalid parameter"); @@ -679,7 +691,7 @@ void noti_list_item_set_item_button_1_cb(Evas_Object *noti_list_item, evas_object_data_set(noti_list_item, E_DATA_NOTI_LIST_CB_BUTTON_1, button_1_cb); } -void noti_list_item_set_item_deleted_cb(Evas_Object *noti_list_item, +HAPI void noti_list_item_set_item_deleted_cb(Evas_Object *noti_list_item, void(*deleted_cb)(void *data, Evas_Object *obj)) { retif(noti_list_item == NULL, , "invalid parameter"); retif(deleted_cb == NULL, , "invalid parameter"); diff --git a/daemon/notifications/noti_listbox.c b/daemon/notifications/noti_listbox.c index 62be236..f345475 100755 --- a/daemon/notifications/noti_listbox.c +++ b/daemon/notifications/noti_listbox.c @@ -51,7 +51,7 @@ typedef struct _listbox_info_animation { int pos; } listbox_info_animation; -Evas_Object *listbox_create(Evas_Object *parent, void *data) { +HAPI Evas_Object *listbox_create(Evas_Object *parent, void *data) { struct appdata *ad = data; Evas_Object *listbox = NULL; @@ -75,7 +75,7 @@ Evas_Object *listbox_create(Evas_Object *parent, void *data) { return listbox; } -void listbox_remove(Evas_Object *listbox) { +HAPI void listbox_remove(Evas_Object *listbox) { retif(listbox == NULL, , "invalid parameter"); @@ -86,7 +86,7 @@ void listbox_remove(Evas_Object *listbox) { evas_object_del(listbox); } -void listbox_set_item_deleted_cb(Evas_Object *listbox, +HAPI void listbox_set_item_deleted_cb(Evas_Object *listbox, void(*deleted_cb)(void *data, Evas_Object *obj)) { retif(listbox == NULL, , "invalid parameter"); retif(deleted_cb == NULL, , "invalid parameter"); @@ -107,7 +107,7 @@ static void _listbox_call_item_deleted_cb(Evas_Object *listbox, void *data, } } -void listbox_add_item(Evas_Object *listbox, Evas_Object *item, int is_prepend) { +HAPI void listbox_add_item(Evas_Object *listbox, Evas_Object *item, int is_prepend) { const char *signal = NULL; retif(listbox == NULL, , "invalid parameter"); @@ -164,7 +164,7 @@ static void _listbox_remove_item_anim_cb(void *data, Elm_Transit *transit) { info_animation = NULL; } -void listbox_remove_item(Evas_Object *listbox, Evas_Object *item, int with_animation) { +HAPI void listbox_remove_item(Evas_Object *listbox, Evas_Object *item, int with_animation) { retif(listbox == NULL, , "invalid parameter"); retif(item == NULL, , "invalid parameter"); @@ -205,7 +205,7 @@ void listbox_remove_item(Evas_Object *listbox, Evas_Object *item, int with_anima } } -void listbox_remove_all_item(Evas_Object *listbox, int with_animation) { +HAPI void listbox_remove_all_item(Evas_Object *listbox, int with_animation) { DBG(""); retif(listbox == NULL, , "invalid parameter"); @@ -223,7 +223,7 @@ void listbox_remove_all_item(Evas_Object *listbox, int with_animation) { } } -void listbox_update(Evas_Object *listbox) { +HAPI void listbox_update(Evas_Object *listbox) { retif(listbox == NULL, , "invalid parameter"); Eina_List *l; @@ -241,14 +241,14 @@ void listbox_update(Evas_Object *listbox) { } } -void listbox_update_item(Evas_Object *listbox, Evas_Object *item) { +HAPI void listbox_update_item(Evas_Object *listbox, Evas_Object *item) { retif(listbox == NULL, , "invalid parameter"); retif(item == NULL, , "invalid parameter"); noti_list_item_update(item); } -void listbox_remove_and_add_item(Evas_Object *listbox, Evas_Object *item +HAPI void listbox_remove_and_add_item(Evas_Object *listbox, Evas_Object *item ,void (*update_cb)(Evas_Object *list, void *data, int is_prepend) ,void *container, void *data, int pos) { @@ -291,7 +291,7 @@ static void listbox_finalize_rotation_cb(void *data) { elm_box_recalculate(listbox); } -void listbox_rotation(Evas_Object *listbox, int angle) { +HAPI void listbox_rotation(Evas_Object *listbox, int angle) { const char *signal = NULL; retif(listbox == NULL, , "invalid parameter"); diff --git a/daemon/notifications/noti_node.c b/daemon/notifications/noti_node.c index 440af1b..2d5b9a2 100755 --- a/daemon/notifications/noti_node.c +++ b/daemon/notifications/noti_node.c @@ -21,7 +21,7 @@ static void _noti_node_free(noti_node_item *node); -void noti_node_create(noti_node **handle) +HAPI void noti_node_create(noti_node **handle) { retif(handle == NULL, , "Invalid parameter!"); @@ -39,7 +39,7 @@ void noti_node_create(noti_node **handle) } } -void noti_node_destroy(noti_node **handle) +HAPI void noti_node_destroy(noti_node **handle) { retif(handle == NULL, , "Invalid parameter!"); retif(*handle == NULL, , "Invalid parameter!"); @@ -52,7 +52,7 @@ void noti_node_destroy(noti_node **handle) *handle = NULL; } -noti_node_item *noti_node_add(noti_node *handle, notification_h noti, void *view) +HAPI noti_node_item *noti_node_add(noti_node *handle, notification_h noti, void *view) { int priv_id = 0; notification_type_e noti_type = NOTIFICATION_TYPE_NONE; @@ -85,7 +85,7 @@ noti_node_item *noti_node_add(noti_node *handle, notification_h noti, void *view return NULL; } -void noti_node_remove(noti_node *handle, int priv_id) +HAPI void noti_node_remove(noti_node *handle, int priv_id) { notification_type_e noti_type = NOTIFICATION_TYPE_NONE; @@ -115,7 +115,7 @@ void noti_node_remove(noti_node *handle, int priv_id) } } -noti_node_item *noti_node_get(noti_node *handle, int priv_id) +HAPI noti_node_item *noti_node_get(noti_node *handle, int priv_id) { retif(handle == NULL, NULL, "Invalid parameter!"); retif(handle->table == NULL, NULL, "Invalid parameter!"); @@ -124,7 +124,7 @@ noti_node_item *noti_node_get(noti_node *handle, int priv_id) (handle->table, GINT_TO_POINTER(priv_id)); } -int noti_node_get_item_count(noti_node *handle, notification_type_e noti_type) +HAPI int noti_node_get_item_count(noti_node *handle, notification_type_e noti_type) { retif(handle == NULL, 0, "Invalid parameter!"); diff --git a/daemon/notifications/noti_section.c b/daemon/notifications/noti_section.c index 06fc604..913153b 100755 --- a/daemon/notifications/noti_section.c +++ b/daemon/notifications/noti_section.c @@ -80,7 +80,7 @@ static void _noti_section_set_text(Evas_Object *noti_section, int count) elm_object_part_text_set(noti_section, "elm.text.text", text); } -Evas_Object *noti_section_create(Evas_Object *parent) { +HAPI Evas_Object *noti_section_create(Evas_Object *parent) { Eina_Bool ret = EINA_FALSE; Evas_Object *section = NULL; @@ -103,14 +103,14 @@ Evas_Object *noti_section_create(Evas_Object *parent) { return section; } -void noti_section_update(Evas_Object *noti_section, int noti_count) { +HAPI void noti_section_update(Evas_Object *noti_section, int noti_count) { retif(noti_section == NULL, , "invalid parameter"); _noti_section_set_button(noti_section); _noti_section_set_text(noti_section, noti_count); } -void noti_section_remove(Evas_Object *noti_section) { +HAPI void noti_section_remove(Evas_Object *noti_section) { retif(noti_section == NULL, , "invalid parameter"); quickpanel_list_util_item_del_tag(noti_section); diff --git a/daemon/notifications/noti_util.c b/daemon/notifications/noti_util.c new file mode 100755 index 0000000..3d4a454 --- /dev/null +++ b/daemon/notifications/noti_util.c @@ -0,0 +1,171 @@ +/* + * Copyright 2012 Samsung Electronics Co., Ltd + * + * Licensed under the Flora License, Version 1.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.tizenopensource.org/license + * + * 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 <unicode/uloc.h> +#include <unicode/udat.h> +#include <unicode/udatpg.h> +#include <unicode/ustring.h> +#include <runtime_info.h> + +#include "quickpanel-ui.h" +#include "common.h" +#include "noti_util.h" + +#define QP_NOTI_DAY_DEC (24 * 60 * 60) + +HAPI int quickpanel_noti_get_event_count_from_noti(notification_h noti) { + char *text_count = NULL; + + retif(noti == NULL, 0, "Invalid parameter!"); + + notification_get_text(noti, NOTIFICATION_TEXT_TYPE_EVENT_COUNT, &text_count); + if (text_count != NULL) { + return atoi(text_count); + } + return 1; +} + +HAPI int quickpanel_noti_get_event_count_by_pkgname(const char *pkgname) { + int count = 0; + notification_h noti = NULL; + notification_list_h noti_list = NULL; + + retif(pkgname == NULL, 0, "Invalid parameter!"); + + DBG("%s", pkgname); + + notification_get_detail_list(pkgname, NOTIFICATION_GROUP_ID_NONE, NOTIFICATION_PRIV_ID_NONE, -1, ¬i_list); + if (noti_list != NULL) { + noti = notification_list_get_data(noti_list); + if (noti != NULL) { + count = quickpanel_noti_get_event_count_from_noti(noti); + } + notification_free_list(noti_list); + return count; + } + + return 0; +} + +HAPI char *quickpanel_noti_get_time(time_t t, char *buf, int buf_len) +{ + UErrorCode status = U_ZERO_ERROR; + UDateTimePatternGenerator *generator; + UDateFormat *formatter; + UChar skeleton[40] = { 0 }; + UChar pattern[40] = { 0 }; + UChar formatted[40] = { 0 }; + int32_t patternCapacity, formattedCapacity; + int32_t skeletonLength, patternLength, formattedLength; + UDate date; + const char *locale; + const char customSkeleton[] = UDAT_YEAR_NUM_MONTH_DAY; + char bf1[32] = { 0, }; + bool is_24hour_enabled = FALSE; + + struct tm loc_time; + time_t today, yesterday; + int ret = 0; + + today = time(NULL); + localtime_r(&today, &loc_time); + + loc_time.tm_sec = 0; + loc_time.tm_min = 0; + loc_time.tm_hour = 0; + today = mktime(&loc_time); + + yesterday = today - QP_NOTI_DAY_DEC; + + localtime_r(&t, &loc_time); + + if (t >= yesterday && t < today) { + ret = snprintf(buf, buf_len, _S("IDS_COM_BODY_YESTERDAY")); + } else if (t < yesterday) { + /* set UDate from time_t */ + date = (UDate) t * 1000; + + /* get default locale */ + /* for thread saftey */ + uloc_setDefault(__secure_getenv("LC_TIME"), &status); + locale = uloc_getDefault(); + + /* open datetime pattern generator */ + generator = udatpg_open(locale, &status); + if (generator == NULL) + return NULL; + + /* calculate pattern string capacity */ + patternCapacity = + (int32_t) (sizeof(pattern) / sizeof((pattern)[0])); + + /* ascii to unicode for input skeleton */ + u_uastrcpy(skeleton, customSkeleton); + + /* get skeleton length */ + skeletonLength = strlen(customSkeleton); + + /* get best pattern using skeleton */ + patternLength = + udatpg_getBestPattern(generator, skeleton, skeletonLength, + pattern, patternCapacity, &status); + + /* open datetime formatter using best pattern */ + formatter = + udat_open(UDAT_IGNORE, UDAT_DEFAULT, locale, NULL, -1, + pattern, patternLength, &status); + if (formatter == NULL) { + udatpg_close(generator); + return NULL; + } + + /* calculate formatted string capacity */ + formattedCapacity = + (int32_t) (sizeof(formatted) / sizeof((formatted)[0])); + + /* formatting date using formatter by best pattern */ + formattedLength = + udat_format(formatter, date, formatted, formattedCapacity, + NULL, &status); + + /* unicode to ascii to display */ + u_austrcpy(bf1, formatted); + + /* close datetime pattern generator */ + udatpg_close(generator); + + /* close datetime formatter */ + udat_close(formatter); + + ret = snprintf(buf, buf_len, "%s", bf1); + } else { + ret = runtime_info_get_value_bool( + RUNTIME_INFO_KEY_24HOUR_CLOCK_FORMAT_ENABLED, &is_24hour_enabled); + if (ret == RUNTIME_INFO_ERROR_NONE && is_24hour_enabled == TRUE) { + ret = strftime(buf, buf_len, "%H:%M", &loc_time); + } else { + strftime(bf1, sizeof(bf1), "%l:%M", &loc_time); + + if (loc_time.tm_hour >= 0 && loc_time.tm_hour < 12) + ret = snprintf(buf, buf_len, "%s%s", bf1, "AM"); + else + ret = snprintf(buf, buf_len, "%s%s", bf1, "PM"); + } + + } + + return ret <= 0 ? NULL : buf; +} diff --git a/daemon/notifications/noti_util.h b/daemon/notifications/noti_util.h new file mode 100755 index 0000000..560c809 --- /dev/null +++ b/daemon/notifications/noti_util.h @@ -0,0 +1,26 @@ +/* + * Copyright 2012 Samsung Electronics Co., Ltd + * + * Licensed under the Flora License, Version 1.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.tizenopensource.org/license + * + * 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. + */ + +#ifndef _QP_NOTI_UTIL_DEF_ +#define _QP_NOTI_UTIL_DEF_ + +#include <notification.h> + +HAPI int quickpanel_noti_get_event_count_from_noti(notification_h noti); +int quickpanel_noti_get_event_count_by_pkgname(const char *pkgname); +char *quickpanel_noti_get_time(time_t t, char *buf, int buf_len); + +#endif diff --git a/daemon/notifications/noti_win.c b/daemon/notifications/noti_win.c index 65210c5..c3228c6 100755 --- a/daemon/notifications/noti_win.c +++ b/daemon/notifications/noti_win.c @@ -204,7 +204,7 @@ static Eina_Bool _prop_change(void *data, int type __UNUSED__, void *event) } #endif -Evas_Object *noti_win_add(Evas_Object *parent) +HAPI Evas_Object *noti_win_add(Evas_Object *parent) { Evas_Object *win; Evas_Object *bg; @@ -250,7 +250,7 @@ Evas_Object *noti_win_add(Evas_Object *parent) return win; } -void noti_win_content_set(Evas_Object *obj, Evas_Object *content) +HAPI void noti_win_content_set(Evas_Object *obj, Evas_Object *content) { Evas_Coord h; struct Internal_Data *wd; @@ -280,7 +280,7 @@ void noti_win_content_set(Evas_Object *obj, Evas_Object *content) } } -void noti_win_orient_set(Evas_Object *obj, enum Noti_Orient orient) +HAPI void noti_win_orient_set(Evas_Object *obj, enum Noti_Orient orient) { #ifdef HAVE_X Evas_Coord root_w, root_h; diff --git a/daemon/notifications/ticker.c b/daemon/notifications/ticker.c index 36b45e3..ef2b406 100755 --- a/daemon/notifications/ticker.c +++ b/daemon/notifications/ticker.c @@ -21,13 +21,13 @@ #include <appsvc.h> #include <app_service.h> #include <notification.h> -#include <time.h> #include <feedback.h> #include "quickpanel-ui.h" #include "common.h" #include "noti.h" #include "noti_win.h" +#include "noti_util.h" #define QP_TICKER_DURATION 5 #define QP_TICKER_DETAIL_DURATION 6 @@ -35,6 +35,9 @@ #define TICKER_MSG_LEN 1024 #define DEFAULT_ICON ICONDIR "/quickpanel_icon_default.png" +#define E_DATA_IS_TICKERNOTI_CONTENT "E_DATA_TN_CONTENT" +#define E_DATA_IS_TICKERNOTI_EXECUTED "E_DATA_TN_EXECUTED" + #define FORMAT_1LINE "<font_size=29><color=#BABABA>%s</color></font>" #define FORMAT_2LINE "<font_size=26><color=#BABABA>%s</color></font><br><font_size=29><color=#F4F4F4>%s</color></font>" #define FORMAT_2LINE_SINGLE "<font_size=26><color=#BABABA>%s</color></font><br><font_size=29><color=#F4F4F4>%s %s</color></font>" @@ -50,6 +53,7 @@ static int quickpanel_ticker_fini(void *data); static int quickpanel_ticker_enter_hib(void *data); static int quickpanel_ticker_leave_hib(void *data); static void quickpanel_ticker_reflesh(void *data); +static void _quickpanel_ticker_destroy_tickernoti(Evas_Object *tickernoti); QP_Module ticker = { .name = "ticker", @@ -61,8 +65,6 @@ QP_Module ticker = { .refresh = quickpanel_ticker_reflesh }; -static int latest_inserted_time; - /***************************************************************************** * * (Static) Util functions @@ -82,6 +84,7 @@ static void _quickpanel_ticker_clicked_cb(void *data, Evas_Object *obj, notification_type_e type = NOTIFICATION_TYPE_NONE; notification_h noti = NULL; int is_lock_launched = VCONFKEY_IDLE_UNLOCK; + int *is_ticker_executed = NULL; noti = data; retif(noti == NULL, , "Invalid parameter!"); @@ -103,10 +106,21 @@ static void _quickpanel_ticker_clicked_cb(void *data, Evas_Object *obj, notification_get_property(noti, &flags); notification_get_type(noti, &type); - if (flags & NOTIFICATION_PROP_DISABLE_APP_LAUNCH) + if (flags & NOTIFICATION_PROP_DISABLE_APP_LAUNCH) { flag_launch = 0; - else - flag_launch = 1; + } else { + is_ticker_executed = evas_object_data_get(obj, E_DATA_IS_TICKERNOTI_EXECUTED); + if (is_ticker_executed != NULL) { + if (*is_ticker_executed == 0) { + flag_launch = 1; + *is_ticker_executed = 1; + } else { + flag_launch = 0; + } + } else { + flag_launch = 0; + } + } if (flags & NOTIFICATION_PROP_DISABLE_AUTO_DELETE) flag_delete = 0; @@ -271,7 +285,7 @@ static void _quickpanel_ticker_hide(void *data) { if (g_ticker) { evas_object_hide(g_ticker); - evas_object_del(g_ticker); + _quickpanel_ticker_destroy_tickernoti(g_ticker); g_ticker = NULL; } } @@ -558,6 +572,7 @@ static Evas_Object *_quickpanel_ticker_create_tickernoti(void *data) char *buf = NULL; const char *data_win_height = NULL; int noti_height = 0; + int *is_ticker_executed = NULL; retif(noti == NULL, NULL, "Invalid parameter!"); @@ -567,7 +582,7 @@ static Evas_Object *_quickpanel_ticker_create_tickernoti(void *data) detail = elm_layout_add(tickernoti); if (!detail) { ERR("Failed to get detailview."); - evas_object_del(tickernoti); + _quickpanel_ticker_destroy_tickernoti(tickernoti); return NULL; } elm_layout_theme_set(detail, "tickernoti", "base", "default"); @@ -603,10 +618,37 @@ static Evas_Object *_quickpanel_ticker_create_tickernoti(void *data) * "info" for text only mode */ elm_object_style_set(tickernoti, "default"); + evas_object_data_set(tickernoti, E_DATA_IS_TICKERNOTI_CONTENT, detail); + is_ticker_executed = (int *)malloc(sizeof(int)); + if (is_ticker_executed != NULL) { + *is_ticker_executed = 0; + evas_object_data_set(detail, E_DATA_IS_TICKERNOTI_EXECUTED, is_ticker_executed); + } return tickernoti; } +static void _quickpanel_ticker_destroy_tickernoti(Evas_Object *tickernoti) +{ + int *is_ticker_executed = NULL; + Evas_Object *detail = NULL; + + retif(tickernoti == NULL, , "Invalid parameter!"); + + detail = evas_object_data_get(tickernoti, E_DATA_IS_TICKERNOTI_CONTENT); + + if (detail != NULL) { + is_ticker_executed = evas_object_data_get(detail, E_DATA_IS_TICKERNOTI_EXECUTED); + if (is_ticker_executed != NULL) { + evas_object_data_del(detail, E_DATA_IS_TICKERNOTI_EXECUTED); + free(is_ticker_executed); + } + evas_object_data_del(detail, E_DATA_IS_TICKERNOTI_CONTENT); + } + + evas_object_del(tickernoti); +} + static int _quickpanel_ticker_get_angle(void *data) { struct appdata *ad = (struct appdata *)data; @@ -850,7 +892,6 @@ static int quickpanel_ticker_init(void *data) { struct appdata *ad = (struct appdata *)data; - latest_inserted_time = time(NULL); g_window = ad->win; notification_register_detailed_changed_cb(_quickpanel_ticker_noti_detailed_changed_cb, diff --git a/daemon/quickpanel-ui.c b/daemon/quickpanel-ui.c index 7419875..47b138e 100755 --- a/daemon/quickpanel-ui.c +++ b/daemon/quickpanel-ui.c @@ -35,7 +35,7 @@ #include "list_util.h" #define QP_WINDOW_PRIO 300 -#define QP_ENABLE_HIDING_INDICATOR 0 +#define QP_ENABLE_HIDING_INDICATOR 1 static struct appdata *g_app_data = NULL; @@ -49,12 +49,12 @@ static void _quickpanel_ui_update_height(void *data); static void _quickpanel_ui_set_indicator_cover(void *data); static void _quickpanel_move_data_to_service(const char *key, const char *val, void *data); -void *quickpanel_get_app_data(void) +HAPI void *quickpanel_get_app_data(void) { return g_app_data; } -int quickpanel_is_suspended(void) +HAPI int quickpanel_is_suspended(void) { struct appdata *ad = quickpanel_get_app_data(); retif(ad == NULL, 0, "invalid data."); @@ -62,7 +62,7 @@ int quickpanel_is_suspended(void) return ad->is_suspended; } -int quickpanel_is_emul(void) +HAPI int quickpanel_is_emul(void) { int is_emul = 0; char *info = NULL; @@ -79,7 +79,7 @@ int quickpanel_is_emul(void) return is_emul; } -int quickpanel_launch_app(char *app_id, void *data) +HAPI int quickpanel_launch_app(char *app_id, void *data) { int ret = SERVICE_ERROR_NONE; service_h service = NULL; @@ -114,7 +114,7 @@ int quickpanel_launch_app(char *app_id, void *data) return ret; } -void quickpanel_launch_app_inform_result(const char *pkgname, int retcode) +HAPI void quickpanel_launch_app_inform_result(const char *pkgname, int retcode) { retif(retcode == SERVICE_ERROR_NONE, , "Invialid parameter!"); retif(pkgname == NULL && retcode != SERVICE_ERROR_APP_NOT_FOUND, , "Invialid parameter!"); @@ -372,7 +372,7 @@ static void _quickpanel_add_debugging_bar(Evas_Object *list) } } -Evas_Object *quickpanel_ui_load_edj(Evas_Object * parent, const char *file, +HAPI Evas_Object *quickpanel_ui_load_edj(Evas_Object * parent, const char *file, const char *group, int is_just_load) { Eina_Bool r; @@ -415,7 +415,11 @@ static int _quickpanel_ui_create_win(void *data) } #ifdef QP_INDICATOR_WIDGET_ENABLE ad->comformant = elm_conformant_add(ad->win); +#if QP_ENABLE_HIDING_INDICATOR + elm_object_style_set(ad->comformant, "without_resize"); +#else elm_object_style_set(ad->comformant, "nokeypad"); +#endif ad->ly = quickpanel_ui_load_edj(ad->comformant, DEFAULT_EDJ, "quickpanel/gl_base", 0); @@ -970,7 +974,22 @@ static void quickpanel_app_region_format_changed_cb(void *data) INFO(" >>>>>>>>>>>>>>> region_format CHANGED!! <<<<<<<<<<<<<<<< "); } -void quickpanel_close_quickpanel(bool is_check_lock) { +HAPI void quickpanel_open_quickpanel(void) { + Ecore_X_Window xwin; + struct appdata *ad = g_app_data; + + DBG(""); + + retif(ad == NULL, , "Invalid parameter!"); + retif(ad->win == NULL, , "Invalid parameter!"); + + xwin = elm_win_xwindow_get(ad->win); + + if (xwin != 0) + ecore_x_e_illume_quickpanel_state_send(ecore_x_e_illume_zone_get(xwin),ECORE_X_ILLUME_QUICKPANEL_STATE_ON); +} + +HAPI void quickpanel_close_quickpanel(bool is_check_lock) { Ecore_X_Window xwin; int is_lock_launched = VCONFKEY_IDLE_UNLOCK; struct appdata *ad = g_app_data; diff --git a/daemon/quickpanel-ui.h b/daemon/quickpanel-ui.h index 86c151a..79553df 100755 --- a/daemon/quickpanel-ui.h +++ b/daemon/quickpanel-ui.h @@ -94,6 +94,7 @@ struct appdata { Evas_Object *cover_indicator_left; Evas_Object *cover_indicator_right; + Ecore_X_Atom *E_ILLUME_ATOM_MV_QUICKPANEL_STATE; }; @@ -128,5 +129,6 @@ Evas_Object *quickpanel_ui_load_edj(Evas_Object * parent, const char *file, const char *group, int is_just_load); void quickpanel_ui_set_indicator_cover(void *data); void quickpanel_close_quickpanel(bool is_check_lock); +void quickpanel_open_quickpanel(void); #endif /* __QUICKPANEL_UI_H__ */ |