[Spice-commits] 5 commits - src/Makefile.am src/spice-audio.c src/spice-audio.h src/spice-audio-priv.h src/spice-client-gtk-manual.defs src/spice-client-gtk.override src/spice-session.c src/usb-device-manager.c src/usb-device-manager.h

Marc-André Lureau elmarco at kemper.freedesktop.org
Tue Jan 31 09:13:24 UTC 2017


 src/Makefile.am                  |    2 
 src/spice-audio-priv.h           |    3 
 src/spice-audio.c                |   39 +++++---
 src/spice-audio.h                |    5 +
 src/spice-client-gtk-manual.defs |  117 --------------------------
 src/spice-client-gtk.override    |  171 ---------------------------------------
 src/spice-session.c              |    2 
 src/usb-device-manager.c         |   30 ++++--
 src/usb-device-manager.h         |    2 
 9 files changed, 52 insertions(+), 319 deletions(-)

New commits:
commit 7cb7003699c25b1171c98e2a4a8a02f6c3715f20
Author: Marc-André Lureau <marcandre.lureau at redhat.com>
Date:   Fri Jan 27 15:11:29 2017 +0400

    usb: remove disconnect_device() deprecation warning
    
    Use a static function instead of the deprecated public function.
    
    The usage of the function seems to be fine for sync case, since the
    device was already removed, but I added a TODO just in case someone
    looks at this code.
    
    Signed-off-by: Marc-André Lureau <marcandre.lureau at redhat.com>
    Acked-by: Victor Toso <victortoso at redhat.com>

diff --git a/src/usb-device-manager.c b/src/usb-device-manager.c
index 7f0b263..4d0b93d 100644
--- a/src/usb-device-manager.c
+++ b/src/usb-device-manager.c
@@ -207,6 +207,9 @@ static
 void _connect_device_async_cb(GObject *gobject,
                               GAsyncResult *channel_res,
                               gpointer user_data);
