Changes in hildon2:
authorJose Dapena Paz <jdapena@igalia.com>
Thu, 9 Oct 2008 13:56:10 +0000 (13:56 +0000)
committerJose Dapena Paz <jdapena@igalia.com>
Thu, 9 Oct 2008 13:56:10 +0000 (13:56 +0000)
* Now we provide compatibility with old and new hildon check button api.
* Now we properly update the sensitivity in settings dialog so the
  auto update check button doesn't get changed badly (fixes NB#89464).
* Now play sound check doesn't break the changes check in settings
  dialog (fixes NB#89704).

pmo-trunk-r5986

src/hildon2/modest-default-account-settings-dialog.c
src/hildon2/modest-hildon-includes.h
src/hildon2/modest-maemo-global-settings-dialog.c
src/hildon2/modest-maemo-security-options-view.c
src/widgets/modest-global-settings-dialog.c
src/widgets/modest-security-options-view.c

index d40117a..75a0226 100644 (file)
@@ -673,7 +673,7 @@ on_check_button_clicked (GtkButton *button, gpointer user_data)
        GtkWidget *widget = GTK_WIDGET (user_data);
        
        /* Enable the widget only if the check button is active: */
        GtkWidget *widget = GTK_WIDGET (user_data);
        
        /* Enable the widget only if the check button is active: */
-       const gboolean enable = hildon_check_button_get_active (button);
+       const gboolean enable = hildon_check_button_get_active (HILDON_CHECK_BUTTON (button));
        gtk_widget_set_sensitive (widget, enable);
 }
 
        gtk_widget_set_sensitive (widget, enable);
 }
 
@@ -762,7 +762,7 @@ create_page_outgoing (ModestDefaultAccountSettingsDialog *self)
        /* connection-specific checkbox: */
        if (!priv->checkbox_outgoing_smtp_specific) {
                priv->checkbox_outgoing_smtp_specific = hildon_check_button_new (MODEST_EDITABLE_SIZE);
        /* connection-specific checkbox: */
        if (!priv->checkbox_outgoing_smtp_specific) {
                priv->checkbox_outgoing_smtp_specific = hildon_check_button_new (MODEST_EDITABLE_SIZE);
-               hildon_check_button_set_active (GTK_BUTTON (priv->checkbox_outgoing_smtp_specific), 
+               hildon_check_button_set_active (HILDON_CHECK_BUTTON (priv->checkbox_outgoing_smtp_specific), 
                        FALSE);
        }
        caption = create_captioned (self, sizegroup, _("mcen_fi_advsetup_connection_smtp"), 
                        FALSE);
        }
        caption = create_captioned (self, sizegroup, _("mcen_fi_advsetup_connection_smtp"), 
@@ -1112,7 +1112,7 @@ modest_default_account_settings_dialog_load_settings (ModestAccountSettingsDialo
                modest_account_settings_get_retrieve_limit (settings));
        
        
                modest_account_settings_get_retrieve_limit (settings));
        
        
-       hildon_check_button_set_active (GTK_BUTTON (priv->checkbox_leave_messages), 
+       hildon_check_button_set_active (HILDON_CHECK_BUTTON (priv->checkbox_leave_messages), 
                                        modest_account_settings_get_leave_messages_on_server (settings));
        
 
                                        modest_account_settings_get_leave_messages_on_server (settings));
        
 
@@ -1195,7 +1195,7 @@ modest_default_account_settings_dialog_load_settings (ModestAccountSettingsDialo
                const gboolean has_specific = 
                        modest_account_settings_get_use_connection_specific_smtp (settings);
                hildon_check_button_set_active (
                const gboolean has_specific = 
                        modest_account_settings_get_use_connection_specific_smtp (settings);
                hildon_check_button_set_active (
-                       GTK_BUTTON (priv->checkbox_outgoing_smtp_specific), 
+                       HILDON_CHECK_BUTTON (priv->checkbox_outgoing_smtp_specific), 
                        has_specific);
                g_object_unref (outgoing_account);
        }
                        has_specific);
                g_object_unref (outgoing_account);
        }
