[Spice-commits] 5 commits - doc/reference po/POTFILES.skip src/channel-cursor.c src/channel-display.c src/channel-main.c src/channel-port.c src/channel-usbredir.c src/channel-webdav.c src/controller src/desktop-integration.c src/glib-compat.c src/glib-compat.h src/gtk-compat.h src/Makefile.am src/smartcard-manager.c src/spice-audio.c src/spice-channel.c src/spice-client-glib-usb-acl-helper.c src/spice-option.c src/spice-pulse.c src/spice-session.c src/spice-uri.c src/spice-util.c src/spice-util.h src/spice-util-priv.h src/spice-widget.c src/spicy.c src/spicy-screenshot.c src/spicy-stats.c src/usb-acl-helper.c src/usb-device-manager.c src/usb-device-widget.c src/usbutil.c src/vmcstream.c src/wocky-http-proxy.c src/wocky-http-proxy.h tests/coroutine.c tests/mock-acl-helper.c

Pavel Grunt pgrunt at kemper.freedesktop.org
Fri Mar 18 10:43:28 UTC 2016


 doc/reference/Makefile.am              |    1 
 po/POTFILES.skip                       |    1 
 src/Makefile.am                        |    5 -
 src/channel-cursor.c                   |    1 
 src/channel-display.c                  |    1 
 src/channel-main.c                     |    1 
 src/channel-port.c                     |    1 
 src/channel-usbredir.c                 |    9 --
 src/channel-webdav.c                   |    1 
 src/controller/dump.c                  |    3 
 src/controller/test.c                  |    3 
 src/desktop-integration.c              |    1 
 src/glib-compat.c                      |  143 ---------------------------------
 src/glib-compat.h                      |   69 ---------------
 src/gtk-compat.h                       |    2 
 src/smartcard-manager.c                |    2 
 src/spice-audio.c                      |    2 
 src/spice-channel.c                    |    1 
 src/spice-client-glib-usb-acl-helper.c |   12 --
 src/spice-option.c                     |    1 
 src/spice-pulse.c                      |    1 
 src/spice-session.c                    |    1 
 src/spice-uri.c                        |   30 ++++++
 src/spice-util-priv.h                  |    8 -
 src/spice-util.c                       |    4 
 src/spice-util.h                       |    2 
 src/spice-widget.c                     |    1 
 src/spicy-screenshot.c                 |    3 
 src/spicy-stats.c                      |    3 
 src/spicy.c                            |   23 -----
 src/usb-acl-helper.c                   |    1 
 src/usb-device-manager.c               |    7 -
 src/usb-device-widget.c                |   10 --
 src/usbutil.c                          |    2 
 src/vmcstream.c                        |    1 
 src/wocky-http-proxy.c                 |    1 
 src/wocky-http-proxy.h                 |    2 
 tests/coroutine.c                      |    4 
 tests/mock-acl-helper.c                |    4 
 39 files changed, 33 insertions(+), 335 deletions(-)

New commits:
commit 5b17818bcdd0c0c8012c89fe8399e0e8c2f6b70d
Author: Pavel Grunt <pgrunt at redhat.com>
Date:   Thu Mar 17 11:19:36 2016 +0100

    Adjust to Gtk+ 3.10
    
    Dependency since f9a1aad85fcc76dd76c454b51fbce5e07c9b145f
    
    Remove unneeded GTK_CHECK_VERSION guards
    
    Acked-by: Victor Toso <victortoso at redhat.com>

diff --git a/src/gtk-compat.h b/src/gtk-compat.h
index b2cf6d6..39438f9 100644
--- a/src/gtk-compat.h
+++ b/src/gtk-compat.h
@@ -22,12 +22,10 @@
 
 #include <gtk/gtk.h>
 
-#if GTK_CHECK_VERSION (2, 91, 0)
 static inline void gdk_drawable_get_size(GdkWindow *w, gint *ww, gint *wh)
 {
     *ww = gdk_window_get_width(w);
     *wh = gdk_window_get_height(w);
 }
-#endif
 
 #endif /* GTK_COMPAT_H */
diff --git a/src/spicy.c b/src/spicy.c
index c3564f0..6ca014b 100644
--- a/src/spicy.c
+++ b/src/spicy.c
@@ -1001,11 +1001,7 @@ static SpiceWindow *create_spice_window(spice_connection *conn, SpiceChannel *ch
                      G_CALLBACK(grab_keys_pressed_cb), win);
 
     /* status line */
-#if GTK_CHECK_VERSION(3,0,0)
     win->statusbar = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 1);
-#else
-    win->statusbar = gtk_hbox_new(FALSE, 1);
-#endif
 
     win->status = gtk_label_new("status line");
     gtk_misc_set_alignment(GTK_MISC(win->status), 0, 0.5);
@@ -1025,11 +1021,7 @@ static SpiceWindow *create_spice_window(spice_connection *conn, SpiceChannel *ch
     }
 
     /* Make a vbox and put stuff in */
-#if GTK_CHECK_VERSION(3,0,0)
     vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 1);
-#else
-    vbox = gtk_vbox_new(FALSE, 1);
-#endif
     gtk_container_set_border_width(GTK_CONTAINER(vbox), 0);
     gtk_container_add(GTK_CONTAINER(win->toplevel), vbox);
     gtk_box_pack_start(GTK_BOX(vbox), win->menubar, FALSE, FALSE, 0);
