2007-04-23 Murray Cumming <murrayc@murrayc.com>
authorMurray Cumming <murrayc@murrayc.com>
Mon, 23 Apr 2007 12:53:22 +0000 (12:53 +0000)
committerMurray Cumming <murrayc@murrayc.com>
Mon, 23 Apr 2007 12:53:22 +0000 (12:53 +0000)
* src/maemo/easysetup/modest-easysetup-wizard.c:
        (set_default_custom_servernames):
        * src/maemo/modest-account-settings-dialog.c:
        (create_page_incoming), (on_combo_outgoing_security_changed),
        (on_combo_incoming_security_changed), (create_page_outgoing),
        (modest_account_settings_dialog_set_account_name),
        (save_configuration):
        * src/maemo/modest-connection-specific-smtp-edit-window.c:
        (on_combo_security_changed),
        (modest_connection_specific_smtp_edit_window_init),
        (modest_connection_specific_smtp_edit_window_set_connection),
        (modest_connection_specific_smtp_edit_window_get_settings):
        Use HildonNumberEditor instead of GtkEntry for the port numbers so it has the - and + buttons,
        as per the UI spec.

pmo-trunk-r1635

ChangeLog2
src/maemo/easysetup/modest-easysetup-wizard.c
src/maemo/modest-account-settings-dialog.c
src/maemo/modest-connection-specific-smtp-edit-window.c

index 6b6332f..9ec9bcd 100644 (file)
@@ -1,3 +1,20 @@
+2007-04-23  Murray Cumming  <murrayc@murrayc.com>
+
+       * src/maemo/easysetup/modest-easysetup-wizard.c:
+       (set_default_custom_servernames):
+       * src/maemo/modest-account-settings-dialog.c:
+       (create_page_incoming), (on_combo_outgoing_security_changed),
+       (on_combo_incoming_security_changed), (create_page_outgoing),
+       (modest_account_settings_dialog_set_account_name),
+       (save_configuration):
+       * src/maemo/modest-connection-specific-smtp-edit-window.c:
+       (on_combo_security_changed),
+       (modest_connection_specific_smtp_edit_window_init),
+       (modest_connection_specific_smtp_edit_window_set_connection),
+       (modest_connection_specific_smtp_edit_window_get_settings): 
+       Use HildonNumberEditor instead of GtkEntry for the port numbers so it has the - and + buttons,
+       as per the UI spec.
+
 2007-04-20  Murray Cumming  <murrayc@murrayc.com>
 
        * po/en_GB.po:
index 1d17134..f0ac9a8 100644 (file)
@@ -918,6 +918,9 @@ static void set_default_custom_servernames (ModestEasysetupWizardDialog *account
        /* Set a default domain for the server, based on the email address,
         * if no server name was already specified.
         */
+       if (!account_wizard->entry_outgoingserver)
+               return;
+               
        const gchar* outgoing_existing = gtk_entry_get_text (GTK_ENTRY (account_wizard->entry_outgoingserver));
        if ((!outgoing_existing || (strlen(outgoing_existing) == 0)) 
                && account_wizard->entry_user_email) {
index a77b639..05ee8a5 100644 (file)
@@ -16,6 +16,7 @@
 #include <gtk/gtkmessagedialog.h>
 #include <gtk/gtkstock.h>
 #include <hildon-widgets/hildon-caption.h>
+#include <hildon-widgets/hildon-number-editor.h>
 #include "widgets/modest-serversecurity-combo-box.h"
 #include "widgets/modest-secureauth-combo-box.h"
 #include "widgets/modest-validating-entry.h"
@@ -457,7 +458,7 @@ static GtkWidget* create_page_incoming (ModestAccountSettingsDialog *self)
        /* The port widgets: */
        /* TODO: There are various rules about this in the UI spec. */
        if (!self->entry_incoming_port)
-               self->entry_incoming_port = GTK_WIDGET (gtk_entry_new ());
+               self->entry_incoming_port = GTK_WIDGET (hildon_number_editor_new (0, 10000 /* arbitrary min and max */));
        caption = hildon_caption_new (sizegroup, _("mcen_fi_emailsetup_port"), 
                self->entry_incoming_port, NULL, HILDON_CAPTION_OPTIONAL);
        gtk_widget_show (self->entry_incoming_port);
@@ -543,9 +544,8 @@ on_combo_outgoing_security_changed (GtkComboBox *widget, gpointer user_data)
                        MODEST_SERVERSECURITY_COMBO_BOX (self->combo_outgoing_security));
 
        if(port_number != 0) {
-               gchar* str = g_strdup_printf ("%d", port_number);
-               gtk_entry_set_text (GTK_ENTRY (self->entry_outgoing_port), str);
-               g_free (str);   
+               hildon_number_editor_set_value (
+                       HILDON_NUMBER_EDITOR (self->entry_outgoing_port), port_number);
        }               
 }
 