@@ -1262,7 +1262,7 @@ save_configuration (ModestDefaultAccountSettingsDialog *dialog)
                MODEST_LIMIT_RETRIEVE_PICKER (priv->limit_retrieve_picker));
        modest_account_settings_set_retrieve_limit (priv->settings, retrieve_limit);
        
                MODEST_LIMIT_RETRIEVE_PICKER (priv->limit_retrieve_picker));
        modest_account_settings_set_retrieve_limit (priv->settings, retrieve_limit);
        
-       leave_on_server = hildon_check_button_get_active (GTK_BUTTON (priv->checkbox_leave_messages));
+       leave_on_server = hildon_check_button_get_active (HILDON_CHECK_BUTTON (priv->checkbox_leave_messages));
        modest_account_settings_set_leave_messages_on_server (priv->settings, leave_on_server); 
 
        store_settings = modest_account_settings_get_store_settings (priv->settings);
        modest_account_settings_set_leave_messages_on_server (priv->settings, leave_on_server); 
 
        store_settings = modest_account_settings_get_store_settings (priv->settings);
@@ -1307,7 +1307,7 @@ save_configuration (ModestDefaultAccountSettingsDialog *dialog)
        /* Save connection-specific SMTP server accounts: */
        modest_account_settings_set_use_connection_specific_smtp 
                (priv->settings, 
        /* Save connection-specific SMTP server accounts: */
        modest_account_settings_set_use_connection_specific_smtp 
                (priv->settings, 
-                hildon_check_button_get_active(GTK_BUTTON(priv->checkbox_outgoing_smtp_specific)));
+                hildon_check_button_get_active(HILDON_CHECK_BUTTON(priv->checkbox_outgoing_smtp_specific)));
 
        /* this configuration is not persistent, we should not save */
        if (account_name != NULL)
 
        /* this configuration is not persistent, we should not save */
        if (account_name != NULL)
index b55bc09..11503cd 100644 (file)
@@ -109,6 +109,10 @@ k * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 #endif /*MODEST_HAVE_HILDON_HELP*/
 #endif /*MODEST_HAVE_OSSO_HELP*/
 
 #endif /*MODEST_HAVE_HILDON_HELP*/
 #endif /*MODEST_HAVE_OSSO_HELP*/
 
+#ifndef HILDON_CHECK_BUTTON
+#define HILDON_CHECK_BUTTON GTK_BUTTON
+#endif
+
 /* some extra #defines, so it will compile with the 'normal' gtk */
 #ifndef MODEST_HAVE_HILDON_GTK
 #define hildon_gtk_entry_set_input_mode(a,b) \
 /* some extra #defines, so it will compile with the 'normal' gtk */
 #ifndef MODEST_HAVE_HILDON_GTK
 #define hildon_gtk_entry_set_input_mode(a,b) \
index 69c061f..7605601 100644 (file)
@@ -45,7 +45,6 @@
 #include "modest-runtime.h"
 #include "widgets/modest-global-settings-dialog-priv.h"
 #include "modest-selector-picker.h"
 #include "modest-runtime.h"
 #include "widgets/modest-global-settings-dialog-priv.h"
 #include "modest-selector-picker.h"
-#include "hildon/hildon-check-button.h"
 #include "hildon/hildon-pannable-area.h"
 #include "modest-maemo-global-settings-dialog.h"
 #include "widgets/modest-ui-constants.h"
 #include "hildon/hildon-pannable-area.h"
 #include "modest-maemo-global-settings-dialog.h"
 #include "widgets/modest-ui-constants.h"
