view fix-casts.sh @ 27512:ff18653ef9f4

Add support in Pidgin for playing back audio:// links. Also include a "Save File" menu item to save a permanent copy. Playback uses purple_sound_play_file, which uses a playbin. This will not correctly play back the Siren codec until Bug 588218 is fixed, but that looks like it will be soon. Also, if anyone has a better idea for GtkIMHtml->PidginConversation than g_object_[gs]_data, feel free to fix it. References #393.
author Elliott Sales de Andrade <qulogic@pidgin.im>
date Sat, 11 Jul 2009 07:01:00 +0000
parents c3ca613ab550
children
line wrap: on
line source

#!/bin/sh

if [ $# -eq 0 ]; then
	echo "Usage: `basename "$0"` PurpleFoo..."
	echo
	echo "This script searches the *current working directory* and replaces casts"
	echo "with GObject-style type checking and casting macros."
	echo 'For example, "(PurpleBuddy *)b" becomes "PURPLE_BUDDY(b)".'
	exit 0
fi

for struct in $* ; do
	cast=`echo $struct | sed "s|[A-Z]|_\0|g" | tr "a-z" "A-Z" | sed "s|^_||"`
	for file in `grep -rl "([[:space:]]*$struct[[:space:]]*\*[[:space:]]*)" . --include=*.c --exclude=purple-client-bindings.c` ; do
		sed -i "s|([[:space:]]*$struct[[:space:]]*\*[[:space:]]*)[[:space:]]*(|$cast(|g" $file
		sed -i "s|([[:space:]]*$struct[[:space:]]*\*[[:space:]]*)[[:space:]]*\([^(][^,);]*\)|$cast(\1)|g" $file
	done
done