Initial commit
[profile/ivi/weekeyboard.git] / src / wkb-ibus-test.c
1 /*
2  * Copyright © 2013 Intel Corporation
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 "wkb-ibus.h"
18
19 #define _GNU_SOURCE
20 #include <signal.h>
21
22 #include <Ecore.h>
23 #include <Eldbus.h>
24
25 static void
26 _finish(int foo)
27 {
28    printf("FINISH\n");
29    wkb_ibus_shutdown();
30 }
31
32 static Eina_Bool
33 _connect_timer(void *data)
34 {
35    return !wkb_ibus_connect();
36 }
37
38 int
39 main (int argc, char *argv[])
40 {
41    if (!ecore_init())
42      {
43         printf("Error initializing ecore");
44         return 1;
45      }
46
47    if (!eldbus_init())
48      {
49         printf("Error initializing eldbus");
50         return 1;
51      }
52
53    if (!wkb_ibus_init())
54      {
55         printf("Error initializing ibus");
56         return 1;
57      }
58
59    ecore_timer_add(1, _connect_timer, NULL);
60
61    signal(SIGTERM, _finish);
62    signal(SIGINT, _finish);
63
64    ecore_main_loop_begin();
65
66    eldbus_shutdown();
67    ecore_shutdown();
68    return 0;
69 }