From: Salvatore Iovene Date: Tue, 26 Jan 2010 07:27:11 +0000 (+0200) Subject: Fix bug#5020 - Unable to save a preset called "ontheroead (vibration)". X-Git-Tag: 0.0.16~4 X-Git-Url: https://vcs.maemo.org/git/?p=tweakr;a=commitdiff_plain;h=757a986905ddbf46b4a53174cb6a29283ecc1bc6 Fix bug#5020 - Unable to save a preset called "ontheroead (vibration)". --- 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 (); diff --git a/po/en_GB.po b/po/en_GB.po index 9eff12e..8683c2a 100644 --- a/po/en_GB.po +++ b/po/en_GB.po @@ -111,6 +111,9 @@ msgstr "Preset name" msgid "Enter the name first." msgstr "Enter the name first." +msgid "Preset name can only contain letters, numbers, - and _." +msgstr "Preset name can only contain letters, numbers, - and _." + msgid "Preset saved. Use the status menu to select it." msgstr "Preset saved. Use the status menu to select it." diff --git a/po/it_IT.po b/po/it_IT.po index d2df73a..6b2e328 100644 --- a/po/it_IT.po +++ b/po/it_IT.po @@ -111,6 +111,9 @@ msgstr "Nome della variante" msgid "Enter the name first." msgstr "Inserire prima il nome" +msgid "Preset name can only contain letters, numbers, - and _." +msgstr "Il nome della variante puo` consistere solo di lettere, numeri, - e _." + msgid "Preset saved. Use the status menu to select it." msgstr "Variante del profilo salvata. Puoi selezionarla nel menu di stato."