[Spice-devel] [spice-gtk] Drop glib < 2.28 support

Marc-André Lureau mlureau at redhat.com
Thu Oct 30 10:10:05 PDT 2014



----- Original Message -----
> With el6 now shipping glib 2.28, there is no very good reason to keep
> support for older glib versions alive, especially as it will barely be
> tested.
> ---
>  configure.ac              | 16 ++-------
>  gtk/Makefile.am           |  9 ++---
>  gtk/bio-gio.c             | 26 ++------------
>  gtk/bio-gio.h             |  4 ---
>  gtk/desktop-integration.c | 49 +++------------------------
>  gtk/glib-compat.c         | 86
>  -----------------------------------------------
>  gtk/glib-compat.h         | 84 ---------------------------------------------
>  gtk/map-file              |  1 -
>  gtk/spice-channel.c       | 17 ----------
>  gtk/spice-session.c       | 38 ---------------------
>  gtk/wocky-http-proxy.c    |  8 -----
>  11 files changed, 11 insertions(+), 327 deletions(-)
> 
> diff --git a/configure.ac b/configure.ac
> index f304e52..3bd09f3 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -255,7 +255,7 @@ fi
>  
>  AC_CHECK_FUNCS(clearenv strtok_r)
>  
> -PKG_CHECK_MODULES(GLIB2, glib-2.0 >= 2.22)
> +PKG_CHECK_MODULES(GLIB2, glib-2.0 >= 2.26)

I guess you wanted 2.28 here

