[dasher] Store preferences using GSettings



commit 4c37ab022d99b7ddb6c73ec9d58689ff4ae43bba
Author: Patrick Welche <prlw1 cam ac uk>
Date:   Wed Apr 6 10:59:14 2011 +0200

    Store preferences using GSettings
    
    * Make generate-schemas output GConf or GSettings XML, or a text dump,
      according to an option flag.
    
    * Default is still to use GConf as many systems don't have the necessary
      file backed GSettingsBackends installed:
    
        GLib-GIO-Message: Using the 'memory' GSettings backend.  Your
        settings will not be saved or shared with other applications.
    
    * Split GnomeSettingsStore.cpp into GSettingsStore.cpp, GConfStore.cpp and
      NoStore.cpp and compile conditionally.
    
    * As the "Actions" box is gone (0f139f46), comment out all action code with
      #ifdef XXXPRLWACTIONSAREFIXED, and remove action specific source files
      from build.
      Actions were the only consumers of dasher_app_settings_{g,s}et_free_long.
    
    * Removed GConf NotificationCallback as all it did was return.
    
    * g/c another reference to an "intl" directory.

 Data/Makefile.am                    |   37 +++++--
 Src/Gtk2/DasherAppSettings.cpp      |  120 ++++++++++++++++-----
 Src/Gtk2/DasherAppSettings.h        |    2 +
 Src/Gtk2/DasherSpi.h                |    6 +-
 Src/Gtk2/GConfStore.cpp             |  100 +++++++++++++++++
 Src/Gtk2/GSettingsStore.cpp         |   43 ++++++++
 Src/Gtk2/GenerateSchema.cpp         |  194 ++++++++++++++++++++++++++-------
 Src/Gtk2/GnomeSettingsStore.cpp     |  203 -----------------------------------
 Src/Gtk2/GnomeSettingsStore.h       |   13 ++-
 Src/Gtk2/Makefile.am                |   47 +++++----
 Src/Gtk2/NoStore.cpp                |   29 +++++
 Src/Gtk2/dasher_editor.cpp          |   19 +++-
 Src/Gtk2/dasher_editor.h            |    6 +
 Src/Gtk2/dasher_editor_internal.cpp |   52 +++++++++-
 Src/Gtk2/dasher_editor_internal.h   |    2 +
 configure.ac                        |   51 ++++++----
 16 files changed, 594 insertions(+), 330 deletions(-)
---
diff --git a/Data/Makefile.am b/Data/Makefile.am
index 22d07c8..49e735a 100644
--- a/Data/Makefile.am
+++ b/Data/Makefile.am
@@ -17,6 +17,7 @@ svgicon_DATA = dasher.svg
 
 gtk_update_icon_cache = gtk-update-icon-cache -f -t $(datadir)/icons/hicolor
 
+if USE_GCONF
 if GCONF_SCHEMAS_INSTALL
 schemasdir = $(GCONF_SCHEMA_FILE_DIR)
 schemas_DATA = dasher.schemas
@@ -31,20 +32,43 @@ install-data-local: install-schemas
 # which is then moved installed in the usual way. None of this happens
 # if configure is told not to install schemas.
 
-dasher.schemas: ../Src/Gtk2/generate-schema
-	echo -n "Generating schema ... "; \
-	../Src/Gtk2/generate-schema > dasher.schemas; \
+dasher.schemas: $(top_builddir)/Src/Gtk2/generate-schema
+	echo -n "Generating GConf schema ... "; \
+	$(top_builddir)/Src/Gtk2/generate-schema -c > dasher.schemas; \
 	echo "done.";
 
 install-schemas: dasher.schemas
 	GCONF_CONFIG_SOURCE=$(GCONF_SCHEMA_CONFIG_SOURCE) \
 	gconftool-2 --makefile-install-rule dasher.schemas
+
+compile-schemas:
+# GCONF_SCHEMAS_INSTALL
+endif
+# !USE_GCONF
+else
+if USE_GSETTINGS
+schemasdir = $(datadir)/glib-2.0/schemas
+schemas_DATA = dasher.gschema.xml
+
+check-local: check-schmemas
+
+dasher.gschema.xml: $(top_builddir)/Src/Gtk2/generate-schema
+	echo -n "Generating GSettings schema ... "; \
+	$(top_builddir)/Src/Gtk2/generate-schema -s > dasher.gschema.xml; \
+	echo "done.";
+
+compile-schemas: dasher.gschema.xml
+	$(GLIB_COMPILE_SCHEMAS) --allow-any-name $(schemasdir)
+
+check-schemas: dasher.gschema.xml
+	$(GLIB_COMPILE_SCHEMAS) --allow-any-name --dry-run --schema-file=dasher.gschema.xml
 else
-install-data-local:
+compile-schemas:
+endif
 endif
 
 
-install-data-hook: update-icon-cache
+install-data-hook: update-icon-cache compile-schemas
 
 uninstall-hook: update-icon-cache
 
@@ -62,5 +86,4 @@ EXTRA_DIST = \
 		$(icon_DATA) \
 		$(svgicon_DATA)
 
-DISTCLEANFILES = dasher.schemas
-
+CLEANFILES = dasher.schemas dasher.gschema.xml
diff --git a/Src/Gtk2/DasherAppSettings.cpp b/Src/Gtk2/DasherAppSettings.cpp
index 2d390ff..55e4066 100644
--- a/Src/Gtk2/DasherAppSettings.cpp
+++ b/Src/Gtk2/DasherAppSettings.cpp
@@ -8,6 +8,10 @@
 #include <gconf/gconf-enum-types.h>
 #endif
 
+#ifdef WITH_GSETTINGS
+#include <gio/gio.h>
+#endif
+
 #include <cstring>
 #include "DasherAppSettings.h"
 #include "../Common/AppSettingsData.h"
@@ -25,9 +29,11 @@
 
 struct _DasherAppSettingsPrivate {
 #ifdef WITH_GCONF
-  // GConf interface
   GConfClient *pGConfClient;
 #endif
+#ifdef WITH_GSETTINGS
+  GSettings *psettings;
+#endif
   GtkDasherControl *pDasherWidget;
 };
 
@@ -37,10 +43,11 @@ typedef struct _DasherAppSettingsPrivate DasherAppSettingsPrivate;
 
 static void dasher_app_settings_class_init(DasherAppSettingsClass *pClass);
 static void dasher_app_settings_init(DasherAppSettings *pAppSettings);
-static void dasher_app_settings_destroy(GObject *pObject);
+static void dasher_app_settings_destroy(GObject*);
 
+#ifdef WITH_GCONF
 static void dasher_app_settings_init_gconf(DasherAppSettings *pSelf, int argc, char **argv);
-static void dasher_app_settings_stop_gconf(DasherAppSettings *pSelf);
+#endif
 static void dasher_app_settings_load(DasherAppSettings *pSelf);
 
 // Function declarations
@@ -81,27 +88,34 @@ static void dasher_app_settings_init(DasherAppSettings *pDasherControl) {
 #ifdef WITH_GCONF
   pPrivate->pGConfClient = NULL;
 #endif
+#ifdef WITH_GSETTINGS
+  pPrivate->psettings = NULL;
+#endif
   pPrivate->pDasherWidget = NULL;
 }
 
 static void dasher_app_settings_destroy(GObject *pObject) {
+  DasherAppSettings *pSelf = DASHER_APP_SETTINGS(pObject);
+  DasherAppSettingsPrivate *pPrivate = (DasherAppSettingsPrivate*)(pSelf->private_data);
 #ifdef WITH_GCONF
-  dasher_app_settings_stop_gconf((DasherAppSettings *)pObject);
+  g_object_unref(pPrivate->pGConfClient);
+#endif
+#ifdef WITH_GSETTINGS
+  g_object_unref(pPrivate->psettings);
 #endif
 
   for(int i(0); i < NUM_OF_APP_SPS; ++i)
     delete[] app_stringparamtable[i].value;
 
   // FIXME - glib routines?
-  // FIXME - do we need a typecast here?
-  delete (DasherAppSettingsPrivate *)(((DasherAppSettings *)pObject)->private_data);
+  delete pPrivate;
   
   // FIXME - I think we need to chain up through the finalize methods
   // of the parent classes here...
 }
 
