X-Git-Url: https://vcs.maemo.org/git/?a=blobdiff_plain;f=modules%2Ftweakr-profile.c;h=00c1a264e6b041644046523f2d79872c827d922e;hb=757a986905ddbf46b4a53174cb6a29283ecc1bc6;hp=128035cfca1b4628e31af30320df01663f7d4ace;hpb=b85db8a395ca016739833467ee16f2b5a495d70a;p=tweakr diff --git a/modules/tweakr-profile.c b/modules/tweakr-profile.c index 128035c..00c1a26 100644 --- a/modules/tweakr-profile.c +++ b/modules/tweakr-profile.c @@ -152,9 +152,10 @@ _save_preset_clicked (HildonPickerButton *button, gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), entry, TRUE, TRUE, 0); - while (text == NULL || text [0] == '\0') + while (TRUE) { gint ret; + gint iter; ret = gtk_dialog_run (GTK_DIALOG (dialog)); if (ret == GTK_RESPONSE_OK) @@ -162,6 +163,7 @@ _save_preset_clicked (HildonPickerButton *button, GtkWidget *banner; profileval_t *values, *values_iter; GConfClient *gconf; + gboolean cont = FALSE; text = hildon_entry_get_text (HILDON_ENTRY (entry)); if (text == NULL || text[0] == '\0') @@ -174,6 +176,25 @@ _save_preset_clicked (HildonPickerButton *button, continue; } + for (iter = 0; iter < strlen (text); iter++) + { + if (!g_ascii_isalnum (text[iter]) && + text[iter] != '-' && + text[iter] != '_') + { + GtkWidget *banner; + + banner = hildon_banner_show_information + (dialog, NULL, + _("Preset name can only contains letters, numbers, - and _.")); + + cont = TRUE; + } + } + + if (cont) + continue; + /* Save the settings to our own gconf directory. */ gconf = gconf_client_get_default ();