gtk_label_set_markup (GTK_LABEL(label),_("<b>Security</b>"));
gtk_box_pack_start (GTK_BOX(box), label, FALSE, FALSE, 0);
+ priv->security = modest_widget_factory_get_combo_box (priv->factory,
+ MODEST_COMBO_BOX_TYPE_SECURITY_PROTOS);
hbox = gtk_hbox_new (FALSE, 6);
label = gtk_label_new(NULL);
gtk_label_set_text (GTK_LABEL(label),_("Connection type:"));
gtk_box_pack_start (GTK_BOX(hbox), label, FALSE, FALSE, 0);
- gtk_box_pack_start (GTK_BOX(hbox), modest_widget_factory_get_combo_box
- (priv->factory, MODEST_COMBO_BOX_TYPE_SECURITY_PROTOS),
- FALSE, FALSE,0);
+ gtk_box_pack_start (GTK_BOX(hbox), priv->security, FALSE, FALSE,0);
gtk_box_pack_start (GTK_BOX(box), hbox, FALSE, FALSE, 0);
hbox = gtk_hbox_new (FALSE, 6);
{
ModestStoreWidgetPrivate *priv;
- g_return_val_if_fail (self, FALSE);
+ g_return_val_if_fail (self, NULL);
priv = MODEST_STORE_WIDGET_GET_PRIVATE(self);
return priv->proto;
}
-
return retval;
}
+void
+modest_account_mgr_set_list (ModestAccountMgr *self,
+ const gchar *name,
+ const gchar *key,
+ GSList *val,
+ ModestConfValueType list_type,
+ gboolean server_account,
+ GError **err)
+{
+ ModestAccountMgrPrivate *priv;
+ gchar *keyname;
+
+ g_return_if_fail (self);
+ g_return_if_fail (name);
+ g_return_if_fail (key);
+ g_return_if_fail (val);
+
+ keyname = get_account_keyname (name, key, server_account);
+
+ priv = MODEST_ACCOUNT_MGR_GET_PRIVATE (self);
+ modest_conf_set_list (priv->modest_conf, keyname, val, list_type, err);
+ g_free (keyname);
+}
gboolean
modest_account_mgr_account_exists (ModestAccountMgr * self, const gchar * name,
GError **err);
/**
+ * modest_account_mgr_get_list:
+ * @self: a ModestAccountMgr instance
+ * @name: the name of the account
+ * @key: the key of the value to get
+ * @list_type: the type of the members of the list
+ * @server_account: if TRUE, this is a server account
+ * @err: a GError ptr, or NULL to ignore.
+ *
+ * get a config list of values of type @list_type of an account
+ *
+ * Returns: a newly allocated list of elements
+ * @err gives details in case of error
+ */
+GSList* modest_account_mgr_get_list (ModestAccountMgr *self,
+ const gchar *name,
+ const gchar *key,
+ ModestConfValueType list_type,
+ gboolean server_account,
+ GError **err);
+
+/**
* modest_account_mgr_set_account_string:
* @self: a ModestAccountMgr instance
* @name: the name of the account
gboolean server_account,
GError **err);
-
/**
- * modest_account_mgr_get_list:
+ * modest_account_mgr_set_list:
* @self: a ModestAccountMgr instance
* @name: the name of the account
- * @key: the key of the value to get
+ * @key: the key of the value to set
+ * @key: the list with the values to set
* @list_type: the type of the members of the list
* @server_account: if TRUE, this is a server account
* @err: a GError ptr, or NULL to ignore.
*
- * get a config list of values of type @list_type of an account
- *
- * Returns: a newly allocated list of elements
+ * set a config list of values of type @list_type of an account
* @err gives details in case of error
*/
-GSList* modest_account_mgr_get_list (ModestAccountMgr *self,
+void modest_account_mgr_set_list (ModestAccountMgr *self,
const gchar *name,
const gchar *key,
+ GSList *val,
ModestConfValueType list_type,
gboolean server_account,
GError **err);
#include <gconf/gconf-client.h>
#include <string.h>
+#include <glib/gi18n.h>
#include "modest-conf.h"
#include "modest-marshal.h"
static void modest_conf_finalize (GObject *obj);
static void modest_conf_on_change (GConfClient *client, guint conn_id,
GConfEntry *entry, gpointer data);
+static GConfValueType modest_conf_type_to_gconf_type (ModestConfValueType value_type,
+ GError **err);
/* list my signals */
enum {
KEY_CHANGED_SIGNAL,
{
ModestConfPrivate *priv;
GConfValueType gconf_type;
+ GSList *retval = NULL;
g_return_val_if_fail (self, NULL);
g_return_val_if_fail (key, NULL);
priv = MODEST_CONF_GET_PRIVATE(self);
- switch (list_type) {
- case MODEST_CONF_VALUE_INT:
- gconf_type = GCONF_VALUE_INT;
- break;
- case MODEST_CONF_VALUE_BOOL:
- gconf_type = GCONF_VALUE_BOOL;
- break;
- case MODEST_CONF_VALUE_FLOAT:
- gconf_type = GCONF_VALUE_FLOAT;
- break;
- case MODEST_CONF_VALUE_STRING:
- gconf_type = GCONF_VALUE_STRING;
- break;
- default:
- g_printerr ("modest: invalid list type %d requested\n", list_type);
- /* FIXME: fill GError */
- return NULL;
- }
- return gconf_client_get_list (priv->gconf_client, key, gconf_type, err);
+ gconf_type = modest_conf_type_to_gconf_type (list_type, err);
+
+ if (!err)
+ retval = gconf_client_get_list (priv->gconf_client, key, gconf_type, err);
+
+ return retval;
}
}
+void
+modest_conf_set_list (ModestConf* self, const gchar* key,
+ GSList *val, ModestConfValueType list_type,
+ GError **err)
+{
+ ModestConfPrivate *priv;
+ GConfValueType gconf_type;
+
+ g_return_if_fail (self);
+ g_return_if_fail (key);
+
+ priv = MODEST_CONF_GET_PRIVATE(self);
+
+ gconf_type = modest_conf_type_to_gconf_type (list_type, err);
+
+ if (!err)
+ gconf_client_set_list (priv->gconf_client, key, gconf_type, val, err);
+}
GSList*
key, event);
}
+static GConfValueType
+modest_conf_type_to_gconf_type (ModestConfValueType value_type, GError **err)
+{
+ GConfValueType gconf_type;
+
+ switch (value_type) {
+ case MODEST_CONF_VALUE_INT:
+ gconf_type = GCONF_VALUE_INT;
+ break;
+ case MODEST_CONF_VALUE_BOOL:
+ gconf_type = GCONF_VALUE_BOOL;
+ break;
+ case MODEST_CONF_VALUE_FLOAT:
+ gconf_type = GCONF_VALUE_FLOAT;
+ break;
+ case MODEST_CONF_VALUE_STRING:
+ gconf_type = GCONF_VALUE_STRING;
+ break;
+ default:
+ /* FIXME: use MODEST_ERROR, and error code */
+ *err = g_error_new_literal (0, 0, _("Invalid list value type"));
+ }
+ return gconf_type;
+}
/**
- * modest_conf_get_list:
+ * modest_conf_set_list:
* @self: a ModestConf instance
* @key: the key of the value to retrieve
+ * @val: the list with the values to set
* @list_type: the type of the elements of the list
* @err: a GError ptr, or NULL to ignore.
*
- * get a list of values from the configuration system
- *
- * Returns: a list with the values for the key, or NULL in case of error or
- * if the list is empty; @err gives details in case of error
+ * set a list of values in the configuration system
+ * @err gives details in case of error
*/
-GSList * modest_conf_get_list (ModestConf* self, const gchar* key,
- ModestConfValueType list_type, GError **err);
+void modest_conf_set_list (ModestConf* self, const gchar* key,
+ GSList *val, ModestConfValueType list_type,
+ GError **err);
/**