@@ -78,6 +77,7 @@ static void       on_size_notify         (HildonNumberEditor *editor,
 
 static void       on_auto_update_clicked (GtkButton *button,
                                          gpointer user_data);
 
 static void       on_auto_update_clicked (GtkButton *button,
                                          gpointer user_data);
+static void       update_sensitive       (ModestGlobalSettingsDialog *dialog);
 
 typedef struct _ModestMaemoGlobalSettingsDialogPrivate ModestMaemoGlobalSettingsDialogPrivate;
 struct _ModestMaemoGlobalSettingsDialogPrivate {
 
 typedef struct _ModestMaemoGlobalSettingsDialogPrivate ModestMaemoGlobalSettingsDialogPrivate;
 struct _ModestMaemoGlobalSettingsDialogPrivate {
@@ -157,6 +157,8 @@ modest_maemo_global_settings_dialog_init (ModestMaemoGlobalSettingsDialog *self)
 
        /* Load current config */
        _modest_global_settings_dialog_load_conf (MODEST_GLOBAL_SETTINGS_DIALOG (self));
 
        /* Load current config */
        _modest_global_settings_dialog_load_conf (MODEST_GLOBAL_SETTINGS_DIALOG (self));
+       /* force update of sensitiveness */
+       update_sensitive (MODEST_GLOBAL_SETTINGS_DIALOG (self));
 
        /* Set first page */
        hildon_help_dialog_help_enable (GTK_DIALOG(self), "applications_email_options_dialog",
 
        /* Set first page */
        hildon_help_dialog_help_enable (GTK_DIALOG(self), "applications_email_options_dialog",
@@ -280,14 +282,14 @@ create_updating_page (ModestMaemoGlobalSettingsDialog *self)
 
 
 static void
 
 
 static void
-on_auto_update_clicked (GtkButton *button,
-                       gpointer user_data)
+update_sensitive (ModestGlobalSettingsDialog *dialog)
 {
        ModestGlobalSettingsDialogPrivate *ppriv;
 
 {
        ModestGlobalSettingsDialogPrivate *ppriv;
 
-       ppriv = MODEST_GLOBAL_SETTINGS_DIALOG_GET_PRIVATE (user_data);
+       g_return_if_fail (MODEST_IS_GLOBAL_SETTINGS_DIALOG (dialog));
+       ppriv = MODEST_GLOBAL_SETTINGS_DIALOG_GET_PRIVATE (dialog);
 
 
-       if (hildon_check_button_get_active (button)) {
+       if (hildon_check_button_get_active (HILDON_CHECK_BUTTON (ppriv->auto_update))) {
                gtk_widget_set_sensitive (ppriv->connect_via, TRUE);
                gtk_widget_set_sensitive (ppriv->update_interval, TRUE);
        } else {
                gtk_widget_set_sensitive (ppriv->connect_via, TRUE);
                gtk_widget_set_sensitive (ppriv->update_interval, TRUE);
        } else {
@@ -296,6 +298,13 @@ on_auto_update_clicked (GtkButton *button,
        }
 }
 
        }
 }
 
+static void
+on_auto_update_clicked (GtkButton *button,
+                       gpointer user_data)
+{
+       g_return_if_fail (MODEST_IS_GLOBAL_SETTINGS_DIALOG (user_data));
+       update_sensitive ((ModestGlobalSettingsDialog *) user_data);
+}
 static gboolean
 on_range_error (HildonNumberEditor *editor, 
                HildonNumberEditorErrorType type,
 static gboolean
 on_range_error (HildonNumberEditor *editor, 
                HildonNumberEditorErrorType type,
index cebf7cc..6a084d0 100644 (file)
@@ -40,6 +40,7 @@
 #include "modest-maemo-utils.h"
 #include <hildon/hildon-number-editor.h>
 #include <hildon/hildon-check-button.h>
 #include "modest-maemo-utils.h"
 #include <hildon/hildon-number-editor.h>
 #include <hildon/hildon-check-button.h>
+#include "modest-hildon-includes.h"
 
 #define PORT_MIN 1
 #define PORT_MAX 65535
 
 #define PORT_MIN 1
 #define PORT_MAX 65535
@@ -76,7 +77,7 @@ on_security_changed (GtkWidget *widget,
 
        if (MODEST_SECURITY_OPTIONS_VIEW (self)->type == MODEST_SECURITY_OPTIONS_INCOMING) {
                /* Activate and dim checkbutton if it's secure */
 
        if (MODEST_SECURITY_OPTIONS_VIEW (self)->type == MODEST_SECURITY_OPTIONS_INCOMING) {
                /* Activate and dim checkbutton if it's secure */
-               hildon_check_button_set_active (GTK_BUTTON (ppriv->auth_view), 
+               hildon_check_button_set_active (HILDON_CHECK_BUTTON (ppriv->auth_view), 
                                                is_secure);
                gtk_widget_set_sensitive (ppriv->auth_view, !is_secure);
        } else {
                                                is_secure);
                gtk_widget_set_sensitive (ppriv->auth_view, !is_secure);
        } else {
index 7f60078..ee6fc92 100644 (file)
@@ -43,7 +43,7 @@
 #include "modest-platform.h"
 #ifdef MODEST_TOOLKIT_HILDON2
 #include "hildon2/modest-selector-picker.h"
 #include "modest-platform.h"
 #ifdef MODEST_TOOLKIT_HILDON2
 #include "hildon2/modest-selector-picker.h"
-#include "hildon/hildon-check-button.h"
+#include "modest-hildon-includes.h"
 #else
 #include "widgets/modest-combo-box.h"
 #endif
 #else
 #include "widgets/modest-combo-box.h"
 #endif
@@ -265,7 +265,7 @@ _modest_global_settings_dialog_load_conf (ModestGlobalSettingsDialog *self)
                checked = FALSE;
        }
 #ifdef MODEST_TOOLKIT_HILDON2
                checked = FALSE;
        }
 #ifdef MODEST_TOOLKIT_HILDON2
-       hildon_check_button_set_active (GTK_BUTTON (priv->auto_update), checked);
+       hildon_check_button_set_active (HILDON_CHECK_BUTTON (priv->auto_update), checked);
 #else
        gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->auto_update), checked);
 #endif
 #else
        gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->auto_update), checked);
 #endif
@@ -288,9 +288,7 @@ _modest_global_settings_dialog_load_conf (ModestGlobalSettingsDialog *self)
        priv->initial_state.connect_via = combo_id;
 
        /* Emit toggled to update the visibility of connect_by caption */
        priv->initial_state.connect_via = combo_id;
 
        /* Emit toggled to update the visibility of connect_by caption */
-#ifdef MODEST_TOOLKIT_HILDON2
-       gtk_button_clicked (GTK_BUTTON (priv->auto_update));
-#else
+#ifndef MODEST_TOOLKIT_HILDON2
        gtk_toggle_button_toggled (GTK_TOGGLE_BUTTON (priv->auto_update));
 #endif
 
        gtk_toggle_button_toggled (GTK_TOGGLE_BUTTON (priv->auto_update));
 #endif
 
@@ -365,7 +363,7 @@ get_current_settings (ModestGlobalSettingsDialogPrivate *priv,
        /* Get values from UI */
 #ifdef MODEST_TOOLKIT_HILDON2
        id = modest_selector_picker_get_active_id (MODEST_SELECTOR_PICKER (priv->connect_via));
        /* Get values from UI */
 #ifdef MODEST_TOOLKIT_HILDON2
        id = modest_selector_picker_get_active_id (MODEST_SELECTOR_PICKER (priv->connect_via));
-       state->auto_update = hildon_check_button_get_active (GTK_BUTTON (priv->auto_update));
+       state->auto_update = hildon_check_button_get_active (HILDON_CHECK_BUTTON (priv->auto_update));
 #else
        id = modest_combo_box_get_active_id (MODEST_COMBO_BOX (priv->connect_via));
        state->auto_update = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->auto_update));
 #else
        id = modest_combo_box_get_active_id (MODEST_COMBO_BOX (priv->connect_via));
        state->auto_update = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->auto_update));
@@ -385,6 +383,7 @@ get_current_settings (ModestGlobalSettingsDialogPrivate *priv,
        state->update_interval = *id;
 #ifdef MODEST_TOOLKIT_HILDON2
        id = modest_selector_picker_get_active_id (MODEST_SELECTOR_PICKER (priv->msg_format));
        state->update_interval = *id;
 #ifdef MODEST_TOOLKIT_HILDON2
        id = modest_selector_picker_get_active_id (MODEST_SELECTOR_PICKER (priv->msg_format));
+       state->play_sound = priv->initial_state.play_sound;
 #else
        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));
 #else
        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));
