From bb0e7c542f1ad6c44c7bdd1e81bf38526de54922 Mon Sep 17 00:00:00 2001 From: "Eduardo Lima (Etrunko)" Date: Fri, 27 Sep 2013 18:12:14 -0300 Subject: Don't hardcode config file path We now depend on Efreet to figure out the directory where to save the configuration file used by IBusConfig service interface. Also fix initializations in wkb_ibus_config_register(). Change-Id: I33395d50431931e91955c833591314aec6c2a2e9 Signed-off-by: Eduardo Lima (Etrunko) --- configure.ac | 4 ++-- src/Makefile.am | 4 ++-- src/wkb-ibus-config.c | 15 +++++++++------ src/wkb-ibus-test.c | 11 +++++++++++ 4 files changed, 24 insertions(+), 10 deletions(-) diff --git a/configure.ac b/configure.ac index 5e4d1dc..75721c8 100644 --- a/configure.ac +++ b/configure.ac @@ -28,7 +28,7 @@ LT_INIT([disable-static]) PKG_PROG_PKG_CONFIG() PKG_CHECK_MODULES(WAYLAND, [wayland-client >= 1.2.0]) -PKG_CHECK_MODULES(EFL, [eina eet evas ecore ecore-evas ecore-wayland edje]) +PKG_CHECK_MODULES(EFL, [eina evas ecore ecore-evas ecore-wayland edje]) AC_ARG_WITH(edje-cc, AS_HELP_STRING([--with-edje-cc=PATH], [Path to edje_cc binary]), @@ -44,7 +44,7 @@ AC_ARG_ENABLE([ibus], AM_CONDITIONAL(ENABLE_IBUS, test "x$enable_ibus" = "xyes") if test "x$enable_ibus" = "xyes"; then - PKG_CHECK_MODULES(ELDBUS, [eldbus]) + PKG_CHECK_MODULES(IBUS, [eldbus eet efreet]) AC_CHECK_PROG([have_ibus], [ibus], [yes], [no]) AS_IF([ test "x$have ibus" = "xno" ], diff --git a/src/Makefile.am b/src/Makefile.am index 7fd9c02..389e6d9 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -4,13 +4,13 @@ bin_PROGRAMS = \ AM_CFLAGS= \ @WAYLAND_CFLAGS@ \ @EFL_CFLAGS@ \ - @ELDBUS_CFLAGS@ \ + @IBUS_CFLAGS@ \ -DPKGDATADIR='"$(pkgdatadir)"' AM_LDFLAGS= \ @WAYLAND_LIBS@ \ @EFL_LIBS@ \ - @ELDBUS_LIBS@ + @IBUS_LIBS@ weekeyboard_SOURCES= \ wkb-main.c \ diff --git a/src/wkb-ibus-config.c b/src/wkb-ibus-config.c index aadffb7..c84f62b 100644 --- a/src/wkb-ibus-config.c +++ b/src/wkb-ibus-config.c @@ -186,21 +186,24 @@ static const Eldbus_Service_Interface_Desc _wkb_ibus_config_interface = Eldbus_Service_Interface * wkb_ibus_config_register(Eldbus_Connection *conn) { - Eldbus_Service_Interface *ret = eldbus_service_interface_register(conn, IBUS_PATH_CONFIG, &_wkb_ibus_config_interface); + Eldbus_Service_Interface *ret = NULL; + const char *path; - if (!ret) + if (_conf_eet) { - ERR("Unable to register IBusConfig interface\n"); + WRN("wkb_config_eet already created\n"); goto end; } - if (_conf_eet) + if (!(ret = eldbus_service_interface_register(conn, IBUS_PATH_CONFIG, &_wkb_ibus_config_interface))) { - WRN("wkb_config_eet already created\n"); + ERR("Unable to register IBusConfig interface\n"); goto end; } - _conf_eet = wkb_ibus_config_eet_new("/home/edebarro/projects/wayland/weekeyboard/ibus-cfg.eet", ret); + path = eina_stringshare_printf("%s/wkb-ibus-cfg.eet", efreet_config_home_get()); + _conf_eet = wkb_ibus_config_eet_new(path, ret); + eina_stringshare_del(path); if (!_conf_eet) { diff --git a/src/wkb-ibus-test.c b/src/wkb-ibus-test.c index e9bcf03..3c281c7 100644 --- a/src/wkb-ibus-test.c +++ b/src/wkb-ibus-test.c @@ -23,6 +23,7 @@ #include #include #include +#include static void _finish(int foo) @@ -61,6 +62,13 @@ main (int argc, char *argv[]) goto eldbus_err; } + if (!efreet_init()) + { + printf("Error initializing efreet"); + ret = 1; + goto efreet_err; + } + if (!wkb_ibus_init()) { printf("Error initializing ibus"); @@ -76,6 +84,9 @@ main (int argc, char *argv[]) ecore_main_loop_begin(); end: + efreet_shutdown(); + +efreet_err: eldbus_shutdown(); eldbus_err: -- cgit v1.2.3