@@ -1510,28 +1502,20 @@ TransferTaskWidgets *transfer_task_widgets_new(SpiceFileTransferTask *task)
 {
     TransferTaskWidgets *widgets = g_new0(TransferTaskWidgets, 1);
 
-#if GTK_CHECK_VERSION(3,0,0)
     widgets->vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
     widgets->hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 6);
     widgets->cancel = gtk_button_new_from_icon_name(GTK_STOCK_CANCEL,
                                                     GTK_ICON_SIZE_SMALL_TOOLBAR);
-#else
-    widgets->vbox = gtk_vbox_new(FALSE, 0);
-    widgets->hbox = gtk_hbox_new(FALSE, 6);
-    widgets->cancel = gtk_button_new_from_stock(GTK_STOCK_CANCEL);
-#endif
 
     widgets->progress = gtk_progress_bar_new();
     widgets->label = gtk_label_new(spice_file_transfer_task_get_filename(task));
 
-#if GTK_CHECK_VERSION(3,0,0)
     gtk_widget_set_halign(widgets->label, GTK_ALIGN_START);
     gtk_widget_set_valign(widgets->label, GTK_ALIGN_BASELINE);
     gtk_widget_set_valign(widgets->progress, GTK_ALIGN_CENTER);
     gtk_widget_set_hexpand(widgets->progress, TRUE);
     gtk_widget_set_valign(widgets->cancel, GTK_ALIGN_CENTER);
     gtk_widget_set_hexpand(widgets->progress, FALSE);
-#endif
 
     gtk_box_pack_start(GTK_BOX(widgets->hbox), widgets->progress,
                        TRUE, TRUE, 0);
