[Spice-devel] [spice-gtk 2/2] gi: Add (allow none) to optional const char * params

Christophe Fergeau cfergeau at redhat.com
Fri Jun 28 04:38:07 PDT 2013


Without that annotation, it will not be possible to pass NULL to
these methods when using a gi-based binding.
---
 gtk/spice-audio.c        | 6 ++++--
 gtk/usb-device-manager.c | 8 +++++---
 gtk/usb-device-widget.c  | 3 ++-
 3 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/gtk/spice-audio.c b/gtk/spice-audio.c
index 6cf8f01..dbd3a8b 100644
--- a/gtk/spice-audio.c
+++ b/gtk/spice-audio.c
@@ -195,8 +195,10 @@ static void session_enable_audio(GObject *gobject, GParamSpec *pspec,
 /**
  * spice_audio_new:
  * @session: the #SpiceSession to connect to
- * @context: a #GMainContext to attach to (or %NULL for default).
- * @name: a name for the audio channels (or %NULL for application name).
+ * @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.
diff --git a/gtk/usb-device-manager.c b/gtk/usb-device-manager.c
index 07cfb48..d9d4263 100644
--- a/gtk/usb-device-manager.c
+++ b/gtk/usb-device-manager.c
@@ -1185,8 +1185,9 @@ SpiceUsbDeviceManager *spice_usb_device_manager_get(SpiceSession *session,
 /**
  * spice_usb_device_manager_get_devices_with_filter:
  * @manager: the #SpiceUsbDeviceManager manager
- * @filter: filter string for selecting which devices to return, see
- *      #SpiceUsbDeviceManager:auto-connect-filter for the filter string format
+ * @filter: (allow-none): filter string for selecting which devices to return,
+ *      see #SpiceUsbDeviceManager:auto-connect-filter for the f ilter
+ *      string format
  *
  * Returns: (element-type SpiceUsbDevice) (transfer full): a %GPtrArray array of %SpiceUsbDevice
  */
@@ -1535,7 +1536,8 @@ spice_usb_device_manager_can_redirect_device(SpiceUsbDeviceManager  *self,
 /**
  * spice_usb_device_get_description:
  * @device: #SpiceUsbDevice to get the description of
- * @format: an optionnal printf() format string with positional parameters
+ * @format: (allow-none): an optional printf() format string with
+ * positional parameters
  *
  * Get a string describing the device which is suitable as a description of
  * the device for the end user. The returned string should be freed with
diff --git a/gtk/usb-device-widget.c b/gtk/usb-device-widget.c
index 8621a5e..69c74b3 100644
--- a/gtk/usb-device-widget.c
+++ b/gtk/usb-device-widget.c
@@ -328,7 +328,8 @@ static void spice_usb_device_widget_init(SpiceUsbDeviceWidget *self)
 /**
  * spice_usb_device_widget_new:
  * @session: #SpiceSession for which to widget will control USB redirection
- * @device_format_string: String passed to spice_usb_device_get_description()
+ * @device_format_string: (allow-none): String passed to
+ * spice_usb_device_get_description()
  *
  * Returns: a new #SpiceUsbDeviceWidget instance
  */
-- 
1.8.3.1



More information about the Spice-devel mailing list