X-Git-Url: http://git.maemo.org/git/?p=espeaktime;a=blobdiff_plain;f=src%2Fdaemon.c;h=3c6da747d67ec647d5d1832d2c03e36901be3103;hp=065c99010822d8287b3ddd3345feb5478874aebc;hb=df91e1a4c233ce7d23b70136b1158fa98d6c59c1;hpb=b62b7a6a4d19e4b6b1889ef7a7a9607eb56457e2 diff --git a/src/daemon.c b/src/daemon.c index 065c990..3c6da74 100644 --- a/src/daemon.c +++ b/src/daemon.c @@ -1,10 +1,12 @@ #include #include +#include #include #include #include #include #include +#include "config.h" #include #include @@ -16,6 +18,7 @@ struct app_data { DBusGConnection *bus; LibHalContext *hal; + GConfClient *gconf; gboolean mode_locked; gboolean display_on; @@ -25,8 +28,10 @@ struct app_data { static void speak_time(struct app_data *app) { - int res = system("espeaktime-now.sh"); - g_debug("speak script: %d", res); + struct espeaktime_settings cfg; + cfg_read(app->gconf, &cfg); + cfg_speak(&cfg, FALSE); + cfg_free(&cfg); } static void sig_tklock_mode(DBusGProxy *proxy, const char *mode, gpointer user_data) @@ -46,7 +51,8 @@ static void sig_display_status(DBusGProxy *proxy, const char *status, gpointer u * in the two ButtonPress events being received before the display_status==on * event. Check here if that's the case. */ - if (app->display_on && app->press_count > 1 && time(NULL) - app->last_press <= 1) + if (app->mode_locked && app->display_on && app->press_count > 1 && + time(NULL) - app->last_press <= 1) speak_time(app); } @@ -179,6 +185,7 @@ int main(int argc, char *argv[]) g_debug("init"); memset(&app, 0, sizeof(app)); + signal(SIGCHLD, SIG_IGN); g_type_init(); loop = g_main_loop_new(NULL, FALSE); @@ -190,6 +197,9 @@ int main(int argc, char *argv[]) return 1; } + app.gconf = gconf_client_get_default(); + g_assert(app.gconf); + if (!init_hal(&app)) return 1;