[PATCH spice-gtk 1/5] PortChannel: Fix introspection method bindings

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Matthew Francis <mjay.francis@xxxxxxxxx>
---
 doc/reference/spice-gtk-sections.txt |  3 ++
 src/channel-port.c                   | 67 +++++++++++++++++++++++++++++++++++-
 src/channel-port.h                   | 15 ++++++++
 src/map-file                         |  3 ++
 src/spice-glib-sym-file              |  3 ++
 tools/spicy.c                        |  6 ++--
 6 files changed, 93 insertions(+), 4 deletions(-)

diff --git a/doc/reference/spice-gtk-sections.txt b/doc/reference/spice-gtk-sections.txt
index d5538d8..c4f416f 100644
--- a/doc/reference/spice-gtk-sections.txt
+++ b/doc/reference/spice-gtk-sections.txt
@@ -452,8 +452,11 @@ SpicePortChannel
 SpicePortChannelClass
 <SUBSECTION>
 spice_port_event
+spice_port_channel_event
 spice_port_write_async
+spice_port_channel_write_async
 spice_port_write_finish
+spice_port_channel_write_finish
 <SUBSECTION Standard>
 SPICE_PORT_CHANNEL
 SPICE_IS_PORT_CHANNEL
diff --git a/src/channel-port.c b/src/channel-port.c
index d922e4b..ff28b72 100644
--- a/src/channel-port.c
+++ b/src/channel-port.c
@@ -277,6 +277,7 @@ static void port_handle_msg(SpiceChannel *channel, SpiceMsgIn *in)
  * the operation.
  *
  * Since: 0.15
