[Libreoffice-commits] core.git: Branch 'feature/tiled-editing' - 2 commits - libreofficekit/source
Miklos Vajna
vmiklos at collabora.co.uk
Mon Jan 12 04:56:30 PST 2015
Rebased ref, commits from common ancestor:
commit bb0eaf86560c2102602c2712d8f8d7bd5e8e58e6
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Mon Jan 12 13:55:11 2015 +0100
libreofficekit: fix for missing gdk_threads_add_idle
Change-Id: I52590f60882682943dda354599ab4ed762383b51
diff --git a/libreofficekit/source/gtk/lokdocview.c b/libreofficekit/source/gtk/lokdocview.c
index 8100455..d9d8e41 100644
--- a/libreofficekit/source/gtk/lokdocview.c
+++ b/libreofficekit/source/gtk/lokdocview.c
@@ -18,6 +18,67 @@
#define G_SOURCE_REMOVE FALSE
#endif
+/* Before glib 2.12. */
+#ifndef HAVE_GDK_THREADS_ADD_API
+typedef struct
+{
+ GSourceFunc func;
+ gpointer data;
+ GDestroyNotify destroy;
+} GdkThreadsDispatch;
+
+static gboolean
+gdk_threads_dispatch (gpointer data)
+{
+ GdkThreadsDispatch *dispatch = data;
+ gboolean ret = FALSE;
+
+ gdk_threads_enter ();
+ ret = dispatch->func (dispatch->data);
+ gdk_threads_leave ();
+
+ return ret;
+}
+
+static void
+gdk_threads_dispatch_free (gpointer data)
+{
+ GdkThreadsDispatch *dispatch = data;
+
+ if (dispatch->destroy && dispatch->data)
+ dispatch->destroy (dispatch->data);
+
+ g_slice_free (GdkThreadsDispatch, data);
+}
+
+guint
+gdk_threads_add_idle_full (gint priority,
+ GSourceFunc function,
+ gpointer data,
+ GDestroyNotify notify)
+{
+ GdkThreadsDispatch *dispatch;
+
+ g_return_val_if_fail (function != NULL, 0);
+
+ dispatch = g_slice_new (GdkThreadsDispatch);
+ dispatch->func = function;
+ dispatch->data = data;
+ dispatch->destroy = notify;
+
+ return g_idle_add_full (priority, gdk_threads_dispatch, dispatch,
+ gdk_threads_dispatch_free);
+}
+
+guint
+gdk_threads_add_idle (GSourceFunc function,
+ gpointer data)
+{
+ return gdk_threads_add_idle_full (G_PRIORITY_DEFAULT_IDLE,
+ function, data, NULL);
+}
+#endif /* HAVE_GDK_THREADS_ADD_API */
+
static void lok_docview_class_init( LOKDocViewClass* pClass );
static void lok_docview_init( LOKDocView* pDocView );
commit f0ac3ea14e493e84e8876da9c37872f22d5a7904
Author: Caolán McNamara <caolanm at redhat.com>
Date: Mon Jan 12 11:58:18 2015 +0000
fix for missing G_SOURCE_REMOVE
Change-Id: I55b69f153c0656d34a230c4328bc7af4bab40447
diff --git a/libreofficekit/source/gtk/lokdocview.c b/libreofficekit/source/gtk/lokdocview.c
index 65fdbfd..8100455 100644
--- a/libreofficekit/source/gtk/lokdocview.c
+++ b/libreofficekit/source/gtk/lokdocview.c
@@ -14,6 +14,10 @@
#include <LibreOfficeKit/LibreOfficeKitGtk.h>
+#ifndef G_SOURCE_REMOVE
+#define G_SOURCE_REMOVE FALSE
+#endif
+
static void lok_docview_class_init( LOKDocViewClass* pClass );
static void lok_docview_init( LOKDocView* pDocView );
More information about the Libreoffice-commits
mailing list