From eb0b8a2e6a2b8c78266e2e641a468843deee61c3 Mon Sep 17 00:00:00 2001
From: Cecil <knoppmyth@gmail.com>
Date: Tue, 28 Dec 2010 10:52:16 -0800
Subject: handbrake:initial inclusion

---
 abs/extra/handbrake/PKGBUILD            |  46 ++++++
 abs/extra/handbrake/gtk2.20_fixes.patch | 248 ++++++++++++++++++++++++++++++++
 abs/extra/handbrake/handbrake.install   |  15 ++
 3 files changed, 309 insertions(+)
 create mode 100644 abs/extra/handbrake/PKGBUILD
 create mode 100644 abs/extra/handbrake/gtk2.20_fixes.patch
 create mode 100644 abs/extra/handbrake/handbrake.install

diff --git a/abs/extra/handbrake/PKGBUILD b/abs/extra/handbrake/PKGBUILD
new file mode 100644
index 0000000..7946bd5
--- /dev/null
+++ b/abs/extra/handbrake/PKGBUILD
@@ -0,0 +1,46 @@
+# $Id: PKGBUILD 84760 2010-07-04 06:05:09Z eric $
+# Contributor: Giovanni Scafora <giovanni@archlinux.org>
+# Contributor: Sebastien Piccand <sebcactus gmail com>
+
+pkgbase=handbrake
+pkgname=('handbrake' 'handbrake-cli')
+pkgver=0.9.4
+pkgrel=3
+arch=('i686' 'x86_64')
+url="http://handbrake.fr/"
+license=('GPL')
+depends=('bzip2' 'hal' 'libnotify' 'libwebkit')
+makedepends=('intltool' 'python' 'yasm')
+source=(http://saintdevelopment.com/mirror/${pkgname}/HandBrake-${pkgver}.tar.bz2
+	gtk2.20_fixes.patch)
+md5sums=('69f88b2e602550615da75947f914d7e6' 'e0296baaed129dceaf0d29c8284dc9fe')
+sha1sums=('91329a83315b7eae0b2b3731a8bf0f2de2a6eb4d' '17b39144d9883b1f63d9b9ff2f6770b35bbdb16a')
+
+build() {
+  cd "${srcdir}/HandBrake-${pkgver}"
+
+  #this patch is cherry picked from svn. remove it when updating to a new version
+  patch -Np0 -i ${srcdir}/gtk2.20_fixes.patch
+
+  ./configure --prefix=/usr --force
+  cd build
+  make
+}
+
+package_handbrake() {
+  pkgdesc="Multiplatform, multithreaded DVD to MPEG-4/H264/Theora converter"
+  install=${pkgname}.install
+
+  cd "${srcdir}/HandBrake-${pkgver}/build"
+  make DESTDIR="${pkgdir}" install
+  rm "${pkgdir}/usr/bin/HandBrakeCLI"
+}
+
+package_handbrake-cli() {
+  pkgdesc="Multiplatform, multithreaded DVD to MPEG-4/H264/Theora converter (CLI version)"
+  depends=('bzip2' 'gcc-libs' 'zlib')
+  conflict=('handbrake<=0.9.4-2')
+
+  cd "${srcdir}/HandBrake-${pkgver}/build"
+  install -D -m 755 HandBrakeCLI "${pkgdir}/usr/bin/HandBrakeCLI"
+}
diff --git a/abs/extra/handbrake/gtk2.20_fixes.patch b/abs/extra/handbrake/gtk2.20_fixes.patch
new file mode 100644
index 0000000..63b0947
--- /dev/null
+++ b/abs/extra/handbrake/gtk2.20_fixes.patch
@@ -0,0 +1,248 @@
+Index: gtk/src/settings.c
+===================================================================
+--- gtk/src/settings.c	(revision 3134)
++++ gtk/src/settings.c	(revision 3135)
+@@ -179,17 +179,14 @@
+ // Map widget names to setting keys
+ // Widgets that map to settings have names
+ // of this format: s_<setting key>
+-static const gchar*
+-get_setting_key(GtkWidget *widget)
++const gchar*
++ghb_get_setting_key(GtkWidget *widget)
+ {
+ 	const gchar *name;
+ 	
+ 	g_debug("get_setting_key ()\n");
+ 	if (widget == NULL) return NULL;
+-	if (GTK_IS_ACTION(widget))
+-		name = gtk_action_get_name(GTK_ACTION(widget));
+-	else
+-		name = gtk_widget_get_name(widget);
++	name = gtk_buildable_get_name(GTK_BUILDABLE(widget));
+ 		
+ 	if (name == NULL)
+ 	{
+@@ -214,10 +211,7 @@
+ 	}
+ 
+ 	type = GTK_WIDGET_TYPE(widget);
+-	if (GTK_IS_ACTION(widget))
+-		name = gtk_action_get_name(GTK_ACTION(widget));
+-	else
+-		name = gtk_widget_get_name(widget);
++	name = ghb_get_setting_key(widget);
+ 	g_debug("ghb_widget_value widget (%s)\n", name);
+ 	if (type == GTK_TYPE_ENTRY)
+ 	{
+@@ -442,7 +436,7 @@
+ 	if (widget == NULL) return;
+ 	g_debug("ghb_widget_to_setting");
+ 	// Find corresponding setting
+-	key = get_setting_key(widget);
++	key = ghb_get_setting_key(widget);
+ 	if (key == NULL) return;
+ 	value = ghb_widget_value(widget);
+ 	if (value != NULL)
+Index: gtk/src/settings.h
+===================================================================
+--- gtk/src/settings.h	(revision 3134)
++++ gtk/src/settings.h	(revision 3135)
+@@ -108,5 +108,6 @@
+ void ghb_widget_to_setting(GValue *settings, GtkWidget *widget);
+ int ghb_ui_update(
+ 	signal_user_data_t *ud, const gchar *name, const GValue *value);
++const gchar* ghb_get_setting_key(GtkWidget *widget);
+ 
+ #endif // _SETTINGS_H_
+Index: gtk/src/preview.c
+===================================================================
+--- gtk/src/preview.c	(revision 3134)
++++ gtk/src/preview.c	(revision 3135)
+@@ -877,7 +877,7 @@
+ 	ghb_widget_to_setting (ud->settings, xwidget);
+ 	ghb_preview_set_visible(ud);
+ 	ghb_check_dependency(ud, xwidget, NULL);
+-	const gchar *name = gtk_widget_get_name(xwidget);
++	const gchar *name = ghb_get_setting_key(xwidget);
+ 	ghb_pref_save(ud->settings, name);
+ }
+ 
+@@ -934,7 +934,7 @@
+ 	g_debug("fullscreen_clicked_cb()");
+ 	ghb_widget_to_setting (ud->settings, toggle);
+ 	ghb_check_dependency(ud, toggle, NULL);
+-	const gchar *name = gtk_widget_get_name(toggle);
++	const gchar *name = ghb_get_setting_key(toggle);
+ 	ghb_pref_save(ud->settings, name);
+ 
+ 	window = GTK_WINDOW(GHB_WIDGET (ud->builder, "preview_window"));
+@@ -1030,7 +1030,7 @@
+ 	ghb_live_reset(ud);
+ 	ghb_widget_to_setting (ud->settings, widget);
+ 	ghb_check_dependency(ud, widget, NULL);
+-	const gchar *name = gtk_widget_get_name(widget);
++	const gchar *name = ghb_get_setting_key(widget);
+ 	ghb_pref_save(ud->settings, name);
+ }
+ 
+Index: gtk/src/audiohandler.c
+===================================================================
+--- gtk/src/audiohandler.c	(revision 3134)
++++ gtk/src/audiohandler.c	(revision 3135)
+@@ -478,7 +478,7 @@
+ G_MODULE_EXPORT void
+ subtitle_changed_cb(GtkWidget *widget, signal_user_data_t *ud)
+ {
+-	const gchar *name = gtk_widget_get_name(widget);
++	const gchar *name = ghb_get_setting_key(widget);
+ 	g_debug("subtitle_changed_cb () %s", name);
+ 	ghb_widget_to_setting(ud->settings, widget);
+ 	ghb_check_dependency(ud, widget, NULL);
+Index: gtk/src/x264handler.c
+===================================================================
+--- gtk/src/x264handler.c	(revision 3134)
++++ gtk/src/x264handler.c	(revision 3135)
+@@ -523,7 +523,7 @@
+ x264_opt_update(signal_user_data_t *ud, GtkWidget *widget)
+ {
+ 	gint jj;
+-	const gchar *name = gtk_widget_get_name(widget);
++	const gchar *name = ghb_get_setting_key(widget);
+ 	gchar **opt_syns = NULL;
+ 	const gchar *def_val = NULL;
+ 	gint type;
+Index: gtk/src/callbacks.c
+===================================================================
+--- gtk/src/callbacks.c	(revision 3134)
++++ gtk/src/callbacks.c	(revision 3135)
+@@ -199,7 +199,7 @@
+ 		type = GTK_WIDGET_TYPE(widget);
+ 		if (type == GTK_TYPE_COMBO_BOX || type == GTK_TYPE_COMBO_BOX_ENTRY)
+ 			if (gtk_combo_box_get_active(GTK_COMBO_BOX(widget)) < 0) return;
+-		name = gtk_widget_get_name(widget);
++		name = ghb_get_setting_key(widget);
+ 	}
+ 	else
+ 		name = alt_name;
+@@ -1054,7 +1054,7 @@
+ 	gchar *sourcename;
+ 
+ 	sourcename = ghb_settings_get_string(ud->settings, "source");
+-	filename = gtk_action_get_name(action);
++	filename = gtk_buildable_get_name(GTK_BUILDABLE(action));
+ 	ghb_do_scan(ud, filename, 0, TRUE);
+ 	if (strcmp(sourcename, filename) != 0)
+ 	{
+@@ -1694,7 +1694,7 @@
+ G_MODULE_EXPORT void
+ target_size_changed_cb(GtkWidget *widget, signal_user_data_t *ud)
+ {
+-	const gchar *name = gtk_widget_get_name(widget);
++	const gchar *name = ghb_get_setting_key(widget);
+ 	g_debug("target_size_changed_cb () %s", name);
+ 	ghb_widget_to_setting(ud->settings, widget);
+ 	ghb_check_dependency(ud, widget, NULL);
+@@ -1713,7 +1713,7 @@
+ start_point_changed_cb(GtkWidget *widget, signal_user_data_t *ud)
+ {
+ 	gint start, end;
+-	const gchar *name = gtk_widget_get_name(widget);
++	const gchar *name = ghb_get_setting_key(widget);
+ 
+ 	g_debug("start_point_changed_cb () %s", name);
+ 	ghb_widget_to_setting(ud->settings, widget);
+@@ -1765,7 +1765,7 @@
+ end_point_changed_cb(GtkWidget *widget, signal_user_data_t *ud)
+ {
+ 	gint start, end;
+-	const gchar *name = gtk_widget_get_name(widget);
++	const gchar *name = ghb_get_setting_key(widget);
+ 
+ 	g_debug("end_point_changed_cb () %s", name);
+ 	ghb_widget_to_setting(ud->settings, widget);
+@@ -3588,7 +3588,7 @@
+ 	g_debug("pref_changed_cb");
+ 	ghb_widget_to_setting (ud->settings, widget);
+ 	ghb_check_dependency(ud, widget, NULL);
+-	const gchar *name = gtk_widget_get_name(widget);
++	const gchar *name = ghb_get_setting_key(widget);
+ 	ghb_pref_save(ud->settings, name);
+ }
+ 
+@@ -3598,7 +3598,7 @@
+ 	g_debug("use_m4v_changed_cb");
+ 	ghb_widget_to_setting (ud->settings, widget);
+ 	ghb_check_dependency(ud, widget, NULL);
+-	const gchar *name = gtk_widget_get_name(widget);
++	const gchar *name = ghb_get_setting_key(widget);
+ 	ghb_pref_save(ud->settings, name);
+ 	ghb_update_destination_extension(ud);
+ }
+@@ -3609,7 +3609,7 @@
+ 	g_debug("show_status_cb");
+ 	ghb_widget_to_setting (ud->settings, widget);
+ 	ghb_check_dependency(ud, widget, NULL);
+-	const gchar *name = gtk_widget_get_name(widget);
++	const gchar *name = ghb_get_setting_key(widget);
+ 	ghb_pref_save(ud->settings, name);
+ 
+ 	GtkStatusIcon *si;
+@@ -3626,7 +3626,7 @@
+ 	ghb_widget_to_setting (ud->settings, widget);
+ 	ghb_check_dependency(ud, widget, NULL);
+ 
+-	const gchar *name = gtk_widget_get_name(widget);
++	const gchar *name = ghb_get_setting_key(widget);
+ 	ghb_pref_save(ud->settings, name);
+ 
+ 	gdouble vqmin, vqmax, step, page;
+@@ -3643,7 +3643,7 @@
+ {
+ 	g_debug("tweaks_changed_cb");
+ 	ghb_widget_to_setting (ud->settings, widget);
+-	const gchar *name = gtk_widget_get_name(widget);
++	const gchar *name = ghb_get_setting_key(widget);
+ 	ghb_pref_save(ud->settings, name);
+ }
+ 
+@@ -3652,7 +3652,7 @@
+ {
+ 	g_debug("hbfd_feature_changed_cb");
+ 	ghb_widget_to_setting (ud->settings, widget);
+-	const gchar *name = gtk_widget_get_name(widget);
++	const gchar *name = ghb_get_setting_key(widget);
+ 	ghb_pref_save(ud->settings, name);
+ 
+ 	gboolean hbfd = ghb_settings_get_boolean(ud->settings, "hbfd_feature");
+@@ -4559,7 +4559,7 @@
+ 		GtkResponseType response;
+ 		gchar *tweak = NULL;
+ 
+-		name = gtk_widget_get_name(widget);
++		name = ghb_get_setting_key(widget);
+ 		if (g_str_has_prefix(name, "tweak_"))
+ 		{
+ 			tweak_name = g_strdup(name);
+Index: gtk/src/main.c
+===================================================================
+--- gtk/src/main.c	(revision 3134)
++++ gtk/src/main.c	(revision 3135)
+@@ -152,7 +152,7 @@
+     g_return_if_fail(handler_name != NULL);
+     g_return_if_fail(signal_name != NULL);
+ 
+-	//const gchar *name = gtk_widget_get_name((GtkWidget*)object);
++	//const gchar *name = ghb_get_setting_key((GtkWidget*)object);
+ 	//g_message("\n\nname %s", name);
+ 	g_debug("handler_name %s", handler_name);
+ 	g_debug("signal_name %s", signal_name);
+@@ -192,7 +192,7 @@
+     font_desc = pango_font_description_from_string(font);
+     if (font_desc == NULL) exit(1);
+     gtk_widget_modify_font(widget, font_desc);
+-    name = gtk_widget_get_name(widget);
++    name = ghb_get_setting_key(widget);
+     g_debug("changing font for widget %s\n", name);
+     if (GTK_IS_CONTAINER(widget))
+     {
diff --git a/abs/extra/handbrake/handbrake.install b/abs/extra/handbrake/handbrake.install
new file mode 100644
index 0000000..9a06fb3
--- /dev/null
+++ b/abs/extra/handbrake/handbrake.install
@@ -0,0 +1,15 @@
+post_install() {
+  gtk-update-icon-cache -q -t -f usr/share/icons/hicolor
+}
+
+post_upgrade() {
+  post_install $1
+
+  if [ "$(vercmp $2 0.9.4-3)" -lt 0 ]; then
+    echo "==> The handbrake CLI binary is now in a separate package: handbrake-cli"
+  fi
+}
+
+post_remove() {
+  gtk-update-icon-cache -q -t -f usr/share/icons/hicolor
+}
-- 
cgit v0.12

