B-Con
PCManFM Patch - Confirm Delete
• Posted by Brad Conte on May 17, 2008
• Post Categories: My Projects
Update 6-30-08 (PCManFM v4.5):
As of v4.5, PCManFM started to add an integrated feature to disable delete confirmation, fullfilling the goal of this patch. (The upcoming official feature appears to disable confirmation when a trash can is used.) This new feature does not yet fully work but the code is similar to the patch. Since the author has not seen fit to activate the feature and is clearly working on it, I do no anticipate releasing patches to work with any version beyond v4.3.

About
The patched preferences menu This patch adds the option to enable/disable delete confirmation in PCManFM, a popular, light-weight, tabbed file browser. Default behavior in PCManFM is to always prompt the user for confirmation when deleting a file (the classic “Are you sure?” prompt), a feature some find inconvenient. This patch adds an option to the Preferences menu that allows the user to select whether or not they wish to be prompted on deletion.

To the right is what the Preferences menu looks like after the patch. (The dark colors are due to my GTK theme, they have nothing to do with the patch.)


Download
Patch version: v2 (June 26, 2008)
Last tested against: PCManFM v0.4.3
Download

Applying the Patch
Applying the patch is simple. First download and extract the PCManFM code. Then apply the patch to the source. Either:

…from the parent directory with:
$ ls pcman-0.4.1.1 confirm_delete.patch $ patch -p0 < confirm_delete.patch
…or from the actual source directory with
$ ls AUTHORS config.guess libtool COPYING config.h ltmain.sh ChangeLog config.h.in missing INSTALL config.log mkinstalldirs Makefile config.status pcmanfm.desktop Makefile.am config.sub pcmanfm.desktop.in Makefile.in configure pcmanfm.png NEWS configure.in please_read_README_carefully_before_packaging README confirm_delete.patch po TODO data src aclocal.m4 depcomp stamp-h1 autogen.sh install-sh $ patch -p1 < confirm_delete.patch
You can then compile PCManFM with the standard:
$ ./configure $ make $ make install

Technical Notes
Patching was pretty minimal, save for one file: pcmanfm-{$version}/data/ui/prefdlg.glade . In the original source, practically the entire XML UI design file is devoid of whitespace, including newlines (for optimization), which makes a nimble patch for it impossible, thus this entire file must be redistributed. This file holds the entire visual layout for the Preferences menu, thus the patched prefdlg.glade file will have to be updated whenever the official PCManFM package updates the Preferences menu layout (something unlikely to happen).

Aside from that issue, since the editing was very simple and inline with the basic structure of the program itself, I see no reason why it shouldn’t work for on many PCManFM releases to come. (If things change, I’ll update the patch, though.)

Automatic Installation
Some OSs lend themselves to compiling from source very easily. If you use such an OS (Arch Linux, Gentoo, FreeBSD, etc) you may wish to write a script to apply the patch and rebuild the package. For Arch Linux, move the patch to your /var/abs/local/pcmanfm directory and add the patch to the PKGBUILD via:
$ cd /var/abs/local/pcmanfm $ sed -i “s_cd\ \$startdir/src/pcmanfm-\$pkgver_cd\ \$startdir/src/pcmanfm\ -\$pkgver\npatch\ -p1<../../confirm\_delete.patch_g" PKGBUILD
I’m unfamiliar with Gentoo’s ebuild format, but I’m sure that modifying an ebuild would be similar.
Bloggers' Rights at EFF