Fri, 30 Jun 2017 02:03:09 +0000
Merged in CMaiku/pidgin (pull request #216)
Remove PurpleEventLoopUiOps
Approved-by: Eion Robb <eionrobb@gmail.com>
Approved-by: Gary Kramlich <grim@reaperworld.com>
| ChangeLog.API | file | annotate | diff | comparison | revisions | |
| pidgin/Makefile.am | file | annotate | diff | comparison | revisions | |
| pidgin/gtkeventloop.c | file | annotate | diff | comparison | revisions | |
| pidgin/gtkeventloop.h | file | annotate | diff | comparison | revisions | |
| pidgin/libpidgin.c | file | annotate | diff | comparison | revisions |
--- a/ChangeLog.API Fri Jun 30 01:55:59 2017 +0000 +++ b/ChangeLog.API Fri Jun 30 02:03:09 2017 +0000 @@ -421,6 +421,10 @@ * PurpleConversationType * purple_core_migrate * purple_dnsquery_a_account + * purple_event_loop_{get|set}_ui_ops. Manually drive the GLib + event loop yourself. See GLib Main Event Loop docs. + * PurpleEventLoopUiOps. Manually drive the GLib event loop + yourself. See GLib Main Event Loop docs. * purple_network_listen_family. Use purple_network_listen, instead. * purple_network_listen_map_external * purple_network_listen_range_family. Use purple_network_listen,
--- a/doc/reference/libpurple/ui_ops.xml Fri Jun 30 01:55:59 2017 +0000 +++ b/doc/reference/libpurple/ui_ops.xml Fri Jun 30 02:03:09 2017 +0000 @@ -17,7 +17,6 @@ <listitem><link linkend="PurpleCoreUiOps"><literal>PurpleCoreUiOps</literal></link></listitem> <listitem><link linkend="PurpleDebugUiOps"><literal>PurpleDebugUiOps</literal></link></listitem> <listitem><link linkend="PurpleDnsQueryUiOps"><literal>PurpleDnsQueryUiOps</literal></link></listitem> -<listitem><link linkend="PurpleEventLoopUiOps"><literal>PurpleEventLoopUiOps</literal></link> (without this, nothing will work and you will cry)</listitem> <listitem><link linkend="PurpleIdleUiOps"><literal>PurpleIdleUiOps</literal></link></listitem> <listitem><link linkend="PurpleNotifyUiOps"><literal>PurpleNotifyUiOps</literal></link></listitem> <listitem><link linkend="PurpleRequestUiOps"><literal>PurpleRequestUiOps</literal></link></listitem>
--- a/doc/reference/pidgin/pidgin-docs.xml Fri Jun 30 01:55:59 2017 +0000 +++ b/doc/reference/pidgin/pidgin-docs.xml Fri Jun 30 02:03:09 2017 +0000 @@ -35,7 +35,6 @@ <xi:include href="xml/gtkdebug.xml" /> <xi:include href="xml/gtkdocklet.xml" /> <xi:include href="xml/gtkdnd-hints.xml" /> - <xi:include href="xml/gtkeventloop.xml" /> <xi:include href="xml/gtkxfer.xml" /> <xi:include href="xml/gtkicon-theme.xml" /> <xi:include href="xml/gtkidle.xml" />
--- a/finch/libfinch.c Fri Jun 30 01:55:59 2017 +0000 +++ b/finch/libfinch.c Fri Jun 30 02:03:09 2017 +0000 @@ -26,7 +26,6 @@ #include "conversation.h" #include "core.h" #include "debug.h" -#include "eventloop.h" #include "glibcompat.h" #include "log.h" #include "notify.h" @@ -134,103 +133,6 @@ return &core_ops; } -/* Anything IO-related is directly copied from gtkpurple's source tree */ - -#define FINCH_READ_COND (G_IO_IN | G_IO_HUP | G_IO_ERR) -#define FINCH_WRITE_COND (G_IO_OUT | G_IO_HUP | G_IO_ERR | G_IO_NVAL) - -typedef struct _PurpleGntIOClosure { - PurpleInputFunction function; - guint result; - gpointer data; - -} PurpleGntIOClosure; - -static void purple_gnt_io_destroy(gpointer data) -{ - g_free(data); -} - -static gboolean purple_gnt_io_invoke(GIOChannel *source, GIOCondition condition, gpointer data) -{ - PurpleGntIOClosure *closure = data; - PurpleInputCondition purple_cond = 0; - - if (condition & FINCH_READ_COND) - purple_cond |= PURPLE_INPUT_READ; - if (condition & FINCH_WRITE_COND) - purple_cond |= PURPLE_INPUT_WRITE; - -#if 0 - purple_debug(PURPLE_DEBUG_MISC, "gtk_eventloop", - "CLOSURE: callback for %d, fd is %d\n", - closure->result, g_io_channel_unix_get_fd(source)); -#endif - -#ifdef _WIN32 - if(! purple_cond) { -#if 0 - purple_debug_misc("gnt_eventloop", - "CLOSURE received GIOCondition of 0x%x, which does not" - " match 0x%x (READ) or 0x%x (WRITE)\n", - condition, FINCH_READ_COND, FINCH_WRITE_COND); -#endif /* DEBUG */ - - return TRUE; - } -#endif /* _WIN32 */ - - closure->function(closure->data, g_io_channel_unix_get_fd(source), - purple_cond); - - return TRUE; -} - -static guint gnt_input_add(gint fd, PurpleInputCondition condition, PurpleInputFunction function, - gpointer data) -{ - PurpleGntIOClosure *closure = g_new0(PurpleGntIOClosure, 1); - GIOChannel *channel; - GIOCondition cond = 0; - - closure->function = function; - closure->data = data; - - if (condition & PURPLE_INPUT_READ) - cond |= FINCH_READ_COND; - if (condition & PURPLE_INPUT_WRITE) - cond |= FINCH_WRITE_COND; - - channel = g_io_channel_unix_new(fd); - closure->result = g_io_add_watch_full(channel, G_PRIORITY_DEFAULT, cond, - purple_gnt_io_invoke, closure, purple_gnt_io_destroy); - - g_io_channel_unref(channel); - return closure->result; -} - -static PurpleEventLoopUiOps eventloop_ops = -{ - g_timeout_add, - g_source_remove, - gnt_input_add, - g_source_remove, - NULL, /* input_get_error */ - g_timeout_add_seconds, - - /* padding */ - NULL, - NULL, - NULL, - NULL -}; - -static PurpleEventLoopUiOps * -gnt_eventloop_get_ui_ops(void) -{ - return &eventloop_ops; -} - /* This is mostly copied from gtkpurple's source tree */ static void show_usage(const char *name, gboolean terse) @@ -348,7 +250,6 @@ purple_debug_set_enabled(debug_enabled); purple_core_set_ui_ops(gnt_core_get_ui_ops()); - purple_eventloop_set_ui_ops(gnt_eventloop_get_ui_ops()); purple_idle_set_ui_ops(finch_idle_get_ui_ops()); if (!purple_core_init(FINCH_UI))
--- a/libpurple/eventloop.c Fri Jun 30 01:55:59 2017 +0000 +++ b/libpurple/eventloop.c Fri Jun 30 02:03:09 2017 +0000 @@ -21,69 +21,88 @@ #include "internal.h" #include "eventloop.h" -static PurpleEventLoopUiOps *eventloop_ui_ops = NULL; +#define PURPLE_GLIB_READ_COND (G_IO_IN | G_IO_HUP | G_IO_ERR) +#define PURPLE_GLIB_WRITE_COND (G_IO_OUT | G_IO_HUP | G_IO_ERR | G_IO_NVAL) + +typedef struct _PurpleIOClosure { + PurpleInputFunction function; + guint result; + gpointer data; +} PurpleIOClosure; 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 g_source_remove(tag); +} + +static gboolean +purple_io_invoke(GIOChannel *source, GIOCondition condition, gpointer data) +{ + PurpleIOClosure *closure = data; + PurpleInputCondition purple_cond = 0; - return ops->timeout_remove(tag); + if (condition & PURPLE_GLIB_READ_COND) + purple_cond |= PURPLE_INPUT_READ; + if (condition & PURPLE_GLIB_WRITE_COND) + purple_cond |= PURPLE_INPUT_WRITE; + +#ifdef _WIN32 + if(!purple_cond) { + return TRUE; + } +#endif /* _WIN32 */ + + closure->function(closure->data, g_io_channel_unix_get_fd(source), + purple_cond); + + return TRUE; } guint purple_input_add(int source, PurpleInputCondition condition, PurpleInputFunction func, gpointer user_data) { - PurpleEventLoopUiOps *ops = purple_eventloop_get_ui_ops(); + PurpleIOClosure *closure = g_new0(PurpleIOClosure, 1); + GIOChannel *channel; + GIOCondition cond = 0; + + closure->function = func; + closure->data = user_data; + + if (condition & PURPLE_INPUT_READ) + cond |= PURPLE_GLIB_READ_COND; + if (condition & PURPLE_INPUT_WRITE) + cond |= PURPLE_GLIB_WRITE_COND; - return ops->input_add(source, condition, func, user_data); +#ifdef _WIN32 + channel = g_io_channel_win32_new_socket(source); +#else + channel = g_io_channel_unix_new(source); +#endif + + closure->result = g_io_add_watch_full(channel, G_PRIORITY_DEFAULT, + cond, purple_io_invoke, closure, g_free); + + g_io_channel_unref(channel); + return closure->result; } gboolean purple_input_remove(guint tag) { - PurpleEventLoopUiOps *ops = purple_eventloop_get_ui_ops(); - - return ops->input_remove(tag); -} - -int -purple_input_get_error(int fd, int *error) -{ - PurpleEventLoopUiOps *ops = purple_eventloop_get_ui_ops(); - - if (ops->input_get_error) - { - int ret = ops->input_get_error(fd, error); - errno = *error; - return ret; - } - else - { - socklen_t len; - len = sizeof(*error); - - return getsockopt(fd, SOL_SOCKET, SO_ERROR, error, &len); - } + return g_source_remove(tag); } int @@ -95,47 +114,3 @@ return pipe(pipefd); #endif } - -void -purple_eventloop_set_ui_ops(PurpleEventLoopUiOps *ops) -{ - eventloop_ui_ops = ops; -} - -PurpleEventLoopUiOps * -purple_eventloop_get_ui_ops(void) -{ - g_return_val_if_fail(eventloop_ui_ops != NULL, NULL); - - return eventloop_ui_ops; -} - -/************************************************************************** - * GBoxed code - **************************************************************************/ -static PurpleEventLoopUiOps * -purple_eventloop_ui_ops_copy(PurpleEventLoopUiOps *ops) -{ - PurpleEventLoopUiOps *ops_new; - - g_return_val_if_fail(ops != NULL, NULL); - - ops_new = g_new(PurpleEventLoopUiOps, 1); - *ops_new = *ops; - - return ops_new; -} - -GType -purple_eventloop_ui_ops_get_type(void) -{ - static GType type = 0; - - if (type == 0) { - type = g_boxed_type_register_static("PurpleEventLoopUiOps", - (GBoxedCopyFunc)purple_eventloop_ui_ops_copy, - (GBoxedFreeFunc)g_free); - } - - return type; -}
--- a/libpurple/eventloop.h Fri Jun 30 01:55:59 2017 +0000 +++ b/libpurple/eventloop.h Fri Jun 30 02:03:09 2017 +0000 @@ -31,8 +31,6 @@ #include <glib.h> #include <glib-object.h> -#define PURPLE_TYPE_EVENTLOOP_UI_OPS (purple_eventloop_ui_ops_get_type()) - /** * PurpleInputCondition: * @PURPLE_INPUT_READ: A read condition. @@ -57,99 +55,6 @@ */ typedef void (*PurpleInputFunction)(gpointer, gint, PurpleInputCondition); -typedef struct _PurpleEventLoopUiOps PurpleEventLoopUiOps; - -/** - * PurpleEventLoopUiOps: - * @timeout_add: Should create a callback timer with an interval measured in - * milliseconds. The supplied @function should be called every - * @interval seconds until it returns %FALSE, after which it - * should not be called again. - * <sbr/>Analogous to g_timeout_add in glib. - * <sbr/>Note: On Win32, this function may be called from a thread - * other than the libpurple thread. You should make sure to detect - * this situation and to only call "function" from the libpurple - * thread. - * <sbr/>See purple_timeout_add(). - * <sbr/>@interval: the interval in - * <emphasis>milliseconds</emphasis> between - * calls to @function. - * <sbr/>@data: arbitrary data to be passed to @function at each - * call. - * <sbr/>Returns: a handle for the timeout, which can be passed to - * @timeout_remove. - * @timeout_remove: Should remove a callback timer. Analogous to - * g_source_remove() in glib. - * <sbr/>See purple_timeout_remove(). - * <sbr/>@handle: an identifier for a timeout, as returned by - * @timeout_add. - * <sbr/>Returns: %TRUE if the timeout identified by @handle - * was found and removed. - * @input_add: Should add an input handler. Analogous to g_io_add_watch_full() - * in glib. - * <sbr/>See purple_input_add(). - * <sbr/>@fd: a file descriptor to watch for events - * <sbr/>@cond: a bitwise OR of events on @fd for which @func - * should be called. - * <sbr/>@func: a callback to fire whenever a relevant event on - * @fd occurs. - * <sbr/>@user_data: arbitrary data to pass to @fd. - * <sbr/>Returns: an identifier for this input handler, which can - * be passed to @input_remove. - * @input_remove: Should remove an input handler. Analogous to g_source_remove() - * in glib. - * <sbr/>See purple_input_remove(). - * <sbr/>@handle: an identifier, as returned by #input_add. - * <sbr/>Returns: %TRUE if the input handler was found and - * removed. - * @input_get_error: If implemented, should get the current error status for an - * input. - * <sbr/>Implementation of this UI op is optional. Implement - * it if the UI's sockets or event loop needs to customize - * determination of socket error status. If unimplemented, - * <literal>getsockopt(2)</literal> will be used instead. - * <sbr/>See purple_input_get_error(). - * @timeout_add_seconds: If implemented, should create a callback timer with an - * interval measured in seconds. Analogous to - * g_timeout_add_seconds() in glib. - * <sbr/>This allows UIs to group timers for better power - * efficiency. For this reason, @interval may be rounded - * by up to a second. - * <sbr/>Implementation of this UI op is optional. If it's - * not implemented, calls to purple_timeout_add_seconds() - * will be serviced by @timeout_add. - * <sbr/>See purple_timeout_add_seconds(). - * - * An abstraction of an application's mainloop; libpurple will use this to - * watch file descriptors and schedule timed callbacks. If your application - * uses the glib mainloop, there is an implementation of this struct in - * <filename>libpurple/example/nullclient.c</filename> which you can use - * verbatim. - */ -struct _PurpleEventLoopUiOps -{ - /* TODO Who is responsible for freeing @data? */ - guint (*timeout_add)(guint interval, GSourceFunc function, gpointer data); - - gboolean (*timeout_remove)(guint handle); - - guint (*input_add)(int fd, PurpleInputCondition cond, - PurpleInputFunction func, gpointer user_data); - - gboolean (*input_remove)(guint handle); - - int (*input_get_error)(int fd, int *error); - - guint (*timeout_add_seconds)(guint interval, GSourceFunc function, - gpointer data); - - /*< private >*/ - void (*_purple_reserved1)(void); - void (*_purple_reserved2)(void); - void (*_purple_reserved3)(void); - void (*_purple_reserved4)(void); -}; - G_BEGIN_DECLS /**************************************************************************/ @@ -231,24 +136,6 @@ gboolean purple_input_remove(guint handle); /** - * purple_input_get_error: - * @fd: The input file descriptor. - * @error: A pointer to an #int which on return will have the error, or - * 0 if no error. - * - * Get the current error status for an input. - * - * The return value and error follow getsockopt() with a level of SOL_SOCKET and an - * option name of SO_ERROR, and this is how the error is determined if the UI does not - * implement the input_get_error UI op. - * - * Returns: 0 if there is no error; -1 if there is an error, in which case - * #errno will be set. - */ -int -purple_input_get_error(int fd, int *error); - -/** * purple_input_pipe: * @pipefd: Array used to return file descriptors for both ends of pipe. * @@ -267,36 +154,6 @@ int purple_input_pipe(int pipefd[2]); - - -/**************************************************************************/ -/* UI Registration Functions */ -/**************************************************************************/ - -/** - * purple_eventloop_ui_ops_get_type: - * - * Returns: The #GType for the #PurpleEventLoopUiOps boxed structure. - */ -GType purple_eventloop_ui_ops_get_type(void); - -/** - * purple_eventloop_set_ui_ops: - * @ops: The UI operations structure. - * - * Sets the UI operations structure to be used for accounts. - */ -void purple_eventloop_set_ui_ops(PurpleEventLoopUiOps *ops); - -/** - * purple_eventloop_get_ui_ops: - * - * Returns the UI operations structure used for accounts. - * - * Returns: The UI operations structure in use. - */ -PurpleEventLoopUiOps *purple_eventloop_get_ui_ops(void); - G_END_DECLS #endif /* _PURPLE_EVENTLOOP_H_ */
--- a/libpurple/example/nullclient.c Fri Jun 30 01:55:59 2017 +0000 +++ b/libpurple/example/nullclient.c Fri Jun 30 02:03:09 2017 +0000 @@ -36,84 +36,6 @@ #include "defines.h" -/** - * The following eventloop functions are used in both pidgin and purple-text. If your - * application uses glib mainloop, you can safely use this verbatim. - */ -#define PURPLE_GLIB_READ_COND (G_IO_IN | G_IO_HUP | G_IO_ERR) -#define PURPLE_GLIB_WRITE_COND (G_IO_OUT | G_IO_HUP | G_IO_ERR | G_IO_NVAL) - -typedef struct _PurpleGLibIOClosure { - PurpleInputFunction function; - guint result; - gpointer data; -} PurpleGLibIOClosure; - -static void purple_glib_io_destroy(gpointer data) -{ - g_free(data); -} - -static gboolean purple_glib_io_invoke(GIOChannel *source, GIOCondition condition, gpointer data) -{ - PurpleGLibIOClosure *closure = data; - PurpleInputCondition purple_cond = 0; - - if (condition & PURPLE_GLIB_READ_COND) - purple_cond |= PURPLE_INPUT_READ; - if (condition & PURPLE_GLIB_WRITE_COND) - purple_cond |= PURPLE_INPUT_WRITE; - - closure->function(closure->data, g_io_channel_unix_get_fd(source), - purple_cond); - - return TRUE; -} - -static guint glib_input_add(gint fd, PurpleInputCondition condition, - PurpleInputFunction function, gpointer data) -{ - PurpleGLibIOClosure *closure = g_new0(PurpleGLibIOClosure, 1); - GIOChannel *channel; - GIOCondition cond = 0; - - closure->function = function; - closure->data = data; - - if (condition & PURPLE_INPUT_READ) - cond |= PURPLE_GLIB_READ_COND; - if (condition & PURPLE_INPUT_WRITE) - cond |= PURPLE_GLIB_WRITE_COND; - -#ifdef _WIN32 - channel = g_io_channel_win32_new_socket(fd); -#else - channel = g_io_channel_unix_new(fd); -#endif - closure->result = g_io_add_watch_full(channel, G_PRIORITY_DEFAULT, - cond, purple_glib_io_invoke, closure, purple_glib_io_destroy); - - g_io_channel_unref(channel); - return closure->result; -} - -static PurpleEventLoopUiOps glib_eventloops = -{ - g_timeout_add, - g_source_remove, - glib_input_add, - g_source_remove, - NULL, - g_timeout_add_seconds, - - /* padding */ - NULL, - NULL, - NULL, - NULL -}; -/*** End of the eventloop functions. ***/ - /*** Conversation uiops ***/ static void null_write_conv(PurpleConversation *conv, PurpleMessage *msg) @@ -189,10 +111,6 @@ */ purple_core_set_ui_ops(&null_core_uiops); - /* Set the uiops for the eventloop. If your client is glib-based, you can safely - * copy this verbatim. */ - purple_eventloop_set_ui_ops(&glib_eventloops); - /* Now that all the essential stuff has been set, let's try to init the core. It's * necessary to provide a non-NULL name for the current ui to the core. This name * is used by stuff that depends on this ui, for example the ui-specific plugins. */
--- a/pidgin/Makefile.am Fri Jun 30 01:55:59 2017 +0000 +++ b/pidgin/Makefile.am Fri Jun 30 02:03:09 2017 +0000 @@ -56,7 +56,6 @@ gtkdialogs.c \ gtkdnd-hints.c \ gtkdocklet.c \ - gtkeventloop.c \ gtkicon-theme.c \ gtkicon-theme-loader.c \ gtkidle.c \ @@ -105,7 +104,6 @@ gtkdialogs.h \ gtkdnd-hints.h \ gtkdocklet.h \ - gtkeventloop.h \ gtkicon-theme.h \ gtkicon-theme-loader.h \ gtkidle.h \
--- a/pidgin/Makefile.mingw Fri Jun 30 01:55:59 2017 +0000 +++ b/pidgin/Makefile.mingw Fri Jun 30 02:03:09 2017 +0000 @@ -71,7 +71,6 @@ gtkdialogs.c \ gtkdnd-hints.c \ gtkdocklet.c \ - gtkeventloop.c \ gtkicon-theme-loader.c \ gtkicon-theme.c \ gtkidle.c \
--- a/pidgin/gtkeventloop.c Fri Jun 30 01:55:59 2017 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,124 +0,0 @@ -/* pidgin - * - * Pidgin is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include <glib.h> -#include "gtkeventloop.h" -#include "eventloop.h" -#include "internal.h" - -#define PIDGIN_READ_COND (G_IO_IN | G_IO_HUP | G_IO_ERR) -#define PIDGIN_WRITE_COND (G_IO_OUT | G_IO_HUP | G_IO_ERR | G_IO_NVAL) - -typedef struct _PidginIOClosure { - PurpleInputFunction function; - guint result; - gpointer data; - -} PidginIOClosure; - -static gboolean pidgin_io_invoke(GIOChannel *source, GIOCondition condition, gpointer data) -{ - PidginIOClosure *closure = data; - PurpleInputCondition purple_cond = 0; - - if (condition & PIDGIN_READ_COND) - purple_cond |= PURPLE_INPUT_READ; - if (condition & PIDGIN_WRITE_COND) - purple_cond |= PURPLE_INPUT_WRITE; - -#if 0 - purple_debug_misc("gtk_eventloop", - "CLOSURE: callback for %d, fd is %d\n", - closure->result, g_io_channel_unix_get_fd(source)); -#endif - -#ifdef _WIN32 - if(! purple_cond) { -#if 0 - purple_debug_misc("gtk_eventloop", - "CLOSURE received GIOCondition of 0x%x, which does not" - " match 0x%x (READ) or 0x%x (WRITE)\n", - condition, PIDGIN_READ_COND, PIDGIN_WRITE_COND); -#endif /* DEBUG */ - - return TRUE; - } -#endif /* _WIN32 */ - - closure->function(closure->data, g_io_channel_unix_get_fd(source), - purple_cond); - - return TRUE; -} - -static guint pidgin_input_add(gint fd, PurpleInputCondition condition, PurpleInputFunction function, - gpointer data) -{ - PidginIOClosure *closure = g_new0(PidginIOClosure, 1); - GIOChannel *channel; - GIOCondition cond = 0; - - closure->function = function; - closure->data = data; - - if (condition & PURPLE_INPUT_READ) - cond |= PIDGIN_READ_COND; - if (condition & PURPLE_INPUT_WRITE) - cond |= PIDGIN_WRITE_COND; - -#ifdef _WIN32 - channel = g_io_channel_win32_new_socket(fd); -#else - channel = g_io_channel_unix_new(fd); -#endif - - closure->result = g_io_add_watch_full(channel, G_PRIORITY_DEFAULT, cond, - pidgin_io_invoke, closure, g_free); - -#if 0 - purple_debug_misc("gtk_eventloop", - "CLOSURE: adding input watcher %d for fd %d\n", - closure->result, fd); -#endif - - g_io_channel_unref(channel); - return closure->result; -} - -static PurpleEventLoopUiOps eventloop_ops = -{ - g_timeout_add, - g_source_remove, - pidgin_input_add, - g_source_remove, - NULL, /* input_get_error */ - g_timeout_add_seconds, - NULL, - NULL, - NULL, - NULL -}; - -PurpleEventLoopUiOps * -pidgin_eventloop_get_ui_ops(void) -{ - return &eventloop_ops; -}
--- a/pidgin/gtkeventloop.h Fri Jun 30 01:55:59 2017 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,46 +0,0 @@ -/* pidgin - * - * Pidgin is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#ifndef _PIDGINEVENTLOOP_H_ -#define _PIDGINEVENTLOOP_H_ -/** - * SECTION:gtkeventloop - * @section_id: pidgin-gtkeventloop - * @short_description: <filename>gtkeventloop.h</filename> - * @title: Event Loop Implementation - */ - -#include "eventloop.h" - -G_BEGIN_DECLS - -/** - * pidgin_eventloop_get_ui_ops: - * - * Returns the GTK+ event loop UI operations structure. - * - * Returns: The GTK+ event loop UI operations structure. - */ -PurpleEventLoopUiOps *pidgin_eventloop_get_ui_ops(void); - -G_END_DECLS - -#endif /* _PIDGINEVENTLOOP_H_ */
--- a/pidgin/libpidgin.c Fri Jun 30 01:55:59 2017 +0000 +++ b/pidgin/libpidgin.c Fri Jun 30 02:03:09 2017 +0000 @@ -29,7 +29,6 @@ #include "core.h" #include "dbus-maybe.h" #include "debug.h" -#include "eventloop.h" #include "glibcompat.h" #include "log.h" #include "network.h" @@ -50,7 +49,6 @@ #include "gtkdebug.h" #include "gtkdialogs.h" #include "gtkdocklet.h" -#include "gtkeventloop.h" #include "gtkxfer.h" #include "gtkidle.h" #include "gtklog.h" @@ -755,7 +753,6 @@ #endif purple_core_set_ui_ops(pidgin_core_get_ui_ops()); - purple_eventloop_set_ui_ops(pidgin_eventloop_get_ui_ops()); if (!purple_core_init(PIDGIN_UI)) { fprintf(stderr,