pidgin/pidgin

Parents 876661dc1375
Children 9d86663a7437
eventloop: Replace eventloop timeout functions with GLib equivalents

Now that libpurple uses Gio, configuring the event loop to use
something other than the GLib event loop causes things to break.
This is because Gio adds sources to the GLib event loop in a way
which can't practically be overridden.

Fortunately, other event loops can still be used by driving the GLib
event loop manually. See the GLib Main Event Loop docs for information
on doing this.

This patch replaces the event loop timeout functions to directly call
their GLib equivalents.
--- a/libpurple/eventloop.c Wed Jun 14 23:13:00 2017 -0500
+++ b/libpurple/eventloop.c Thu Jun 15 11:21:45 2017 -0500
@@ -26,28 +26,19 @@
guint
purple_timeout_add(guint interval, GSourceFunc function, gpointer data)
{
- PurpleEventLoopUiOps *ops = purple_eventloop_get_ui_ops();
-
- return ops->timeout_add(interval, function, data);
+ return g_timeout_add(interval, function, data);
}
guint
purple_timeout_add_seconds(guint interval, GSourceFunc function, gpointer data)
{
- PurpleEventLoopUiOps *ops = purple_eventloop_get_ui_ops();
-
- if (ops->timeout_add_seconds)
- return ops->timeout_add_seconds(interval, function, data);
- else
- return ops->timeout_add(1000 * interval, function, data);
+ return g_timeout_add_seconds(interval, function, data);
}
gboolean
purple_timeout_remove(guint tag)
{
- PurpleEventLoopUiOps *ops = purple_eventloop_get_ui_ops();
-
- return ops->timeout_remove(tag);
+ return g_source_remove(tag);
}
guint