-static void dasher_app_settings_init_gconf(DasherAppSettings *pSelf, int argc, char **argv) {
 #ifdef WITH_GCONF
+static void dasher_app_settings_init_gconf(DasherAppSettings *pSelf, int argc, char **argv) {
   DasherAppSettingsPrivate *pPrivate = (DasherAppSettingsPrivate*)(pSelf->private_data);
 
   GError *pGConfError;
@@ -110,21 +124,13 @@ static void dasher_app_settings_init_gconf(DasherAppSettings *pSelf, int argc, c
     g_error("Failed to initialise gconf: %s", pGConfError->message);
   
     pPrivate->pGConfClient = gconf_client_get_default();
-#endif
 }
-
-static void dasher_app_settings_stop_gconf(DasherAppSettings *pSelf) {
-#ifdef WITH_GCONF
-  DasherAppSettingsPrivate *pPrivate = (DasherAppSettingsPrivate*)(pSelf->private_data);
-
-  g_object_unref(pPrivate->pGConfClient);
 #endif
-}
 
 static void dasher_app_settings_load(DasherAppSettings *pSelf) { 
-#ifdef WITH_GCONF
   DasherAppSettingsPrivate *pPrivate = (DasherAppSettingsPrivate *)(pSelf->private_data);
 
+#ifdef WITH_GCONF
   GError *pGConfError = NULL;
   GConfValue *pGConfValue;
  
@@ -186,13 +192,44 @@ static void dasher_app_settings_load(DasherAppSettings *pSelf) {
     }
   }
 #endif
+#ifdef WITH_GSETTINGS
+  gchar *tmpstr;
+  for(int i(0); i < NUM_OF_APP_BPS; ++i ) {
+    if(app_boolparamtable[i].persistent) {
+	  app_boolparamtable[i].value = g_settings_get_boolean(pPrivate->psettings,
+                                               app_boolparamtable[i].regName);
+    }
+  }
+
+  for(int i(0); i < NUM_OF_APP_LPS; ++i ) {
+    if(app_longparamtable[i].persistent) {
+	  app_longparamtable[i].value = g_settings_get_int(pPrivate->psettings,
+                                               app_longparamtable[i].regName);
+    }
+  }
+
+  for(int i(0); i < NUM_OF_APP_SPS; ++i ) {
+    if(app_stringparamtable[i].persistent) {
+	  tmpstr = g_settings_get_string(pPrivate->psettings,
+                                               app_stringparamtable[i].regName);
+
+      if(tmpstr) {
+        delete[] app_stringparamtable[i].value;
+        app_stringparamtable[i].value = new char[strlen(tmpstr) + 1];
+        strcpy(app_stringparamtable[i].value, tmpstr);
+        g_free(tmpstr);
+      }
+    }
+  }
+#endif
 }
 
 // Public methods
 
 DasherAppSettings *dasher_app_settings_new(int argc, char **argv) {
-  DasherAppSettings *pDasherControl;
-  pDasherControl = (DasherAppSettings *)(g_object_new(dasher_app_settings_get_type(), NULL));
+  DasherAppSettings *pNewAppSettings;
+  pNewAppSettings = (DasherAppSettings *)(g_object_new(dasher_app_settings_get_type(), NULL));
+  DasherAppSettingsPrivate *pPrivate = (DasherAppSettingsPrivate*)(pNewAppSettings->private_data);
 
   for(int i(0); i < NUM_OF_APP_SPS; ++i) {
     gchar *szNew;
@@ -201,11 +238,14 @@ DasherAppSettings *dasher_app_settings_new(int argc, char **argv) {
     app_stringparamtable[i].value = szNew;
   }
 #ifdef WITH_GCONF
-  dasher_app_settings_init_gconf(pDasherControl, argc, argv);  
+  dasher_app_settings_init_gconf(pNewAppSettings, argc, argv);  
+#endif
+#ifdef WITH_GSETTINGS
+  pPrivate->psettings = g_settings_new("org.gnome.Dasher");
 #endif
-  dasher_app_settings_load(pDasherControl);
+  dasher_app_settings_load(pNewAppSettings);
 
-  return pDasherControl;
+  return pNewAppSettings;
 }
 
 void dasher_app_settings_reset(DasherAppSettings *pSelf, int iParameter) {
@@ -275,6 +315,13 @@ void dasher_app_settings_set_bool(DasherAppSettings *pSelf, int iParameter, bool
 	g_message("Error");
     }
 #endif
+#ifdef WITH_GSETTINGS
+    if(app_boolparamtable[ iParameter - FIRST_APP_BP ].persistent) {
+      g_settings_set_boolean(pPrivate->psettings,
+                            app_boolparamtable[iParameter-FIRST_APP_BP].regName,
+                            bValue);
+    }
+#endif
 
     // TODO: Use real signals to achieve this
     parameter_notification(0, iParameter, 0);
@@ -285,10 +332,8 @@ gint dasher_app_settings_get_long(DasherAppSettings *pSelf, int iParameter) {
   DasherAppSettingsPrivate *pPrivate = (DasherAppSettingsPrivate *)(pSelf->private_data);
  
   if( iParameter < END_OF_LPS) {
-    if(pPrivate->pDasherWidget) 
-      return gtk_dasher_control_get_parameter_long(pPrivate->pDasherWidget, iParameter);
-    else
-      return false;
+    DASHER_ASSERT_VALIDPTR_R(pPrivate->pDasherWidget);
+    return gtk_dasher_control_get_parameter_long(pPrivate->pDasherWidget, iParameter);
   }
   else
     return app_longparamtable[ iParameter - FIRST_APP_LP ].value;
@@ -298,8 +343,8 @@ void dasher_app_settings_set_long(DasherAppSettings *pSelf, int iParameter, gint
   DasherAppSettingsPrivate *pPrivate = (DasherAppSettingsPrivate *)(pSelf->private_data);
 
   if( iParameter < END_OF_LPS) {
-    if(pPrivate->pDasherWidget)
-      gtk_dasher_control_set_parameter_long(pPrivate->pDasherWidget, iParameter, iValue);
+    DASHER_ASSERT_VALIDPTR_RW(pPrivate->pDasherWidget);
+    gtk_dasher_control_set_parameter_long(pPrivate->pDasherWidget, iParameter, iValue);
   }
   else {
     if(dasher_app_settings_get_long(pSelf, iParameter) == iValue)
@@ -320,16 +365,23 @@ void dasher_app_settings_set_long(DasherAppSettings *pSelf, int iParameter, gint
       gconf_client_set_int(pPrivate->pGConfClient, szName, iValue, &pGConfError);
     }
 #endif
+#ifdef WITH_GSETTINGS    
+    if(app_longparamtable[ iParameter - FIRST_APP_LP ].persistent) {
+      g_settings_set_int(pPrivate->psettings,
+                         app_longparamtable[iParameter-FIRST_APP_LP].regName,
+                         iValue);
+    }
+#endif
     
     // TODO: Use real signals to achieve this
     parameter_notification(0, iParameter, 0);
   }
 }
 
+#ifdef XXXPRLWACTIONSAREFIXED
 gboolean dasher_app_settings_get_free_long(DasherAppSettings *pSelf, const gchar *szName, gint &iValue) {
-#ifdef WITH_GCONF
   DasherAppSettingsPrivate *pPrivate = (DasherAppSettingsPrivate *)(pSelf->private_data);
-
+#ifdef WITH_GCONF
   gchar szFullName[256];
       
   strncpy(szFullName, "/apps/dasher4/", 256);
@@ -352,7 +404,9 @@ gboolean dasher_app_settings_get_free_long(DasherAppSettings *pSelf, const gchar
   return false;
 #endif
 }
+#endif
 
+#ifdef XXXPRLWACTIONSAREFIXED
 void dasher_app_settings_set_free_long(DasherAppSettings *pSelf, const gchar *szName, gint iValue) {   
 #ifdef WITH_GCONF
   DasherAppSettingsPrivate *pPrivate = (DasherAppSettingsPrivate *)(pSelf->private_data);
@@ -366,6 +420,7 @@ void dasher_app_settings_set_free_long(DasherAppSettings *pSelf, const gchar *sz
   gconf_client_set_int(pPrivate->pGConfClient, szFullName, iValue, &pGConfError);
 #endif
 }
+#endif
 
 const gchar *dasher_app_settings_get_string(DasherAppSettings *pSelf, int iParameter) {
   DasherAppSettingsPrivate *pPrivate = (DasherAppSettingsPrivate *)(pSelf->private_data);
@@ -412,6 +467,13 @@ void dasher_app_settings_set_string(DasherAppSettings *pSelf, int iParameter, co
       gconf_client_set_string(pPrivate->pGConfClient, szName, szValue, &pGConfError);
     }
 #endif    
+#ifdef WITH_GSETTINGS
+    if(app_stringparamtable[ iParameter - FIRST_APP_SP ].persistent) {
+      g_settings_set_string(pPrivate->psettings,
+                          app_stringparamtable[iParameter-FIRST_APP_SP].regName,
+                            szValue);
+    }
+#endif    
 
     // TODO: Use real signals to achieve this
     parameter_notification(0, iParameter, 0);
diff --git a/Src/Gtk2/DasherAppSettings.h b/Src/Gtk2/DasherAppSettings.h
index 44a2f3b..86758a0 100644
--- a/Src/Gtk2/DasherAppSettings.h
+++ b/Src/Gtk2/DasherAppSettings.h
@@ -60,8 +60,10 @@ bool dasher_app_settings_get_bool(DasherAppSettings *pSelf, int iParameter);
 void dasher_app_settings_set_bool(DasherAppSettings *pSelf, int iParameter, bool bValue);
 gint dasher_app_settings_get_long(DasherAppSettings *pSelf, int iParameter);
 void dasher_app_settings_set_long(DasherAppSettings *pSelf, int iParameter, gint iValue);
+#ifdef XXXPRLWACTIONSAREFIXED
 gboolean dasher_app_settings_get_free_long(DasherAppSettings *pSelf, const gchar *szName, gint &iValue);
 void dasher_app_settings_set_free_long(DasherAppSettings *pSelf, const gchar *szName, gint iValue);
+#endif
 const gchar *dasher_app_settings_get_string(DasherAppSettings *pSelf, int iParameter);
 void dasher_app_settings_set_string(DasherAppSettings *pSelf, int iParameter, const gchar *szValue);
 
diff --git a/Src/Gtk2/DasherSpi.h b/Src/Gtk2/DasherSpi.h
index 7232c79..4e3a2b7 100644
--- a/Src/Gtk2/DasherSpi.h
+++ b/Src/Gtk2/DasherSpi.h
@@ -1,10 +1,10 @@
+#ifndef __dasher_spi_h__
+#define __dasher_spi_h__
+
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
 
-#ifndef __dasher_spi_h__
-#define __dasher_spi_h__
-
 #ifdef GNOME_A11Y
 bool initSPI();
 #endif
diff --git a/Src/Gtk2/GConfStore.cpp b/Src/Gtk2/GConfStore.cpp
new file mode 100644
index 0000000..c6bef98
--- /dev/null
+++ b/Src/Gtk2/GConfStore.cpp
@@ -0,0 +1,100 @@
+#include "GnomeSettingsStore.h"
+
+CGnomeSettingsStore::CGnomeSettingsStore(Dasher::CEventHandler *pEventHandler):CSettingsStore(pEventHandler) {
+  the_gconf_client = gconf_client_get_default();
+
+  gconf_client_add_dir(the_gconf_client, "/apps/dasher4", GCONF_CLIENT_PRELOAD_RECURSIVE, NULL);
+
+  LoadPersistent();
+}
+
+CGnomeSettingsStore::~CGnomeSettingsStore() {
+  g_object_unref(the_gconf_client);
+}
+
+bool CGnomeSettingsStore::LoadSetting(const std::string &Key, bool *Value) {
+  char keypath[1024];
+
+  snprintf(keypath, 1024, "/apps/dasher4/%s", Key.c_str());
+
+  GError *the_error = NULL;
+
+  GConfValue *got_value = gconf_client_get_without_default(the_gconf_client, keypath, &the_error);
+
+  if(got_value == NULL) {
+    return false;
+  }
+
+  *Value = gconf_value_get_bool(got_value);
+  gconf_value_free(got_value);
+
+  return true;
+}
+
+bool CGnomeSettingsStore::LoadSetting(const std::string &Key, long *Value) {
+  char keypath[1024];
+
+  snprintf(keypath, 1024, "/apps/dasher4/%s", Key.c_str());
+
+  GError *the_error = NULL;
+
+  GConfValue *got_value = gconf_client_get_without_default(the_gconf_client, keypath, &the_error);
+
+  if(got_value == NULL) {
+    return false;
+  }
+
+  *Value = gconf_value_get_int(got_value);
+  gconf_value_free(got_value);
+
+  return true;
+}
+
+bool CGnomeSettingsStore::LoadSetting(const std::string &Key, std::string *Value) {
+  char keypath[1024];
+
+  snprintf(keypath, 1024, "/apps/dasher4/%s", Key.c_str());
+
+  GError *the_error = NULL;
+
+  GConfValue *got_value = gconf_client_get_without_default(the_gconf_client, keypath, &the_error);
+
+  if(got_value == NULL) {
+    return false;
+  }
+
+  *Value = gconf_value_get_string(got_value);
+  gconf_value_free(got_value);
+
+  return true;
+}
+
+void CGnomeSettingsStore::SaveSetting(const std::string &Key, bool Value) {
+  char keypath[1024];
+
+  snprintf(keypath, 1024, "/apps/dasher4/%s", Key.c_str());
+
+  GError *the_error = NULL;
+
+  gconf_client_set_bool(the_gconf_client, keypath, Value, &the_error);
+}
+
+void CGnomeSettingsStore::SaveSetting(const std::string &Key, long Value) {
+  char keypath[1024];
+
+  snprintf(keypath, 1024, "/apps/dasher4/%s", Key.c_str());
+
+  GError *the_error = NULL;
+
+  gconf_client_set_int(the_gconf_client, keypath, Value, &the_error);
+}
+
+void CGnomeSettingsStore::SaveSetting(const std::string &Key, const std::string &Value) {
+  char keypath[1024];
+
+  snprintf(keypath, 1024, "/apps/dasher4/%s", Key.c_str());
+
+  GError *the_error = NULL;
+
+  gconf_client_set_string(the_gconf_client, keypath, Value.c_str(), &the_error);
+}
diff --git a/Src/Gtk2/GSettingsStore.cpp b/Src/Gtk2/GSettingsStore.cpp
new file mode 100644
index 0000000..eb07e8b
--- /dev/null
+++ b/Src/Gtk2/GSettingsStore.cpp
@@ -0,0 +1,43 @@
+#include "GnomeSettingsStore.h"
+
+#include <iostream>
+
+CGnomeSettingsStore::CGnomeSettingsStore(Dasher::CEventHandler *pEventHandler):CSettingsStore(pEventHandler) {
+  settings = g_settings_new("org.gnome.Dasher");
+  LoadPersistent();
+}
+
+CGnomeSettingsStore::~CGnomeSettingsStore() {
+  g_object_unref(settings);
+}
+
+bool CGnomeSettingsStore::LoadSetting(const std::string &Key, bool *Value) {
+  // If Key doesn't exist, or is not boolean, g_settings_get_boolean will
+  // return false.
+  *Value = g_settings_get_boolean(settings, Key.c_str());
+  return true;
+}
+
+bool CGnomeSettingsStore::LoadSetting(const std::string &Key, long *Value) {
+  // It seems that this has never been able to store a long, only an int.
+  *Value = g_settings_get_int(settings, Key.c_str());
+  return true;
+}
+
+bool CGnomeSettingsStore::LoadSetting(const std::string &Key, std::string *Value) {
+  *Value = g_settings_get_string(settings, Key.c_str());
+  return true;
+}
+
+void CGnomeSettingsStore::SaveSetting(const std::string &Key, bool Value) {
+  // g_settings_set_boolean returns fals if the key was not writable.
+  g_settings_set_boolean(settings, Key.c_str(), Value);
+}
+
+void CGnomeSettingsStore::SaveSetting(const std::string &Key, long Value) {
+  g_settings_set_int(settings, Key.c_str(), Value);
+}
+
+void CGnomeSettingsStore::SaveSetting(const std::string &Key, const std::string &Value) {
+  g_settings_set_string(settings, Key.c_str(), Value.c_str());
+}
diff --git a/Src/Gtk2/GenerateSchema.cpp b/Src/Gtk2/GenerateSchema.cpp
index 2f46ef2..e579888 100644
--- a/Src/Gtk2/GenerateSchema.cpp
+++ b/Src/Gtk2/GenerateSchema.cpp
@@ -3,69 +3,173 @@
 #include "../DasherCore/Parameters.h"
 #include "../Common/AppSettingsData.h"
 
+#include <algorithm>
 #include <string>
 #include <sstream>
 #include <iostream>
+#include <iomanip>
 
-enum{ TYPE_BOOL, TYPE_LONG, TYPE_STRING };
+enum EValType { TYPE_BOOL, TYPE_LONG, TYPE_STRING };
+enum EOutput { GCONF_OUTPUT, GSETTINGS_OUTPUT, TEXT_OUTPUT };
 
 class CSchema {
 public:
-  CSchema(const std::string &strKeyName, int iType, 
+  CSchema(const std::string &strKeyName, EValType iType, 
 	  const std::string &strDefault, const std::string &strShort,
 	  const std::string &strLong);
 
-  void Dump();
+  void Dump(EOutput);
 private:
   std::string m_strKeyName;
-  std::string m_strType;
+  EValType    m_iType;
   std::string m_strDefault;
   std::string m_strShort;
   std::string m_strLong;
 };
 
-CSchema::CSchema(const std::string &strKeyName, int iType, 
+struct lower_char
+{
+	void operator()(char &c) {c = tolower(c);}
+};
+
+std::string lower(const std::string& in)
+{
+	std::string out(in);
+	for_each(out.begin(), out.end(), lower_char());
+	return out;
+}
+
+CSchema::CSchema(const std::string &strKeyName, EValType iType, 
 		 const std::string &strDefault, const std::string &strShort,
 		 const std::string &strLong) {
   m_strKeyName = strKeyName;
-  
-  switch(iType) {
-  case TYPE_BOOL:
-    m_strType="bool";
+  m_iType = iType;
+  m_strDefault = strDefault;
+  m_strShort = strShort;
+  m_strLong = strLong;
+}
+
+void CSchema::Dump(EOutput output_type) {
+  switch(output_type) {
+  case GCONF_OUTPUT:
+    std::cout << "<schema>" << std::endl;
+    std::cout << "<key>/schemas/apps/dasher4/" << m_strKeyName << "</key>" << std::endl;
+    std::cout << "<applyto>/apps/dasher4/" << m_strKeyName << "</applyto>" << std::endl;
+    std::cout << "<owner>dasher</owner>" << std::endl;
+
+    std::cout << "<type>";
+    switch(m_iType) {
+    case TYPE_BOOL:
+      std::cout << "bool";
+      break;
+    case TYPE_LONG:
+      std::cout << "int";
+      break;
+    case TYPE_STRING:
+      std::cout << "string";
+      break;
+    }
+    std::cout << "</type>" << std::endl;
+
+    std::cout << "<default>" << m_strDefault << "</default>" << std::endl;
+    std::cout << "<locale name=\"C\">" << std::endl;
+    std::cout << "<short>" << m_strShort << "</short>" << std::endl;
+    std::cout << "<long>" << m_strLong << "</long>" << std::endl;
+    std::cout << "</locale>" << std::endl;
+    std::cout << "</schema>" << std::endl;
     break;
-  case TYPE_LONG:
-    m_strType="int";
+  case GSETTINGS_OUTPUT:
+    std::cout << "    <key name=\"" << m_strKeyName << "\" type=\"";
+    switch(m_iType) {
+    case TYPE_BOOL:
+      std::cout << 'b';
+      break;
+    case TYPE_LONG:
+      std::cout << 'i';
+      break;
+    case TYPE_STRING:
+      std::cout << 's';
+      break;
+    }
+    std::cout << "\">\n";
+
+    std::cout << "      <default>" << (m_iType==TYPE_STRING?"'":"");
+    if (m_iType==TYPE_BOOL)
+      std::cout << lower(m_strDefault);
+    else
+      std::cout << m_strDefault;
+    std::cout << (m_iType==TYPE_STRING?"'":"") << "</default>\n";
+
+    if (!m_strShort.empty())
+      std::cout << "      <summary>" << m_strShort << "</summary>\n";
+    if (!m_strLong.empty())
+      std::cout << "      <description>" << m_strLong << "</description>\n";
+    std::cout << "    </key>\n";
+
     break;
-  case TYPE_STRING:
-    m_strType="string";
+  case TEXT_OUTPUT:
+    std::cout << std::setw(30)
+              << m_strKeyName << '\t';
+    switch(m_iType) {
+    case TYPE_BOOL:
+      std::cout << "bool\t";
+      break;
+    case TYPE_LONG:
+      std::cout << "int\t";
+      break;
+    case TYPE_STRING:
+      std::cout << "string\t";
+      break;
+    }
+    std::cout << m_strDefault << '\t'
+              << m_strShort   << '\n';
     break;
   }
-
-  m_strDefault = strDefault;
-  m_strShort = strShort;
-  m_strLong = strLong;
 }
 
-void CSchema::Dump() {
-  std::cout << "<schema>" << std::endl;
-  std::cout << "<key>/schemas/apps/dasher4/" << m_strKeyName << "</key>" << std::endl;
-  std::cout << "<applyto>/apps/dasher4/" << m_strKeyName << "</applyto>" << std::endl;
-  std::cout << "<owner>dasher</owner>" << std::endl;
-  std::cout << "<type>" << m_strType << "</type>" << std::endl;
-  std::cout << "<default>" << m_strDefault << "</default>" << std::endl;
-  std::cout << "<locale name=\"C\">" << std::endl;
-  std::cout << "<short>" << m_strShort << "</short>" << std::endl;
-  std::cout << "<long>" << m_strLong << "</long>" << std::endl;
-  std::cout << "</locale>" << std::endl;
-  std::cout << "</schema>" << std::endl;
-  
+void usage(char *progname) {
+	std::cerr << "usage: " << progname
+		<< " [-cst]\n-c: GConf\n-s: GSettings\n-t: text\n";
 }
 
 int main(int argc, char **argv) {
 
-  std::cout << "<gconfschemafile>" << std::endl;
-  std::cout << "<schemalist>" << std::endl;
-  std::cout << "Is this really main? -- Who knows?" << std::endl;
+	EOutput output;
+
+	if (argc != 2) {
+		usage(argv[0]);
+		return 1;
+	}
+	if (argv[1][0] != '-' || argv[1][2] != '\0') {
+		usage(argv[0]);
+		return 1;
+	}
+	switch(argv[1][1]) {
+		case 'c':
+			output = GCONF_OUTPUT;
+			break;
+		case 's':
+			output = GSETTINGS_OUTPUT;
+			break;
+		case 't':
+			output = TEXT_OUTPUT;
+			break;
+		default:
+			usage(argv[0]);
+			return 1;
+	}
+
+  switch (output) {
+  case GCONF_OUTPUT:
+    std::cout << "<gconfschemafile>" << std::endl;
+    std::cout << "<schemalist>" << std::endl;
+    std::cout << "Is this really main? -- Who knows?" << std::endl;
+    break;
+  case GSETTINGS_OUTPUT:
+    std::cout << "<schemalist>\n"
+                 "  <schema id=\"org.gnome.Dasher\" path=\"/apps/dasher4/\">\n";
+    break;
+  }
 
   for(int i(0); i < NUM_OF_BPS; ++i) {
     if(boolparamtable[i].persistent) {
@@ -82,7 +186,7 @@ int main(int argc, char **argv) {
 		       "",
 		       boolparamtable[i].humanReadable );
       
-      oSchema.Dump();
+      oSchema.Dump(output);
     }
   }  
 
@@ -102,7 +206,7 @@ int main(int argc, char **argv) {
 		       "",
 		       app_boolparamtable[i].humanReadable );
       
-      oSchema.Dump();
+      oSchema.Dump(output);
     }
   } 
 
@@ -120,7 +224,7 @@ int main(int argc, char **argv) {
 		       "",
 		       longparamtable[i].humanReadable );
       
-      oSchema.Dump();
+      oSchema.Dump(output);
     }
   }  
  
@@ -138,7 +242,7 @@ int main(int argc, char **argv) {
 		       "",
 		       app_longparamtable[i].humanReadable );
       
-      oSchema.Dump();
+      oSchema.Dump(output);
     }
   }  
 
@@ -150,7 +254,7 @@ int main(int argc, char **argv) {
 		       "",
 		       stringparamtable[i].humanReadable );
       
-      oSchema.Dump();
+      oSchema.Dump(output);
     }
   } 
   
@@ -162,12 +266,20 @@ int main(int argc, char **argv) {
 		       "",
 		       app_stringparamtable[i].humanReadable );
       
-      oSchema.Dump();
+      oSchema.Dump(output);
     }
   } 
   
-  std::cout << "</schemalist>" << std::endl;
-  std::cout << "</gconfschemafile>" << std::endl;
+  switch (output) {
+  case GCONF_OUTPUT:
+    std::cout << "</schemalist>" << std::endl;
+    std::cout << "</gconfschemafile>" << std::endl;
+    break;
+  case GSETTINGS_OUTPUT:
+    std::cout << "  </schema>\n</schemalist>" << std::endl;
+  }
+
+  return 0;
 }
 // struct bp_table {
 //   int key;
diff --git a/Src/Gtk2/GnomeSettingsStore.h b/Src/Gtk2/GnomeSettingsStore.h
index 29fc2c7..6f72e9d 100644
--- a/Src/Gtk2/GnomeSettingsStore.h
+++ b/Src/Gtk2/GnomeSettingsStore.h
@@ -13,19 +13,17 @@
 #include <gconf/gconf-enum-types.h>
 #endif
 
-#include "SettingsStore.h"
+#ifdef WITH_GSETTINGS
+#include <gio/gio.h>
+#endif
 
-#include <stdio.h>
+#include "SettingsStore.h"
 
 class CGnomeSettingsStore:public CSettingsStore {
 public:
   CGnomeSettingsStore(Dasher::CEventHandler * pEventHandler);
   ~CGnomeSettingsStore();
 
-#ifdef WITH_GCONF
-  void NotificationCallback(GConfClient * pClient, guint iCNXN_ID, GConfEntry * pEntry);
-#endif
-
 private:
   bool LoadSetting(const std::string & Key, bool * Value);
   bool LoadSetting(const std::string & Key, long * Value);
@@ -39,6 +37,9 @@ private:
   GConfClient *the_gconf_client;
   GConfEngine *gconfengine;
 #endif
+#ifdef WITH_GSETTINGS
+  GSettings *settings;
+#endif
 };
 
 #endif
diff --git a/Src/Gtk2/Makefile.am b/Src/Gtk2/Makefile.am
index 6036f8c..22ec5ac 100644
--- a/Src/Gtk2/Makefile.am
+++ b/Src/Gtk2/Makefile.am
@@ -1,10 +1,9 @@
 LIBS = @INTLLIBS@ @LIBS@
 
 noinst_LTLIBRARIES = libdashergtk.la libdashercontrol.la
-if GCONF_SCHEMAS_INSTALL
-  noinst_PROGRAMS = generate-schema
-  generate_schema_SOURCES = GenerateSchema.cpp
-endif
+
+noinst_PROGRAMS = generate-schema
+generate_schema_SOURCES = GenerateSchema.cpp
 
 #bin_PROGRAMS = dasher-config
 
@@ -31,7 +30,6 @@ libdashercontrol_la_SOURCES = \
 		Canvas.h \
 		DasherControl.cpp \
 		DasherControl.h \
-		GnomeSettingsStore.cpp \
 		GnomeSettingsStore.h \
 		GtkDasherControl.cpp \
 		GtkDasherControl.h \
@@ -51,6 +49,16 @@ libdashercontrol_la_SOURCES = \
 		mouse_input.h \
 		$(settings_store)
 
+if USE_GCONF
+libdashercontrol_la_SOURCES += GConfStore.cpp
+else
+if USE_GSETTINGS
+libdashercontrol_la_SOURCES += GSettingsStore.cpp
+else
+libdashercontrol_la_SOURCES += NoStore.cpp
+endif
+endif
+
 libdashergtk_la_SOURCES = \
 		DasherAppSettings.cpp \
 		DasherAppSettings.h \
@@ -60,12 +68,6 @@ libdashergtk_la_SOURCES = \
 		dasher.h \
 		DasherSpi.h \
 		DasherSpi.cpp \
-		dasher_action.cpp \
-		dasher_action.h \
-		dasher_action_keyboard.cpp \
-		dasher_action_keyboard.h \
-		dasher_action_script.cpp \
-		dasher_action_script.h \
 		dasher_editor.cpp \
 		dasher_editor.h \
 		dasher_editor_external.cpp \
@@ -79,17 +81,24 @@ libdashergtk_la_SOURCES = \
 		module_settings_window.cpp \
 		module_settings_window.h
 
-if WITH_MAEMO
-libdashergtk_la_SOURCES += \
-		dasher_action_keyboard_maemo.cpp \
-		dasher_action_keyboard_maemo.h \
-		dasher_maemo_helper.cpp \
-		dasher_maemo_helper.h
-endif
+# ifdef XXXPRLWACTIONSAREFIXED
+#		dasher_action.cpp \
+#		dasher_action.h \
+#		dasher_action_keyboard.cpp \
+#		dasher_action_keyboard.h \
+#		dasher_action_script.cpp \
+#		dasher_action_script.h \
+# if WITH_MAEMO
+# libdashergtk_la_SOURCES += \
+#		dasher_action_keyboard_maemo.cpp \
+#		dasher_action_keyboard_maemo.h \
+#		dasher_maemo_helper.cpp \
+#		dasher_maemo_helper.h
+# endif
 
 libdashergtk_la_LIBADD = @SPEECH_SOURCES@
 libdashergtk_la_DEPENDENCIES = @SPEECH_SOURCES@
 
-AM_CXXFLAGS = -I$(srcdir)/../DasherCore -DPROGDATA=\"$(pkgdatadir)\" -I../../intl -I$(top_srcdir)/intl $(GTK2BUILD_CFLAGS) 
+AM_CXXFLAGS = -I$(srcdir)/../DasherCore -DPROGDATA=\"$(pkgdatadir)\" $(GTK2BUILD_CFLAGS) 
 
 AM_CFLAGS = $(GTK2_CFLAGS)
diff --git a/Src/Gtk2/NoStore.cpp b/Src/Gtk2/NoStore.cpp
new file mode 100644
index 0000000..6b50574
--- /dev/null
+++ b/Src/Gtk2/NoStore.cpp
@@ -0,0 +1,29 @@
+#include "GnomeSettingsStore.h"
+
+CGnomeSettingsStore::CGnomeSettingsStore(Dasher::CEventHandler *pEventHandler):CSettingsStore(pEventHandler) {
+  LoadPersistent();
+}
+
+CGnomeSettingsStore::~CGnomeSettingsStore() {
+}
+
+bool CGnomeSettingsStore::LoadSetting(const std::string &Key, bool *Value) {
+  return false;
+}
+
+bool CGnomeSettingsStore::LoadSetting(const std::string &Key, long *Value) {
+  return false;
+}
+
+bool CGnomeSettingsStore::LoadSetting(const std::string &Key, std::string *Value) {
+  return false;
+}
+
+void CGnomeSettingsStore::SaveSetting(const std::string &Key, bool Value) {
+}
+
+void CGnomeSettingsStore::SaveSetting(const std::string &Key, long Value) {
+}
+
+void CGnomeSettingsStore::SaveSetting(const std::string &Key, const std::string &Value) {
+}
diff --git a/Src/Gtk2/dasher_editor.cpp b/Src/Gtk2/dasher_editor.cpp
index d11fead..fbdf20a 100644
--- a/Src/Gtk2/dasher_editor.cpp
+++ b/Src/Gtk2/dasher_editor.cpp
@@ -25,17 +25,21 @@
 #include <glib/gi18n.h>
 #include <gtk/gtk.h>
 
-#include "dasher_action_keyboard.h"
+#ifdef XXXPRLWACTIONSAREFIXED
 #ifdef WITH_MAEMO
 #include "dasher_action_keyboard_maemo.h"
 #else
+#include "dasher_action_keyboard.h"
 #include "dasher_action_script.h"
 #endif
+#endif
+
 #include "dasher_editor.h"
 #include "dasher_lock_dialogue.h"
 #include "dasher_main.h"
 //#include "game_mode_helper.h"
 
+#ifdef XXXPRLWACTIONSAREFIXED
 #define ACTION_STATE_SHOW 1
 #define ACTION_STATE_CONTROL 2
 #define ACTION_STATE_AUTO 4
@@ -53,6 +57,7 @@ struct _EditorAction {
   gboolean bAuto;
   gint iNSub;
 };
+#endif
 
 typedef struct _DasherEditorPrivate DasherEditorPrivate;
 
@@ -60,13 +65,17 @@ struct _DasherEditorPrivate {
   DasherMain *pDasherMain;
   GtkTextView *pTextView;
   GtkTextBuffer *pBuffer;
+#ifdef XXXPRLWACTIONSAREFIXED
   GtkVBox *pActionPane;
+#endif
   GtkClipboard *pTextClipboard;
   GtkClipboard *pPrimarySelection;
+#ifdef XXXPRLWACTIONSAREFIXED
   EditorAction *pActionRing;
   EditorAction *pActionIter;
   gboolean bActionIterStarted;
   gint iNextActionID;
+#endif
   //  GameModeHelper *pGameModeHelper;
   GtkTextMark *pNewMark;
   DasherAppSettings *pAppSettings;
@@ -123,6 +132,7 @@ dasher_editor_class_init(DasherEditorClass *pClass) {
 
   pClass->initialise = NULL;
   pClass->command = NULL;
+#ifdef XXXPRLWACTIONSAREFIXED
   pClass->action_button = NULL;
   pClass->actions_start = NULL;
   pClass->actions_more = NULL;
@@ -130,6 +140,7 @@ dasher_editor_class_init(DasherEditorClass *pClass) {
   pClass->action_set_show = NULL;
   pClass->action_set_control = NULL;
   pClass->action_set_auto = NULL;
+#endif
   pClass->get_all_text = NULL;
   pClass->get_new_text = NULL;
   pClass->output = NULL;
@@ -162,8 +173,10 @@ dasher_editor_init(DasherEditor *pDasherControl) {
   pPrivate->szFilename = NULL;
   pPrivate->pTextClipboard = gtk_clipboard_get(GDK_SELECTION_CLIPBOARD);
   pPrivate->pPrimarySelection = gtk_clipboard_get(GDK_SELECTION_PRIMARY);
+#ifdef XXXPRLWACTIONSAREFIXED
   pPrivate->pActionRing = NULL;
   pPrivate->iNextActionID = 0;
+#endif
   //  pPrivate->pGameModeHelper = NULL;
   pPrivate->bFileModified = FALSE;
 }
@@ -174,6 +187,7 @@ dasher_editor_finalize(GObject *pObject) {
 
   DasherEditorPrivate *pPrivate = DASHER_EDITOR_GET_PRIVATE(pObject);
 
+#ifdef XXXPRLWACTIONSAREFIXED
   EditorAction *pCurrentAction = pPrivate->pActionRing;
 
   if(pCurrentAction) {
@@ -186,6 +200,7 @@ dasher_editor_finalize(GObject *pObject) {
       pCurrentAction = pCurrentAction->pNext;
     }
   }
+#endif
 
   if(pPrivate->szFilename)
     g_free(pPrivate->szFilename);
@@ -216,6 +231,7 @@ dasher_editor_handle_control(DasherEditor *pSelf, int iNodeID) {
     DASHER_EDITOR_GET_CLASS(pSelf)->handle_control(pSelf, iNodeID);
 }
 
+#ifdef XXXPRLWACTIONSAREFIXED
 void 
 dasher_editor_action_button(DasherEditor *pSelf, DasherAction *pAction) {
   if(DASHER_EDITOR_GET_CLASS(pSelf)->action_button)
@@ -259,6 +275,7 @@ dasher_editor_action_set_auto(DasherEditor *pSelf, int iActionID, bool bValue) {
   if(DASHER_EDITOR_GET_CLASS(pSelf)->action_set_auto)
     DASHER_EDITOR_GET_CLASS(pSelf)->action_set_auto(pSelf, iActionID, bValue);
 }
+#endif
 
 void 
 dasher_editor_grab_focus(DasherEditor *pSelf) {
diff --git a/Src/Gtk2/dasher_editor.h b/Src/Gtk2/dasher_editor.h
index 406f700..6d8fdca 100644
--- a/Src/Gtk2/dasher_editor.h
+++ b/Src/Gtk2/dasher_editor.h
@@ -5,7 +5,9 @@
 #include <glib-object.h>
 #include <gtk/gtk.h>
 
+#ifdef XXXPRLWACTIONSAREFIXED
 #include "dasher_action.h"
+#endif
 
 /* Forward declaration */
 typedef struct _DasherMain DasherMain;
@@ -47,6 +49,7 @@ struct _DasherEditorClass {
   /* VTable */
   void (*initialise)(DasherEditor *, DasherAppSettings *, DasherMain *, GtkBuilder *, const gchar *);
   gboolean (*command)(DasherEditor *, const gchar *);
+#ifdef XXXPRLWACTIONSAREFIXED
   void (*action_button)(DasherEditor *, DasherAction *);
   void (*actions_start)(DasherEditor *);
   bool (*actions_more)(DasherEditor *);
@@ -54,6 +57,7 @@ struct _DasherEditorClass {
   void (*action_set_show)(DasherEditor *, int, bool);
   void (*action_set_control)(DasherEditor *, int, bool);
   void (*action_set_auto)(DasherEditor *, int, bool);
+#endif
   const gchar *(*get_all_text)(DasherEditor *);
   const gchar *(*get_new_text)(DasherEditor *);
   void (*output)(DasherEditor *, const gchar *, int);
@@ -99,6 +103,7 @@ void dasher_editor_initialise(DasherEditor *pSelf,
 gboolean dasher_editor_command(DasherEditor *pSelf, const gchar *szCommand);
 
 /* Action related methods */
+#ifdef XXXPRLWACTIONSAREFIXED
 void dasher_editor_action_button(DasherEditor *pSelf, DasherAction *pAction);
 void dasher_editor_actions_start(DasherEditor *pSelf);
 bool dasher_editor_actions_more(DasherEditor *pSelf);
@@ -108,6 +113,7 @@ void dasher_editor_actions_get_next(DasherEditor *pSelf, const gchar **szName,
 void dasher_editor_action_set_show(DasherEditor *pSelf, int iActionID, bool bValue);
 void dasher_editor_action_set_control(DasherEditor *pSelf, int iActionID, bool bValue);
 void dasher_editor_action_set_auto(DasherEditor *pSelf, int iActionID, bool bValue);
+#endif
 
 const gchar *dasher_editor_get_all_text(DasherEditor *pSelf);
 const gchar *dasher_editor_get_new_text(DasherEditor *pSelf);
diff --git a/Src/Gtk2/dasher_editor_internal.cpp b/Src/Gtk2/dasher_editor_internal.cpp
index 6003d72..d436696 100644
--- a/Src/Gtk2/dasher_editor_internal.cpp
+++ b/Src/Gtk2/dasher_editor_internal.cpp
@@ -10,6 +10,7 @@
 #endif
 #include <gtk/gtk.h>
 
+#if XXXPRLWACTIONSAREFIXED
 #ifdef WITH_MAEMO
 #include "dasher_action_keyboard_maemo.h"
 #else
@@ -19,6 +20,7 @@
 #ifndef WITH_MAEMO
 #include "dasher_action_script.h"
 #endif
+#endif
 
 #include "dasher_editor_internal.h"
 #include "dasher_lock_dialogue.h"
@@ -49,6 +51,7 @@
 
 // ---
 
+#ifdef XXXPRLWACTIONSAREFIXED
 #define ACTION_STATE_SHOW 1
 #define ACTION_STATE_CONTROL 2
 #define ACTION_STATE_AUTO 4
@@ -66,6 +69,7 @@ struct _EditorAction {
   gboolean bAuto;
   gint iNSub;
 };
+#endif /* XXXPRLWACTIONSAREFIXED */
 
 typedef struct _DasherEditorInternalPrivate DasherEditorInternalPrivate;
 
@@ -73,15 +77,19 @@ struct _DasherEditorInternalPrivate {
   DasherMain *pDasherMain;
   GtkTextView *pTextView;
   GtkTextBuffer *pBuffer;
+#ifdef XXXPRLWACTIONSAREFIXED
   GtkVBox *pActionPane;
+#endif
   GtkClipboard *pTextClipboard;
   GtkClipboard *pPrimarySelection;
   GtkTable *pGameGroup;
   GtkLabel *pGameInfoLabel;
+#ifdef XXXPRLWACTIONSAREFIXED
   EditorAction *pActionRing;
   EditorAction *pActionIter;
   gboolean bActionIterStarted;
   gint iNextActionID;
+#endif
   //  GameModeHelper *pGameModeHelper;
   GtkTextMark *pNewMark;
   DasherAppSettings *pAppSettings;
@@ -113,13 +121,15 @@ void dasher_editor_internal_initialise(DasherEditor *pSelf, DasherAppSettings *p
 
 /* Private methods */
 static void dasher_editor_internal_select_all(DasherEditor *pSelf);
+#if XXXPRLWACTIONSAREFIXED
 static void dasher_editor_internal_setup_actions(DasherEditor *pSelf);
 static void dasher_editor_internal_add_action(DasherEditor *pSelf, DasherAction *pNewAction);
 static EditorAction *dasher_editor_internal_get_action_by_id(DasherEditor *pSelf, int iID);
 static void dasher_editor_internal_rebuild_action_pane(DasherEditor *pSelf);
+static void dasher_editor_internal_action_save_state(DasherEditor *pSelf, EditorAction *pAction);
 //static void dasher_editor_internal_display_message(DasherEditor *pSelf, DasherMessageInfo *pMessageInfo);
 static void dasher_editor_internal_check_activity(DasherEditor *pSelf, EditorAction *pAction);
-static void dasher_editor_internal_action_save_state(DasherEditor *pSelf, EditorAction *pAction);
+#endif
 
 static void dasher_editor_internal_command_new(DasherEditor *pSelf);
 static void dasher_editor_internal_command_open(DasherEditor *pSelf);
@@ -164,6 +174,7 @@ void dasher_editor_internal_handle_start(DasherEditor *pSelf);
 void dasher_editor_internal_handle_control(DasherEditor *pSelf, int iNodeID);
 
 /* Action related methods - TODO: a lot of this should be moved to dasher_main (eg action on stop etc) - that way we get a better level of abstraction, and can incorporate commands from other modules too. Actions should only be externally visible as a list of string commands*/
+#ifdef XXXPRLWACTIONSAREFIXED
 void dasher_editor_internal_action_button(DasherEditor *pSelf, DasherAction *pAction);
 void dasher_editor_internal_actions_start(DasherEditor *pSelf);
 bool dasher_editor_internal_actions_more(DasherEditor *pSelf);
@@ -171,6 +182,7 @@ void dasher_editor_internal_actions_get_next(DasherEditor *pSelf, const gchar **
 void dasher_editor_internal_action_set_show(DasherEditor *pSelf, int iActionID, bool bValue);
 void dasher_editor_internal_action_set_control(DasherEditor *pSelf, int iActionID, bool bValue);
 void dasher_editor_internal_action_set_auto(DasherEditor *pSelf, int iActionID, bool bValue);
+#endif
 
 void dasher_editor_internal_grab_focus(DasherEditor *pSelf);
 
@@ -221,6 +233,7 @@ dasher_editor_internal_class_init(DasherEditorInternalClass *pClass) {
   pParentClass->handle_stop = dasher_editor_internal_handle_stop;
   pParentClass->handle_start = dasher_editor_internal_handle_start;
   pParentClass->handle_control = dasher_editor_internal_handle_control;
+#ifdef XXXPRLWACTIONSAREFIXED
   pParentClass->action_button = dasher_editor_internal_action_button;
   pParentClass->actions_start = dasher_editor_internal_actions_start;
   pParentClass->actions_more = dasher_editor_internal_actions_more;
@@ -228,6 +241,7 @@ dasher_editor_internal_class_init(DasherEditorInternalClass *pClass) {
   pParentClass->action_set_show = dasher_editor_internal_action_set_show;
   pParentClass->action_set_control = dasher_editor_internal_action_set_control;
   pParentClass->action_set_auto = dasher_editor_internal_action_set_auto;
+#endif
   pParentClass->grab_focus = dasher_editor_internal_grab_focus;
   pParentClass->file_changed = dasher_editor_internal_file_changed;
   pParentClass->get_filename = dasher_editor_internal_get_filename;
@@ -247,8 +261,10 @@ dasher_editor_internal_init(DasherEditorInternal *pSelf) {
   pPrivate->szFilename = NULL;
   pPrivate->pTextClipboard = gtk_clipboard_get(GDK_SELECTION_CLIPBOARD);
   pPrivate->pPrimarySelection = gtk_clipboard_get(GDK_SELECTION_PRIMARY);
+#ifdef XXXPRLWACTIONSAREFIXED
   pPrivate->pActionRing = NULL;
   pPrivate->iNextActionID = 0;
+#endif
   //  pPrivate->pGameModeHelper = NULL;
   GtkTextIter oStartIter;
   gtk_text_buffer_get_start_iter(pPrivate->pBuffer, &oStartIter);
@@ -278,6 +294,7 @@ static void
 dasher_editor_internal_finalize(GObject *pObject) {
   DasherEditorInternalPrivate *pPrivate = DASHER_EDITOR_INTERNAL_GET_PRIVATE(pObject);
 
+#ifdef XXXPRLWACTIONSAREFIXED
   EditorAction *pCurrentAction = pPrivate->pActionRing;
 
   if(pCurrentAction) {
@@ -290,6 +307,7 @@ dasher_editor_internal_finalize(GObject *pObject) {
       pCurrentAction = pCurrentAction->pNext;
     }
   }
+#endif
 
   if(pPrivate->szFilename)
     g_free(pPrivate->szFilename);
@@ -314,15 +332,19 @@ dasher_editor_internal_initialise(DasherEditor *pSelf, DasherAppSettings *pAppSe
 				     dasher_app_settings_get_string(pPrivate->pAppSettings, 
 								    APP_SP_EDIT_FONT));
   
+#ifdef XXXPRLWACTIONSAREFIXED
   GtkVBox *pActionPane = GTK_VBOX(gtk_builder_get_object(pXML, "vbox39"));
 
 
   pPrivate->pActionPane = pActionPane;
+#endif
 
   // TODO: is this still needed?
   dasher_editor_internal_create_buffer(pSelf);
 
+#ifdef XXXPRLWACTIONSAREFIXED
   dasher_editor_internal_setup_actions(pSelf);
+#endif
 
   // TODO: see note in command_new method
   if(szFullPath)
@@ -377,6 +399,7 @@ dasher_editor_internal_clipboard(DasherEditor *pSelf, clipboard_action act) {
 
 void 
 dasher_editor_internal_handle_stop(DasherEditor *pSelf) {
+#ifdef XXXPRLWACTIONSAREFIXED
   DasherEditorInternalPrivate *pPrivate = DASHER_EDITOR_INTERNAL_GET_PRIVATE(pSelf);
   
   // See if anything is set to auto:
@@ -392,6 +415,7 @@ dasher_editor_internal_handle_stop(DasherEditor *pSelf) {
       pCurrentAction = pCurrentAction->pNext;
     }
   }
+#endif
 }
 
 void 
@@ -409,6 +433,7 @@ dasher_editor_internal_handle_control(DasherEditor *pSelf, int iNodeID) {
 
   if(iNodeID == Dasher::CControlManager::CTL_USER + 1)
     dasher_editor_internal_clear(pSelf, false); // Clear node is a special case (it shouldn't be)
+#ifdef XXXPRLWACTIONSAREFIXED
   else if (pPrivate->pActionRing) {
     EditorAction *pCurrentAction = pPrivate->pActionRing;
     bool bStarted = false;
@@ -425,6 +450,7 @@ dasher_editor_internal_handle_control(DasherEditor *pSelf, int iNodeID) {
       pCurrentAction = pCurrentAction->pNext;
     }
   }
+#endif
 
 
   // TODO: Think about changing signals so we don't need to do this translation
@@ -466,6 +492,7 @@ dasher_editor_internal_handle_control(DasherEditor *pSelf, int iNodeID) {
 }
 
 
+#ifdef XXXPRLWACTIONSAREFIXED
 void 
 dasher_editor_internal_action_button(DasherEditor *pSelf, DasherAction *pAction) {
   if(pAction) {
@@ -476,6 +503,7 @@ dasher_editor_internal_action_button(DasherEditor *pSelf, DasherAction *pAction)
     dasher_editor_internal_clear(pSelf, false);
   }
 }
+#endif
 
 static void 
 dasher_editor_internal_clear(DasherEditor *pSelf, gboolean bStore) {
@@ -500,6 +528,7 @@ dasher_editor_internal_clear(DasherEditor *pSelf, gboolean bStore) {
 }
 
 
+#ifdef XXXPRLWACTIONSAREFIXED
 void 
 dasher_editor_internal_actions_start(DasherEditor *pSelf) {
   DasherEditorInternalPrivate *pPrivate = DASHER_EDITOR_INTERNAL_GET_PRIVATE(pSelf);
@@ -576,6 +605,7 @@ EditorAction *pAction;
     dasher_editor_internal_action_save_state(pSelf, pAction);
   }
 }
+#endif
 
 void 
 dasher_editor_internal_grab_focus(DasherEditor *pSelf) {
@@ -616,6 +646,7 @@ dasher_editor_internal_output(DasherEditor *pSelf, const gchar *szText, int iOff
   // TODO: tidy this up, actionlookup by name, more flexible
   // definition of space
   // Python scripting?
+#ifdef XXXPRLWACTIONSAREFIXED
   if(!strcmp(szText, " ")) {
     gboolean bActionIterStarted = false;
     EditorAction *pActionIter = pPrivate->pActionRing;
@@ -624,12 +655,13 @@ dasher_editor_internal_output(DasherEditor *pSelf, const gchar *szText, int iOff
       bActionIterStarted = true;
       
       if(!strcmp(dasher_action_get_name(pActionIter->pAction), "Speak")) {
-	dasher_action_preview(pActionIter->pAction, DASHER_EDITOR(pSelf));
+        dasher_action_preview(pActionIter->pAction, DASHER_EDITOR(pSelf));
       }
       
       pActionIter = pActionIter->pNext;
     }
   }
+#endif
 
   //  std::cout << "i: " << szText << " (" << iOffset << " " << gtk_text_buffer_get_char_count(pPrivate->pBuffer) << ")" << std::endl;
 
@@ -1064,6 +1096,7 @@ dasher_editor_internal_select_all(DasherEditor *pSelf) {
   delete end;
 }
 
+#ifdef XXXPRLWACTIONSAREFIXED
 static void 
 dasher_editor_internal_setup_actions(DasherEditor *pSelf) {
   DasherEditorInternalPrivate *pPrivate = DASHER_EDITOR_INTERNAL_GET_PRIVATE(pSelf);
@@ -1075,6 +1108,8 @@ dasher_editor_internal_setup_actions(DasherEditor *pSelf) {
   // are now in DasherCore, & the old DasherAction would no-op if used in
   // any otherway! (Also the whole actions code stuff seems so unfinished etc.
   // anyway...that perhaps it's best removed?)
+  //PRLW 4/4/11 Its tentacles made it into DasherAppSettings, so hiding with
+  // #ifdef XXXPRLWACTIONSAREFIXED
 
   dasher_editor_internal_add_action(pSelf, DASHER_ACTION(dasher_action_keyboard_new()));
 
@@ -1168,7 +1203,9 @@ dasher_editor_internal_setup_actions(DasherEditor *pSelf) {
   //  dasher_editor_internal_rebuild_action_pane(pSelf);
 #endif
 }
+#endif /* XXXPRLWACTIONSAREFIXED */
 
+#ifdef XXXPRLWACTIONSAREFIXED
 static void 
 dasher_editor_internal_add_action(DasherEditor *pSelf, DasherAction *pNewAction) {
   DasherEditorInternalPrivate *pPrivate = DASHER_EDITOR_INTERNAL_GET_PRIVATE(pSelf);
@@ -1220,7 +1257,9 @@ dasher_editor_internal_add_action(DasherEditor *pSelf, DasherAction *pNewAction)
 //   if(iState & ACTION_STATE_SHOW)
 //     gtk_dasher_control_add_action_button(GTK_DASHER_CONTROL(pDasherWidget), dasher_action_get_name(pNewEditorAction->pAction));
 }
+#endif /* XXXPRLWACTIONSAREFIXED */
 
+#ifdef XXXPRLWACTIONSAREFIXED
 static EditorAction *
 dasher_editor_internal_get_action_by_id(DasherEditor *pSelf, int iID){
   DasherEditorInternalPrivate *pPrivate = DASHER_EDITOR_INTERNAL_GET_PRIVATE(pSelf);
@@ -1237,7 +1276,9 @@ dasher_editor_internal_get_action_by_id(DasherEditor *pSelf, int iID){
   
   return 0;
 }
+#endif /* XXXPRLWACTIONSAREFIXED */
 
+#ifdef XXXPRLWACTIONSAREFIXED
 static void 
 dasher_editor_internal_rebuild_action_pane(DasherEditor *pSelf) {
   DasherEditorInternalPrivate *pPrivate = DASHER_EDITOR_INTERNAL_GET_PRIVATE(pSelf);
@@ -1286,6 +1327,7 @@ dasher_editor_internal_rebuild_action_pane(DasherEditor *pSelf) {
     pCurrentAction = pCurrentAction->pNext;
   }
 }
+#endif /* XXXPRLWACTIONSAREFIXED */
 
 // TODO: This shouldn't be a part of the editor
 //static void 
@@ -1295,6 +1337,7 @@ dasher_editor_internal_rebuild_action_pane(DasherEditor *pSelf) {
 //  gtk_widget_destroy(GTK_WIDGET(pDialog));
 //}
 
+#ifdef XXXPRLWACTIONSAREFIXED
 static void 
 dasher_editor_internal_check_activity(DasherEditor *pSelf, EditorAction *pAction) {
   gboolean bNeedActive(pAction->bShow || pAction->bControl || pAction->bAuto);
@@ -1305,7 +1348,9 @@ dasher_editor_internal_check_activity(DasherEditor *pSelf, EditorAction *pAction
   else if(!bNeedActive && bActive)
     dasher_action_deactivate(pAction->pAction);
 }
+#endif
 
+#ifdef XXXPRLWACTIONSAREFIXED
 static void 
 dasher_editor_internal_action_save_state(DasherEditor *pSelf, EditorAction *pAction) {
   gchar szRegistryName[256];
@@ -1330,6 +1375,7 @@ dasher_editor_internal_action_save_state(DasherEditor *pSelf, EditorAction *pAct
   DasherEditorInternalPrivate *pPrivate = DASHER_EDITOR_INTERNAL_GET_PRIVATE(pSelf);
   dasher_app_settings_set_free_long(pPrivate->pAppSettings, szRegistryName, iState);
 }
+#endif
 
 static void 
 dasher_editor_internal_command_new(DasherEditor *pSelf) {
@@ -1804,11 +1850,13 @@ extern "C" void
 main_window_realized(DasherMain *pMain, gpointer pUserData) {
 }
 
+#ifdef XXXPRLWACTIONSAREFIXED
 extern "C" void 
 action_button_callback(GtkWidget *pWidget, gpointer pUserData) { 
   void **pPointers((void **)pUserData);
   dasher_editor_internal_action_button((DasherEditor *)pPointers[0], (DasherAction *)pPointers[1]);
 }
+#endif
 
 extern "C" void mark_set_handler(GtkWidget *widget, GtkTextIter *pIter, GtkTextMark *pMark, gpointer pUserData) {
   dasher_editor_internal_mark_changed(DASHER_EDITOR_INTERNAL(pUserData), pIter, pMark);
diff --git a/Src/Gtk2/dasher_editor_internal.h b/Src/Gtk2/dasher_editor_internal.h
index 2e7373e..61c4a33 100644
--- a/Src/Gtk2/dasher_editor_internal.h
+++ b/Src/Gtk2/dasher_editor_internal.h
@@ -6,7 +6,9 @@
 #include <gtk/gtk.h>
 
 #include "DasherAppSettings.h"
+#ifdef XXXPRLWACTIONSAREFIXED
 #include "dasher_action.h"
+#endif
 #include "dasher_editor.h"
 
 /* Forward declaration */
diff --git a/configure.ac b/configure.ac
index d5e08fd..73f8278 100644
--- a/configure.ac
+++ b/configure.ac
@@ -74,9 +74,6 @@ AC_ARG_WITH([gnome],
 	fi, 
 	WITHGNOME=true)
 
-PKG_CHECK_MODULES(GIO, gio-2.0,
-	[AC_DEFINE(HAVE_GIO, 1, [gio exists so use gvfs])])
-
 AC_ARG_ENABLE([speech],
 	 AS_HELP_STRING([--enable-speech],[build with speech support (default is NO)]),
 	 if test "x$enableval" = "xno"; then
@@ -185,6 +182,12 @@ AC_ARG_WITH([cairo],
 	 fi, 
 	 WITHCAIRO=true)
 
+AC_ARG_WITH([gsettings],
+	[AS_HELP_STRING([--with-gsettings],
+		[store user preferences using GSettings (default is NO)])])
+AC_ARG_VAR([GLIB_COMPILE_SCHEMAS],
+	[Path to glib-compile-schemas, used for compiling GSettings schema])
+
 if test x"$WITHGTK2" = xtrue
 then 
 	PKG_CHECK_MODULES(GTK2, gtk+-3.0,
@@ -204,16 +207,16 @@ fi
 DAM_GCONF_SOURCE_2
 if test x$BUILDGTK2 = xtrue
 then
-	PKG_CHECK_MODULES(GCONF, gconf-2.0,
-		[AC_DEFINE([WITH_GCONF], 1, [Use GConf])],
-		[AC_MSG_WARN([GConf was not detected - user preferences will not be stored.])])
+	PKG_CHECK_MODULES(GIO, gio-2.0,
+		[AC_DEFINE(HAVE_GIO, 1, [gio exists so use gvfs])])
+
 	save_CFLAGS="$CFLAGS"
 	save_LIBS="$LIBS"
 	CFLAGS="$CFLAGS $GTK2_CFLAGS"
 	CPPFLAGS="$CPPFLAGS $GTK2_CFLAGS"
 	LIBS="$LIBS $GTK2_LIBS"
 	AC_CHECK_HEADERS([gdk/gdkkeysyms-compat.h])
-	AC_CHECK_FUNCS([gtk_builder_new gtk_show_uri gdk_window_get_width gtk_cairo_should_draw_window], [],
+	AC_CHECK_FUNCS([gtk_builder_new gtk_show_uri gdk_window_get_width gtk_cairo_should_draw_window g_settings_new], [],
 		[if test "x$ac_cv_func_gtk_builder_new" = "xno"; then
 			AC_MSG_ERROR([A version of GTK+ providing GtkBuilder is necessary.])
 		fi
@@ -223,10 +226,26 @@ then
 	)
 	CFLAGS="$save_CFLAGS"
 	LIBS="$save_LIBS"
-# GtkBuilder's autoconnect feature requires dasher to be linked with
-# the --export-dynamic flag. pkg-config does not provide it, and libtool
-# knows what to do with -export-dynamic.
-# (We need this e.g., for <object class="DasherEditor">)
+
+	AS_IF([test "x$with_gsettings" = "xyes" -a "x$ac_cv_func_g_settings_new" = "xyes"],
+		[AC_CHECK_TOOLS([GLIB_COMPILE_SCHEMAS], [glib-compile-schemas])
+         have_gsettings=true
+		 have_gconf=false
+		 AC_DEFINE([WITH_GSETTINGS], 1, [Use GSettings])],
+		[have_gsettings=false
+		 PKG_CHECK_MODULES(GCONF, gconf-2.0,
+			[have_gconf=true
+			 AC_DEFINE([WITH_GCONF], 1, [Use GConf])
+			 SETTINGS_CFLAGS=$GCONF_CFLAGS
+			 SETTINGS_LIBS=$GCONF_LIBS],
+			[have_gconf=false
+			 AC_MSG_WARN([Neither a glib with GSettings, nor GConf were detected - user preferences will not be stored.])])
+		])
+
+	# GtkBuilder's autoconnect feature requires dasher to be
+	# linked with the --export-dynamic flag. pkg-config does not
+	# provide it, and libtool knows what to do with -export-dynamic.
+	# (We need this e.g., for <object class="DasherEditor">)
 	GTK2_LIBS="$GTK2_LIBS -export-dynamic"
 else
 	AC_MSG_ERROR("Unable to find GTK2 or another necessary library.")
@@ -336,6 +355,8 @@ AC_SUBST(hildon_CFLAGS)
 
 AC_SUBST(GETTEXT_PACKAGE)
 
+AM_CONDITIONAL(USE_GCONF, test x$have_gconf = xtrue)
+AM_CONDITIONAL(USE_GSETTINGS, test x$have_gsettings = xtrue)
 AM_CONDITIONAL(DOGTK2, test x$BUILDGTK2 = xtrue)	
 AM_CONDITIONAL(DOQTE, test x$WITHQTE = xtrue)
 AM_CONDITIONAL(GNOME_SPEECH, test x$WITHSPEECH = xtrue)
@@ -350,18 +371,10 @@ AM_CONDITIONAL(JOYSTICK, test x$WITHJOYSTICK = xtrue)
 AC_SUBST(GTK2_CFLAGS)
 AC_SUBST(GTK2_LIBS)
 
-AC_SUBST(GCONF_CFLAGS)
-AC_SUBST(GCONF_LIBS)
-
 if test x"$WITHGPE" = xtrue ; then
 	SETTINGS_CFLAGS=" "
 	SETTINGS_LIBS="-lgpewidget -lXsettings-client -lXsettings"
-else
-	SETTINGS_CFLAGS=$GCONF_CFLAGS
-	SETTINGS_LIBS=$GCONF_LIBS
 fi
-AC_SUBST(SETTINGS_CFLAGS)
-AC_SUBST(SETTINGS_LIBS)
 
 GTK2BUILD_CFLAGS="$GTK2_CFLAGS $GIO_CFLAGS $SETTINGS_CFLAGS $gthread_CFLAGS $gnome_speech_CFLAGS $gnome_a11y_CFLAGS $hildon_CFLAGS"
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]