From 90a00c3b013fa76a40f2bd1816b22e0c1725be65 Mon Sep 17 00:00:00 2001 From: Taeyoung Kim Date: Tue, 9 Apr 2013 22:30:44 +0900 Subject: [PATCH] Fix the issue which tickernoti is not shown when host keyboard is on/off Signed-off-by: Taeyoung Kim --- CMakeLists.txt | 1 + sys_pci_noti/sys_pci_noti.c | 57 ++++++++++++--------------------------------- 2 files changed, 16 insertions(+), 42 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8ad3a00..78aed6d 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -42,6 +42,7 @@ pkg_check_modules(pkgs REQUIRED tapi dlog syspopup-caller + notification devman device-node) diff --git a/sys_pci_noti/sys_pci_noti.c b/sys_pci_noti/sys_pci_noti.c index 93601c9..7f3b279 100755 --- a/sys_pci_noti/sys_pci_noti.c +++ b/sys_pci_noti/sys_pci_noti.c @@ -20,17 +20,26 @@ #include #include #include +#include #include "ss_log.h" #include "sys_pci_noti.h" -#define TICKERNOTI_LOCATION_TOP 0 +static void show_tickernoti(char *msg) +{ + if (!msg) + return; + + notification_error_e noti_err = NOTIFICATION_ERROR_NONE; + noti_err = notification_status_message_post(gettext(msg)); + if (noti_err != NOTIFICATION_ERROR_NONE) + PRT_TRACE_ERR("FAIL: notification_status_message_post(msg)"); +} static void pci_noti(pci_noti_type iPCI) { char *lang; char *r; int ret = -1; - bundle *b = NULL; const int arrSize = 2; char str_tickernoti[arrSize]; @@ -47,50 +56,14 @@ static void pci_noti(pci_noti_type iPCI) bindtextdomain("sys_pci_noti","/usr/share/system-server/sys_pci_noti/res/locale/"); textdomain("sys_pci_noti"); - b = bundle_create(); - if(b == NULL) { - PRT_TRACE_ERR("FAIL: bundle_create()"); - return; - } - /* set tickernoti style */ - ret = bundle_add(b, "0", "info"); - if (ret != 0) - goto BUNDLE_ADD_ERR; - - /* set tickernoti text */ if (iPCI == CB_NOTI_PCI_REMOVED) - ret = bundle_add(b, "1", _("IDS_COM_POP_KEYBOARD_DISCONNECTED_ABB2")); - else if (iPCI == CB_NOTI_PCI_INSERTED) - ret = bundle_add(b, "1", _("IDS_COM_POP_KEYBOARD_CONNECTED_ABB2")); - if (ret != 0) - goto BUNDLE_ADD_ERR; - /* set tickernoti orientation */ - snprintf(str_tickernoti,arrSize,"%d",TICKERNOTI_LOCATION_TOP); - ret = bundle_add(b, "2", str_tickernoti); - if (ret != 0) - goto BUNDLE_ADD_ERR; - - /* set tickernoti timeout */ - ret = bundle_add(b, "3", "3"); - if (ret != 0) - goto BUNDLE_ADD_ERR; - - /* launch tickernoti */ - ret = syspopup_launch("tickernoti-syspopup", b); - if (ret < 0) - PRT_TRACE_ERR("FAIL: syspopup_launch()"); + show_tickernoti(_("IDS_COM_POP_KEYBOARD_DISCONNECTED_ABB2")); - if(bundle_free(b) != 0) - PRT_TRACE_ERR("FAIL: bundle_free()"); - return; - -BUNDLE_ADD_ERR: - PRT_TRACE_ERR("FAIL: bundle_add()"); - if (bundle_free(b) != 0) - PRT_TRACE_ERR("FAIL: bundle_free()"); - return; + else if (iPCI == CB_NOTI_PCI_INSERTED) + show_tickernoti(_("IDS_COM_POP_KEYBOARD_CONNECTED_ABB2")); } + int main(int argc, char *argv[]) { int r = 0; -- 2.7.4