[goffice] Conf: remove stuff we aren't using and sometimes not implement



commit 41d311bb97fec6a65f44656e278d14aa75189d5e
Author: Morten Welinder <terra gnome org>
Date:   Thu Nov 10 11:39:17 2011 -0500

    Conf: remove stuff we aren't using and sometimes not implement

 ChangeLog                       |    5 ++
 goffice/app/go-conf-gsettings.c |   86 ---------------------------------------
 goffice/app/go-conf-keyfile.c   |   68 ------------------------------
 goffice/app/go-conf-win32.c     |   85 --------------------------------------
 goffice/app/go-conf.h           |    2 -
 5 files changed, 5 insertions(+), 241 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 9ab5684..2aeac65 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2011-11-10  Morten Welinder  <terra gnome org>
+
+	* goffice/app/go-conf.h (go_conf_node_get_key_type)
+	(go_conf_get_value_as_str, go_conf_set_value_from_str): Delete.
+
 2011-11-09  Jean Brefort  <jean brefort normalesup org>
 
 	* goffice/graph/gog-plot-impl.h: fixed macro name.
diff --git a/goffice/app/go-conf-gsettings.c b/goffice/app/go-conf-gsettings.c
index 731b0fc..53b3f2b 100644
--- a/goffice/app/go-conf-gsettings.c
+++ b/goffice/app/go-conf-gsettings.c
@@ -355,44 +355,6 @@ go_conf_get_long_desc  (GOConfNode *node, gchar const *key)
 	return NULL;
 }
 
-gchar *
-go_conf_get_value_as_str (GOConfNode *node, gchar const *key)
-{
-	gchar *value_string;
-	GVariant *value = NULL;
-
-	if (node) {
-		if (key && !strchr (key, '/') &&  !strchr (key, '.'))
-			value = g_settings_get_value (node->settings, key);
-		else if (node->key)
-			value = g_settings_get_value (node->settings, node->key);
-	}
-	if (value == NULL) {
-		GOConfNode *real_node = go_conf_get_node (node, key);
-		value = real_node? g_settings_get_value (real_node->settings, real_node->key): NULL;
-		go_conf_free_node (real_node);
-	}
-	switch (g_variant_classify (value)) {
-	case 's':
-		value_string = g_strdup (g_variant_get_string (value, NULL));
-		break;
-	case 'i':
-		value_string = g_strdup_printf ("%i", g_variant_get_int32 (value));
-		break;
-	case 'd':
-		value_string = g_strdup_printf ("%f", g_variant_get_double (value));
-		break;
-	case 'b':
-		value_string = g_strdup (go_locale_boolean_name (g_variant_get_boolean (value)));
-		break;
-	default:
-		value_string = g_strdup ("ERROR FIXME");
-		break;
-	}
-
-	return value_string;
-}
-
 gboolean
 go_conf_get_bool (GOConfNode *node, gchar const *key)
 {
@@ -446,54 +408,6 @@ go_conf_get_str_list (GOConfNode *node, gchar const *key)
 	return go_conf_load_str_list (node, key);
 }
 
-#if 0
-gboolean
-go_conf_set_value_from_str (GOConfNode *node, gchar const *key, gchar const *val_str)
-{
-	switch (go_conf_node_get_key_type (node, key)) {
-	case G_TYPE_STRING:
-		go_conf_set_string (node, key, val_str);
-		break;
-	case G_TYPE_FLOAT: {
-		GODateConventions const *conv = NULL;  /* workbook_date_conv (state->wb); */
-		GnmValue *value = format_match_number (val_str, NULL, conv);
-		if (value != NULL) {
-			gnm_float the_float = value_get_as_float (value);
-			go_conf_set_double (node, key, the_float);
-		}
-		value_release (value);
-		break;
-	}
-	case G_TYPE_INT: {
-		GODateConventions const *conv = NULL;  /* workbook_date_conv (state->wb); */
-		GnmValue *value = format_match_number (val_str, NULL, conv);
-		if (value != NULL) {
-			gint the_int = value_get_as_int (value);
-			go_conf_set_int (node, key, the_int);
-		}
-		value_release (value);
-		break;
-	}
-	case G_TYPE_BOOLEAN: {
-		GODateConventions const *conv = NULL;  /* workbook_date_conv (state->wb); */
-		GnmValue *value = format_match_number (val_str, NULL, conv);
-		gboolean err, the_bool;
-		if (value != NULL) {
-			err = FALSE;
-			the_bool =  value_get_as_bool (value, &err);
-			go_conf_set_bool (node, key, the_bool);
-		}
-		value_release (value);
-		break;
-	}
-	default:
-		g_warning ("Unsupported gconf type in preference dialog");
-	}
-
-	return TRUE;
-}
-#endif
-
 void
 go_conf_remove_monitor (guint monitor_id)
 {
diff --git a/goffice/app/go-conf-keyfile.c b/goffice/app/go-conf-keyfile.c
index d92dac3..24885b2 100644
--- a/goffice/app/go-conf-keyfile.c
+++ b/goffice/app/go-conf-keyfile.c
@@ -430,74 +430,6 @@ go_conf_get_long_desc  (GOConfNode *node, gchar const *key)
 	return NULL;
 }
 