+ * Deprecated: 0.35: use spice_port_channel_write_async() instead.
  **/
 void spice_port_write_async(SpicePortChannel *self,
                             const void *buffer, gsize count,
@@ -284,6 +285,32 @@ void spice_port_write_async(SpicePortChannel *self,
                             GAsyncReadyCallback callback,
                             gpointer user_data)
 {
+    spice_port_channel_write_async(self, buffer, count, cancellable, callback, user_data);
+}
+
+/**
+ * spice_port_channel_write_async:
+ * @port: A #SpicePortChannel
+ * @buffer: (array length=count) (element-type guint8): the buffer
+ * containing the data to write
+ * @count: the number of bytes to write
+ * @cancellable: (allow-none): optional GCancellable object, NULL to ignore
+ * @callback: (scope async): callback to call when the request is satisfied
+ * @user_data: (closure): the data to pass to callback function
+ *
+ * Request an asynchronous write of count bytes from @buffer into the
+ * @port. When the operation is finished @callback will be called. You
+ * can then call spice_port_write_finish() to get the result of
+ * the operation.
+ *
+ * Since: 0.35
+ **/
+void spice_port_channel_write_async(SpicePortChannel *self,
+                                    const void *buffer, gsize count,
+                                    GCancellable *cancellable,
+                                    GAsyncReadyCallback callback,
+                                    gpointer user_data)
+{
     SpicePortChannelPrivate *c;
 
     g_return_if_fail(SPICE_IS_PORT_CHANNEL(self));
@@ -292,7 +319,7 @@ void spice_port_write_async(SpicePortChannel *self,
 
     if (!c->opened) {
         g_task_report_new_error(self, callback,
-            user_data, spice_port_write_async,
+            user_data, spice_port_channel_write_async,
             SPICE_CLIENT_ERROR, SPICE_CLIENT_ERROR_FAILED,
             "The port is not opened");
         return;
@@ -313,10 +340,29 @@ void spice_port_write_async(SpicePortChannel *self,
  *
  * Returns: a #gssize containing the number of bytes written to the stream.
  * Since: 0.15
+ * Deprecated: 0.35: use spice_port_channel_write_finish() instead.
  **/
 gssize spice_port_write_finish(SpicePortChannel *self,
                                GAsyncResult *result, GError **error)
 {
+    return spice_port_channel_write_finish(self, result, error);
+}
+
+/**
+ * spice_port_channel_write_finish:
+ * @port: a #SpicePortChannel
+ * @result: a #GAsyncResult
+ * @error: a #GError location to store the error occurring, or %NULL
+ * to ignore
+ *
+ * Finishes a port write operation.
+ *
+ * Returns: a #gssize containing the number of bytes written to the stream.
+ * Since: 0.35
+ **/
+gssize spice_port_channel_write_finish(SpicePortChannel *self,
+                                       GAsyncResult *result, GError **error)
+{
     g_return_val_if_fail(SPICE_IS_PORT_CHANNEL(self), -1);
 
     return spice_vmc_write_finish(SPICE_CHANNEL(self), result, error);
@@ -334,9 +380,28 @@ gssize spice_port_write_finish(SpicePortChannel *self,
  * state.
  *
  * Since: 0.15
+ * Deprecated: 0.35: use spice_port_channel_event() instead.
  **/
 void spice_port_event(SpicePortChannel *self, guint8 event)
 {
+    spice_port_channel_event(self, event);
+}
+
+/**
+ * spice_port_channel_event:
+ * @port: a #SpicePortChannel
+ * @event: a SPICE_PORT_EVENT value
+ *
+ * Send an event to the port.
+ *
+ * Note: The values SPICE_PORT_EVENT_CLOSED and
+ * SPICE_PORT_EVENT_OPENED are managed by the channel connection
+ * state.
+ *
+ * Since: 0.35
+ **/
+void spice_port_channel_event(SpicePortChannel *self, guint8 event)
+{
     SpiceMsgcPortEvent e;
     SpiceMsgOut *msg;
 
diff --git a/src/channel-port.h b/src/channel-port.h
index 8fc19cc..3c80d61 100644
--- a/src/channel-port.h
+++ b/src/channel-port.h
@@ -66,14 +66,29 @@ struct _SpicePortChannelClass {
 
 GType spice_port_channel_get_type(void);
 
+void spice_port_channel_write_async(SpicePortChannel *port,
+                                    const void *buffer, gsize count,
+                                    GCancellable *cancellable,
+                                    GAsyncReadyCallback callback,
+                                    gpointer user_data);
+gssize spice_port_channel_write_finish(SpicePortChannel *port,
+                                       GAsyncResult *result, GError **error);
+void spice_port_channel_event(SpicePortChannel *port, guint8 event);
+
+
+#ifndef SPICE_DISABLE_DEPRECATED
+G_DEPRECATED_FOR(spice_port_channel_write_async)
 void spice_port_write_async(SpicePortChannel *port,
                             const void *buffer, gsize count,
                             GCancellable *cancellable,
                             GAsyncReadyCallback callback,
                             gpointer user_data);
+G_DEPRECATED_FOR(spice_port_channel_write_finish)
 gssize spice_port_write_finish(SpicePortChannel *port,
                                GAsyncResult *result, GError **error);
+G_DEPRECATED_FOR(spice_port_channel_event)
 void spice_port_event(SpicePortChannel *port, guint8 event);
+#endif
 
 G_END_DECLS
 
diff --git a/src/map-file b/src/map-file
index 668ff41..de4f421 100644
--- a/src/map-file
+++ b/src/map-file
@@ -86,7 +86,10 @@ spice_main_update_display;
 spice_main_update_display_enabled;
 spice_playback_channel_get_type;
 spice_playback_channel_set_delay;
+spice_port_channel_event;
 spice_port_channel_get_type;
+spice_port_channel_write_async;
+spice_port_channel_write_finish;
 spice_port_event;
 spice_port_write_async;
 spice_port_write_finish;
diff --git a/src/spice-glib-sym-file b/src/spice-glib-sym-file
index e061744..79c75f1 100644
--- a/src/spice-glib-sym-file
+++ b/src/spice-glib-sym-file
@@ -65,7 +65,10 @@ spice_main_update_display
 spice_main_update_display_enabled
 spice_playback_channel_get_type
 spice_playback_channel_set_delay
+spice_port_channel_event
 spice_port_channel_get_type
+spice_port_channel_write_async
+spice_port_channel_write_finish
 spice_port_event
 spice_port_write_async
 spice_port_write_finish
diff --git a/tools/spicy.c b/tools/spicy.c
index a09f8cd..d71d996 100644
--- a/tools/spicy.c
+++ b/tools/spicy.c
@@ -1484,7 +1484,7 @@ static void port_write_cb(GObject *source_object,
     SpicePortChannel *port = SPICE_PORT_CHANNEL(source_object);
     GError *error = NULL;
 
-    spice_port_write_finish(port, res, &error);
+    spice_port_channel_write_finish(port, res, &error);
     if (error != NULL)
         g_warning("%s", error->message);
     g_clear_error(&error);
@@ -1519,7 +1519,7 @@ static gboolean input_cb(GIOChannel *gin, GIOCondition condition, gpointer data)
         return FALSE;
 
     if (stdin_port != NULL)
-        spice_port_write_async(stdin_port, buf, bytes_read, NULL, port_write_cb, NULL);
+        spice_port_channel_write_async(stdin_port, buf, bytes_read, NULL, port_write_cb, NULL);
 
     return TRUE;
 }
@@ -1543,7 +1543,7 @@ static void port_opened(SpiceChannel *channel, GParamSpec *pspec,
     if (opened) {
         /* only send a break event and disconnect */
         if (g_strcmp0(name, "org.spice.spicy.break") == 0) {
-            spice_port_event(port, SPICE_PORT_EVENT_BREAK);
+            spice_port_channel_event(port, SPICE_PORT_EVENT_BREAK);
             spice_channel_flush_async(channel, NULL, port_flushed_cb, conn);
         }
 
-- 
2.7.4

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]