Move mcc_mapping file to common side.
[modest] / src / maemo / easysetup / modest-easysetup-wizard-dialog.c
index 24b8ef7..12efd24 100644 (file)
@@ -28,7 +28,7 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
  
-
+#include <config.h>
 #include "modest-easysetup-wizard-dialog.h"
 #include <glib/gi18n.h>
 #include <gtk/gtknotebook.h>
@@ -321,9 +321,28 @@ invoke_enable_buttons_vfunc (ModestEasysetupWizardDialog *wizard_dialog)
 static void
 on_caption_entry_changed (GtkEditable *editable, gpointer user_data)
 {
-       ModestEasysetupWizardDialog *self = MODEST_EASYSETUP_WIZARD_DIALOG (user_data);
-       g_assert(self);
+       ModestEasysetupWizardDialog *self;
+       gboolean mandatory, empty;
+       ModestEasysetupWizardDialogPrivate *priv;
+
+       g_return_if_fail (user_data);
+
+       self = MODEST_EASYSETUP_WIZARD_DIALOG (user_data);
+       priv = MODEST_EASYSETUP_WIZARD_DIALOG_GET_PRIVATE (self);
+
        invoke_enable_buttons_vfunc(self);
+
+       empty = !g_utf8_collate (gtk_entry_get_text (GTK_ENTRY (editable)), "");
+       mandatory = ((GtkWidget *) editable == priv->entry_account_title) ||
+               ((GtkWidget *) editable == priv->entry_user_username) || 
+               ((GtkWidget *) editable == priv->entry_user_email);
+
+       /* Show a banner & get focus */
+       if (empty && mandatory) {
+               modest_platform_information_banner ((GtkWidget *) editable, NULL, 
+                                                   _CS("ckct_ib_enter_some_text"));
+               gtk_widget_grab_focus (GTK_WIDGET (editable));
+       }
 }
 
 static void
@@ -390,8 +409,13 @@ create_page_welcome (ModestEasysetupWizardDialog *self)
        return GTK_WIDGET (box);
 }
 
+#if MODEST_HILDON_API < 2
 static void
 on_combo_account_country (GtkComboBox *widget, gpointer user_data)
+#else
+static void
+on_combo_account_country (HildonTouchSelector *widget, gint column, gpointer user_data)
+#endif
 {
        ModestEasysetupWizardDialog *self = MODEST_EASYSETUP_WIZARD_DIALOG (user_data);
        g_assert(self);
@@ -469,8 +493,15 @@ create_page_account_details (ModestEasysetupWizardDialog *self)
        gtk_widget_show (caption);
        
        /* connect to country combo's changed signal, so we can fill the provider combo: */
+#if MODEST_HILDON_API < 2
        g_signal_connect (G_OBJECT (priv->combo_account_country), "changed",
                          G_CALLBACK (on_combo_account_country), self);
+#else
+       g_signal_connect (G_OBJECT (hildon_picker_button_get_selector 
+                                   (HILDON_PICKER_BUTTON (priv->combo_account_country))),
+                         "changed",
+                         G_CALLBACK (on_combo_account_country), self);
+#endif
             
        GtkWidget *separator = gtk_hseparator_new ();
        gtk_box_pack_start (GTK_BOX (box), separator, FALSE, FALSE, MODEST_MARGIN_HALF);
@@ -896,7 +927,8 @@ on_button_outgoing_smtp_servers (GtkButton *button, gpointer user_data)
        modest_connection_specific_smtp_window_fill_with_connections (MODEST_CONNECTION_SPECIFIC_SMTP_WINDOW (specific_window), priv->account_manager);
 
        /* Show the window */
-       modest_window_mgr_set_modal (modest_runtime_get_window_mgr (), GTK_WINDOW (specific_window));
+       modest_window_mgr_set_modal (modest_runtime_get_window_mgr (), 
+                                    GTK_WINDOW (specific_window), GTK_WINDOW (self));
        gtk_widget_show (specific_window);
 }
 
@@ -999,7 +1031,8 @@ show_advanced_edit(gpointer user_data)
        }
        modest_account_settings_dialog_load_settings (dialog, priv->settings);
        
-       modest_window_mgr_set_modal (modest_runtime_get_window_mgr (), GTK_WINDOW (dialog));
+       modest_window_mgr_set_modal (modest_runtime_get_window_mgr (), 
+                                    GTK_WINDOW (dialog), GTK_WINDOW (self));
        
        response = gtk_dialog_run (GTK_DIALOG (dialog));
 
@@ -1675,6 +1708,7 @@ on_before_next (ModestWizardDialog *dialog, GtkWidget *current_page, GtkWidget *
                /* Aavoid a clash with an existing display name: */
                const gboolean name_in_use = modest_account_mgr_account_with_display_name_exists (
                        priv->account_manager, account_title);
+               g_free (account_title);
 
                if (name_in_use) {
                        /* Warn the user via a dialog: */
@@ -1860,7 +1894,7 @@ save_to_settings (ModestEasysetupWizardDialog *self)
 {
        ModestEasysetupWizardDialogPrivate *priv = MODEST_EASYSETUP_WIZARD_DIALOG_GET_PRIVATE (self);
        guint special_port;
-       gchar *provider_id;
+       gchar *provider_id = NULL;
        gchar* display_name;
        const gchar *username, *password;
        gchar *store_hostname, *transport_hostname;
@@ -1913,6 +1947,7 @@ save_to_settings (ModestEasysetupWizardDialog *self)
                                   "but it's not a ModestAccountProtocol");
                }
 
+               g_free (provider_id);
                return;
        }
 
@@ -2085,5 +2120,6 @@ save_to_settings (ModestEasysetupWizardDialog *self)
        display_name = get_entered_account_title (self);
        modest_account_settings_set_display_name (priv->settings, display_name);
        g_free (display_name);
+       g_free (provider_id);
 }