daemon: read settings from gconf
authorAlex Badea <vamposdecampos@gmail.com>
Sun, 20 Jun 2010 12:34:12 +0000 (15:34 +0300)
committerAlex Badea <vamposdecampos@gmail.com>
Sun, 20 Jun 2010 12:34:12 +0000 (15:34 +0300)
src/Makefile.am
src/daemon.c

index 25d50d0..488b9c6 100644 (file)
@@ -1,8 +1,8 @@
 bin_SCRIPTS = espeaktime-now.sh
 bin_PROGRAMS = espeaktimed
-espeaktimed_SOURCES = daemon.c
-espeaktimed_CFLAGS = $(GLIB_CFLAGS) $(DBUS_CFLAGS) $(MCE_CFLAGS) $(HAL_CFLAGS)
-espeaktimed_LDADD = $(GLIB_LIBS) $(DBUS_LIBS) $(MCE_LIBS) $(HAL_LIBS)
+espeaktimed_SOURCES = daemon.c config.c
+espeaktimed_CFLAGS = $(GLIB_CFLAGS) $(DBUS_CFLAGS) $(MCE_CFLAGS) $(HAL_CFLAGS) $(GCONF_CFLAGS)
+espeaktimed_LDADD = $(GLIB_LIBS) $(DBUS_LIBS) $(MCE_LIBS) $(HAL_LIBS) $(GCONF_LIBS)
 
 libcpdir = $(libdir)/hildon-control-panel
 libcp_LTLIBRARIES = libespeaktime-cp.la
index 065c990..a7bbeaf 100644 (file)
@@ -5,6 +5,7 @@
 #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>
@@ -16,6 +17,7 @@
 struct app_data {
        DBusGConnection *bus;
        LibHalContext *hal;
+       GConfClient *gconf;
 
        gboolean mode_locked;
        gboolean display_on;
@@ -25,8 +27,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)
@@ -190,6 +194,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;