Skip to content

new-file-popover: add check button to automatically trim whitespaces

Fixes #1277 (closed)

I'm quite new to C, and manual memory management. But I'm pretty sure this is right. I'm just duplicating the text returned by gtk_entry_get_text who doesn't give ownership into a g_autofree gchar * to strip it. After, the variable isn't passed to anybody who'd take ownership of it at anypoint.

Also, the part where I'm checking the first and last characters could be done by stripping and then comparing length, but doing it this way makes it possible to save on allocation. It's probably not significant at all, but why not. The lines are very lengthy though, I don't know if/how they should be split up.

I noticed that gbp_new_file_popover_check_exists takes the argument directory. The current code doesn't require it however, it could just use self->directory no? The async code doesn't depend on it.

Edited by Mathieu PATUREL

Merge request reports