summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Ruprecht <cmaiku@gmail.com>2017-06-15 11:21:45 -0500
committerMike Ruprecht <cmaiku@gmail.com>2017-06-15 11:21:45 -0500
commit8f2f7ceb642db706aefc5511682ee8dcb023443b (patch)
tree08fd21469c34810b88819af0cd295c1f96408d0c
parentf66a1497aa43ed7e6050c59ee38f1ef8e4bee30b (diff)
downloadpidgin-8f2f7ceb642db706aefc5511682ee8dcb023443b.tar.gz
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.
-rw-r--r--libpurple/eventloop.c15
1 files changed, 3 insertions, 12 deletions
diff --git a/libpurple/eventloop.c b/libpurple/eventloop.c
index 6922d3dc8f..e1e8022903 100644
--- a/libpurple/eventloop.c
+++ b/libpurple/eventloop.c
@@ -26,28 +26,19 @@ static PurpleEventLoopUiOps *eventloop_ui_ops = NULL;
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