[gimp/osx-build: 37/38] OS X build: Remove GVFS and D-Bus dependencies of GIMP 2.8.
- From: Sven Claussner <sclaussner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/osx-build: 37/38] OS X build: Remove GVFS and D-Bus dependencies of GIMP 2.8.
- Date: Wed, 4 Jun 2014 17:38:50 +0000 (UTC)
commit e6302d2c955258eaad3d2cd1e44f69e3bb0bc9b5
Author: Simone Karin Lehmann <simone lisanet de>
Date: Wed Jun 4 19:14:03 2014 +0200
OS X build: Remove GVFS and D-Bus dependencies of GIMP 2.8.
Cache the help index file locally.
Fetch help and open location with libcurl instead.
Partially fixes bug 683177 (Help not working, File/Open location not
working)
Adaptions by Sven Claussner:
- Adapt gimp.modules and GIMP launcher.
- Add code comments.
build/osx/gimp.modules | 6 +--
build/osx/launcher-2.8-python.sh | 20 +----------
plug-ins/help/Makefile.am | 11 +++++-
plug-ins/help/gimphelplocale.c | 70 ++++++++++++++++++++++++++++++++++++++
plug-ins/help/gimphelpprogress.c | 28 +++++++++++++++
5 files changed, 111 insertions(+), 24 deletions(-)
---
diff --git a/build/osx/gimp.modules b/build/osx/gimp.modules
index f09325e..5e56275 100755
--- a/build/osx/gimp.modules
+++ b/build/osx/gimp.modules
@@ -825,7 +825,7 @@
</autotools>
<autotools id="gimp-osx" autogen-sh="autogen.sh"
- autogenargs="--without-x --enable-gtk-doc=no --without-dbus --without-wmf --enable-binreloc
--without-gs"
+ autogenargs="--without-x --enable-gtk-doc=no --without-dbus --without-wmf --enable-binreloc
--without-gs --without-gvfs --with-libcurl"
skip-autogen="never">
<branch repo="git.gnome.org" module="gimp" revision="osx-build"
checkoutdir="gimp-osx" />
@@ -835,7 +835,6 @@
<dep package="libtiff" />
<dep package="exif" />
<dep package="dbus" />
- <dep package="dbus-glib" />
<dep package="librsvg" />
<dep package="lcms" />
<dep package="fontconfig" />
@@ -848,7 +847,6 @@
<dep package="meta-gtk-osx-python" />
<dep package="tango-icon-theme" />
<dep package="gimp-osx-theme" />
- <dep package="gvfs" />
<dep package="curl" />
<dep package="gtk-mac-integration-python2" />
</dependencies>
@@ -1300,4 +1298,4 @@
<dep package="ilmbase" />
</dependencies>
</autotools>
-</moduleset>
\ No newline at end of file
+</moduleset>
diff --git a/build/osx/launcher-2.8-python.sh b/build/osx/launcher-2.8-python.sh
index da68ea1..622d068 100755
--- a/build/osx/launcher-2.8-python.sh
+++ b/build/osx/launcher-2.8-python.sh
@@ -90,21 +90,5 @@ if /bin/expr "x$1" : '^x-psn_' > /dev/null; then
shift 1
fi
-
-echo "Launching GIMP in a D-Bus session..."
-
-# Test for an existing D-Bus daemon and if there, reuse it.
-# Otherwise launch a new exclusive D-Bus daemon with an exclusive session
-# and run GIMP within it.
-# Taken and adapted from http://dbus.freedesktop.org/doc/dbus-launch.1.html
-if test -z "$DBUS_SESSION_BUS_ADDRESS" ; then
- $bundle_bin/dbus-launch --sh-syntax --exit-with-session \
- --config-file "$bundle_etc/dbus-1/session.conf" \
- "$bundle_contents/MacOS/$name-bin" "$@" $EXTRA_ARGS
-else
- $EXEC "$bundle_contents/MacOS/$name-bin" "$@" $EXTRA_ARGS
-fi
-
-
-echo "Cleaning up..."
-$bundle_bin/dbus-cleanup-sockets /var/tmp
\ No newline at end of file
+echo "Launching GIMP..."
+$EXEC "$bundle_contents/MacOS/$name-bin" "$@" $EXTRA_ARGS
\ No newline at end of file
diff --git a/plug-ins/help/Makefile.am b/plug-ins/help/Makefile.am
index c83d7e6..4ba5ec3 100644
--- a/plug-ins/help/Makefile.am
+++ b/plug-ins/help/Makefile.am
@@ -7,6 +7,11 @@ libgimpcolor = $(top_builddir)/libgimpcolor/libgimpcolor-$(GIMP_API_VERSION).la
libgimpbase = $(top_builddir)/libgimpbase/libgimpbase-$(GIMP_API_VERSION).la
libgimpmath = $(top_builddir)/libgimpmath/libgimpmath-$(GIMP_API_VERSION).la
+if PLATFORM_OSX
+xobjective_c = "-xobjective-c"
+framework_cocoa = -framework Foundation
+endif
+
if OS_WIN32
mwindows = -mwindows
endif
@@ -18,7 +23,8 @@ endif
AM_CPPFLAGS = -DDATADIR=\""$(gimpdatadir)"\"
-AM_LDFLAGS = $(mwindows)
+AM_LDFLAGS = $(mwindows) \
+ $(framework_cocoa)
noinst_LIBRARIES = libgimphelp.a
@@ -47,7 +53,8 @@ INCLUDES = \
$(CAIRO_CFLAGS) \
$(GIO_CFLAGS) \
$(GDK_PIXBUF_CFLAGS) \
- -I$(includedir)
+ -I$(includedir) \
+ $(xobjective_c)
LDADD = \
$(libgimphelp) \
diff --git a/plug-ins/help/gimphelplocale.c b/plug-ins/help/gimphelplocale.c
index a9768ee..0c11252 100644
--- a/plug-ins/help/gimphelplocale.c
+++ b/plug-ins/help/gimphelplocale.c
@@ -28,9 +28,17 @@
#include <string.h>
+#ifdef PLATFORM_OSX
+#import <Foundation/Foundation.h>
+#endif
+
#include <glib-object.h>
#include <gio/gio.h>
+#ifdef PLATFORM_OSX
+#include "libgimpbase/gimpbase.h"
+#endif
+
#include "gimphelp.h"
#include "gimphelpprogress-private.h"
@@ -161,6 +169,20 @@ static const GMarkupParser markup_parser =
locale_parser_error
};
+/**
+ * gimp_help_locale_parse: *
+ * @locale: language code of the help language
+ * @uri: URI of the help index file
+ * @help_domain: the help namespace; for instance see #GIMP_HELP_DEFAULT_DOMAIN
+ * @progress: data model for the prgress indicator
+ * @error: a structure to contain occured errors
+ *
+ * Load and parse the locale specific help index file (gimp-help.xml).
+ * On OS X: cache the help index file on disk to become independent of
+ * GVFS and D-Bus.
+ *
+ * Returns: TRUE if parsing succeeded; FALSE on errors
+ */
gboolean
gimp_help_locale_parse (GimpHelpLocale *locale,
const gchar *uri,
@@ -176,6 +198,13 @@ gimp_help_locale_parse (GimpHelpLocale *locale,
goffset size = 0;
gboolean success;
+#ifdef PLATFORM_OSX
+ const char *filepath;
+ NSURL *url;
+ NSData *urldata;
+ NSAutoreleasePool *pool;
+#endif
+
g_return_val_if_fail (locale != NULL, FALSE);
g_return_val_if_fail (uri != NULL, FALSE);
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
@@ -197,7 +226,27 @@ gimp_help_locale_parse (GimpHelpLocale *locale,
locale->locale_id, uri, help_domain);
#endif
+#ifdef PLATFORM_OSX
+ if (g_str_has_prefix (uri, "http:"))
+ {
+ pool = [[NSAutoreleasePool alloc] init];
+ url = [NSURL URLWithString: [NSString stringWithUTF8String: uri]];
+ urldata = [NSData dataWithContentsOfURL: url];
+ filepath = g_build_filename (gimp_directory (), "gimp-help.xml", NULL);
+ [urldata writeToFile: [NSString stringWithUTF8String: filepath]
+ atomically: YES];
+ [pool drain];
+
+ file = g_file_new_for_path (filepath);
+ g_free (filepath);
+ }
+ else
+ {
+ file = g_file_new_for_uri (uri);
+ }
+#else
file = g_file_new_for_uri (uri);
+#endif
if (progress)
{
@@ -270,6 +319,18 @@ gimp_help_locale_parse (GimpHelpLocale *locale,
return success;
}
+/**
+ * locale_parser_parse:
+ * @context: the parsed content of the input stream
+ * @progress: the GimpHelpProgress to update
+ * @stream: the input stream to parse
+ * @size: the size of the input stream
+ * @cancellable: a thread-safe operation cancellation stack
+ * @error: a structure to contain occured errors
+ *
+ * Read and parse stream into context, update progress.
+ * Returns: TRUE if parsing succeeded; FALSE on errors
+ */
static gboolean
locale_parser_parse (GMarkupParseContext *context,
GimpHelpProgress *progress,
@@ -517,6 +578,15 @@ locale_parser_parse_missing (LocaleParser *parser,
}
}
+/**
+ * locale_set_error:
+ * @error: the error to contain the resulting message
+ * @format: the message to print; a standard printf() format string
+ * @file: the file name to insert into the format string
+ *
+ * Write a message (given by format and file) into error->message.
+ *
+ */
static void
locale_set_error (GError **error,
const gchar *format,
diff --git a/plug-ins/help/gimphelpprogress.c b/plug-ins/help/gimphelpprogress.c
index 3d037c7..b5ef214 100644
--- a/plug-ins/help/gimphelpprogress.c
+++ b/plug-ins/help/gimphelpprogress.c
@@ -87,6 +87,15 @@ gimp_help_progress_cancel (GimpHelpProgress *progress)
}
+/**
+ * _gimp_help_progress_start:
+ * @progress: data model for the progress indicator
+ * @cancellable: a thread-safe operation cancellation stack
+ * @format: format string for the output message
+ * @...: variable argument list
+ *
+ * Initialize the progress indicator.
+ */
void
_gimp_help_progress_start (GimpHelpProgress *progress,
GCancellable *cancellable,
@@ -116,6 +125,13 @@ _gimp_help_progress_start (GimpHelpProgress *progress,
g_free (message);
}
+/**
+ * _gimp_help_progress_update:
+ * @progress: the progress indicator
+ * @percentage: the new percentage
+ *
+ * Update the progress indicator.
+ */
void
_gimp_help_progress_update (GimpHelpProgress *progress,
gdouble percentage)
@@ -126,6 +142,12 @@ _gimp_help_progress_update (GimpHelpProgress *progress,
progress->vtable.set_value (percentage, progress->user_data);
}
+/**
+ * _gimp_help_progress_pulse:
+ * @progress: the progress indicator
+ *
+ * Change the progress indicator's percentage back to 0.
+ */
void
_gimp_help_progress_pulse (GimpHelpProgress *progress)
{
@@ -134,6 +156,12 @@ _gimp_help_progress_pulse (GimpHelpProgress *progress)
_gimp_help_progress_update (progress, -1.0);
}
+/**
+ * _gimp_help_progress_finish:
+ * @progress: the progress indicator
+ *
+ * Finalize the progress indidicator.
+ */
void
_gimp_help_progress_finish (GimpHelpProgress *progress)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]