From f49b0ce9f15db9d9ecfc6b09ec24b017a2d0fcaf Mon Sep 17 00:00:00 2001 From: Sergio Villar Senin Date: Mon, 27 Oct 2008 18:46:16 +0000 Subject: [PATCH] * Fixes NB#90887 pmo-trunk-r6169 --- .../modest-connection-specific-smtp-edit-window.c | 47 +++++--------------- .../modest-connection-specific-smtp-edit-window.c | 47 +++++--------------- 2 files changed, 22 insertions(+), 72 deletions(-) diff --git a/src/hildon2/modest-connection-specific-smtp-edit-window.c b/src/hildon2/modest-connection-specific-smtp-edit-window.c index dd3b615..509f58f 100644 --- a/src/hildon2/modest-connection-specific-smtp-edit-window.c +++ b/src/hildon2/modest-connection-specific-smtp-edit-window.c @@ -75,7 +75,6 @@ struct _ModestConnectionSpecificSmtpEditWindowPrivate gboolean is_dirty; gboolean range_error_occured; - guint range_error_banner_timeout; }; static void @@ -114,10 +113,6 @@ modest_connection_specific_smtp_edit_window_finalize (GObject *object) ModestConnectionSpecificSmtpEditWindowPrivate *priv = CONNECTION_SPECIFIC_SMTP_EDIT_WINDOW_GET_PRIVATE (self); - if (priv->range_error_banner_timeout > 0) { - g_source_remove (priv->range_error_banner_timeout); - priv->range_error_banner_timeout = 0; - } if (priv->account_name) { g_free (priv->account_name); priv->account_name = NULL; @@ -162,26 +157,10 @@ on_value_changed(GtkWidget* widget, GValue* value, ModestConnectionSpecificSmtpE on_change(widget, self); } -gboolean -show_banner_handler (gpointer userdata) -{ - ModestConnectionSpecificSmtpEditWindow *self = userdata; - ModestConnectionSpecificSmtpEditWindowPrivate *priv = - CONNECTION_SPECIFIC_SMTP_EDIT_WINDOW_GET_PRIVATE (self); - gchar *msg; - - msg = g_strdup_printf (dgettext("hildon-libs", "ckct_ib_set_a_value_within_range"), PORT_RANGE_MIN, PORT_RANGE_MAX); - - hildon_banner_show_information (NULL, NULL, msg); - g_free (msg); - - priv->range_error_banner_timeout = 0; - return FALSE; -} - static gboolean on_range_error (GtkWidget *widget, HildonNumberEditorErrorType type, gpointer user_data) { + gchar *msg; ModestConnectionSpecificSmtpEditWindow *self = user_data; ModestConnectionSpecificSmtpEditWindowPrivate *priv = CONNECTION_SPECIFIC_SMTP_EDIT_WINDOW_GET_PRIVATE (self); @@ -190,8 +169,16 @@ on_range_error (GtkWidget *widget, HildonNumberEditorErrorType type, gpointer us * the hildon number editor already resets the value to the default value, so we have to * remember that such an error occured. */ priv->range_error_occured = TRUE; - if (priv->range_error_banner_timeout == 0) - priv->range_error_banner_timeout = g_timeout_add (200, show_banner_handler, self); + + if (type == HILDON_NUMBER_EDITOR_ERROR_MAXIMUM_VALUE_EXCEED) { + msg = g_strdup (_HL("ckct_ib_maximum_value")); + } else if (type == HILDON_NUMBER_EDITOR_ERROR_MINIMUM_VALUE_EXCEED) { + msg = g_strdup (_HL("ckct_ib_minimum_value")); + } else { + msg = g_strdup_printf (_HL("ckct_ib_set_a_value_within_range"), PORT_RANGE_MIN, PORT_RANGE_MAX); + } + modest_platform_information_banner (widget, NULL, msg); + g_free (msg); /* Show error message by not returning TRUE */ return TRUE; @@ -207,12 +194,6 @@ on_response (GtkDialog *dialog, int response_id, gpointer user_data) hostname = gtk_entry_get_text (GTK_ENTRY (priv->entry_outgoingserver)); - if ((response_id != GTK_RESPONSE_OK) && - (priv->range_error_banner_timeout > 0)) { - g_source_remove (priv->range_error_banner_timeout); - priv->range_error_banner_timeout = 0; - } - /* Don't close the dialog if a range error occured */ if(response_id == GTK_RESPONSE_OK && priv->range_error_occured) { @@ -397,7 +378,6 @@ modest_connection_specific_smtp_edit_window_init (ModestConnectionSpecificSmtpEd g_signal_connect(G_OBJECT(self), "response", G_CALLBACK(on_response), self); g_signal_connect(G_OBJECT(vbox), "set-focus-child", G_CALLBACK(on_set_focus_child), self); - priv->range_error_banner_timeout = 0; priv->account_name = NULL; pannable = hildon_pannable_area_new (); @@ -467,11 +447,6 @@ modest_connection_specific_smtp_edit_window_set_connection ( /* This will cause changed signals so we set dirty back to FALSE */ priv->is_dirty = FALSE; - if (priv->range_error_banner_timeout > 0) { - g_source_remove (priv->range_error_banner_timeout); - priv->range_error_banner_timeout = 0; - } - } } diff --git a/src/maemo/modest-connection-specific-smtp-edit-window.c b/src/maemo/modest-connection-specific-smtp-edit-window.c index 37886bc..91a788b 100644 --- a/src/maemo/modest-connection-specific-smtp-edit-window.c +++ b/src/maemo/modest-connection-specific-smtp-edit-window.c @@ -74,7 +74,6 @@ struct _ModestConnectionSpecificSmtpEditWindowPrivate gboolean is_dirty; gboolean range_error_occured; - guint range_error_banner_timeout; }; static void @@ -113,10 +112,6 @@ modest_connection_specific_smtp_edit_window_finalize (GObject *object) ModestConnectionSpecificSmtpEditWindowPrivate *priv = CONNECTION_SPECIFIC_SMTP_EDIT_WINDOW_GET_PRIVATE (self); - if (priv->range_error_banner_timeout > 0) { - g_source_remove (priv->range_error_banner_timeout); - priv->range_error_banner_timeout = 0; - } if (priv->account_name) { g_free (priv->account_name); priv->account_name = NULL; @@ -161,26 +156,10 @@ on_value_changed(GtkWidget* widget, GValue* value, ModestConnectionSpecificSmtpE on_change(widget, self); } -gboolean -show_banner_handler (gpointer userdata) -{ - ModestConnectionSpecificSmtpEditWindow *self = userdata; - ModestConnectionSpecificSmtpEditWindowPrivate *priv = - CONNECTION_SPECIFIC_SMTP_EDIT_WINDOW_GET_PRIVATE (self); - gchar *msg; - - msg = g_strdup_printf (dgettext("hildon-libs", "ckct_ib_set_a_value_within_range"), PORT_RANGE_MIN, PORT_RANGE_MAX); - - hildon_banner_show_information (NULL, NULL, msg); - g_free (msg); - - priv->range_error_banner_timeout = 0; - return FALSE; -} - static gboolean on_range_error (GtkWidget *widget, HildonNumberEditorErrorType type, gpointer user_data) { + gchar *msg; ModestConnectionSpecificSmtpEditWindow *self = user_data; ModestConnectionSpecificSmtpEditWindowPrivate *priv = CONNECTION_SPECIFIC_SMTP_EDIT_WINDOW_GET_PRIVATE (self); @@ -189,8 +168,16 @@ on_range_error (GtkWidget *widget, HildonNumberEditorErrorType type, gpointer us * the hildon number editor already resets the value to the default value, so we have to * remember that such an error occured. */ priv->range_error_occured = TRUE; - if (priv->range_error_banner_timeout == 0) - priv->range_error_banner_timeout = g_timeout_add (200, show_banner_handler, self); + + if (type == HILDON_NUMBER_EDITOR_ERROR_MAXIMUM_VALUE_EXCEED) { + msg = g_strdup (_HL("ckct_ib_maximum_value")); + } else if (type == HILDON_NUMBER_EDITOR_ERROR_MINIMUM_VALUE_EXCEED) { + msg = g_strdup (_HL("ckct_ib_minimum_value")); + } else { + msg = g_strdup_printf (_HL("ckct_ib_set_a_value_within_range"), PORT_RANGE_MIN, PORT_RANGE_MAX); + } + modest_platform_information_banner (widget, NULL, msg); + g_free (msg); /* Show error message by not returning TRUE */ return TRUE; @@ -206,12 +193,6 @@ on_response (GtkDialog *dialog, int response_id, gpointer user_data) hostname = gtk_entry_get_text (GTK_ENTRY (priv->entry_outgoingserver)); - if ((response_id == GTK_RESPONSE_CANCEL) && - (priv->range_error_banner_timeout > 0)) { - g_source_remove (priv->range_error_banner_timeout); - priv->range_error_banner_timeout = 0; - } - /* Don't close the dialog if a range error occured */ if(response_id == GTK_RESPONSE_OK && priv->range_error_occured) { @@ -392,7 +373,6 @@ modest_connection_specific_smtp_edit_window_init (ModestConnectionSpecificSmtpEd g_signal_connect(G_OBJECT(self), "response", G_CALLBACK(on_response), self); g_signal_connect(G_OBJECT(vbox), "set-focus-child", G_CALLBACK(on_set_focus_child), self); - priv->range_error_banner_timeout = 0; priv->account_name = NULL; scrolled_window = gtk_scrolled_window_new (NULL, NULL); @@ -464,11 +444,6 @@ modest_connection_specific_smtp_edit_window_set_connection ( /* This will cause changed signals so we set dirty back to FALSE */ priv->is_dirty = FALSE; - if (priv->range_error_banner_timeout > 0) { - g_source_remove (priv->range_error_banner_timeout); - priv->range_error_banner_timeout = 0; - } - } } -- 1.7.9.5