2 * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the License);
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an AS IS BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 #include <Elementary.h>
23 #include "attach_panel.h"
24 #include "attach_panel_internal.h"
36 static int __rua_stat_tag_iter_cb(const char *rua_stat_tag, void *data)
38 Eina_List *content_list = data;
41 content_s *content_info = NULL;
43 retv_if(!content_list, -1);
44 retv_if(!rua_stat_tag, -1);
46 _D("[Rua] %d : %s", list_info.ordering, rua_stat_tag);
47 EINA_LIST_FOREACH_SAFE(content_list, l, ln, content_info) {
48 continue_if(!content_info);
49 continue_if(!content_info->innate_content_info);
50 if (!strcmp(rua_stat_tag, content_info->innate_content_info->appid)) {
51 content_info->order = list_info.ordering;
52 list_info.ordering ++;
61 static int __sort_cb(const void *d1, const void *d2)
63 content_s *content_info1 = (content_s *) d1;
64 content_s *content_info2 = (content_s *) d2;
66 if (!content_info1 || !content_info1->innate_content_info) {
69 if (!content_info2 || !content_info2->innate_content_info) {
72 if (content_info1->innate_content_info->is_ug || content_info2->innate_content_info->is_ug) {
75 if (content_info1->order < content_info2->order) {
77 } else if (content_info1->order > content_info2->order) {
80 return (strcmp(content_info1->innate_content_info->appid, content_info2->innate_content_info->appid));
86 Eina_List * _list_sort_by_rua(Eina_List *content_list)
90 retv_if(!content_list, NULL);
92 list_info.ordering = 1;
93 ret = rua_stat_get_stat_tags("attach-panel", __rua_stat_tag_iter_cb, content_list);
94 retv_if(0 != ret, NULL);
96 content_list = eina_list_sort(content_list, eina_list_count(content_list), __sort_cb);