Fix ibus-test to match new wkb-ibus connection scheme
[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 #include "wkb-log.h"
19
20 #define _GNU_SOURCE
21 #include <signal.h>
22
23 #include <Eina.h>
24 #include <Ecore.h>
25 #include <Eldbus.h>
26 #include <Efreet.h>
27
28 static void
29 _finish(int foo)
30 {
31    wkb_ibus_shutdown();
32 }
33
34 int
35 main (int argc, char *argv[])
36 {
37    int ret = 1;
38
39    if (!wkb_log_init("ibus-test"))
40       return 1;
41
42    if (!ecore_init())
43      {
44         ERR("Error initializing ecore");
45         goto ecore_err;
46      }
47
48    if (!wkb_ibus_init())
49      {
50         ERR("Error initializing ibus");
51         goto ibus_err;
52      }
53
54    wkb_ibus_connect();
55
56    signal(SIGTERM, _finish);
57    signal(SIGINT, _finish);
58
59    ecore_main_loop_begin();
60    ret = 0;
61
62 ibus_err:
63    ecore_shutdown();
64
65 ecore_err:
66    wkb_log_shutdown();
67
68    return ret;
69 }