version update: m1
[profile/tv/apps/native/air_etg.git] / src / utils.c
1 /*
2  * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
3  *
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
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  */
16
17 #include <Elementary.h>
18 #include <app_debug.h>
19 #include <stdbool.h>
20 #include <app.h>
21
22 #include "utils.h"
23 #include "defs.h"
24
25 Evas_Object *utils_add_layout(Evas_Object *base, const char *group,
26                 bool focus_allow, const char *part)
27 {
28         Evas_Object *ly;
29
30         if (!base || !group) {
31                 _ERR("Invalid argument");
32                 return NULL;
33         }
34
35         ly = elm_layout_add(base);
36         if (!ly) {
37                 _ERR("failed to add layout");
38                 return false;
39         }
40         elm_layout_file_set(ly, EDJEFILE, group);
41
42         if (focus_allow)
43                 elm_object_focus_allow_set(ly, EINA_TRUE);
44         if (part)
45                 elm_object_part_content_set(base, part, ly);
46
47         return ly;
48 }
49