* Fixes NB#80917, added wimax support
[modest] / src / widgets / modest-global-settings-dialog.c
index 13114eb..c21f03d 100644 (file)
 #include "modest-platform.h"
 #include "widgets/modest-combo-box.h"
 #ifdef MODEST_PLATFORM_MAEMO
-#ifdef MODEST_HILDON_VERSION_0
+#ifdef MODEST_HAVE_HILDON0_WIDGETS
 #include <hildon-widgets/hildon-number-editor.h>
 #else
 #include <hildon/hildon-number-editor.h>
-#endif /*MODEST_HILDON_VERSION_0*/
+#endif /*MODEST_HAVE_HILDON0_WIDGETS*/
 #endif
 /* include other impl specific header files */
 
@@ -124,11 +124,10 @@ modest_global_settings_dialog_init (ModestGlobalSettingsDialog *self)
        priv = MODEST_GLOBAL_SETTINGS_DIALOG_GET_PRIVATE (self);
 
        priv->notebook = gtk_notebook_new ();
-       priv->changed = FALSE;
 
        /* Add the buttons: */
-       gtk_dialog_add_button (GTK_DIALOG (self), GTK_STOCK_OK, GTK_RESPONSE_OK);
-       gtk_dialog_add_button (GTK_DIALOG (self), GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL);
+       gtk_dialog_add_button (GTK_DIALOG (self), _("mcen_bd_dialog_ok"), GTK_RESPONSE_OK);
+       gtk_dialog_add_button (GTK_DIALOG (self), _("mcen_bd_dialog_cancel"), GTK_RESPONSE_CANCEL);
     
        /* Connect to the dialog's response signal: */
        g_signal_connect (G_OBJECT (self), "response", G_CALLBACK (on_response), self);
@@ -140,7 +139,14 @@ modest_global_settings_dialog_init (ModestGlobalSettingsDialog *self)
 static void
 modest_global_settings_dialog_finalize (GObject *obj)
 {
-/*     free/unref instance resources here */
+       ModestGlobalSettingsDialogPrivate *priv = 
+               MODEST_GLOBAL_SETTINGS_DIALOG_GET_PRIVATE (obj);
+
+       /* These had to stay alive as long as the comboboxes that used them: */
+       modest_pair_list_free (priv->connect_via_list);
+       modest_pair_list_free (priv->update_interval_list);
+       modest_pair_list_free (priv->msg_format_list);
+       
        G_OBJECT_CLASS(parent_class)->finalize (obj);
 }
 
@@ -167,8 +173,8 @@ _modest_global_settings_dialog_get_connected_via (void)
 {
        GSList *list = NULL;
 
-       add_to_modest_pair_list (MODEST_CONNECTED_VIA_WLAN, 
-                                _("mcen_va_options_connectiontype_wlan"), 
+       add_to_modest_pair_list (MODEST_CONNECTED_VIA_WLAN_OR_WIMAX, 
+                                _("mcen_va_options_connectiontype_wlan_wimax"), 
                                 &list);
        add_to_modest_pair_list (MODEST_CONNECTED_VIA_ANY, 
                                 _("mcen_va_options_connectiontype_all"), 
@@ -252,7 +258,7 @@ _modest_global_settings_dialog_load_conf (ModestGlobalSettingsDialog *self)
        if (error) {
                g_error_free (error);
                error = NULL;
-               combo_id = MODEST_CONNECTED_VIA_WLAN;
+               combo_id = MODEST_CONNECTED_VIA_WLAN_OR_WIMAX;
        }
        modest_combo_box_set_active_id (MODEST_COMBO_BOX (priv->connect_via), 
                                        (gpointer) &combo_id);
@@ -284,7 +290,7 @@ _modest_global_settings_dialog_load_conf (ModestGlobalSettingsDialog *self)
 #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));
+       gtk_spin_button_set_value (GTK_SPIN_BUTTON (priv->size_limit), value);
 #endif
        priv->initial_state.size_limit = value;
 
@@ -309,20 +315,6 @@ _modest_global_settings_dialog_load_conf (ModestGlobalSettingsDialog *self)
        modest_combo_box_set_active_id (MODEST_COMBO_BOX (priv->msg_format), 
                                        (gpointer) &combo_id);
        priv->initial_state.prefer_formatted_text = checked;
-
-       /* 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);
-       priv->initial_state.include_reply = checked;
 }
 
 static void 
@@ -338,14 +330,13 @@ get_current_settings (ModestGlobalSettingsDialogPrivate *priv,
 #ifdef MODEST_PLATFORM_MAEMO
        state->size_limit = hildon_number_editor_get_value (HILDON_NUMBER_EDITOR (priv->size_limit));
 #else
-       state->size_limit = gtk_spin_button_set_value (GTK_SPIN_BUTTON (priv->size_limit));
+       state->size_limit = gtk_spin_button_get_value (GTK_SPIN_BUTTON (priv->size_limit));
 #endif
        id = modest_combo_box_get_active_id (MODEST_COMBO_BOX (priv->update_interval));
        state->update_interval = *id;
        state->play_sound = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->play_sound));
        id = modest_combo_box_get_active_id (MODEST_COMBO_BOX (priv->msg_format));
        state->prefer_formatted_text = (*id == MODEST_FILE_FORMAT_FORMATTED_TEXT) ? TRUE : FALSE;
-       state->include_reply = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->include_reply));
 }
 
 gboolean
@@ -375,10 +366,6 @@ _modest_global_settings_dialog_save_conf (ModestGlobalSettingsDialog *self)
        RETURN_FALSE_ON_ERROR(error);
        modest_conf_set_bool (conf, MODEST_CONF_PREFER_FORMATTED_TEXT, current_state.prefer_formatted_text, NULL);
        RETURN_FALSE_ON_ERROR(error);
-       modest_conf_set_int (conf, MODEST_CONF_REPLY_TYPE,
-                            (current_state.include_reply) ? MODEST_TNY_MSG_REPLY_TYPE_QUOTE : 
-                            MODEST_TNY_MSG_REPLY_TYPE_CITE, NULL);
-       RETURN_FALSE_ON_ERROR(error);
 
        /* Apply changes */
        if (priv->initial_state.auto_update != current_state.auto_update || 
@@ -418,7 +405,7 @@ _modest_global_settings_dialog_save_conf (ModestGlobalSettingsDialog *self)
                        /* Disable autoupdate in offline mode */
                        modest_platform_set_update_interval (0);
                }
-               g_object_unref (device);                
+               g_object_unref (device);
        }
 
 exit:
@@ -434,8 +421,7 @@ settings_changed (ModestGlobalSettingsState initial_state,
            initial_state.update_interval != current_state.update_interval ||
            initial_state.size_limit != current_state.size_limit ||
            initial_state.play_sound != current_state.play_sound ||
-           initial_state.prefer_formatted_text != current_state.prefer_formatted_text ||
-           initial_state.include_reply != current_state.include_reply)
+           initial_state.prefer_formatted_text != current_state.prefer_formatted_text)
                return TRUE;
        else
                return FALSE;
@@ -484,5 +470,5 @@ static ModestConnectedVia
 current_connection_default (void)
 {
        g_warning ("You must implement %s", __FUNCTION__);
-       g_return_val_if_reached (-1);
+       g_return_val_if_reached (MODEST_CONNECTED_VIA_ANY);
 }