+
+void
+_modest_global_settings_dialog_load_conf (ModestGlobalSettingsDialogPrivate *priv)
+{
+ ModestConf *conf;
+ gboolean checked;
+ gint combo_id, value;
+ GError *error = NULL;
+
+ conf = modest_runtime_get_conf ();
+
+ /* Autoupdate */
+ checked = modest_conf_get_bool (conf, MODEST_CONF_AUTO_UPDATE, &error);
+ if (error) {
+ g_clear_error (&error);
+ error = NULL;
+ checked = FALSE;
+ }
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->auto_update), checked);
+
+ /* Connected by */
+ combo_id = modest_conf_get_int (conf, MODEST_CONF_UPDATE_WHEN_CONNECTED_BY, &error);
+ if (error) {
+ g_error_free (error);
+ error = NULL;
+ combo_id = MODEST_CONNECTED_VIA_WLAN;
+ }
+ modest_combo_box_set_active_id (MODEST_COMBO_BOX (priv->connect_via),
+ (gpointer) &combo_id);
+
+ /* Update interval */
+ combo_id = modest_conf_get_int (conf, MODEST_CONF_UPDATE_INTERVAL, &error);
+ if (error) {
+ g_error_free (error);
+ error = NULL;
+ combo_id = MODEST_UPDATE_INTERVAL_15_MIN;
+ }
+ modest_combo_box_set_active_id (MODEST_COMBO_BOX (priv->update_interval),
+ (gpointer) &combo_id);
+
+ /* Size limit */
+ value = modest_conf_get_int (conf, MODEST_CONF_MSG_SIZE_LIMIT, &error);
+ if (error) {
+ g_error_free (error);
+ error = NULL;
+ value = 1000;
+ }
+ /* It's better to do this in the subclasses, but it's just one
+ line, so we'll leave it here for the moment */
+#ifdef MODEST_PLATFORM_MAEMO
+ hildon_number_editor_set_value (HILDON_NUMBER_EDITOR (priv->size_limit), value);
+#else
+ gtk_spin_button_set_value (GTK_SPIN_BUTTON (priv->size_limit, value);
+#endif
+
+ /* TODO Fix with the value */
+
+ /* Play sound */
+ checked = modest_conf_get_bool (conf, MODEST_CONF_PLAY_SOUND_MSG_ARRIVE, &error);
+ if (error) {
+ g_error_free (error);
+ error = NULL;
+ checked = FALSE;
+ }
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->play_sound), checked);
+
+ /* Msg format */
+ combo_id = modest_conf_get_int (conf, MODEST_CONF_PREFER_FORMATTED_TEXT, &error);
+ if (error) {
+ g_error_free (error);
+ error = NULL;
+ combo_id = MODEST_FILE_FORMAT_FORMATTED_TEXT;
+ }
+ modest_combo_box_set_active_id (MODEST_COMBO_BOX (priv->msg_format),
+ (gpointer) &combo_id);
+
+ /* Include reply */
+ value = modest_conf_get_int (conf, MODEST_CONF_REPLY_TYPE, &error);
+ if (error) {
+ g_error_free (error);
+ error = NULL;
+ value = MODEST_TNY_MSG_REPLY_TYPE_QUOTE;
+ }
+ if (value == MODEST_TNY_MSG_REPLY_TYPE_QUOTE)
+ checked = TRUE;
+ else
+ checked = FALSE;
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->include_reply), checked);
+}
+
+void
+_modest_global_settings_dialog_save_conf (ModestGlobalSettingsDialogPrivate *priv)
+{
+ ModestConf *conf;
+ gboolean checked;
+ gint *combo_id, value;
+
+ conf = modest_runtime_get_conf ();
+
+ /* Autoupdate */
+ checked = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->auto_update));
+ modest_conf_set_bool (conf, MODEST_CONF_AUTO_UPDATE, checked, NULL);
+
+ /* Connected by */
+ combo_id = modest_combo_box_get_active_id (MODEST_COMBO_BOX (priv->connect_via));
+ modest_conf_set_int (conf, MODEST_CONF_UPDATE_WHEN_CONNECTED_BY, *combo_id, NULL);
+
+ /* Update interval */
+ combo_id = modest_combo_box_get_active_id (MODEST_COMBO_BOX (priv->update_interval));
+ modest_conf_set_int (conf, MODEST_CONF_UPDATE_INTERVAL, *combo_id, NULL);
+
+ /* Size limit */
+ /* It's better to do this in the subclasses, but it's just one
+ line, so we'll leave it here for the moment */
+#ifdef MODEST_PLATFORM_MAEMO
+ value = hildon_number_editor_get_value (HILDON_NUMBER_EDITOR (priv->size_limit));
+#else
+ value = gtk_spin_button_set_value (GTK_SPIN_BUTTON (priv->size_limit);
+#endif
+ modest_conf_set_int (conf, MODEST_CONF_MSG_SIZE_LIMIT, value, NULL);
+
+ /* Play sound */
+ checked = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->play_sound));
+ modest_conf_set_bool (conf, MODEST_CONF_PLAY_SOUND_MSG_ARRIVE, checked, NULL);
+
+ /* Msg format */
+ combo_id = modest_combo_box_get_active_id (MODEST_COMBO_BOX (priv->msg_format));
+ modest_conf_set_int (conf, MODEST_CONF_PREFER_FORMATTED_TEXT, *combo_id, NULL);
+
+ /* Include reply */
+ checked = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->include_reply));
+ modest_conf_set_int (conf, MODEST_CONF_REPLY_TYPE,
+ (checked) ? MODEST_TNY_MSG_REPLY_TYPE_QUOTE :
+ MODEST_TNY_MSG_REPLY_TYPE_CITE, NULL);
+}
+
+static void
+on_response (GtkDialog *dialog,
+ gint arg1,
+ gpointer user_data)
+{
+ ModestGlobalSettingsDialogPrivate *priv;
+
+ priv = MODEST_GLOBAL_SETTINGS_DIALOG_GET_PRIVATE (user_data);
+
+ if (arg1 == GTK_RESPONSE_OK)
+ _modest_global_settings_dialog_save_conf (priv);
+}