+static
+void disconnect_device_sync(SpiceUsbDeviceManager *self,
+                            SpiceUsbDevice *device);
 
 G_DEFINE_BOXED_TYPE(SpiceUsbDevice, spice_usb_device,
                     (GBoxedCopyFunc)spice_usb_device_ref,
@@ -983,7 +986,8 @@ static void spice_usb_device_manager_remove_dev(SpiceUsbDeviceManager *self,
         return;
     }
 
-    spice_usb_device_manager_disconnect_device(self, device);
+    /* TODO: check usage of the sync version is ok here */
+    disconnect_device_sync(self, device);
 
     SPICE_DEBUG("device removed %04x:%04x (%p)",
                 spice_usb_device_get_vid(device),
@@ -1542,15 +1546,8 @@ void _connect_device_async_cb(GObject *gobject,
 }
 #endif
 
-/**
- * spice_usb_device_manager_disconnect_device:
- * @manager: the #SpiceUsbDeviceManager manager
- * @device: a #SpiceUsbDevice to disconnect
- *
- * Disconnects the @device.
- */
-void spice_usb_device_manager_disconnect_device(SpiceUsbDeviceManager *self,
-                                                SpiceUsbDevice *device)
+static void disconnect_device_sync(SpiceUsbDeviceManager *self,
+                                   SpiceUsbDevice *device)
 {
     g_return_if_fail(SPICE_IS_USB_DEVICE_MANAGER(self));
     g_return_if_fail(device != NULL);
@@ -1567,6 +1564,19 @@ void spice_usb_device_manager_disconnect_device(SpiceUsbDeviceManager *self,
 #endif
 }
 
+/**
+ * spice_usb_device_manager_disconnect_device:
+ * @manager: the #SpiceUsbDeviceManager manager
+ * @device: a #SpiceUsbDevice to disconnect
+ *
+ * Disconnects the @device.
+ */
+void spice_usb_device_manager_disconnect_device(SpiceUsbDeviceManager *self,
+                                                SpiceUsbDevice *device)
+{
+    disconnect_device_sync(self, device);
+}
+
 typedef struct _disconnect_cb_data
 {
     SpiceUsbDeviceManager  *self;
commit cc4de5f31c13d972005937913af96f7ad10f9f28
Author: Marc-André Lureau <marcandre.lureau at redhat.com>
Date:   Fri Jan 27 15:00:10 2017 +0400

    Give a hint about spice_usb_device_manager_disconnect_device() deprecation
    
    Signed-off-by: Marc-André Lureau <marcandre.lureau at redhat.com>
    Acked-by: Victor Toso <victortoso at redhat.com>

diff --git a/src/usb-device-manager.h b/src/usb-device-manager.h
index 219fe44..dae1d49 100644
--- a/src/usb-device-manager.h
+++ b/src/usb-device-manager.h
@@ -131,7 +131,7 @@ gboolean spice_usb_device_manager_disconnect_device_finish(
     SpiceUsbDeviceManager *self, GAsyncResult *res, GError **err);
 
 #ifndef SPICE_DISABLE_DEPRECATED
-SPICE_GNUC_DEPRECATED
+SPICE_DEPRECATED_FOR(spice_usb_device_manager_disconnect_device_async)
 void spice_usb_device_manager_disconnect_device(SpiceUsbDeviceManager *manager,
                                                 SpiceUsbDevice *device);
 #endif
commit 8f72ada3fa191fca7a455d1e40d455a6fecf9bcc
Author: Marc-André Lureau <marcandre.lureau at redhat.com>
Date:   Fri Jan 27 14:55:55 2017 +0400

    audio: fix deprecation warning
    
    Use a private function to avoid the spice_audio_new() deprecation
    warning.
    
    Signed-off-by: Marc-André Lureau <marcandre.lureau at redhat.com>
    Acked-by: Victor Toso <victortoso at redhat.com>

diff --git a/src/spice-audio-priv.h b/src/spice-audio-priv.h
index f108059..04123f5 100644
--- a/src/spice-audio-priv.h
+++ b/src/spice-audio-priv.h
@@ -29,6 +29,9 @@ struct _SpiceAudioPrivate {
     GMainContext            *main_context;
 };
 
+SpiceAudio *spice_audio_new_priv(SpiceSession *session, GMainContext *context,
+                                 const char *name);
+
 void spice_audio_get_playback_volume_info_async(SpiceAudio *audio, GCancellable *cancellable,
         SpiceMainChannel *main_channel, GAsyncReadyCallback callback, gpointer user_data);
 gboolean spice_audio_get_playback_volume_info_finish(SpiceAudio *audio, GAsyncResult *res,
diff --git a/src/spice-audio.c b/src/spice-audio.c
index c514d30..7dc6a24 100644
--- a/src/spice-audio.c
+++ b/src/spice-audio.c
@@ -232,22 +232,9 @@ gboolean spice_audio_get_record_volume_info_finish(SpiceAudio *audio,
             res, mute, nchannels, volume, error);
 }
 
-/**
- * spice_audio_new:
- * @session: the #SpiceSession to connect to
- * @context: (allow-none): a #GMainContext to attach to (or %NULL for
- * default).
- * @name: (allow-none): a name for the audio channels (or %NULL for
- * application name).
- *
- * Once instantiated, #SpiceAudio will handle the playback and record
- * channels to stream to your local audio system.
- *
- * Returns: a new #SpiceAudio instance or %NULL if no backend or failed.
- * Deprecated: 0.8: Use spice_audio_get() instead
- **/
-SpiceAudio *spice_audio_new(SpiceSession *session, GMainContext *context,
-                            const char *name)
+G_GNUC_INTERNAL
+SpiceAudio *spice_audio_new_priv(SpiceSession *session, GMainContext *context,
+                                 const char *name)
 {
     SpiceAudio *self = NULL;
 
@@ -272,3 +259,23 @@ SpiceAudio *spice_audio_new(SpiceSession *session, GMainContext *context,
 
     return self;
 }
+
+/**
+ * spice_audio_new:
+ * @session: the #SpiceSession to connect to
+ * @context: (allow-none): a #GMainContext to attach to (or %NULL for
+ * default).
+ * @name: (allow-none): a name for the audio channels (or %NULL for
+ * application name).
+ *
+ * Once instantiated, #SpiceAudio will handle the playback and record
+ * channels to stream to your local audio system.
+ *
+ * Returns: a new #SpiceAudio instance or %NULL if no backend or failed.
+ * Deprecated: 0.8: Use spice_audio_get() instead
+ **/
+SpiceAudio *spice_audio_new(SpiceSession *session, GMainContext *context,
+                            const char *name)
+{
+    return spice_audio_new_priv(session, context, name);
+}
diff --git a/src/spice-session.c b/src/spice-session.c
index 3f450d9..66376ff 100644
--- a/src/spice-session.c
+++ b/src/spice-session.c
@@ -33,7 +33,7 @@
 #include "wocky-http-proxy.h"
 #include "spice-uri-priv.h"
 #include "channel-playback-priv.h"
-#include "spice-audio.h"
+#include "spice-audio-priv.h"
 
 struct channel {
     SpiceChannel      *channel;
@@ -2648,7 +2648,7 @@ SpiceAudio *spice_audio_get(SpiceSession *session, GMainContext *context)
     g_mutex_lock(&mutex);
     self = session->priv->audio_manager;
     if (self == NULL) {
-        self = spice_audio_new(session, context, NULL);
+        self = spice_audio_new_priv(session, context, NULL);
         session->priv->audio_manager = self;
     }
     g_mutex_unlock(&mutex);
commit f84431375a4809b9ca570f3f126a804134488d71
Author: Marc-André Lureau <marcandre.lureau at redhat.com>
Date:   Fri Jan 27 14:51:54 2017 +0400

    Revert "audio: Remove spice_audio_new() from the public header"
    
    This reverts commit c6d9fa1c4af03d9875bf503ce6eabc9e7b52acc3.
    
    There is no rush to remove a deprecated API from public headers. It's
    better to do that when the whole library breaks API/ABI altogether.
    
    Signed-off-by: Marc-André Lureau <marcandre.lureau at redhat.com>
    Acked-by: Victor Toso <victortoso at redhat.com>

diff --git a/src/spice-audio-priv.h b/src/spice-audio-priv.h
index 8eee89b..f108059 100644
--- a/src/spice-audio-priv.h
+++ b/src/spice-audio-priv.h
@@ -29,8 +29,6 @@ struct _SpiceAudioPrivate {
     GMainContext            *main_context;
 };
 
-SpiceAudio* spice_audio_new(SpiceSession *session, GMainContext *context, const char *name);
-
 void spice_audio_get_playback_volume_info_async(SpiceAudio *audio, GCancellable *cancellable,
         SpiceMainChannel *main_channel, GAsyncReadyCallback callback, gpointer user_data);
 gboolean spice_audio_get_playback_volume_info_finish(SpiceAudio *audio, GAsyncResult *res,
diff --git a/src/spice-audio.h b/src/spice-audio.h
index b3d739b..01f564a 100644
--- a/src/spice-audio.h
+++ b/src/spice-audio.h
@@ -103,6 +103,11 @@ GType spice_audio_get_type(void);
 
 SpiceAudio* spice_audio_get(SpiceSession *session, GMainContext *context);
 
+#ifndef SPICE_DISABLE_DEPRECATED
+SPICE_DEPRECATED_FOR(spice_audio_get)
+SpiceAudio* spice_audio_new(SpiceSession *session, GMainContext *context, const char *name);
+#endif
+
 G_END_DECLS
 
 #endif /* __SPICE_CLIENT_AUDIO_H__ */
diff --git a/src/spice-session.c b/src/spice-session.c
index cc3dbdd..3f450d9 100644
--- a/src/spice-session.c
+++ b/src/spice-session.c
@@ -33,7 +33,7 @@
 #include "wocky-http-proxy.h"
 #include "spice-uri-priv.h"
 #include "channel-playback-priv.h"
-#include "spice-audio-priv.h"
+#include "spice-audio.h"
 
 struct channel {
     SpiceChannel      *channel;
commit 96ed6b7aaff7493de5f181d08834a67e2f452969
Author: Marc-André Lureau <marcandre.lureau at redhat.com>
Date:   Fri Jan 27 14:38:14 2017 +0400

    pygtk: remove bindings leftover
    
    PyGtk 2.0 got removed in 0917002c48a0a5deb615d120a0e5997eefc89fd4,
    remove some remaining files.
    
    Signed-off-by: Marc-André Lureau <marcandre.lureau at redhat.com>
    Acked-by: Pavel Grunt <pgrunt at redhat.com>

diff --git a/src/Makefile.am b/src/Makefile.am
index b991a5f..7542fac 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -37,8 +37,6 @@ EXTRA_DIST =					\
 	map-file				\
 	spice-glib-sym-file			\
 	spice-gtk-sym-file			\
-	spice-client-gtk-manual.defs		\
-	spice-client-gtk.override		\
 	spice-marshal.txt			\
 	spice-version.h.in			\
 	$(NULL)
diff --git a/src/spice-client-gtk-manual.defs b/src/spice-client-gtk-manual.defs
deleted file mode 100644
index 9631b74..0000000
--- a/src/spice-client-gtk-manual.defs
+++ /dev/null
@@ -1,117 +0,0 @@
-(define-method set_display
-  (of-object "SpiceMainChannel")
-  (c-name "spice_main_set_display")
-  (return-type "none")
-  (parameters
-    '("int" "id")
-    '("int" "x")
-    '("int" "y")
-    '("int" "width")
-    '("int" "height")
-  )
-)
-
-(define-method clipboard_grab
-  (of-object "SpiceMainChannel")
-  (c-name "spice_main_clipboard_grab")
-  (return-type "none")
-  (parameters
-    '("int*" "types")
-    '("int" "ntypes")
-  )
-)
-
-(define-method clipboard_release
-  (of-object "SpiceMainChannel")
-  (c-name "spice_main_clipboard_release")
-  (return-type "none")
-)
-
-(define-method motion
-  (of-object "SpiceInputsChannel")
-  (c-name "spice_inputs_motion")
-  (return-type "none")
-  (parameters
-    '("gint" "dx")
-    '("gint" "dy")
-    '("gint" "button_state")
-  )
-)
-
-(define-method position
-  (of-object "SpiceInputsChannel")
-  (c-name "spice_inputs_position")
-  (return-type "none")
-  (parameters
-    '("gint" "x")
-    '("gint" "y")
-    '("gint" "display")
-    '("gint" "button_state")
-  )
-)
-
-(define-method button_press
-  (of-object "SpiceInputsChannel")
-  (c-name "spice_inputs_button_press")
-  (return-type "none")
-  (parameters
-    '("gint" "button")
-    '("gint" "button_state")
-  )
-)
-
-(define-method button_release
-  (of-object "SpiceInputsChannel")
-  (c-name "spice_inputs_button_release")
-  (return-type "none")
-  (parameters
-    '("gint" "button")
-    '("gint" "button_state")
-  )
-)
-
-(define-method key_press
-  (of-object "SpiceInputsChannel")
-  (c-name "spice_inputs_key_press")
-  (return-type "none")
-  (parameters
-    '("guint" "keyval")
-  )
-)
-
-(define-method key_release
-  (of-object "SpiceInputsChannel")
-  (c-name "spice_inputs_key_release")
-  (return-type "none")
-  (parameters
-    '("guint" "keyval")
-  )
-)
-
-(define-method set_key_locks
-  (of-object "SpiceInputsChannel")
-  (c-name "spice_inputs_set_key_locks")
-  (return-type "none")
-  (parameters
-    '("guint" "locks")
-  )
-)
-
-(define-enum ClientError
-  (in-module "Spice")
-  (c-name "SpiceClientError")
-  (values
-    '("failed" "SPICE_CLIENT_ERROR_FAILED")
-  )
-)
-
-(define-function spice_audio_new
-  (c-name "spice_audio_new")
-  (is-constructor-of "SpiceAudio")
-  (return-type "SpiceAudio*")
-  (parameters
-    '("SpiceSession*" "session")
-    '("GMainContext*" "context")
-    '("const-char*" "name")
-  )
-)
diff --git a/src/spice-client-gtk.override b/src/spice-client-gtk.override
deleted file mode 100644
index 41aeee3..0000000
--- a/src/spice-client-gtk.override
+++ /dev/null
@@ -1,171 +0,0 @@
-%%
-headers
-#include <Python.h>
-#include "pygobject.h"
-#include "spice-common.h"
-#include "spice-widget.h"
-#include "spice-gtk-session.h"
-#include "spice-audio.h"
-#include "usb-device-widget.h"
-%%
-modulename spice_client_gtk
-%%
-import gobject.GObject as PyGObject_Type
-import gtk.DrawingArea as PyGtkDrawingArea_Type
-import gtk.Widget as PyGtkWidget_Type
-import gtk.VBox as PyGtkVBox_Type
-%%
-ignore-glob
-  *_get_type
-%%
-%%
-override spice_display_send_keys kwargs
-static PyObject*
-_wrap_spice_display_send_keys(PyGObject *self,
-                            PyObject *args, PyObject *kwargs)
-{
-    static char *kwlist[] = {"keys", "kind", NULL};
-    PyObject *keyList;
-    int kind = SPICE_DISPLAY_KEY_EVENT_CLICK;
-    int i, len;
-    guint *keys;
-
-    if (!PyArg_ParseTupleAndKeywords(args, kwargs,
-                                     "O|I:SpiceDisplay.send_keys", kwlist,
-                                     &keyList, &kind))
-	return NULL;
-
-    if (!PyList_Check(keyList))
-	return NULL;
-
-    len = PyList_Size(keyList);
-    keys = g_malloc0(sizeof(guint)*len);
-
-    for (i = 0 ; i < len ; i++) {
-        PyObject *val;
-        char *sym;
-        val = PyList_GetItem(keyList, i);
-        sym = PyString_AsString(val);
-        if (!sym) {
-            g_free(keys);
-	    return NULL;
-        }
-        keys[i] = gdk_keyval_from_name(sym);
-    }
-
-    spice_display_send_keys(SPICE_DISPLAY(self->obj), keys, len, kind);
-    g_free(keys);
-
-    Py_INCREF(Py_None);
-    return Py_None;
-}
-%%
-override spice_display_get_grab_keys kwargs
-static PyObject*
-_wrap_spice_display_get_grab_keys(PyGObject *self,
-                            PyObject *args, PyObject *kwargs)
-{
-    SpiceGrabSequence *seq;
-    PyObject *keyList;
-    int i;
-
-    seq = spice_display_get_grab_keys(SPICE_DISPLAY(self->obj));
-
-    keyList = PyList_New(0);
-    for (i = 0 ; i < seq->nkeysyms ; i++)
-       PyList_Append(keyList, PyInt_FromLong(seq->keysyms[i]));
-
-    return keyList;
-}
-%%
-override spice_display_set_grab_keys kwargs
-static PyObject*
-_wrap_spice_display_set_grab_keys(PyGObject *self,
-                            PyObject *args, PyObject *kwargs)
-{
-    static char *kwlist[] = {"keys", NULL};
-    PyObject *keyList;
-    int i;
-    guint nkeysyms;
-    guint *keysyms;
-    SpiceGrabSequence *seq;
-
-    if (!PyArg_ParseTupleAndKeywords(args, kwargs,
-                                     "O|I:SpiceDisplay.set_grab_keys", kwlist,
-                                     &keyList))
-        return NULL;
-
-    if (!PyList_Check(keyList))
-        return NULL;
-
-    nkeysyms = PyList_Size(keyList);
-    keysyms = g_new0(guint, nkeysyms);
-
-    for (i = 0 ; i < nkeysyms ; i++) {
-        PyObject *val = PyList_GetItem(keyList, i);
-        keysyms[i] = (guint)PyInt_AsLong(val);
-    }
-
-    seq = spice_grab_sequence_new(nkeysyms, keysyms);
-    g_free(keysyms);
-
-    spice_display_set_grab_keys(SPICE_DISPLAY(self->obj), seq);
-
-    spice_grab_sequence_free(seq);
-
-    Py_INCREF(Py_None);
-    return Py_None;
-}
-%%
-override spice_session_get_channels
-static PyObject*
-_wrap_spice_session_get_channels(PyGObject *self,
-                                 PyObject *args, PyObject *kwargs)
-{
-    PyObject *py_list;
-    GList *list, *tmp;
-    PyObject *chann;
-
-    list = spice_session_get_channels(SPICE_SESSION(self->obj));
-
-    if ((py_list = PyList_New(0)) == NULL) {
-        return NULL;
-    }
-    for (tmp = list; tmp != NULL; tmp = tmp->next) {
-        chann = pygobject_new(G_OBJECT(tmp->data));
-        if (chann == NULL) {
-            Py_DECREF(py_list);
-            return NULL;
-        }
-        PyList_Append(py_list, chann);
-        Py_DECREF(chann);
-    }
-    return py_list;
-}
-%%
-override spice_audio_new
-static int
-_wrap_spice_audio_new(PyGObject *self,
-                      PyObject *args, PyObject *kwargs)
-{
-    static char *kwlist[] = {"session", "context", "name", NULL};
-    PyGObject *session = NULL;
-    PyObject *py_context = NULL;
-    char *name = NULL;
-
-    if (!PyArg_ParseTupleAndKeywords(args, kwargs,
-                                     "O!|Os:SpiceAudio", kwlist,
-                                     &PySpiceSession_Type, &session,
-                                     &py_context, &name))
-	return -1;
-
-    self->obj = (GObject *)spice_audio_new(SPICE_SESSION(session->obj), NULL, NULL);
-
-    if (!self->obj) {
-        PyErr_SetString(PyExc_RuntimeError, "could not create SpiceAudio object");
-        return -1;
-    }
-    pygobject_register_wrapper((PyObject *)self);
-    return 0;
-
-}


More information about the Spice-commits mailing list