+2007-07-05 Johannes Schmid <johannes.schmid@openismus.com>
+
+ * src/maemo/easysetup/modest-easysetup-wizard.c:
+ (on_entry_invalid_character), (create_page_account_details),
+ (create_page_user_details):
+ Use new API of ModestValidatingEntry. But for some reason the banner is
+ not shown. I will have to investigate that further.
+
+ * src/widgets/modest-validating-entry.c: (on_insert_text),
+ (modest_validating_entry_set_func):
+ * src/widgets/modest-validating-entry.h:
+ Added a new callback function to be able to react to prevented
+ characters whitespaces to e.g show a banner.
+
+
2007-07-05 Armin Burgmeier <armin@openismus.com>
* src/maemo/modest-account-settings-dialog.c: Use the notify::value
show_error (GTK_WINDOW (dialog), _("ckdg_ib_maximum_characters_reached"));
}
+static void
+on_entry_invalid_character (ModestValidatingEntry *self, const gchar* character, gpointer user_data)
+{
+ ModestEasysetupWizardDialog *dialog = MODEST_EASYSETUP_WIZARD_DIALOG (user_data);
+ /* We could add a special case for whitespace here
+ if (character == NULL) ...
+ */
+ hildon_banner_show_information (
+ GTK_WIDGET(dialog), NULL, _("ckdg_ib_illegal_characters_entered"));
+}
+
static GtkWidget*
create_page_account_details (ModestEasysetupWizardDialog *self)
{
modest_validating_entry_set_unallowed_characters (
MODEST_VALIDATING_ENTRY (self->entry_account_title), list_prevent);
g_list_free (list_prevent);
+ modest_validating_entry_set_func(MODEST_VALIDATING_ENTRY(self->entry_account_title),
+ on_entry_invalid_character, self);
/* Set max length as in the UI spec:
* The UI spec seems to want us to show a dialog if we hit the maximum. */
list_prevent = g_list_append (list_prevent, ">");
modest_validating_entry_set_unallowed_characters (
MODEST_VALIDATING_ENTRY (self->entry_user_name), list_prevent);
+ modest_validating_entry_set_func(MODEST_VALIDATING_ENTRY(self->entry_account_title),
+ on_entry_invalid_character, self);
g_list_free (list_prevent);
/* The username widgets: */
* as required by our UI specification: */
modest_validating_entry_set_unallowed_characters_whitespace (
MODEST_VALIDATING_ENTRY (self->entry_user_username));
+ modest_validating_entry_set_func(MODEST_VALIDATING_ENTRY(self->entry_account_title),
+ on_entry_invalid_character, self);
/* Set max length as in the UI spec:
* The UI spec seems to want us to show a dialog if we hit the maximum. */
gboolean prevent_whitespace;
+ EasySetupValidatingEntryFunc func;
+ gpointer func_user_data;
+
EasySetupValidatingEntryMaxFunc max_func;
gpointer max_func_user_data;
};
GList *found = g_list_find_custom(priv->list_prevent, &one_char, &on_list_compare);
if(found) {
allow = FALSE;
+ if (priv->func)
+ {
+ priv->func(self, iter, priv->func_user_data);
+ }
break;
}
}
gunichar one_char = g_utf8_get_char (iter);
if (g_unichar_isspace (one_char)) {
allow = FALSE;
+ if (priv->func)
+ {
+ priv->func(self, NULL, priv->func_user_data);
+ }
break;
}
}
priv->max_func_user_data = user_data;
}
+/** Set a callback to be called when a character was prevented so that a
+ * note can be shown by the application to inform the user. For whitespaces,
+ * character will be NULL
+ */
+void modest_validating_entry_set_func (ModestValidatingEntry *self, EasySetupValidatingEntryFunc func, gpointer user_data)
+{
+ ModestValidatingEntryPrivate *priv = VALIDATING_ENTRY_GET_PRIVATE (self);
+ priv->func = func;
+ priv->func_user_data = user_data;
+}
+
void modest_validating_entry_set_unallowed_characters (ModestValidatingEntry *self, GList *list);
void modest_validating_entry_set_unallowed_characters_whitespace (ModestValidatingEntry *self);
+typedef void (* EasySetupValidatingEntryFunc) (ModestValidatingEntry *self, const gchar* character, gpointer user_data);
+void modest_validating_entry_set_func (ModestValidatingEntry *self, EasySetupValidatingEntryFunc func, gpointer user_data);
+
+
typedef void (* EasySetupValidatingEntryMaxFunc) (ModestValidatingEntry *self, gpointer user_data);
void modest_validating_entry_set_max_func (ModestValidatingEntry *self, EasySetupValidatingEntryMaxFunc func, gpointer user_data);