information/noti: Updating icon fix. 58/92858/4
authorRadoslaw Czerski <r.czerski@samsung.com>
Fri, 21 Oct 2016 12:57:23 +0000 (14:57 +0200)
committerRadoslaw Czerski <r.czerski@samsung.com>
Fri, 21 Oct 2016 12:57:23 +0000 (14:57 +0200)
Syntax error: missed curly braces added.
Unneeded copying removed.

Change-Id: Ia81275483735bcdff7018277a64bc623b7407b40
Signed-off-by: Radoslaw Czerski <r.czerski@samsung.com>
src/modules/information/noti.c

index 9eda3fe..1326ae9 100644 (file)
@@ -312,6 +312,7 @@ static bool _indicator_noti_display_check(notification_h noti)
 
 static void _remove_noti_by_privid(int priv_id)
 {
+       _D();
        Eina_List *l = NULL;
        struct noti_status *n_data = NULL;
        char priv_id_str[256] = {0,};
@@ -321,7 +322,7 @@ static void _remove_noti_by_privid(int priv_id)
        EINA_LIST_FOREACH(status_list, l, n_data) {
 
                if (!strcmp(n_data->icon->name, priv_id_str)) {
-                       _D("remove %s", priv_id_str);
+                       _D("Removed notification: %s; Icon path:%s", priv_id_str, n_data->icon->img_obj.data);
                        status_list = eina_list_remove(status_list, n_data);
                        hide_image_icon(n_data);
                        free_image_icon(n_data);
@@ -333,6 +334,7 @@ static void _remove_noti_by_privid(int priv_id)
 
 static void _insert_noti_by_privid(notification_h noti, void *data)
 {
+       _D();
        int ret;
        struct noti_status *status = NULL;
        int prev_id = -1;
@@ -351,8 +353,9 @@ static void _insert_noti_by_privid(notification_h noti, void *data)
        retm_if(ret != NOTIFICATION_ERROR_NONE, "notification_get_id failed[%d]:%s", ret , get_error_message(ret));
 
        ret = notification_get_image(noti, NOTIFICATION_IMAGE_TYPE_ICON_FOR_INDICATOR, &icon_path);
-       retm_if(ret != NOTIFICATION_ERROR_NONE, "notification_get_id failed[%d]:%s", ret , get_error_message(ret));
+       retm_if(ret != NOTIFICATION_ERROR_NONE, "notification_get_image failed[%d]:%s", ret , get_error_message(ret));
 
+       _D("PATH:%s", icon_path);
        if (!icon_path) {
                _E("The icon path is NULL");
                return;
@@ -379,6 +382,7 @@ static void _insert_noti_by_privid(notification_h noti, void *data)
 
 static void _update_noti_by_privid(notification_h noti)
 {
+       _D();
        Eina_List *l = NULL;
        struct noti_status *n_data = NULL;
        int priv_id = -1;
@@ -398,20 +402,20 @@ static void _update_noti_by_privid(notification_h noti)
 
        snprintf(priv_id_str, sizeof(priv_id_str), "%d", priv_id);
 
-       char *indicator_path = NULL;
        char *icon_path = NULL;
 
-       ret = notification_get_image(noti, NOTIFICATION_IMAGE_TYPE_ICON_FOR_INDICATOR, &indicator_path);
+       ret = notification_get_image(noti, NOTIFICATION_IMAGE_TYPE_ICON_FOR_INDICATOR, &icon_path);
        retm_if(ret != NOTIFICATION_ERROR_NONE, "notification_get_image failed[%d]:%s", ret , get_error_message(ret));
 
-       if (!indicator_path)
+       _D("PATH:%s", icon_path);
+       if (!icon_path) {
                _E("The icon path is NULL");
                return;
+       }
 
-       if (ecore_file_exists(indicator_path) ||
-                       util_check_noti_ani(indicator_path) ||
-                       util_reserved_path_check(indicator_path)) {
-               icon_path = strdup(indicator_path);
+       if (ecore_file_exists(icon_path) ||
+                       util_check_noti_ani(icon_path) ||
+                       util_reserved_path_check(icon_path)) {
 
                EINA_LIST_FOREACH(status_list, l, n_data) {
                        if (!strcmp(n_data->icon->name, priv_id_str)) {
@@ -430,10 +434,6 @@ static void _update_noti_by_privid(notification_h noti)
                }
        } else
                _E("The path is invalid:%s", icon_path);
-       if (icon_path) {
-               free(icon_path);
-               icon_path = NULL;
-       }
 
        return;
 }
@@ -474,7 +474,7 @@ static void _change_icon_status(void *data, notification_list_h noti_list)
 
                ret = notification_get_image(noti, NOTIFICATION_IMAGE_TYPE_ICON_FOR_INDICATOR, &icon_path);
                if (ret != NOTIFICATION_ERROR_NONE) continue;
-
+               _D("PATH:%s", icon_path);
                if (!icon_path) {
                        _E("The file path is NULL");
                        continue;
@@ -501,6 +501,7 @@ static void _change_icon_status(void *data, notification_list_h noti_list)
 
 void update_noti_module_new(void *data, notification_type_e type)
 {
+       _D();
        notification_list_h list = NULL;
        notification_error_e ret = NOTIFICATION_ERROR_NONE;
 
@@ -518,6 +519,7 @@ void update_noti_module_new(void *data, notification_type_e type)
 
 static void _indicator_noti_detailed_changed_cb(void *data, notification_type_e type, notification_op *op_list, int num_op)
 {
+       _D();
        int i = 0;
        int op_type = 0;
        int priv_id = 0;