index 94eca02..26915c1 100644 (file)
@@ -37,7 +37,7 @@
 #ifdef MODEST_TOOLKIT_HILDON2
 #include "modest-serversecurity-picker.h"
 #include "modest-secureauth-picker.h"
 #ifdef MODEST_TOOLKIT_HILDON2
 #include "modest-serversecurity-picker.h"
 #include "modest-secureauth-picker.h"
-#include <hildon/hildon-check-button.h>
+#include <modest-hildon-includes.h>
 #else
 #include "widgets/modest-serversecurity-combo-box.h"
 #include "widgets/modest-secureauth-combo-box.h"
 #else
 #include "widgets/modest-serversecurity-combo-box.h"
 #include "widgets/modest-secureauth-combo-box.h"
@@ -106,7 +106,7 @@ modest_security_options_view_load_settings (ModestSecurityOptionsView* self,
                if (modest_protocol_registry_protocol_type_is_secure (modest_runtime_get_protocol_registry (), 
                                                                      secure_auth))
 #ifdef MODEST_TOOLKIT_HILDON2
                if (modest_protocol_registry_protocol_type_is_secure (modest_runtime_get_protocol_registry (), 
                                                                      secure_auth))
 #ifdef MODEST_TOOLKIT_HILDON2
-                       hildon_check_button_set_active (GTK_BUTTON (priv->auth_view),
+                       hildon_check_button_set_active (HILDON_CHECK_BUTTON (priv->auth_view),
                                                        TRUE);
 #else
                        gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->auth_view),
                                                        TRUE);
 #else
                        gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->auth_view),
