#include <string.h>
#include <stdlib.h>
+#include <signal.h>
#include <time.h>
#include <glib.h>
#include <dbus/dbus-glib.h>
#include <dbus/dbus-glib-lowlevel.h>
#include <hal/libhal.h>
+#include "config.h"
#include <mce/dbus-names.h>
#include <mce/mode-names.h>
struct app_data {
DBusGConnection *bus;
LibHalContext *hal;
+ GConfClient *gconf;
gboolean mode_locked;
gboolean display_on;
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)
* 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 && app->last_press - time(NULL) <= 1)
+ if (app->mode_locked && app->display_on && app->press_count > 1 &&
+ time(NULL) - app->last_press <= 1)
speak_time(app);
}
g_debug("init");
memset(&app, 0, sizeof(app));
+ signal(SIGCHLD, SIG_IGN);
g_type_init();
loop = g_main_loop_new(NULL, FALSE);
return 1;
}
+ app.gconf = gconf_client_get_default();
+ g_assert(app.gconf);
+
if (!init_hal(&app))
return 1;