Fix the issue which tickernoti is not shown when host keyboard is on/off
authorTaeyoung Kim <ty317.kim@samsung.com>
Tue, 9 Apr 2013 13:30:44 +0000 (22:30 +0900)
committerTaeyoung Kim <ty317.kim@samsung.com>
Tue, 9 Apr 2013 13:30:44 +0000 (22:30 +0900)
Signed-off-by: Taeyoung Kim <ty317.kim@samsung.com>
CMakeLists.txt
sys_pci_noti/sys_pci_noti.c

index 8ad3a00..78aed6d 100755 (executable)
@@ -42,6 +42,7 @@ pkg_check_modules(pkgs REQUIRED
        tapi
        dlog
        syspopup-caller
+       notification
        devman
        device-node)
 
index 93601c9..7f3b279 100755 (executable)
 #include <locale.h>
 #include <vconf.h>
 #include <syspopup_caller.h>
+#include <notification.h>
 #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;