@@ -158,7 +158,7 @@ modest_security_options_view_save_settings (ModestSecurityOptionsView* self,
 
        if (self->type == MODEST_SECURITY_OPTIONS_INCOMING) {
 #ifdef MODEST_TOOLKIT_HILDON2
 
        if (self->type == MODEST_SECURITY_OPTIONS_INCOMING) {
 #ifdef MODEST_TOOLKIT_HILDON2
-               if (hildon_check_button_get_active (GTK_BUTTON (priv->auth_view))) {
+               if (hildon_check_button_get_active (HILDON_CHECK_BUTTON (priv->auth_view))) {
 #else
                if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->auth_view))) {
 #endif
 #else
                if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->auth_view))) {
 #endif
@@ -252,7 +252,7 @@ get_current_state (ModestSecurityOptionsView* self,
                }
        } else {
 #ifdef MODEST_TOOLKIT_HILDON2
                }
        } else {
 #ifdef MODEST_TOOLKIT_HILDON2
-               if (hildon_check_button_get_active (GTK_BUTTON (priv->auth_view)))
+               if (hildon_check_button_get_active (HILDON_CHECK_BUTTON (priv->auth_view)))
 #else
                if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->auth_view)))
 #endif
 #else
                if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->auth_view)))
 #endif
@@ -332,7 +332,7 @@ modest_security_options_view_auth_check (ModestSecurityOptionsView* self)
 
 #ifdef MODEST_TOOLKIT_HILDON2
        auth_active = 
 
 #ifdef MODEST_TOOLKIT_HILDON2
        auth_active = 
-               hildon_check_button_get_active (GTK_BUTTON (priv->auth_view));
+               hildon_check_button_get_active (HILDON_CHECK_BUTTON (priv->auth_view));
 #else
        auth_active = 
                gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->auth_view));
 #else
        auth_active = 
                gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->auth_view));