thanks for your initial work. First, some comments to the patch so far:
- gtk_editable_get_chars() (just like all glib/gtk functions) already return a copy of the string, no need to copy it again. So you can simplify the loop like Mikele said.
Just for some bikeshedding, I think that a for loop is a bit easier to read:
for (p = text; *p; ++p)
if (*p=='/') *p='_';
But that's just a matter of style.
- Right now it seems that the modified string is never actually written back to the input line? This should happen, so that the user sees the correction.
- The loop should set a flag if it replaced any character. If so, then there should be a gtk_message_dialog which points out the error.
- You need to g_free() the string you received from gtk_editable_get_chars() after having finished working with it.
Nicolas,
thanks for your initial work. First, some comments to the patch so far:
- gtk_editable_ get_chars( ) (just like all glib/gtk functions) already return a copy of the string, no need to copy it again. So you can simplify the loop like Mikele said.
Just for some bikeshedding, I think that a for loop is a bit easier to read:
for (p = text; *p; ++p)
if (*p=='/') *p='_';
But that's just a matter of style.
- Right now it seems that the modified string is never actually written back to the input line? This should happen, so that the user sees the correction. get_chars( ) after having finished working with it.
- The loop should set a flag if it replaced any character. If so, then there should be a gtk_message_dialog which points out the error.
- You need to g_free() the string you received from gtk_editable_
Happy hacking!