@@ -559,9 +559,8 @@ on_combo_incoming_security_changed (GtkComboBox *widget, gpointer user_data)
                        MODEST_SERVERSECURITY_COMBO_BOX (self->combo_incoming_security));
 
        if(port_number != 0) {
-               gchar* str = g_strdup_printf ("%d", port_number);
-               gtk_entry_set_text (GTK_ENTRY (self->entry_incoming_port), str);
-               g_free (str);   
+               hildon_number_editor_set_value (
+                       HILDON_NUMBER_EDITOR (self->entry_incoming_port), port_number);
        }               
 }
 
@@ -645,7 +644,7 @@ static GtkWidget* create_page_outgoing (ModestAccountSettingsDialog *self)
        
        /* The port widgets: */
        if (!self->entry_outgoing_port)
-               self->entry_outgoing_port = GTK_WIDGET (gtk_entry_new ());
+               self->entry_outgoing_port = GTK_WIDGET (hildon_number_editor_new (0, 10000 /* arbitrary min and max */));
        caption = hildon_caption_new (sizegroup, _("mcen_fi_emailsetup_port"), 
                self->entry_outgoing_port, NULL, HILDON_CAPTION_OPTIONAL);
        gtk_widget_show (self->entry_outgoing_port);
@@ -934,17 +933,8 @@ void modest_account_settings_dialog_set_account_name (ModestAccountSettingsDialo
                
                const gint port_num = modest_account_mgr_get_int (dialog->account_manager, incoming_account->account_name,
                        MODEST_ACCOUNT_PORT, TRUE /* server account */);
-               gchar *port_str = g_strdup_printf ("%d", port_num);
-               gtk_entry_set_text (GTK_ENTRY (dialog->entry_incoming_port), port_str);
-               g_free (port_str);
-       
-               /* TODO:
-       gchar            *uri;
-       ModestProtocol    proto;
-       gchar            *password;
-       time_t            last_updated;
-       GSList           *options;
-       */
+               hildon_number_editor_set_value (
+                       HILDON_NUMBER_EDITOR (dialog->entry_incoming_port), port_num);
        
        }
        
@@ -976,9 +966,8 @@ void modest_account_settings_dialog_set_account_name (ModestAccountSettingsDialo
                
                const gint port_num = modest_account_mgr_get_int (dialog->account_manager, outgoing_account->account_name,
                        MODEST_ACCOUNT_PORT, TRUE /* server account */);
-               gchar *port_str = g_strdup_printf ("%d", port_num);
-               gtk_entry_set_text (GTK_ENTRY (dialog->entry_outgoing_port), port_str);
-               g_free (port_str);
+               hildon_number_editor_set_value (
+                       HILDON_NUMBER_EDITOR (dialog->entry_outgoing_port), port_num);
        }
        
        /* account_data->is_enabled,  */
@@ -1063,10 +1052,8 @@ save_configuration (ModestAccountSettingsDialog *dialog)
        modest_server_account_set_security (dialog->account_manager, incoming_account_name, protocol_security_incoming);
        
        /* port: */
