2 * Copyright 2012 Samsung Electronics Co., Ltd
4 * Licensed under the Flora License, Version 1.1 (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://floralicense.org/license/
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.
17 #include "homescreen-efl.h"
28 HAPI app_item_t *app_item_create(const app_item_type_t type, const int unique_id,
29 const char *label, const char *icon, const char *exec,
30 const char *appid, void *data, bool is_removeable,
31 int col, int row, int col_span, int row_span,
32 const char *content_info)
34 app_item_t *item = (app_item_t *)calloc(1, sizeof(app_item_t));
37 dlog_print(DLOG_ERROR, LOG_TAG, "[ALLOC_FAILED]");
43 item->unique_id = ++s_app_item_info.unique_id;
45 item->unique_id = unique_id;
46 s_app_item_info.unique_id = s_app_item_info.unique_id > unique_id ? s_app_item_info.unique_id : unique_id;
50 item->label = strdup(label);
52 item->icon = strdup(icon);
54 item->exec = strdup(exec);
56 item->appid = strdup(appid);
58 item->content_info = strdup(content_info);
60 item->badge_count = 0;
62 item->removable = is_removeable;
63 item->is_checked = false;
65 item->grid_item = NULL;
69 item->col_span = col_span;
70 item->row_span = row_span;
76 HAPI void app_item_free(app_item_t *item)
81 free((void *)item->label);
82 free((void *)item->icon);
83 free((void *)item->exec);
84 free((void *)item->appid);
85 free((void *)item->content_info);
90 HAPI void app_item_geometry_update(app_item_t *app_item, int x, int y, int w, int h)
93 LOGE("app_item == NULL");
99 app_item->col_span = w;
100 app_item->row_span = h;
103 HAPI void app_item_update_content_info(app_item_t *app_item, const char *content_info)
106 LOGE("app_item == NULL");
110 if (app_item->content_info)
111 free(app_item->content_info);
114 app_item->content_info = strdup(content_info);
116 app_item->content_info = NULL;