-GType
-go_conf_node_get_key_type (GOConfNode *node, gchar const *key)
-{
-	gchar **groups;
-	gchar *real_key;
-	GType type = G_TYPE_NONE;
-	gsize i, ng;
-
-	if (!node)
-		return type;
-
-	real_key = go_conf_get_real_key (node, key);
-	groups = g_key_file_get_groups (node->key_file, &ng);
-
-	if (groups != NULL) {
-		for (i = 0; i < ng; i++) {
-			if (g_key_file_has_key (node->key_file, groups[i], real_key, NULL)) {
-				if (!g_ascii_strcasecmp (groups[i], BOOL_GROUP)) {
-					type = G_TYPE_BOOLEAN;
-				} else if (!g_ascii_strcasecmp (groups[i], INT_GROUP)) {
-					type = G_TYPE_INT;
-				} else if (!g_ascii_strcasecmp (groups[i], DOUBLE_GROUP)) {
-					type = G_TYPE_DOUBLE;
-				} else if (!g_ascii_strcasecmp (groups[i], STRING_GROUP)) {
-					type = G_TYPE_STRING;
-				} else if (!g_ascii_strcasecmp (groups[i], STRLIST_GROUP)) {
-					type = G_TYPE_STRING;
-				}
-				break;
-			}
-		}
-		g_strfreev (groups);
-	}
-
-	g_free (real_key);
-
-	return type;
-}
-
-gchar *
-go_conf_get_value_as_str (GOConfNode *node, gchar const *key)
-{
-	gchar *val = NULL;
-	gchar *real_key = go_conf_get_real_key (node, key);
-
-	if (!node)
-		return NULL;
-
-	val = g_key_file_get_string (node->key_file, STRING_GROUP, real_key, NULL);
-	g_free (real_key);
-	return val;
-}
-
-#if 0
-gboolean
-go_conf_set_value_from_str (GOConfNode *node, gchar const *key, gchar const *val_str)
-{
-	gchar *real_key = go_conf_get_real_key (node, key);
-
-	if (!node)
-		return FALSE;
-
-	g_key_file_set_value (node->key_file, STRING_GROUP, real_key, val_str);
-	g_free (real_key);
-	return TRUE;
-}
-#endif
-
 void
 go_conf_sync (GOConfNode *node)
 {
diff --git a/goffice/app/go-conf-win32.c b/goffice/app/go-conf-win32.c
index c04abcf..eca5bbc 100644
--- a/goffice/app/go-conf-win32.c
+++ b/goffice/app/go-conf-win32.c
@@ -521,91 +521,6 @@ go_conf_get_long_desc  (GOConfNode *node, gchar const *key)
 	return NULL;
 }
 
-GType
-go_conf_node_get_key_type (GOConfNode *node, gchar const *key)
-{
-	gulong type, size;
-	guchar *ptr = NULL;
-
-	if (go_conf_win32_get (node, key, &type, &ptr, &size, FALSE, FALSE)) {
-		switch (type) {
-		case REG_BINARY:
-			return G_TYPE_BOOLEAN;
-		case REG_DWORD:
-			return G_TYPE_INT;
-		case REG_SZ:
-			g_free (ptr);
-			return G_TYPE_STRING;
-		}
-	}
-
-	return G_TYPE_NONE;
-}
-
-gchar *
-go_conf_get_value_as_str (GOConfNode *node, gchar const *key)
-{
-	gchar *value_string;
-
-	switch (go_conf_node_get_key_type (node, key)) {
-	case G_TYPE_STRING:
-		value_string = go_conf_get_string (node, key);
-		break;
-	case G_TYPE_INT:
-		value_string = g_strdup_printf ("%i", go_conf_get_int (node, key));
-		break;
-	case G_TYPE_FLOAT:
-		value_string = go_conf_get_string (node, key);
-		break;
-	case G_TYPE_BOOLEAN:
-		value_string = g_strdup (go_locale_boolean_name (go_conf_get_bool (node, key)));
-		break;
-	default:
-		value_string = g_strdup ("ERROR FIXME");
-	}
-
-	return value_string;
-}
-
-#if 0
-gboolean
-go_conf_set_value_from_str (GOConfNode *node, gchar const *key,
-			    gchar const *val_str)
-{
-	switch (go_conf_node_get_key_type (node, key)) {
-	case G_TYPE_STRING:
-		go_conf_set_string (node, key, val_str);
-		break;
-	case G_TYPE_INT: {
-		GODateConventions const *conv = NULL;  /* workbook_date_conv (state->wb); */
-		GnmValue *value = format_match_number (val_str, NULL, conv);
-		if (value != NULL) {
-			gint the_int = value_get_as_int (value);
-			go_conf_set_int (node, key, the_int);
-		}
-		value_release (value);
-		break;
-	}
-	case G_TYPE_BOOLEAN: {
-		GODateConventions const *conv = NULL;  /* workbook_date_conv (state->wb); */
-		GnmValue *value = format_match_number (val_str, NULL, conv);
-		gboolean err, the_bool;
-		if (value != NULL) {
-			err = FALSE;
-			the_bool =  value_get_as_bool (value, &err);
-			go_conf_set_bool (node, key, the_bool);
-		}
-		value_release (value);
-		break;
-	}
-	default:
-		g_warning ("Unsupported gconf type in preference dialog");
-	}
-
-	return TRUE;
-}
-#endif
-
 void
 go_conf_sync (GOConfNode *node)
 {
diff --git a/goffice/app/go-conf.h b/goffice/app/go-conf.h
index 0e566ac..2884a71 100644
--- a/goffice/app/go-conf.h
+++ b/goffice/app/go-conf.h
@@ -16,8 +16,6 @@ void	 go_conf_free_node	    (GOConfNode *node);
 
 gchar	*go_conf_get_short_desc     (GOConfNode *node, gchar const *key);
 gchar	*go_conf_get_long_desc      (GOConfNode *node, gchar const *key);
-GType	 go_conf_node_get_key_type	(GOConfNode *node, gchar const *key);
-gchar	*go_conf_get_value_as_str   (GOConfNode *node, gchar const *key);
 
 gboolean go_conf_get_bool	(GOConfNode *node, gchar const *key);
 gint	 go_conf_get_int	(GOConfNode *node, gchar const *key);



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