[Spice-devel] [PATCH 3/9] gtk: move gtk session

Marc-André Lureau marcandre.lureau at gmail.com
Tue Feb 16 14:49:11 UTC 2016


Do not leak internals of SpiceGtkSession in our headers. This makes also
the class final, which let us extend more easily without fear of
breaking ABI.

Signed-off-by: Marc-André Lureau <marcandre.lureau at gmail.com>
---
 src/spice-gtk-session-priv.h | 13 +++++++++++++
 src/spice-gtk-session.h      | 33 ---------------------------------
 src/usb-device-widget.c      | 16 ++++++++++++++++
 src/usb-device-widget.h      | 36 ------------------------------------
 4 files changed, 29 insertions(+), 69 deletions(-)

diff --git a/src/spice-gtk-session-priv.h b/src/spice-gtk-session-priv.h
index b2b6206..d7fe313 100644
--- a/src/spice-gtk-session-priv.h
+++ b/src/spice-gtk-session-priv.h
@@ -22,6 +22,19 @@
 
 G_BEGIN_DECLS
 
+typedef struct _SpiceGtkSessionPrivate SpiceGtkSessionPrivate;
+
+struct _SpiceGtkSession
+{
+    GObject parent;
+    SpiceGtkSessionPrivate *priv;
+};
+
+struct _SpiceGtkSessionClass
+{
+    GObjectClass parent_class;
+};
+
 void spice_gtk_session_request_auto_usbredir(SpiceGtkSession *self,
                                              gboolean state);
 gboolean spice_gtk_session_get_read_only(SpiceGtkSession *self);
diff --git a/src/spice-gtk-session.h b/src/spice-gtk-session.h
index 9a45d85..b04f4fc 100644
--- a/src/spice-gtk-session.h
+++ b/src/spice-gtk-session.h
@@ -35,39 +35,6 @@ G_BEGIN_DECLS
 
 typedef struct _SpiceGtkSession SpiceGtkSession;
 typedef struct _SpiceGtkSessionClass SpiceGtkSessionClass;
-typedef struct _SpiceGtkSessionPrivate SpiceGtkSessionPrivate;
-
-/**
- * SpiceGtkSession:
- *
- * The #SpiceGtkSession struct is opaque and should not be accessed directly.
- */
-struct _SpiceGtkSession
-{
-    GObject parent;
-    SpiceGtkSessionPrivate *priv;
-    /* Do not add fields to this struct */
-};
-
-/**
- * SpiceGtkSessionClass:
- * @parent_class: Parent class.
- *
- * Class structure for #SpiceGtkSession.
- */
-struct _SpiceGtkSessionClass
-{
-    GObjectClass parent_class;
-
-    /* signals */
-
-    /*< private >*/
-    /*
-     * If adding fields to this struct, remove corresponding
-     * amount of padding to avoid changing overall struct size
-     */
-    gchar _spice_reserved[SPICE_RESERVED_PADDING];
-};
 
 GType spice_gtk_session_get_type(void);
 
diff --git a/src/usb-device-widget.c b/src/usb-device-widget.c
index 59273f9..faa6c6d 100644
--- a/src/usb-device-widget.c
+++ b/src/usb-device-widget.c
@@ -39,6 +39,22 @@
  * add an UI to select USB devices to redirect (or unredirect).
  */
 
+struct _SpiceUsbDeviceWidget
+{
+    GtkVBox parent;
+
+    SpiceUsbDeviceWidgetPrivate *priv;
+};
+
+struct _SpiceUsbDeviceWidgetClass
+{
+    GtkVBoxClass parent_class;
+
+    /* signals */
+    void (*connect_failed) (SpiceUsbDeviceWidget *widget,
+                            SpiceUsbDevice *device, GError *error);
+};
+
 /* ------------------------------------------------------------------ */
 /* Prototypes for callbacks  */
 static void device_added_cb(SpiceUsbDeviceManager *manager,
diff --git a/src/usb-device-widget.h b/src/usb-device-widget.h
index 8ce91f2..a4ba638 100644
--- a/src/usb-device-widget.h
+++ b/src/usb-device-widget.h
@@ -41,42 +41,6 @@ typedef struct _SpiceUsbDeviceWidget SpiceUsbDeviceWidget;
 typedef struct _SpiceUsbDeviceWidgetClass SpiceUsbDeviceWidgetClass;
 typedef struct _SpiceUsbDeviceWidgetPrivate SpiceUsbDeviceWidgetPrivate;
 
-/**
- * SpiceUsbDeviceWidget:
- *
- * The #SpiceUsbDeviceWidget struct is opaque and should not be accessed directly.
- */
-struct _SpiceUsbDeviceWidget
-{
-    GtkVBox parent;
-
-    /*< private >*/
-    SpiceUsbDeviceWidgetPrivate *priv;
-    /* Do not add fields to this struct */
-};
-
-/**
- * SpiceUsbDeviceWidgetClass:
- * @parent_class: Parent class.
- * @connect_failed: Signal class handler for the #SpiceUsbDeviceWidget::connect-failed signal.
- *
- * Class structure for #SpiceUsbDeviceWidget.
- */
-struct _SpiceUsbDeviceWidgetClass
-{
-    GtkVBoxClass parent_class;
-
-    /* signals */
-    void (*connect_failed) (SpiceUsbDeviceWidget *widget,
-                            SpiceUsbDevice *device, GError *error);
-    /*< private >*/
-    /*
-     * If adding fields to this struct, remove corresponding
-     * amount of padding to avoid changing overall struct size
-     */
-    gchar _spice_reserved[SPICE_RESERVED_PADDING];
-};
-
 GType spice_usb_device_widget_get_type(void);
 GtkWidget *spice_usb_device_widget_new(SpiceSession    *session,
                                        const gchar     *device_format_string);
-- 
2.5.0



More information about the Spice-devel mailing list