-       const gchar* port_str = gtk_entry_get_text (GTK_ENTRY (dialog->entry_incoming_port));
-       gint port_num = 0;
-       if (port_str)
-               port_num = atoi (port_str);
+       gint port_num = hildon_number_editor_get_value (
+                       HILDON_NUMBER_EDITOR (dialog->entry_incoming_port));
        modest_account_mgr_set_int (dialog->account_manager, incoming_account_name,
                        MODEST_ACCOUNT_PORT, port_num, TRUE /* server account */);
                
@@ -1104,10 +1091,8 @@ save_configuration (ModestAccountSettingsDialog *dialog)
        modest_server_account_set_secure_auth (dialog->account_manager, outgoing_account_name, protocol_authentication_outgoing);       
                
        /* port: */
-       port_str = gtk_entry_get_text (GTK_ENTRY (dialog->entry_outgoing_port));
-       port_num = 0;
-       if (port_str)
-               port_num = atoi (port_str);
+       port_num = hildon_number_editor_get_value (
+                       HILDON_NUMBER_EDITOR (dialog->entry_outgoing_port));
        modest_account_mgr_set_int (dialog->account_manager, outgoing_account_name,
                        MODEST_ACCOUNT_PORT, port_num, TRUE /* server account */);
                        
index 1bd7789..9c66625 100644 (file)
@@ -2,6 +2,7 @@
 
 #include "modest-connection-specific-smtp-edit-window.h"
 #include <hildon-widgets/hildon-caption.h>
+#include <hildon-widgets/hildon-number-editor.h>
 #include "widgets/modest-serversecurity-combo-box.h"
 #include "widgets/modest-secureauth-combo-box.h"
 #include "widgets/modest-validating-entry.h"
@@ -98,9 +99,8 @@ on_combo_security_changed (GtkComboBox *widget, gpointer user_data)
                        MODEST_SERVERSECURITY_COMBO_BOX (priv->combo_outgoing_security));
 
        if(port_number != 0) {
-               gchar* str = g_strdup_printf ("%d", port_number);
-               gtk_entry_set_text (GTK_ENTRY (priv->entry_port), str);
-               g_free (str);   
+               hildon_number_editor_set_value (
+                       HILDON_NUMBER_EDITOR (priv->entry_port), port_number);
        }               
 }
 
@@ -181,7 +181,7 @@ modest_connection_specific_smtp_edit_window_init (ModestConnectionSpecificSmtpEd
        
        /* The port number widgets: */
        if (!priv->entry_port)
-               priv->entry_port = gtk_entry_new ();
+               priv->entry_port = GTK_WIDGET (hildon_number_editor_new (0, 10000 /* arbitrary min and max */));
        caption = hildon_caption_new (sizegroup, 
                _("mcen_li_emailsetup_smtp"), priv->entry_port, NULL, HILDON_CAPTION_OPTIONAL);
        gtk_widget_show (priv->entry_port);
@@ -228,9 +228,8 @@ modest_connection_specific_smtp_edit_window_set_connection (
                MODEST_SECUREAUTH_COMBO_BOX (priv->combo_outgoing_auth), data->secure_auth);
                
                /* port: */
-               gchar * port_str = g_strdup_printf ("%d", data->port);
-               gtk_entry_set_text (GTK_ENTRY (priv->entry_port), port_str);
-               g_free (port_str);
+               hildon_number_editor_set_value (
+                       HILDON_NUMBER_EDITOR (priv->entry_port), data->port);
        }
 }
 
@@ -261,9 +260,8 @@ modest_connection_specific_smtp_edit_window_get_settings (
                MODEST_SECUREAUTH_COMBO_BOX (priv->combo_outgoing_auth));
                
        /* port: */
-       const gchar * port_str = gtk_entry_get_text (GTK_ENTRY (priv->entry_port));
-       if (port_str)
-               result->port = atoi (port_str);
+       result->port = hildon_number_editor_get_value (
+                       HILDON_NUMBER_EDITOR (priv->entry_port));
                        
        return result;
 }