diff options
author | Mike Ruprecht <cmaiku@gmail.com> | 2017-06-15 12:13:53 -0500 |
---|---|---|
committer | Mike Ruprecht <cmaiku@gmail.com> | 2017-06-15 12:13:53 -0500 |
commit | f09ae28f47aeec123cdc460238e6430e26370cf2 (patch) | |
tree | 70b20b0bd630341a3bbeac2362ed563914916107 | |
parent | 8c0e328faa5fffa883e9f4c514bffebdf8d42eb7 (diff) | |
download | pidgin-f09ae28f47aeec123cdc460238e6430e26370cf2.tar.gz |
nullclient: Remove event loop UiOps in preparation for dropping them
This patch removes the example nullclient's event loop UiOps
implementation now that the event loop functions have been given
their own implementations.
-rw-r--r-- | libpurple/example/nullclient.c | 82 |
1 files changed, 0 insertions, 82 deletions
diff --git a/libpurple/example/nullclient.c b/libpurple/example/nullclient.c index 665f871156..f2d4f5e980 100644 --- a/libpurple/example/nullclient.c +++ b/libpurple/example/nullclient.c @@ -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 @@ init_libpurple(void) */ 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. */ |