diff --git a/src/usb-device-widget.c b/src/usb-device-widget.c
index 8f85ae9..3b060e9 100644
--- a/src/usb-device-widget.c
+++ b/src/usb-device-widget.c
@@ -94,12 +94,7 @@ struct _SpiceUsbDeviceWidgetPrivate {
 
 static guint signals[LAST_SIGNAL] = { 0, };
 
-#if GTK_CHECK_VERSION(3,0,0)
 G_DEFINE_TYPE(SpiceUsbDeviceWidget, spice_usb_device_widget, GTK_TYPE_BOX);
-#else
-G_DEFINE_TYPE(SpiceUsbDeviceWidget, spice_usb_device_widget, GTK_TYPE_VBOX);
-#endif
-
 
 static void spice_usb_device_widget_get_property(GObject     *gobject,
                                                  guint        prop_id,
@@ -168,11 +163,7 @@ spice_usb_device_widget_show_info_bar(SpiceUsbDeviceWidget *self,
     gtk_info_bar_set_message_type(GTK_INFO_BAR(info_bar), message_type);
 
     content_area = gtk_info_bar_get_content_area(GTK_INFO_BAR(info_bar));
-#if GTK_CHECK_VERSION(3,0,0)
     hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 12);
-#else
-    hbox = gtk_hbox_new(FALSE, 12);
-#endif
     gtk_container_add(GTK_CONTAINER(content_area), hbox);
 
     widget = gtk_image_new_from_stock(stock_icon_id,
commit 0a9ec4ec01d9559440a347d9db348ecc92a44a9b
Author: Pavel Grunt <pgrunt at redhat.com>
Date:   Thu Mar 17 11:19:35 2016 +0100

    Adjust to GLib 2.36
    
    Dependency since 8693e7d3f7de1ff102082212fa6e35fb1a252ef7
    
    Remove glib-compat files and most of GLIB_CHECK_VERSION guards
    
    Acked-by: Victor Toso <victortoso at redhat.com>

diff --git a/doc/reference/Makefile.am b/doc/reference/Makefile.am
index b76a9cf..cb01f97 100644
--- a/doc/reference/Makefile.am
+++ b/doc/reference/Makefile.am
@@ -32,7 +32,6 @@ IGNORE_HFILES=					\
 	decode.h				\
 	display					\
 	gio-coroutine.h				\
-	glib-compat.h				\
 	smartcard-manager-priv.h		\
 	spice-audio-priv.h			\
 	spice-channel-cache.h			\
diff --git a/po/POTFILES.skip b/po/POTFILES.skip
index 4da36d0..0dd1912 100644
--- a/po/POTFILES.skip
+++ b/po/POTFILES.skip
@@ -1,3 +1,2 @@
 spice-common/python_modules/spice_parser.py
 spice-common/spice_codegen.py
-src/glib-compat.c
diff --git a/src/Makefile.am b/src/Makefile.am
index 2e7aa3b..e393913 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -122,7 +122,6 @@ SPICE_GTK_LIBADD_COMMON =		\
 	$(NULL)
 
 SPICE_GTK_SOURCES_COMMON =		\
-	glib-compat.h			\
 	gtk-compat.h			\
 	spice-util.c			\
 	spice-util-priv.h		\
@@ -214,8 +213,6 @@ endif
 libspice_client_glib_2_0_la_SOURCES =			\
 	bio-gio.c					\
 	bio-gio.h					\
-	glib-compat.c					\
-	glib-compat.h					\
 	spice-audio.c					\
 	spice-audio-priv.h				\
 	spice-common.h					\
@@ -389,8 +386,6 @@ spicy_CPPFLAGS =			\
 
 if WITH_POLKIT
 spice_client_glib_usb_acl_helper_SOURCES =	\
-	glib-compat.c				\
-	glib-compat.h				\
 	spice-client-glib-usb-acl-helper.c	\
 	$(NULL)
 
diff --git a/src/channel-cursor.c b/src/channel-cursor.c
index 0765209..2ae8f86 100644
--- a/src/channel-cursor.c
+++ b/src/channel-cursor.c
@@ -17,7 +17,6 @@
 */
 #include "config.h"
 
-#include "glib-compat.h"
 #include "spice-client.h"
 #include "spice-common.h"
 
diff --git a/src/channel-display.c b/src/channel-display.c
index f576679..2c54df7 100644
--- a/src/channel-display.c
+++ b/src/channel-display.c
@@ -21,7 +21,6 @@
 #include <sys/types.h>
 #endif
 
-#include "glib-compat.h"
 #include "spice-client.h"
 #include "spice-common.h"
 
diff --git a/src/channel-main.c b/src/channel-main.c
index 276799f..1c19de1 100644
--- a/src/channel-main.c
+++ b/src/channel-main.c
@@ -21,7 +21,6 @@
 #include <spice/vd_agent.h>
 #include <glib/gstdio.h>
 
-#include "glib-compat.h"
 #include "spice-client.h"
 #include "spice-common.h"
 #include "spice-marshal.h"
diff --git a/src/channel-port.c b/src/channel-port.c
index 20ee2fa..d922e4b 100644
--- a/src/channel-port.c
+++ b/src/channel-port.c
@@ -21,7 +21,6 @@
 #include "spice-common.h"
 #include "spice-channel-priv.h"
 #include "spice-marshal.h"
-#include "glib-compat.h"
 
 /**
  * SECTION:channel-port
diff --git a/src/channel-usbredir.c b/src/channel-usbredir.c
index d95a6c5..d04267f 100644
--- a/src/channel-usbredir.c
+++ b/src/channel-usbredir.c
@@ -36,7 +36,6 @@
 #include "spice-common.h"
 
 #include "spice-channel-priv.h"
-#include "glib-compat.h"
 
 /**
  * SECTION:channel-usbredir
@@ -559,16 +558,12 @@ static int usbredir_write_callback(void *user_data, uint8_t *data, int count)
 }
 
 static void *usbredir_alloc_lock(void) {
-#if GLIB_CHECK_VERSION(2,32,0)
     GMutex *mutex;
 
     mutex = g_new0(GMutex, 1);
     g_mutex_init(mutex);
 
     return mutex;
-#else
-    return g_mutex_new();
-#endif
 }
 
 static void usbredir_lock_lock(void *user_data) {
@@ -586,12 +581,8 @@ static void usbredir_unlock_lock(void *user_data) {
 static void usbredir_free_lock(void *user_data) {
     GMutex *mutex = user_data;
 
-#if GLIB_CHECK_VERSION(2,32,0)
     g_mutex_clear(mutex);
     g_free(mutex);
-#else
-    g_mutex_free(mutex);
-#endif
 }
 
 /* --------------------------------------------------------------------- */
diff --git a/src/channel-webdav.c b/src/channel-webdav.c
index e72c92c..307a867 100644
--- a/src/channel-webdav.c
+++ b/src/channel-webdav.c
@@ -22,7 +22,6 @@
 #include "spice-channel-priv.h"
 #include "spice-session-priv.h"
 #include "spice-marshal.h"
-#include "glib-compat.h"
 #include "vmcstream.h"
 #include "giopipe.h"
 
diff --git a/src/controller/dump.c b/src/controller/dump.c
index 831a1d7..b260264 100644
--- a/src/controller/dump.c
+++ b/src/controller/dump.c
@@ -88,9 +88,6 @@ void connect_signals (gpointer obj)
 
 int main (int argc, char *argv[])
 {
-#if !GLIB_CHECK_VERSION(2,36,0)
-    g_type_init ();
-#endif
     loop = g_main_loop_new (NULL, FALSE);
 
     if (argc > 1 && g_str_equal(argv[1], "--menu")) {
diff --git a/src/controller/test.c b/src/controller/test.c
index c08fe21..9a45581 100644
--- a/src/controller/test.c
+++ b/src/controller/test.c
@@ -212,9 +212,6 @@ int main (int argc, char *argv[])
     ControllerValue msg;
     ssize_t read;
 
-#if !GLIB_CHECK_VERSION(2,36,0)
-    g_type_init ();
-#endif
     ctrl = spice_ctrl_controller_new ();
     loop = g_main_loop_new (NULL, FALSE);
     g_signal_connect (ctrl, "notify", G_CALLBACK (notified), NULL);
diff --git a/src/desktop-integration.c b/src/desktop-integration.c
index 5868d48..01300e8 100644
--- a/src/desktop-integration.c
+++ b/src/desktop-integration.c
@@ -23,7 +23,6 @@
 
 #include <glib-object.h>
 
-#include "glib-compat.h"
 #include "spice-session-priv.h"
 #include "desktop-integration.h"
 
diff --git a/src/glib-compat.c b/src/glib-compat.c
deleted file mode 100644
index 622620b..0000000
--- a/src/glib-compat.c
+++ /dev/null
@@ -1,112 +0,0 @@
-/* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */
-/*
-   Copyright (C) 2012-2014 Red Hat, Inc.
-   Copyright © 1998-2009 VLC authors and VideoLAN
-
-   This library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   This library 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
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with this library; if not, see <http://www.gnu.org/licenses/>.
-*/
-#include "config.h"
-
-#include <string.h>
-#include <glib/gi18n.h>
-
-#include "glib-compat.h"
-
-#if !GLIB_CHECK_VERSION(2,30,0)
-G_DEFINE_BOXED_TYPE (GMainContext, spice_main_context, g_main_context_ref, g_main_context_unref)
-
-#define KILOBYTE_FACTOR (G_GOFFSET_CONSTANT (1000))
-#define MEGABYTE_FACTOR (KILOBYTE_FACTOR * KILOBYTE_FACTOR)
-#define GIGABYTE_FACTOR (MEGABYTE_FACTOR * KILOBYTE_FACTOR)
-#define TERABYTE_FACTOR (GIGABYTE_FACTOR * KILOBYTE_FACTOR)
-#define PETABYTE_FACTOR (TERABYTE_FACTOR * KILOBYTE_FACTOR)
-#define EXABYTE_FACTOR  (PETABYTE_FACTOR * KILOBYTE_FACTOR)
-
-/**
- * g_format_size:
- * @size: a size in bytes
- *
- * Formats a size (for example the size of a file) into a human readable
- * string.  Sizes are rounded to the nearest size prefix (kB, MB, GB)
- * and are displayed rounded to the nearest tenth. E.g. the file size
- * 3292528 bytes will be converted into the string "3.2 MB".
- *
- * The prefix units base is 1000 (i.e. 1 kB is 1000 bytes).
- *
- * This string should be freed with g_free() when not needed any longer.
- *
- * See g_format_size_full() for more options about how the size might be
- * formatted.
- *
- * Returns: a newly-allocated formatted string containing a human readable
- *     file size
- *
- * Since: 2.30
- */
-gchar *
-g_format_size (guint64 size)
-{
-  GString *string;
-
-  string = g_string_new (NULL);
-
-    if (size < KILOBYTE_FACTOR)
-      {
-        g_string_printf (string,
-                         g_dngettext(GETTEXT_PACKAGE, "%u byte", "%u bytes", (guint) size),
-                         (guint) size);
-      }
-
-    else if (size < MEGABYTE_FACTOR)
-      g_string_printf (string, _("%.1f kB"), (gdouble) size / (gdouble) KILOBYTE_FACTOR);
-
-    else if (size < GIGABYTE_FACTOR)
-      g_string_printf (string, _("%.1f MB"), (gdouble) size / (gdouble) MEGABYTE_FACTOR);
-
-    else if (size < TERABYTE_FACTOR)
-      g_string_printf (string, _("%.1f GB"), (gdouble) size / (gdouble) GIGABYTE_FACTOR);
-    else if (size < PETABYTE_FACTOR)
-      g_string_printf (string, _("%.1f TB"), (gdouble) size / (gdouble) TERABYTE_FACTOR);
-
-    else if (size < EXABYTE_FACTOR)
-      g_string_printf (string, _("%.1f PB"), (gdouble) size / (gdouble) PETABYTE_FACTOR);
-
-    else
-      g_string_printf (string, _("%.1f EB"), (gdouble) size / (gdouble) EXABYTE_FACTOR);
-
-  return g_string_free (string, FALSE);
-}
-
-#endif
-
-
-#if !GLIB_CHECK_VERSION(2,32,0)
-/**
- * g_queue_free_full:
- * @queue: a pointer to a #GQueue
- * @free_func: the function to be called to free each element's data
- *
- * Convenience method, which frees all the memory used by a #GQueue,
- * and calls the specified destroy function on every element's data.
- *
- * Since: 2.32
- */
-void
-g_queue_free_full (GQueue        *queue,
-                  GDestroyNotify  free_func)
-{
-  g_queue_foreach (queue, (GFunc) free_func, NULL);
-  g_queue_free (queue);
-}
-#endif
diff --git a/src/glib-compat.h b/src/glib-compat.h
deleted file mode 100644
index 51eef5c..0000000
--- a/src/glib-compat.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */
-/*
-   Copyright (C) 2012-2014 Red Hat, Inc.
-   Copyright © 1998-2009 VLC authors and VideoLAN
-
-   This library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   This library 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
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with this library; if not, see <http://www.gnu.org/licenses/>.
-*/
-#ifndef GLIB_COMPAT_H
-#define GLIB_COMPAT_H
-
-#include "config.h"
-
-#include <glib-object.h>
-#include <gio/gio.h>
-
-
-#if !GLIB_CHECK_VERSION(2,30,0)
-#define G_TYPE_MAIN_CONTEXT (spice_main_context_get_type ())
-GType spice_main_context_get_type (void) G_GNUC_CONST;
-gchar *g_format_size (guint64 size);
-#endif
-
-#if !GLIB_CHECK_VERSION(2,32,0)
-# define G_SIGNAL_DEPRECATED (1 << 9)
-
-#define G_SOURCE_CONTINUE   TRUE
-#define G_SOURCE_REMOVE     FALSE
-
-void
-g_queue_free_full (GQueue        *queue,
-                   GDestroyNotify  free_func);
-#endif
-
-#ifndef g_clear_pointer
-#define g_clear_pointer(pp, destroy) \
-  G_STMT_START {                                                               \
-    G_STATIC_ASSERT (sizeof *(pp) == sizeof (gpointer));                       \
-    /* Only one access, please */                                              \
-    gpointer *_pp = (gpointer *) (pp);                                         \
-    gpointer _p;                                                               \
-    /* This assignment is needed to avoid a gcc warning */                     \
-    GDestroyNotify _destroy = (GDestroyNotify) (destroy);                      \
-                                                                               \
-    (void) (0 ? (gpointer) *(pp) : 0);                                         \
-    do                                                                         \
-      _p = g_atomic_pointer_get (_pp);                                         \
-    while G_UNLIKELY (!g_atomic_pointer_compare_and_exchange (_pp, _p, NULL)); \
-                                                                               \
-    if (_p)                                                                    \
-      _destroy (_p);                                                           \
-  } G_STMT_END
-#endif
-
-#endif /* GLIB_COMPAT_H */
diff --git a/src/smartcard-manager.c b/src/smartcard-manager.c
index 21a4925..d3a40ba 100644
--- a/src/smartcard-manager.c
+++ b/src/smartcard-manager.c
@@ -20,8 +20,6 @@
 #include <glib-object.h>
 #include <string.h>
 
-#include "glib-compat.h"
-
 #ifdef USE_SMARTCARD_012
 #include <vcard_emul.h>
 #include <vevent.h>
diff --git a/src/spice-audio.c b/src/spice-audio.c
index 0087a0c..86a5138 100644
--- a/src/spice-audio.c
+++ b/src/spice-audio.c
@@ -49,8 +49,6 @@
 #include "spice-gstaudio.h"
 #endif
 
-#include "glib-compat.h"
-
 #define SPICE_AUDIO_GET_PRIVATE(obj)                                  \
     (G_TYPE_INSTANCE_GET_PRIVATE ((obj), SPICE_TYPE_AUDIO, SpiceAudioPrivate))
 
diff --git a/src/spice-channel.c b/src/spice-channel.c
index 6cf94b4..8ae0e4d 100644
--- a/src/spice-channel.c
+++ b/src/spice-channel.c
@@ -19,7 +19,6 @@
 
 #include "spice-client.h"
 #include "spice-common.h"
-#include "glib-compat.h"
 
 #include "spice-channel-priv.h"
 #include "spice-session-priv.h"
diff --git a/src/spice-client-glib-usb-acl-helper.c b/src/spice-client-glib-usb-acl-helper.c
index 20d1558..c2baeda 100644
--- a/src/spice-client-glib-usb-acl-helper.c
+++ b/src/spice-client-glib-usb-acl-helper.c
@@ -34,8 +34,6 @@
 #include <polkit/polkit.h>
 #include <acl/libacl.h>
 
-#include "glib-compat.h"
-
 #define FATAL_ERROR(...) \
     do { \
         /* We print the error both to stdout, for the app invoking us and \
@@ -335,10 +333,6 @@ int main(void)
         return 1;
     }
 
-#if !GLIB_CHECK_VERSION(2,36,0)
-    g_type_init();
-#endif
-
     loop = g_main_loop_new(NULL, FALSE);
 
     authority = polkit_authority_get_sync(NULL, NULL);
diff --git a/src/spice-option.c b/src/spice-option.c
index 06b9b19..70d0277 100644
--- a/src/spice-option.c
+++ b/src/spice-option.c
@@ -20,7 +20,6 @@
 #include <stdlib.h>
 #include <glib-object.h>
 #include <glib/gi18n.h>
-#include "glib-compat.h"
 #include "spice-session.h"
 #include "spice-util.h"
 #include "spice-channel-priv.h"
diff --git a/src/spice-pulse.c b/src/spice-pulse.c
index 2339011..8d45dbe 100644
--- a/src/spice-pulse.c
+++ b/src/spice-pulse.c
@@ -22,7 +22,6 @@
 #include "spice-session-priv.h"
 #include "spice-channel-priv.h"
 #include "spice-util-priv.h"
-#include "glib-compat.h"
 
 #include <pulse/glib-mainloop.h>
 #include <pulse/pulseaudio.h>
diff --git a/src/spice-session.c b/src/spice-session.c
index f77487a..6a0edae 100644
--- a/src/spice-session.c
+++ b/src/spice-session.c
@@ -30,7 +30,6 @@
 #include "spice-util-priv.h"
 #include "spice-session-priv.h"
 #include "gio-coroutine.h"
-#include "glib-compat.h"
 #include "wocky-http-proxy.h"
 #include "spice-uri-priv.h"
 #include "channel-playback-priv.h"
diff --git a/src/spice-uri.c b/src/spice-uri.c
index d925973..e1317bd 100644
--- a/src/spice-uri.c
+++ b/src/spice-uri.c
@@ -20,7 +20,6 @@
 #include <stdlib.h>
 #include <string.h>
 
-#include "glib-compat.h"
 #include "spice-client.h"
 #include "spice-uri.h"
 
diff --git a/src/spice-util-priv.h b/src/spice-util-priv.h
index c0ea8d9..811d61a 100644
--- a/src/spice-util-priv.h
+++ b/src/spice-util-priv.h
@@ -33,19 +33,11 @@ gchar* spice_dos2unix(const gchar *str, gssize len, GError **error);
 void spice_mono_edge_highlight(unsigned width, unsigned hight,
                                const guint8 *and, const guint8 *xor, guint8 *dest);
 
-#if GLIB_CHECK_VERSION(2,32,0)
 #define STATIC_MUTEX            GMutex
 #define STATIC_MUTEX_INIT(m)    g_mutex_init(&(m))
 #define STATIC_MUTEX_CLEAR(m)   g_mutex_clear(&(m))
 #define STATIC_MUTEX_LOCK(m)    g_mutex_lock(&(m))
 #define STATIC_MUTEX_UNLOCK(m)  g_mutex_unlock(&(m))
-#else
-#define STATIC_MUTEX            GStaticMutex
-#define STATIC_MUTEX_INIT(m)    g_static_mutex_init(&(m))
-#define STATIC_MUTEX_CLEAR(m)   g_static_mutex_free(&(m))
-#define STATIC_MUTEX_LOCK(m)    g_static_mutex_lock(&(m))
-#define STATIC_MUTEX_UNLOCK(m)  g_static_mutex_unlock(&(m))
-#endif
 
 G_END_DECLS
 
diff --git a/src/spice-util.c b/src/spice-util.c
index d2bcfbf..6b1f8e5 100644
--- a/src/spice-util.c
+++ b/src/spice-util.c
@@ -42,7 +42,6 @@ static GOnce debug_once = G_ONCE_INIT;
 
 static void spice_util_enable_debug_messages(void)
 {
-#if GLIB_CHECK_VERSION(2, 31, 0)
     const gchar *doms = g_getenv("G_MESSAGES_DEBUG");
     if (!doms) {
         g_setenv("G_MESSAGES_DEBUG", G_LOG_DOMAIN, 1);
@@ -53,7 +52,6 @@ static void spice_util_enable_debug_messages(void)
         g_setenv("G_MESSAGES_DEBUG", newdoms, 1);
         g_free(newdoms);
     }
-#endif
 }
 
 /**
diff --git a/src/spice-util.h b/src/spice-util.h
index 3f429a0..88e3a57 100644
--- a/src/spice-util.h
+++ b/src/spice-util.h
@@ -40,7 +40,7 @@ gchar* spice_uuid_to_string(const guint8 uuid[16]);
 
 #define SPICE_RESERVED_PADDING (10 * sizeof(void*))
 
-/* need to be in a public header, glib-compat.h is private */
+/* need to be in a public header */
 #ifndef SPICE_GNUC_DEPRECATED_FOR
 #if    __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5)
 #define SPICE_GNUC_DEPRECATED_FOR(f)                        \
diff --git a/src/spice-widget.c b/src/spice-widget.c
index 30426be..a9c7869 100644
--- a/src/spice-widget.c
+++ b/src/spice-widget.c
@@ -42,7 +42,6 @@
 #include "vncdisplaykeymap.h"
 #include "spice-grabsequence-priv.h"
 
-#include "glib-compat.h"
 #include "gtk-compat.h"
 
 /* Some compatibility defines to let us build on both Gtk2 and Gtk3 */
diff --git a/src/spicy-screenshot.c b/src/spicy-screenshot.c
index 63666d6..ab1f387 100644
--- a/src/spicy-screenshot.c
+++ b/src/spicy-screenshot.c
@@ -177,9 +177,6 @@ int main(int argc, char *argv[])
         exit(0);
     }
 
-#if !GLIB_CHECK_VERSION(2,36,0)
-    g_type_init();
-#endif
     mainloop = g_main_loop_new(NULL, false);
 
     session = spice_session_new();
diff --git a/src/spicy-stats.c b/src/spicy-stats.c
index d8a4706..1bed12e 100644
--- a/src/spicy-stats.c
+++ b/src/spicy-stats.c
@@ -103,9 +103,6 @@ int main(int argc, char *argv[])
         exit(0);
     }
 
-#if !GLIB_CHECK_VERSION(2,36,0)
-    g_type_init();
-#endif
     mainloop = g_main_loop_new(NULL, false);
 
     session = spice_session_new();
diff --git a/src/spicy.c b/src/spicy.c
index a3f357a..c3564f0 100644
--- a/src/spicy.c
+++ b/src/spicy.c
@@ -28,7 +28,6 @@
 #include <vreader.h>
 #endif
 
-#include "glib-compat.h"
 #include "spice-widget.h"
 #include "spice-gtk-session.h"
 #include "spice-audio.h"
@@ -1848,9 +1847,6 @@ int main(int argc, char *argv[])
     gchar *conf_file, *conf;
     char *host = NULL, *port = NULL, *tls_port = NULL, *unix_path = NULL;
 
-#if !GLIB_CHECK_VERSION(2,31,18)
-    g_thread_init(NULL);
-#endif
     keyfile = g_key_file_new();
 
     int mode = S_IRWXU;
@@ -1886,9 +1882,6 @@ int main(int argc, char *argv[])
         exit(0);
     }
 
-#if !GLIB_CHECK_VERSION(2,36,0)
-    g_type_init();
-#endif
     mainloop = g_main_loop_new(NULL, false);
 
     conn = connection_new();
diff --git a/src/usb-acl-helper.c b/src/usb-acl-helper.c
index 03d6c67..487e1ee 100644
--- a/src/usb-acl-helper.c
+++ b/src/usb-acl-helper.c
@@ -26,7 +26,6 @@
 #include <string.h>
 
 #include "usb-acl-helper.h"
-#include "glib-compat.h"
 
 /* ------------------------------------------------------------------ */
 /* gobject glue                                                       */
diff --git a/src/usb-device-manager.c b/src/usb-device-manager.c
index 1b9a227..417c5b2 100644
--- a/src/usb-device-manager.c
+++ b/src/usb-device-manager.c
@@ -23,8 +23,6 @@
 
 #include <glib-object.h>
 
-#include "glib-compat.h"
-
 #ifdef USE_USBREDIR
 #include <errno.h>
 #include <libusb.h>
@@ -1234,14 +1232,9 @@ gboolean spice_usb_device_manager_start_event_listening(
          priv->event_thread = NULL;
     }
     priv->event_thread_run = TRUE;
-#if GLIB_CHECK_VERSION(2,31,19)
     priv->event_thread = g_thread_new("usb_ev_thread",
                                       spice_usb_device_manager_usb_ev_thread,
                                       self);
-#else
-    priv->event_thread = g_thread_create(spice_usb_device_manager_usb_ev_thread,
-                                         self, TRUE, err);
-#endif
     return priv->event_thread != NULL;
 }
 
diff --git a/src/usb-device-widget.c b/src/usb-device-widget.c
index faa6c6d..8f85ae9 100644
--- a/src/usb-device-widget.c
+++ b/src/usb-device-widget.c
@@ -21,7 +21,6 @@
 
 #include "config.h"
 #include <glib/gi18n.h>
-#include "glib-compat.h"
 #include "spice-client.h"
 #include "spice-marshal.h"
 #include "usb-device-widget.h"
diff --git a/src/usbutil.c b/src/usbutil.c
index 16d757b..24330b2 100644
--- a/src/usbutil.c
+++ b/src/usbutil.c
@@ -26,8 +26,6 @@
 #include <ctype.h>
 #include <stdlib.h>
 
-#include "glib-compat.h"
-
 #ifdef USE_USBREDIR
 #ifdef __linux__
 #include <stdio.h>
diff --git a/src/vmcstream.c b/src/vmcstream.c
index 05dba7d..48f9513 100644
--- a/src/vmcstream.c
+++ b/src/vmcstream.c
@@ -22,7 +22,6 @@
 #include "vmcstream.h"
 #include "spice-channel-priv.h"
 #include "gio-coroutine.h"
-#include "glib-compat.h"
 
 struct _SpiceVmcInputStream
 {
diff --git a/src/wocky-http-proxy.c b/src/wocky-http-proxy.c
index afe8be6..a1a030a 100644
--- a/src/wocky-http-proxy.c
+++ b/src/wocky-http-proxy.c
@@ -22,7 +22,6 @@
 
 #include "config.h"
 
-#include "glib-compat.h"
 #include "wocky-http-proxy.h"
 
 #include <string.h>
diff --git a/src/wocky-http-proxy.h b/src/wocky-http-proxy.h
index 9484b51..38dad78 100644
--- a/src/wocky-http-proxy.h
+++ b/src/wocky-http-proxy.h
@@ -37,7 +37,6 @@ typedef struct _WockyHttpProxyClass   WockyHttpProxyClass;
 
 GType _wocky_http_proxy_get_type (void);
 
-#if GLIB_CHECK_VERSION(2, 28, 0)
 #define WOCKY_TYPE_HTTPS_PROXY         (_wocky_https_proxy_get_type ())
 #define WOCKY_HTTPS_PROXY(o)           (G_TYPE_CHECK_INSTANCE_CAST ((o), WOCKY_TYPE_HTTPS_PROXY, WockyHttpsProxy))
 #define WOCKY_HTTPS_PROXY_CLASS(k)     (G_TYPE_CHECK_CLASS_CAST((k), WOCKY_TYPE_HTTPS_PROXY, WockyHttpsProxyClass))
@@ -49,7 +48,6 @@ typedef struct _WockyHttpsProxy        WockyHttpsProxy;
 typedef struct _WockyHttpsProxyClass   WockyHttpsProxyClass;
 
 GType _wocky_https_proxy_get_type (void);
-#endif
 
 G_END_DECLS
 
diff --git a/tests/coroutine.c b/tests/coroutine.c
index 287b3c9..bded593 100644
--- a/tests/coroutine.c
+++ b/tests/coroutine.c
@@ -36,11 +36,9 @@ static void test_coroutine_simple(void)
     result = coroutine_yieldto(&co, GINT_TO_POINTER(42));
     g_assert_cmpint(GPOINTER_TO_INT(result), ==, 0x42);
 
-#if GLIB_CHECK_VERSION(2,34,0)
     g_test_expect_message(G_LOG_DOMAIN, G_LOG_LEVEL_CRITICAL, "*!to->exited*");
     coroutine_yieldto(&co, GINT_TO_POINTER(42));
     g_test_assert_expected_messages();
-#endif
 
     g_assert(self == coroutine_self());
     g_assert(coroutine_self_is_main());
@@ -117,11 +115,9 @@ static void test_coroutine_yield(void)
     g_assert(self == coroutine_self());
     g_assert(val == NULL);
 
-#if GLIB_CHECK_VERSION(2,34,0)
     g_test_expect_message(G_LOG_DOMAIN, G_LOG_LEVEL_CRITICAL, "*!to->exited*");
     coroutine_yieldto(&co, GINT_TO_POINTER(42));
     g_test_assert_expected_messages();
-#endif
 }
 
 int main(int argc, char* argv[])
diff --git a/tests/mock-acl-helper.c b/tests/mock-acl-helper.c
index 11268cb..782ebaf 100644
--- a/tests/mock-acl-helper.c
+++ b/tests/mock-acl-helper.c
@@ -71,10 +71,6 @@ int main(void)
 {
     GInputStream *stdin_unix_stream;
 
-#if !GLIB_CHECK_VERSION(2,36,0)
-    g_type_init();
-#endif
-
     loop = g_main_loop_new(NULL, FALSE);
 
     stdin_unix_stream = g_unix_input_stream_new(STDIN_FILENO, 0);
commit 23cd3e6041fa686fbd3ac0bbee2e440eeceac822
Author: Pavel Grunt <pgrunt at redhat.com>
Date:   Thu Mar 17 11:19:34 2016 +0100

    Move strtok_r from glib-compat to spice-uri
    
    It is not glib specific and it is only used in spice-uri
    
    Acked-by: Victor Toso <victortoso at redhat.com>

diff --git a/src/glib-compat.c b/src/glib-compat.c
index 41a7f52..622620b 100644
--- a/src/glib-compat.c
+++ b/src/glib-compat.c
@@ -110,34 +110,3 @@ g_queue_free_full (GQueue        *queue,
   g_queue_free (queue);
 }
 #endif
-
-
-#ifndef HAVE_STRTOK_R
-G_GNUC_INTERNAL
-char *strtok_r(char *s, const char *delim, char **save_ptr)
-{
-    char *token;
-
-    if (s == NULL)
-        s = *save_ptr;
-
-    /* Scan leading delimiters. */
-    s += strspn (s, delim);
-    if (*s == '\0')
-        return NULL;
-
-    /* Find the end of the token. */
-    token = s;
-    s = strpbrk (token, delim);
-    if (s == NULL)
-        /* This token finishes the string. */
-        *save_ptr = strchr (token, '\0');
-    else
-    {
-        /* Terminate the token and make *SAVE_PTR point past it. */
-        *s = '\0';
-        *save_ptr = s + 1;
-    }
-    return token;
-}
-#endif
diff --git a/src/glib-compat.h b/src/glib-compat.h
index 512ea55..51eef5c 100644
--- a/src/glib-compat.h
+++ b/src/glib-compat.h
@@ -62,8 +62,4 @@ g_queue_free_full (GQueue        *queue,
   } G_STMT_END
 #endif
 
-#ifndef HAVE_STRTOK_R
-char* strtok_r(char *s, const char *delim, char **save_ptr);
-#endif
-
 #endif /* GLIB_COMPAT_H */
diff --git a/src/spice-uri.c b/src/spice-uri.c
index e2c5c9a..d925973 100644
--- a/src/spice-uri.c
+++ b/src/spice-uri.c
@@ -60,6 +60,35 @@ enum  {
     SPICE_URI_PORT
 };
 
+#ifndef HAVE_STRTOK_R
+static char *strtok_r(char *s, const char *delim, char **save_ptr)
+{
+    char *token;
+
+    if (s == NULL)
+        s = *save_ptr;
+
+    /* Scan leading delimiters. */
+    s += strspn (s, delim);
+    if (*s == '\0')
+        return NULL;
+
+    /* Find the end of the token. */
+    token = s;
+    s = strpbrk (token, delim);
+    if (s == NULL)
+        /* This token finishes the string. */
+        *save_ptr = strchr (token, '\0');
+    else
+    {
+        /* Terminate the token and make *SAVE_PTR point past it. */
+        *s = '\0';
+        *save_ptr = s + 1;
+    }
+    return token;
+}
+#endif
+
 G_GNUC_INTERNAL
 SpiceURI* spice_uri_new(void)
 {
commit c2e48b7c31163385cab40c7f728b69f563da8154
Author: Pavel Grunt <pgrunt at redhat.com>
Date:   Thu Mar 17 11:19:33 2016 +0100

    spice-util: Fix alignment
    
    Acked-by: Victor Toso <victortoso at redhat.com>

diff --git a/src/spice-util.c b/src/spice-util.c
index fd97ee7..d2bcfbf 100644
--- a/src/spice-util.c
+++ b/src/spice-util.c
@@ -47,7 +47,7 @@ static void spice_util_enable_debug_messages(void)
     if (!doms) {
         g_setenv("G_MESSAGES_DEBUG", G_LOG_DOMAIN, 1);
     } else if (g_str_equal(doms, "all")) {
-	return;
+        return;
     } else if (!strstr(doms, G_LOG_DOMAIN)) {
         gchar *newdoms = g_strdup_printf("%s %s", doms, G_LOG_DOMAIN);
         g_setenv("G_MESSAGES_DEBUG", newdoms, 1);
commit fdeef8e6ddee74190346c640a02d259981b33c8a
Author: Pavel Grunt <pgrunt at redhat.com>
Date:   Thu Mar 17 11:19:32 2016 +0100

    usb-acl-helper: Remove extra check for NULL
    
    g_cancellable_cancel() and g_clear_object() can handle it
    
    Acked-by: Victor Toso <victortoso at redhat.com>

diff --git a/src/spice-client-glib-usb-acl-helper.c b/src/spice-client-glib-usb-acl-helper.c
index 3c5de05..20d1558 100644
--- a/src/spice-client-glib-usb-acl-helper.c
+++ b/src/spice-client-glib-usb-acl-helper.c
@@ -150,8 +150,7 @@ out:
 
 static void cleanup(void)
 {
-    if (polkit_cancellable)
-        g_cancellable_cancel(polkit_cancellable);
+    g_cancellable_cancel(polkit_cancellable);
 
     if (state == STATE_WAITING_FOR_STDIN_EOF)
         set_facl(path, getuid(), 0);
@@ -361,8 +360,7 @@ int main(void)
 
     g_main_loop_run(loop);
 
-    if (polkit_cancellable)
-        g_clear_object(&polkit_cancellable);
+    g_clear_object(&polkit_cancellable);
     g_object_unref(stdin_stream);
     g_object_unref(authority);
     g_object_unref(subject);


More information about the Spice-commits mailing list