libreofficekit: we don't need our own gdk_threads_add_idle() version after all
Change-Id: I9d05a3971bd0dd14654d0b0e2a80a263d360505b
This commit is contained in:
@@ -18,67 +18,6 @@
|
||||
#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 );
|
||||
|
||||
@@ -218,7 +157,16 @@ void renderDocument( LOKDocView* pDocView )
|
||||
static gboolean lok_docview_callback(gpointer pData)
|
||||
{
|
||||
LOKDocView* pDocView = pData;
|
||||
|
||||
#if ! GTK_CHECK_VERSION(2,12,0)
|
||||
GDK_THREADS_ENTER();
|
||||
#endif
|
||||
|
||||
renderDocument(pDocView);
|
||||
|
||||
#if ! GTK_CHECK_VERSION(2,12,0)
|
||||
GDK_THREADS_LEAVE();
|
||||
#endif
|
||||
return G_SOURCE_REMOVE;
|
||||
}
|
||||
|
||||
@@ -232,7 +180,11 @@ static void lok_docview_callback_worker(int nType, const char* pPayload, void* p
|
||||
case LOK_CALLBACK_INVALIDATE_TILES:
|
||||
// TODO for now just always render the document.
|
||||
(void)pPayload;
|
||||
#if GTK_CHECK_VERSION(2,12,0)
|
||||
gdk_threads_add_idle(lok_docview_callback, pDocView);
|
||||
#else
|
||||
g_add_idle(lok_docview_callback, pDocView);
|
||||
#endif
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
Reference in New Issue
Block a user