>  AC_SUBST(GLIB2_CFLAGS)
>  AC_SUBST(GLIB2_LIBS)
>  
> @@ -267,9 +267,6 @@ PKG_CHECK_MODULES(GIO, gio-2.0 >= 2.10.0 $gio_os)
>  AC_SUBST(GIO_CFLAGS)
>  AC_SUBST(GIO_LIBS)
>  
> -PKG_CHECK_EXISTS([gio-2.0 >= 2.26], [have_gio26=yes])
> -AM_CONDITIONAL([WITH_GPROXY], [test "x$have_gio26" = "xyes"])
> -
>  PKG_CHECK_MODULES(CAIRO, cairo >= 1.2.0)
>  AC_SUBST(CAIRO_CFLAGS)
>  AC_SUBST(CAIRO_LIBS)
> @@ -690,15 +687,8 @@ AC_ARG_ENABLE([dbus],
>  
>  have_dbus=no
>  if test "x$enable_dbus" != "xno"; then
> -  if test "x$have_gio26" = "xyes"; then
> -    AC_DEFINE([USE_GDBUS], [1], [Define if supporting gdbus])
> -    have_dbus=gdbus
> -  else
> -    PKG_CHECK_EXISTS([DBUS_GLIB], [dbus-glib-1], [
> -      AC_DEFINE([USE_DBUS_GLIB], [1], [Define if supporting dbus-glib])
> -      have_dbus=dbus-glib
> -    ])
> -  fi
> +  AC_DEFINE([USE_GDBUS], [1], [Define if supporting gdbus])
> +  have_dbus=yes
>  
>    if test "x$enable_dbus" = "xyes" && test "x$have_dbus" = "xno"; then
>      AC_MSG_ERROR([D-Bus support explicitly requested, but some required
>      packages are not available])
> diff --git a/gtk/Makefile.am b/gtk/Makefile.am
> index 7bc5842..f11cfb9 100644
> --- a/gtk/Makefile.am
> +++ b/gtk/Makefile.am
> @@ -272,6 +272,8 @@ libspice_client_glib_2_0_la_SOURCES =			\
>  	$(USB_ACL_HELPER_SRCS)				\
>  	vmcstream.c					\
>  	vmcstream.h					\
> +	wocky-http-proxy.c				\
> +	wocky-http-proxy.h				\
>  							\
>  	decode.h					\
>  	decode-glz.c					\
> @@ -282,13 +284,6 @@ libspice_client_glib_2_0_la_SOURCES =			\
>  	client_sw_canvas.h	\
>  	$(NULL)
>  
> -if WITH_GPROXY
> -libspice_client_glib_2_0_la_SOURCES +=			\
> -	wocky-http-proxy.c				\
> -	wocky-http-proxy.h				\
> -	$(NULL)
> -endif
> -
>  nodist_libspice_client_glib_2_0_la_SOURCES =	\
>  	spice-glib-enums.c			\
>  	spice-marshal.c				\
> diff --git a/gtk/bio-gio.c b/gtk/bio-gio.c
> index cad904e..108ac1a 100644
> --- a/gtk/bio-gio.c
> +++ b/gtk/bio-gio.c
> @@ -25,11 +25,7 @@
>  
>  typedef struct bio_gsocket_method {
>      BIO_METHOD method;
> -#if GLIB_CHECK_VERSION(2, 28, 0)
>      GIOStream *stream;
> -#else
> -    GSocket *gsocket;
> -#endif
>  } bio_gsocket_method;
>  
>  #define BIO_GET_GSOCKET(bio)  (((bio_gsocket_method*)bio->method)->gsocket)
> @@ -41,12 +37,8 @@ static int bio_gio_write(BIO *bio, const char *in, int
> inl)
>      gssize ret;
>      GError *error = NULL;
>  
> -#if GLIB_CHECK_VERSION(2, 28, 0)
>      ret =
>      g_pollable_output_stream_write_nonblocking(G_POLLABLE_OUTPUT_STREAM(BIO_GET_OSTREAM(bio)),
> -#else
> -    ret = g_socket_send(BIO_GET_GSOCKET(bio),
> -#endif
> -                        in, inl, NULL, &error);
> +                                                     in, inl, NULL, &error);
>      BIO_clear_retry_flags(bio);
>  
>      if (g_error_matches(error, G_IO_ERROR, G_IO_ERROR_WOULD_BLOCK))
> @@ -64,12 +56,8 @@ static int bio_gio_read(BIO *bio, char *out, int outl)
>      gssize ret;
>      GError *error = NULL;
>  
> -#if GLIB_CHECK_VERSION(2, 28, 0)
>      ret =
>      g_pollable_input_stream_read_nonblocking(G_POLLABLE_INPUT_STREAM(BIO_GET_ISTREAM(bio)),
> -#else
> -    ret = g_socket_receive(BIO_GET_GSOCKET(bio),
> -#endif
> -                           out, outl, NULL, &error);
> +                                                   out, outl, NULL, &error);
>      BIO_clear_retry_flags(bio);
>  
>      if (g_error_matches(error, G_IO_ERROR, G_IO_ERROR_WOULD_BLOCK))
> @@ -105,24 +93,14 @@ static int bio_gio_puts(BIO *bio, const char *str)
>  }
>  
>  G_GNUC_INTERNAL
> -#if GLIB_CHECK_VERSION(2, 28, 0)
>  BIO* bio_new_giostream(GIOStream *stream)
>  {
>      // TODO: make an actual new BIO type, or just switch to GTls already...
>      BIO *bio = BIO_new_socket(-1, BIO_NOCLOSE);
> -#else
> -BIO* bio_new_gsocket(GSocket *gsocket)
> -{
> -    BIO *bio = BIO_new_socket(g_socket_get_fd(gsocket), BIO_NOCLOSE);
> -#endif
>  
>      bio_gsocket_method *bio_method = g_new(bio_gsocket_method, 1);
>      bio_method->method = *bio->method;
> -#if GLIB_CHECK_VERSION(2, 28, 0)
>      bio_method->stream = stream;
> -#else
> -    bio_method->gsocket = gsocket;
> -#endif
>  
>      bio->method->destroy(bio);
>      bio->method = (BIO_METHOD*)bio_method;
> diff --git a/gtk/bio-gio.h b/gtk/bio-gio.h
> index 9bd3566..31fd369 100644
> --- a/gtk/bio-gio.h
> +++ b/gtk/bio-gio.h
> @@ -23,11 +23,7 @@
>  
>  G_BEGIN_DECLS
>  
> -#if GLIB_CHECK_VERSION(2, 28, 0)
>  BIO* bio_new_giostream(GIOStream *stream);
> -#else
> -BIO* bio_new_gsocket(GSocket *gsocket);
> -#endif
>  
>  G_END_DECLS
>  
> diff --git a/gtk/desktop-integration.c b/gtk/desktop-integration.c
> index d764e56..145fa6a 100644
> --- a/gtk/desktop-integration.c
> +++ b/gtk/desktop-integration.c
> @@ -22,9 +22,6 @@
>  #include "config.h"
>  
>  #include <glib-object.h>
> -#if defined(USE_DBUS_GLIB)
> -#include <dbus/dbus-glib.h>
> -#endif
>  
>  #include "glib-compat.h"
>  #include "spice-session-priv.h"
> @@ -41,9 +38,7 @@
>      (G_TYPE_INSTANCE_GET_PRIVATE ((obj), SPICE_TYPE_DESKTOP_INTEGRATION,
>      SpiceDesktopIntegrationPrivate))
>  
>  struct _SpiceDesktopIntegrationPrivate {
> -#if defined(USE_DBUS_GLIB)
> -    DBusGProxy *gnome_session_proxy;
> -#elif defined(USE_GDBUS)
> +#if defined(USE_GDBUS)
>      GDBusProxy *gnome_session_proxy;
>  #else
>      GObject *gnome_session_proxy; /* dummy */
> @@ -61,11 +56,6 @@ static void handle_dbus_call_error(const char *call,
> GError **_error)
>      GError *error = *_error;
>      const char *message = error->message;
>  
> -#if defined(USE_DBUS_GLIB)
> -    if (error->domain == DBUS_GERROR &&
> -            error->code == DBUS_GERROR_REMOTE_EXCEPTION)
> -        message = dbus_g_error_get_name(error);
> -#endif
>      g_warning("Error calling '%s': %s", call, message);
>      g_clear_error(_error);
>  }
> @@ -76,21 +66,7 @@ static gboolean
> gnome_integration_init(SpiceDesktopIntegration *self)
>      GError *error = NULL;
>      gboolean success = TRUE;
>  
> -#if defined(USE_DBUS_GLIB)
> -    DBusGConnection *conn = dbus_g_bus_get(DBUS_BUS_SESSION, &error);
> -    if (!conn)
> -        goto end;
> -
> -    /* We use for_name_owner, to resolve the name now, as we may not be
> -       running under gnome-session manager at all! */
> -    priv->gnome_session_proxy = dbus_g_proxy_new_for_name_owner(
> -                                            conn,
> -                                            "org.gnome.SessionManager",
> -                                            "/org/gnome/SessionManager",
> -                                            "org.gnome.SessionManager",
> -                                            &error);
> -end:
> -#elif defined(USE_GDBUS)
> +#if defined(USE_GDBUS)
>      priv->gnome_session_proxy =
>          g_dbus_proxy_new_for_bus_sync(G_BUS_TYPE_SESSION,
>                                        G_DBUS_PROXY_FLAGS_NONE,
> @@ -126,18 +102,7 @@ static void
> gnome_integration_inhibit_automount(SpiceDesktopIntegration *self)
>  
>      g_return_if_fail(priv->gnome_automount_inhibit_cookie == 0);
>  
> -#if defined(USE_DBUS_GLIB)
> -    dbus_g_proxy_call(
> -                priv->gnome_session_proxy, "Inhibit", &error,
> -                G_TYPE_STRING, g_get_prgname(),
> -                G_TYPE_UINT, 0,
> -                G_TYPE_STRING,
> -                reason,
> -                G_TYPE_UINT, GNOME_SESSION_INHIBIT_AUTOMOUNT,
> -                G_TYPE_INVALID,
> -                G_TYPE_UINT, &priv->gnome_automount_inhibit_cookie,
> -                G_TYPE_INVALID);
> -#elif defined(USE_GDBUS)
> +#if defined(USE_GDBUS)
>      GVariant *v = g_dbus_proxy_call_sync(priv->gnome_session_proxy,
>                  "Inhibit",
>                  g_variant_new("(susu)",
> @@ -167,13 +132,7 @@ static void
> gnome_integration_uninhibit_automount(SpiceDesktopIntegration *self)
>      if (priv->gnome_automount_inhibit_cookie == 0)
>          return;
>  
> -#if defined(USE_DBUS_GLIB)
> -    dbus_g_proxy_call(
> -                priv->gnome_session_proxy, "Uninhibit", &error,
> -                G_TYPE_UINT, priv->gnome_automount_inhibit_cookie,
> -                G_TYPE_INVALID,
> -                G_TYPE_INVALID);
> -#elif defined(USE_GDBUS)
> +#if defined(USE_GDBUS)
>      GVariant *v = g_dbus_proxy_call_sync(priv->gnome_session_proxy,
>                  "Uninhibit",
>                  g_variant_new("(u)",
> diff --git a/gtk/glib-compat.c b/gtk/glib-compat.c
> index 9d1165e..49edf73 100644
> --- a/gtk/glib-compat.c
> +++ b/gtk/glib-compat.c
> @@ -22,80 +22,6 @@
>  
>  #include "glib-compat.h"
>  
> -#if !GLIB_CHECK_VERSION(2,26,0)
> -G_DEFINE_BOXED_TYPE (GError, spice_error, g_error_copy, g_error_free)
> -
> -/**
> - * g_key_file_set_uint64:
> - * @key_file: a #GKeyFile
> - * @group_name: a group name
> - * @key: a key
> - * @value: an integer value
> - *
> - * Associates a new integer value with @key under @group_name.
> - * If @key cannot be found then it is created.
> - *
> - * Since: 2.26
> - **/
> -void
> -g_key_file_set_uint64 (GKeyFile    *key_file,
> -                       const gchar *group_name,
> -                       const gchar *key,
> -                       guint64      value)
> -{
> -  gchar *result;
> -
> -  g_return_if_fail (key_file != NULL);
> -
> -  result = g_strdup_printf ("%" G_GUINT64_FORMAT, value);
> -  g_key_file_set_value (key_file, group_name, key, result);
> -  g_free (result);
> -}
> -#endif
> -
> -#if !GLIB_CHECK_VERSION(2,28,0)
> -/**
> - * spice_simple_async_result_take_error: (skip)
> - * @simple: a #GSimpleAsyncResult
> - * @error: a #GError
> - *
> - * Sets the result from @error, and takes over the caller's ownership
> - * of @error, so the caller does not need to free it any more.
> - *
> - * Since: 2.28
> - **/
> -G_GNUC_INTERNAL void
> -g_simple_async_result_take_error (GSimpleAsyncResult *simple,
> -                                  GError             *error)
> -{
> -    /* this code is different from upstream */
> -    /* we can't avoid extra copy/free, since the simple struct is
> -       opaque */
> -    g_simple_async_result_set_from_error (simple, error);
> -    g_error_free (error);
> -}
> -
> -
> -/**
> - * g_slist_free_full: (skip)
> - * @list: a #GSList
> - * @free_func: a #GDestroyNotify
> - *
> - * Convenience method, which frees all the memory used by a #GSList,
> - * and calls the specified destroy function on every element's data
> - *
> - * Since: 2.28
> - **/
> -G_GNUC_INTERNAL void
> -g_slist_free_full (GSList         *list,
> -		   GDestroyNotify  free_func)
> -{
> -  g_slist_foreach (list, (GFunc) free_func, NULL);
> -  g_slist_free (list);
> -}
> -
> -#endif
> -
>  #if !GLIB_CHECK_VERSION(2,30,0)
>  G_DEFINE_BOXED_TYPE (GMainContext, spice_main_context, g_main_context_ref,
>  g_main_context_unref)
>  #endif
> @@ -122,18 +48,6 @@ g_queue_free_full (GQueue        *queue,
>  #endif
>  
>  
> -#if !GLIB_CHECK_VERSION(2,27,2)
> -guint64 g_get_monotonic_time(void)
> -{
> -    GTimeVal tv;
> -
> -    /* TODO: support real monotonic clock? */
> -    g_get_current_time(&tv);
> -
> -    return (((gint64) tv.tv_sec) * 1000000) + tv.tv_usec;
> -}
> -#endif
> -
>  #ifndef HAVE_STRTOK_R
>  G_GNUC_INTERNAL
>  char *strtok_r(char *s, const char *delim, char **save_ptr)
> diff --git a/gtk/glib-compat.h b/gtk/glib-compat.h
> index 45d961e..8828599 100644
> --- a/gtk/glib-compat.h
> +++ b/gtk/glib-compat.h
> @@ -24,86 +24,6 @@
>  #include <glib-object.h>
>  #include <gio/gio.h>
>  
> -#if !GLIB_CHECK_VERSION(2,26,0)
> -#define G_DEFINE_BOXED_TYPE(TypeName, type_name, copy_func, free_func)
> G_DEFINE_BOXED_TYPE_WITH_CODE (TypeName, type_name, copy_func, free_func,
> {})
> -#define G_DEFINE_BOXED_TYPE_WITH_CODE(TypeName, type_name, copy_func,
> free_func, _C_) _G_DEFINE_BOXED_TYPE_BEGIN (TypeName, type_name, copy_func,
> free_func) {_C_;} _G_DEFINE_TYPE_EXTENDED_END()
> -#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)
> -#define _G_DEFINE_BOXED_TYPE_BEGIN(TypeName, type_name, copy_func,
> free_func) \
> -GType \
> -type_name##_get_type (void) \
> -{ \
> -  static volatile gsize g_define_type_id__volatile = 0; \
> -  if (g_once_init_enter (&g_define_type_id__volatile))  \
> -    { \
> -      GType (* _g_register_boxed) \
> -        (const gchar *, \
> -         union \
> -           { \
> -             TypeName * (*do_copy_type) (TypeName *); \
> -             TypeName * (*do_const_copy_type) (const TypeName *); \
> -             GBoxedCopyFunc do_copy_boxed; \
> -           } __attribute__((__transparent_union__)), \
> -         union \
> -           { \
> -             void (* do_free_type) (TypeName *); \
> -             GBoxedFreeFunc do_free_boxed; \
> -           } __attribute__((__transparent_union__)) \
> -        ) = g_boxed_type_register_static; \
> -      GType g_define_type_id = \
> -        _g_register_boxed (g_intern_static_string (#TypeName), copy_func,
> free_func); \
> -      { /* custom code follows */
> -#else
> -#define _G_DEFINE_BOXED_TYPE_BEGIN(TypeName, type_name, copy_func,
> free_func) \
> -GType \
> -type_name##_get_type (void) \
> -{ \
> -  static volatile gsize g_define_type_id__volatile = 0; \
> -  if (g_once_init_enter (&g_define_type_id__volatile))  \
> -    { \
> -      GType g_define_type_id = \
> -        g_boxed_type_register_static (g_intern_static_string (#TypeName), \
> -                                      (GBoxedCopyFunc) copy_func, \
> -                                      (GBoxedFreeFunc) free_func); \
> -      { /* custom code follows */
> -#endif /* __GNUC__ */
> -
> -#define g_source_set_name(source, name) G_STMT_START { } G_STMT_END
> -
> -#define G_TYPE_ERROR (spice_error_get_type ())
> -GType spice_error_get_type (void) G_GNUC_CONST;
> -
> -#define G_PARAM_DEPRECATED  (1 << 31)
> -
> -void      g_key_file_set_uint64             (GKeyFile             *key_file,
> -					     const gchar          *group_name,
> -					     const gchar          *key,
> -					     guint64               value);
> -#endif /* glib 2.26 */
> -
> -#if !GLIB_CHECK_VERSION(2,28,0)
> -#define g_clear_object(object_ptr) \
> -  G_STMT_START {
> \
> -    /* Only one access, please */
> \
> -    gpointer *_p = (gpointer) (object_ptr);
> \
> -    gpointer _o;
> \
> -
> \
> -    do
> \
> -      _o = g_atomic_pointer_get (_p);
> \
> -    while G_UNLIKELY (!g_atomic_pointer_compare_and_exchange (_p, _o,
> NULL));\
> -
> \
> -    if (_o)
> \
> -      g_object_unref (_o);
> \
> -  } G_STMT_END
> -
> -void
> -g_simple_async_result_take_error(GSimpleAsyncResult *simple,
> -                                 GError             *error);
> -
> -void
> -g_slist_free_full(GSList         *list,
> -                  GDestroyNotify free_func);
> -
> -#endif /* glib 2.28 */
>  
>  #if !GLIB_CHECK_VERSION(2,30,0)
>  #define G_TYPE_MAIN_CONTEXT (spice_main_context_get_type ())
> @@ -137,10 +57,6 @@ g_queue_free_full (GQueue        *queue,
>    } G_STMT_END
>  #endif
>  
> -#if !GLIB_CHECK_VERSION(2,27,2)
> -guint64 g_get_monotonic_time(void);
> -#endif
> -
>  #ifndef HAVE_STRTOK_R
>  char* strtok_r(char *s, const char *delim, char **save_ptr);
>  #endif
> diff --git a/gtk/map-file b/gtk/map-file
> index 12982be..9f8d04e 100644
> --- a/gtk/map-file
> +++ b/gtk/map-file
> @@ -33,7 +33,6 @@ spice_display_new_with_monitor;
>  spice_display_paste_from_guest;
>  spice_display_send_keys;
>  spice_display_set_grab_keys;
> -spice_error_get_type;
>  spice_get_option_group;
>  spice_grab_sequence_as_string;
>  spice_grab_sequence_copy;
> diff --git a/gtk/spice-channel.c b/gtk/spice-channel.c
> index cd031e4..6c24bf5 100644
> --- a/gtk/spice-channel.c
> +++ b/gtk/spice-channel.c
> @@ -769,12 +769,8 @@ static void spice_channel_flush_wire(SpiceChannel
> *channel,
>                  ret = -1;
>              }
>          } else {
> -#if GLIB_CHECK_VERSION(2, 28, 0)
>              ret =
>              g_pollable_output_stream_write_nonblocking(G_POLLABLE_OUTPUT_STREAM(c->out),
>                                                               ptr+offset,
>                                                               datalen-offset,
>                                                               NULL, &error);
> -#else
> -            ret = g_socket_send(c->sock, ptr+offset, datalen-offset, NULL,
> &error);
> -#endif
>              if (ret < 0) {
>                  if (g_error_matches(error, G_IO_ERROR,
>                  G_IO_ERROR_WOULD_BLOCK)) {
>                      cond = G_IO_OUT;
> @@ -902,13 +898,8 @@ reread:
>          }
>      } else {
>          GError *error = NULL;
> -#if GLIB_CHECK_VERSION(2, 28, 0)
>          ret =
>          g_pollable_input_stream_read_nonblocking(G_POLLABLE_INPUT_STREAM(c->in),
>                                                         data, len, NULL,
>                                                         &error);
> -#else
> -        ret = g_socket_receive(c->sock,
> -                               data, len, NULL, &error);
> -#endif
>          if (ret < 0) {
>              if (g_error_matches(error, G_IO_ERROR, G_IO_ERROR_WOULD_BLOCK))
>              {
>                  cond = G_IO_IN;
> @@ -2105,11 +2096,7 @@ static void spice_channel_iterate_read(SpiceChannel
> *channel)
>      /* treat all incoming data (block on message completion) */
>      while (!c->has_error &&
>             c->state != SPICE_CHANNEL_STATE_MIGRATING &&
> -#if GLIB_CHECK_VERSION(2, 28, 0)
>             g_pollable_input_stream_is_readable(G_POLLABLE_INPUT_STREAM(c->in))
> -#else
> -           g_socket_condition_check(c->sock, G_IO_IN) & G_IO_IN
> -#endif
>      ) { do
>              spice_channel_recv_msg(channel,
>                                     (handler_msg_in)SPICE_CHANNEL_GET_CLASS(channel)->handle_msg,
>                                     NULL);
> @@ -2369,11 +2356,7 @@ reconnect:
>          }
>  
>  
> -#if GLIB_CHECK_VERSION(2, 28, 0)
>          BIO *bio = bio_new_giostream(G_IO_STREAM(c->conn));
> -#else
> -        BIO *bio = bio_new_gsocket(c->sock);
> -#endif
>          SSL_set_bio(c->ssl, bio, bio);
>  
>          {
> diff --git a/gtk/spice-session.c b/gtk/spice-session.c
> index 0663380..88bcacd 100644
> --- a/gtk/spice-session.c
> +++ b/gtk/spice-session.c
> @@ -651,12 +651,8 @@ static void spice_session_class_init(SpiceSessionClass
> *klass)
>  {
>      GObjectClass *gobject_class = G_OBJECT_CLASS(klass);
>  
> -#if GLIB_CHECK_VERSION(2, 26, 0)
>      _wocky_http_proxy_get_type();
> -#endif
> -#if GLIB_CHECK_VERSION(2, 28, 0)
>      _wocky_https_proxy_get_type();
> -#endif
>  
>      gobject_class->dispose      = spice_session_dispose;
>      gobject_class->finalize     = spice_session_finalize;
> @@ -1737,9 +1733,6 @@ struct spice_open_host {
>      GError *error;
>      GSocketConnection *connection;
>      GSocketClient *client;
> -#if !GLIB_CHECK_VERSION(2,26,0)
> -    guint timeout_id;
> -#endif
>  };
>  
>  static void socket_client_connect_ready(GObject *source_object, GAsyncResult
>  *result,
> @@ -1770,7 +1763,6 @@ static void
> open_host_connectable_connect(spice_open_host *open_host, GSocketCon
>                                    socket_client_connect_ready, open_host);
>  }
>  
> -#if GLIB_CHECK_VERSION(2,26,0)
>  /* main context */
>  static void proxy_lookup_ready(GObject *source_object, GAsyncResult *result,
>                                 gpointer data)
> @@ -1804,7 +1796,6 @@ static void proxy_lookup_ready(GObject *source_object,
> GAsyncResult *result,
>      open_host_connectable_connect(open_host, G_SOCKET_CONNECTABLE(address));
>      g_resolver_free_addresses(addresses);
>  }
> -#endif
>  
>  /* main context */
>  static gboolean open_host_idle_cb(gpointer data)
> @@ -1816,7 +1807,6 @@ static gboolean open_host_idle_cb(gpointer data)
>      g_return_val_if_fail(open_host != NULL, FALSE);
>      g_return_val_if_fail(open_host->connection == NULL, FALSE);
>  
> -#if GLIB_CHECK_VERSION(2,26,0)
>      open_host->proxy = s->proxy;
>      if (open_host->error != NULL) {
>          coroutine_yieldto(open_host->from, NULL);
> @@ -1829,7 +1819,6 @@ static gboolean open_host_idle_cb(gpointer data)
>                                          open_host->cancellable,
>                                          proxy_lookup_ready, open_host);
>      else
> -#endif
>      {
>          GSocketConnectable *address;
>  
> @@ -1850,18 +1839,6 @@ static gboolean open_host_idle_cb(gpointer data)
>  
>  #define SOCKET_TIMEOUT 10
>  
> -#if !GLIB_CHECK_VERSION(2,26,0)
> -static gboolean connect_timeout(gpointer data)
> -{
> -    spice_open_host *open_host = data;
> -
> -    open_host->timeout_id = 0;
> -    coroutine_yieldto(open_host->from, NULL);
> -
> -    return FALSE;
> -}
> -#endif
> -
>  /* coroutine context */
>  G_GNUC_INTERNAL
>  GSocketConnection* spice_session_channel_open_host(SpiceSession *session,
>  SpiceChannel *channel,
> @@ -1894,34 +1871,19 @@ GSocketConnection*
> spice_session_channel_open_host(SpiceSession *session, SpiceC
>      }
>  
>      open_host.client = g_socket_client_new();
> -#if GLIB_CHECK_VERSION(2,26,0)
>      g_socket_client_set_timeout(open_host.client, SOCKET_TIMEOUT);
> -#else
> -    open_host.timeout_id =
> -        g_timeout_add_seconds(SOCKET_TIMEOUT, connect_timeout, &open_host);
> -#endif
>  
>      g_idle_add(open_host_idle_cb, &open_host);
>      /* switch to main loop and wait for connection */
>      coroutine_yield(NULL);
>  
> -#if !GLIB_CHECK_VERSION(2,26,0)
> -    if (open_host.timeout_id == 0)
> -        open_host.error = g_error_new(SPICE_CLIENT_ERROR,
> SPICE_CLIENT_ERROR_FAILED,
> -                                      "connect timed out");
> -    else
> -        g_source_remove(open_host.timeout_id);
> -#endif
> -
>      if (open_host.error != NULL) {
>          SPICE_DEBUG("open host: %s", open_host.error->message);
>          g_propagate_error(error, open_host.error);
>      } else if (open_host.connection != NULL) {
>          GSocket *socket;
>          socket = g_socket_connection_get_socket(open_host.connection);
> -#if GLIB_CHECK_VERSION(2,26,0)
>          g_socket_set_timeout(socket, 0);
> -#endif
>          g_socket_set_blocking(socket, FALSE);
>          g_socket_set_keepalive(socket, TRUE);
>      }
> diff --git a/gtk/wocky-http-proxy.c b/gtk/wocky-http-proxy.c
> index fa519ec..ce23b0e 100644
> --- a/gtk/wocky-http-proxy.c
> +++ b/gtk/wocky-http-proxy.c
> @@ -188,7 +188,6 @@ wocky_http_proxy_connect (GProxy *proxy,
>    gboolean has_cred;
>    GIOStream *tlsconn = NULL;
>  
> -#if GLIB_CHECK_VERSION(2, 28, 0)
>    if (WOCKY_IS_HTTPS_PROXY (proxy))
>      {
>        tlsconn = g_tls_client_connection_new (io_stream,
> @@ -208,7 +207,6 @@ wocky_http_proxy_connect (GProxy *proxy,
>  
>        io_stream = tlsconn;
>      }
> -#endif
>  
>    in = g_io_stream_get_input_stream (io_stream);
>    out = g_io_stream_get_output_stream (io_stream);
> @@ -333,7 +331,6 @@ stream_connected (ConnectAsyncData *data,
>    do_write (request_write_cb, data);
>  }
>  
> -#if GLIB_CHECK_VERSION(2, 28, 0)
>  static void
>  handshake_completed (GObject *source_object,
>                       GAsyncResult *res,
> @@ -351,7 +348,6 @@ handshake_completed (GObject *source_object,
>  
>    stream_connected (data, G_IO_STREAM (conn));
>  }
> -#endif
>  
>  static void
>  wocky_http_proxy_connect_async (GProxy *proxy,
> @@ -380,7 +376,6 @@ wocky_http_proxy_connect_async (GProxy *proxy,
>    g_simple_async_result_set_op_res_gpointer (simple, data,
>                                               (GDestroyNotify)
>                                               free_connect_data);
>  
> -#if GLIB_CHECK_VERSION(2, 28, 0)
>    if (WOCKY_IS_HTTPS_PROXY (proxy))
>      {
>        GError *error = NULL;
> @@ -408,7 +403,6 @@ wocky_http_proxy_connect_async (GProxy *proxy,
>                                          handshake_completed, data);
>      }
>    else
> -#endif
>      {
>        stream_connected (data, io_stream);
>      }
> @@ -512,7 +506,6 @@ wocky_http_proxy_iface_init (GProxyInterface
> *proxy_iface)
>    proxy_iface->supports_hostname = wocky_http_proxy_supports_hostname;
>  }
>  
> -#if GLIB_CHECK_VERSION(2, 28, 0)
>  struct _WockyHttpsProxy
>  {
>    WockyHttpProxy parent;
> @@ -542,4 +535,3 @@ static void
>  wocky_https_proxy_class_init (WockyHttpsProxyClass *class)
>  {
>  }
> -#endif
> --
> 2.1.0
> 
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/spice-devel
> 


More information about the Spice-devel mailing list