- unbreak after recent libgdata update

This commit is contained in:
jasper 2011-03-23 15:25:39 +00:00
parent 9371498af4
commit 674e7c7e5d
4 changed files with 138 additions and 17 deletions

View File

@ -1,9 +1,10 @@
# $OpenBSD: Makefile,v 1.13 2011/03/07 19:29:14 ajacoutot Exp $
# $OpenBSD: Makefile,v 1.14 2011/03/23 15:25:39 jasper Exp $
COMMENT= plugins for EOG
GNOME_PROJECT= eog-plugins
GNOME_VERSION= 2.30.2
REVISION= 0
CATEGORIES= graphics
@ -38,6 +39,8 @@ BUILD_DEPENDS= ${RUN_DEPENDS}
RUN_DEPENDS= x11/gnome/eog>=2.30.0
MODGCONF2_SCHEMAS_DIR= eog-plugins
AUTOCONF_VERSION= 2.64
CONFIGURE_STYLE= autoconf gnu
CONFIGURE_ARGS+= --with-plugins=all
CONFIGURE_ENV+= CPPFLAGS="-I${LOCALBASE}/include" \
LDFLAGS="-L${LOCALBASE}/lib"

View File

@ -1,16 +0,0 @@
$OpenBSD: patch-configure,v 1.4 2011/03/07 19:29:14 ajacoutot Exp $
Fix some stupid egrep(1) misusage causing this function to always
return 1.
--- configure.orig Sat Feb 5 15:28:14 2011
+++ configure Sat Feb 5 16:43:18 2011
@@ -14400,7 +14400,7 @@ disabled_plugins=
# *******************
check_plugin_defined() {
- if echo "$2" | egrep "\b($1)\b" > /dev/null;
+ if echo "$2" | egrep "$1" > /dev/null;
then
return 1
else

View File

@ -0,0 +1,33 @@
$OpenBSD: patch-configure_ac,v 1.1 2011/03/23 15:25:39 jasper Exp $
Be compatible with libgdata-0.8 as well
The file upload API changed from libgdata-0.6 to 0.8.
This checks the used library version on build time and
switches between APIs accordingly. Fixes bug 639261.
Upstream git: 66b4e5a6696c14f416223a65658a5124b52f996b
--- configure.ac.orig Wed Mar 23 16:01:33 2011
+++ configure.ac Wed Mar 23 16:02:20 2011
@@ -238,7 +238,7 @@ disabled_plugins=
# *******************
check_plugin_defined() {
- if echo "$2" | egrep "\b($1)\b" > /dev/null;
+ if echo "$2" | egrep "$1" > /dev/null;
then
return 1
else
@@ -297,7 +297,11 @@ if test "$?" = 1
then
PKG_CHECK_MODULES(POSTASA,
[ libgdata >= 0.6.0 ],
- [],[have_postasa=no])
+ PKG_CHECK_EXISTS( libgdata >= 0.8 ,
+ AC_DEFINE([HAVE_LIBGDATA_80], [1],
+ [Define to be compatible with the API of libgdata-0.8])
+ ),
+ [have_postasa=no])
AC_SUBST(POSTASA_LIBS)
AC_SUBST(POSTASA_CFLAGS)
if test "x$have_postasa" = "xno"

View File

@ -0,0 +1,101 @@
$OpenBSD: patch-plugins_postasa_eog-postasa-plugin_c,v 1.1 2011/03/23 15:25:39 jasper Exp $
Be compatible with libgdata-0.8 as well
The file upload API changed from libgdata-0.6 to 0.8.
This checks the used library version on build time and
switches between APIs accordingly. Fixes bug 639261.
Upstream git: 66b4e5a6696c14f416223a65658a5124b52f996b
--- plugins/postasa/eog-postasa-plugin.c.orig Wed Mar 23 16:09:42 2011
+++ plugins/postasa/eog-postasa-plugin.c Wed Mar 23 16:16:39 2011
@@ -402,8 +402,14 @@ tmp_picasaweb_upload_async (GSimpleAsyncResult *result
{
GDataPicasaWebFile *new_file = NULL;
EogPostasaPlugin *plugin = EOG_POSTASA_PLUGIN (source_object);
+ GDataPicasaWebService *service = plugin->priv->service;
GDataPicasaWebFile *file_entry;
PicasaWebUploadFileAsyncData *data;
+#ifdef HAVE_LIBGDATA_80
+ GDataUploadStream *upload_stream;
+ GFileInputStream *in_stream;
+ GFileInfo *file_info;
+#endif
gchar *filename;
GError *error = NULL;
@@ -415,15 +421,71 @@ tmp_picasaweb_upload_async (GSimpleAsyncResult *result
gdata_entry_set_title (GDATA_ENTRY (file_entry), filename);
g_free (filename);
- new_file = gdata_picasaweb_service_upload_file (plugin->priv->service, NULL /* Uploading to Drop Box */, file_entry,
- data->imgfile, cancellable, &error);
+#ifdef HAVE_LIBGDATA_80
+ file_info = g_file_query_info (data->imgfile,
+ G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME ","
+ G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE,
+ G_FILE_QUERY_INFO_NONE, cancellable,
+ &error);
+
+ if (file_info == NULL)
+ goto got_err;
+
+ upload_stream = gdata_picasaweb_service_upload_file (service,
+ NULL /* Upload to Dropbox */, file_entry,
+ g_file_info_get_display_name (file_info),
+ g_file_info_get_content_type (file_info),
+ cancellable, &error);
+ g_object_unref (file_info);
+
+ if (upload_stream == NULL)
+ goto got_err;
+
+ in_stream = g_file_read (data->imgfile, cancellable, &error);
+
+ if (in_stream == NULL) {
+ g_object_unref (upload_stream);
+ goto got_err;
+ }
+
+ if (g_output_stream_splice (G_OUTPUT_STREAM (upload_stream),
+ G_INPUT_STREAM (in_stream),
+ G_OUTPUT_STREAM_SPLICE_CLOSE_SOURCE |
+ G_OUTPUT_STREAM_SPLICE_CLOSE_TARGET,
+ cancellable, &error) == -1)
+ {
+ g_object_unref (upload_stream);
+ g_object_unref (in_stream);
+ goto got_err;
+ }
+
+
+ new_file = gdata_picasaweb_service_finish_file_upload (service,
+ upload_stream,
+ &error);
+
+ g_object_unref (upload_stream);
+ g_object_unref (in_stream);
+got_err:
+ /* Jump here if any GIO/GData call doesn't return successfully.
+ * Error handling happens below. */
+
+#else
+ /* libgdata-0.6 */
+ new_file = gdata_picasaweb_service_upload_file (service,
+ NULL /* Uploading to Drop Box */,
+ file_entry, data->imgfile,
+ cancellable, &error);
+#endif
+
g_object_unref (file_entry);
if (new_file == NULL || error) {
if (g_cancellable_is_cancelled (cancellable) == FALSE) {
g_simple_async_result_set_from_error (result, error);
- g_clear_error (&error); /* we can clear this, because set_from_error() does a g_error_copy() */
}
+ /* Clear errors always as cancelling creates errors too */
+ g_clear_error (&error);
} else {
g_simple_async_result_set_op_res_gboolean (result, TRUE);
}