PrefixSuffix revived

In 2002 I released a little GNOME app to rename files by changing the start or end of the filename, using gtkmm and gnome-vfs(mm). It worked well enough and was even packaged for distros for a while before the dependencies became too awkward.

I’ve never heard of a single person using it, but I still need the app now and then so I just updated it and put it in github, changing it from gtkmm 2.4 to gtkmm 3, removing the bakery dependency, and changing from gnome-vfs to GIO. I also removed most signs of my 2002 code style.

It seems to work, but it really needs a set of test cases.

I’m sure that the performance could be vastly improved but I’m not greatly interested in that so far. Patches are welcome. In particular, I haven’t found an equivalent for the gnome_vfs_xfer_uri_list() function for renaming several files at once and I guess that repeated sequential calls to g_file_set_display_name_async() are probably not ideal.

screenshot_prefixsuffix

8 thoughts on “PrefixSuffix revived

  1. There is no “really” async version of rename() in unix, so g_file_set_display_name_async() just calls rename() in a thread. If you’re doing a lot of these I’d propose you just do sync in a g_file_set_display_name() in a thread. This is pretty easy with gio.

    1. For something this simple why not just call rename() directly. It will give you the best speed and is going to get called by the methods your calling eventually anyways.

      A program this trivial cause drop a lot of the dependencies by just calling the main OS functions directly.

      1. Thanks, but rename() wouldn’t work for non-local files. For instance, I’d like this to work with files on servers, such as scp and ftp. These are URIs that it can get via the regular GTK+ file chooser dialog, for instance. GIO is a nice abstraction for that.

        This app depends only on GTK+ (via gtkmm), so it already pulls in gio. Removing all use of gio API would not change the dependencies but would make the code unpleasant (to me). I like to use sensible APIs where they exist.

  2. Thank you for PrefixSuffix. Worked awesome for me.
    Find and mv could accomplish similar things, but your tool as a gui is certainly more thorough and saves time.

Comments are closed.