Load voice-control-elm library in the thread
[platform/core/appfw/app-core.git] / src / multiwindow_base / appcore_multiwindow_base_class.c
1 /*
2  * Copyright (c) 2017 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 <stdio.h>
18 #include <stdarg.h>
19 #include <errno.h>
20 #include <string.h>
21 #include <stdlib.h>
22 #include <malloc.h>
23 #include <stdbool.h>
24
25 #include <glib-object.h>
26 #include <glib.h>
27 #include <gio/gio.h>
28
29 #include "appcore_base.h"
30 #include "appcore_multiwindow_base.h"
31 #include "appcore_multiwindow_base_private.h"
32
33 extern appcore_multiwindow_base_context _appcore_mw_context;
34
35 static void __on_create(appcore_multiwindow_base_instance_h context, void *data)
36 {
37         appcore_multiwindow_base_class_on_create(context);
38 }
39
40 static void __on_terminate(appcore_multiwindow_base_instance_h context, void *data)
41 {
42         appcore_multiwindow_base_class_on_terminate(context);
43 }
44
45 static void __on_pause(appcore_multiwindow_base_instance_h context, void *data)
46 {
47         appcore_multiwindow_base_class_on_pause(context);
48 }
49
50 static void __on_resume(appcore_multiwindow_base_instance_h context, void *data)
51 {
52         appcore_multiwindow_base_class_on_resume(context);
53 }
54
55 EXPORT_API appcore_multiwindow_base_class appcore_multiwindow_base_class_get_default(void)
56 {
57         appcore_multiwindow_base_class cls = { 0, };
58
59         cls.create = __on_create;
60         cls.terminate = __on_terminate;
61         cls.pause = __on_pause;
62         cls.resume = __on_resume;
63
64         return cls;
65 }
66
67 EXPORT_API void appcore_multiwindow_base_class_add(appcore_multiwindow_base_class cls)
68 {
69         appcore_multiwindow_base_class *c;
70
71         if (!cls.id)
72                 return;
73
74         c = malloc(sizeof(appcore_multiwindow_base_class));
75
76         if (!c)
77                 return;
78
79         *c = cls;
80         c->id = strdup(cls.id);
81         _appcore_mw_context.classes = g_list_append(_appcore_mw_context.classes, c);
82 }
83
84 EXPORT_API void appcore_multiwindow_base_class_on_create(appcore_multiwindow_base_instance_h context)
85 {
86 }
87
88 EXPORT_API void appcore_multiwindow_base_class_on_terminate(appcore_multiwindow_base_instance_h context)
89 {
90         appcore_multiwindow_base_window_unbind(context);
91 }
92
93 EXPORT_API void appcore_multiwindow_base_class_on_pause(appcore_multiwindow_base_instance_h context)
94 {
95 }
96
97 EXPORT_API void appcore_multiwindow_base_class_on_resume(appcore_multiwindow_base_instance_h context)
98 {
99 }
100
101