2 * Copyright (c) 2009-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>
20 #include <tzsh_quickpanel_service.h>
23 #include "quickpanel-ui.h"
25 #include "quickpanel_def.h"
26 #include "animated_icon.h"
28 #define E_DATA_ANI_ICON_TYPE "ANI_ICON_TYPE"
29 #define PATH_DOWNLOAD "reserved://quickpanel/ani/downloading"
30 #define PATH_UPLOAD "reserved://quickpanel/ani/uploading"
31 #define PATH_INSTALL "reserved://quickpanel/ani/install"
33 static qp_animated_icon_type _animated_type_get(const char *path)
35 retif_nomsg(path == NULL, QP_ANIMATED_ICON_NONE);
37 if (strncasecmp(path, PATH_DOWNLOAD, MIN(strlen(PATH_DOWNLOAD), strlen(path))) == 0) {
38 return QP_ANIMATED_ICON_DOWNLOAD;
39 } else if (strncasecmp(path, PATH_UPLOAD, MIN(strlen(PATH_UPLOAD), strlen(path))) == 0) {
40 return QP_ANIMATED_ICON_UPLOAD;
41 } else if (strncasecmp(path, PATH_INSTALL, MIN(strlen(PATH_INSTALL), strlen(path))) == 0) {
42 return QP_ANIMATED_ICON_INSTALL;
45 return QP_ANIMATED_ICON_NONE;
48 HAPI Evas_Object *quickpanel_animated_icon_get(Evas_Object *parent, const char *path)
50 qp_animated_icon_type type = QP_ANIMATED_ICON_NONE;
51 const char *layout_icon = NULL;
52 Evas_Object *layout = NULL;
53 retif_nomsg(parent == NULL, NULL);
54 retif_nomsg(path == NULL, NULL);
56 type = _animated_type_get(path);
58 if (type == QP_ANIMATED_ICON_DOWNLOAD) {
59 layout_icon = "quickpanel/animated_icon_download";
60 } else if (type == QP_ANIMATED_ICON_UPLOAD) {
61 layout_icon = "quickpanel/animated_icon_upload";
62 } else if (type == QP_ANIMATED_ICON_INSTALL) {
63 layout_icon = "quickpanel/animated_icon_install";
68 layout = elm_layout_add(parent);
70 elm_layout_file_set(layout, DEFAULT_EDJ, layout_icon);
71 evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
72 evas_object_size_hint_align_set(layout, EVAS_HINT_FILL, EVAS_HINT_FILL);
73 evas_object_data_set(layout, E_DATA_ANI_ICON_TYPE, (void *)type);
74 evas_object_show(layout);
80 HAPI int quickpanel_animated_icon_is_same_icon(Evas_Object *view, const char *path)
82 qp_animated_icon_type type = QP_ANIMATED_ICON_NONE;
83 qp_animated_icon_type type_old = QP_ANIMATED_ICON_NONE;
84 retif_nomsg(view == NULL, 0);
85 retif_nomsg(path == NULL, 0);
87 type = _animated_type_get(path);
88 type_old = (qp_animated_icon_type)evas_object_data_get(view,
89 E_DATA_ANI_ICON_TYPE);
91 if (type == type_old) {