[Spice-devel] [PATCH spice-server 2/2] Reuse GOBJECT_DECLARE_TYPE* macros
Frediano Ziglio
fziglio at redhat.com
Mon Sep 4 16:09:23 UTC 2017
Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
---
server/char-device.c | 2 +-
server/char-device.h | 14 +-----
server/common-graphics-channel.h | 40 ++--------------
server/cursor-channel-client.h | 18 +------
server/cursor-channel.h | 13 +-----
server/dcc.h | 18 +------
server/dispatcher.h | 13 +-----
server/display-channel.h | 16 +------
server/inputs-channel-client.h | 18 +------
server/inputs-channel.h | 14 +-----
server/main-channel-client.h | 18 +------
server/main-channel.h | 14 +-----
server/main-dispatcher.h | 13 +-----
server/red-channel-client.h | 17 +------
server/red-channel.h | 19 ++------
server/red-client.h | 13 +-----
server/reds.c | 12 +----
server/smartcard-channel-client.h | 18 +------
server/smartcard.c | 19 +-------
server/smartcard.h | 12 +----
server/sound.c | 77 +++++++++++++-----------------
server/spicevmc.c | 98 ++++++++++++---------------------------
22 files changed, 86 insertions(+), 410 deletions(-)
diff --git a/server/char-device.c b/server/char-device.c
index 658f9f36..a00c29f4 100644
--- a/server/char-device.c
+++ b/server/char-device.c
@@ -697,7 +697,7 @@ void red_char_device_reset_dev_instance(RedCharDevice *dev,
void red_char_device_destroy(RedCharDevice *char_dev)
{
- g_return_if_fail(RED_IS_CHAR_DEVICE(char_dev));
+ g_return_if_fail(IS_RED_CHAR_DEVICE(char_dev));
g_object_unref(char_dev);
}
diff --git a/server/char-device.h b/server/char-device.h
index dccd576d..28c10684 100644
--- a/server/char-device.h
+++ b/server/char-device.h
@@ -25,19 +25,9 @@
#include "red-channel.h"
#include "migration-protocol.h"
+GOBJECT_DECLARE_TYPE_STRUCT(RedCharDevice, red_char_device, RED_CHAR_DEVICE, SpiceCharDeviceState);
#define RED_TYPE_CHAR_DEVICE red_char_device_get_type()
-#define RED_CHAR_DEVICE(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), RED_TYPE_CHAR_DEVICE, RedCharDevice))
-#define RED_CHAR_DEVICE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), RED_TYPE_CHAR_DEVICE, RedCharDeviceClass))
-#define RED_IS_CHAR_DEVICE(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), RED_TYPE_CHAR_DEVICE))
-#define RED_IS_CHAR_DEVICE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), RED_TYPE_CHAR_DEVICE))
-#define RED_CHAR_DEVICE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), RED_TYPE_CHAR_DEVICE, RedCharDeviceClass))
-
-/* SpiceCharDeviceState is public API, but internally we use RedCharDevice */
-typedef struct SpiceCharDeviceState RedCharDevice;
-typedef struct RedCharDeviceClass RedCharDeviceClass;
-typedef struct RedCharDevicePrivate RedCharDevicePrivate;
-
/* 'SpiceCharDeviceState' name is used for consistency with what spice-char.h exports */
struct SpiceCharDeviceState
{
@@ -83,8 +73,6 @@ struct RedCharDeviceClass
void (*port_event)(RedCharDevice *self, uint8_t event);
};
-GType red_char_device_get_type(void) G_GNUC_CONST;
-
/*
* Shared code for char devices, mainly for flow control.
*
diff --git a/server/common-graphics-channel.h b/server/common-graphics-channel.h
index c478b319..596f28dc 100644
--- a/server/common-graphics-channel.h
+++ b/server/common-graphics-channel.h
@@ -29,23 +29,9 @@ bool common_channel_client_config_socket(RedChannelClient *rcc);
#define COMMON_CLIENT_TIMEOUT (NSEC_PER_SEC * 30)
+GOBJECT_DECLARE_TYPE(CommonGraphicsChannel, common_graphics_channel, COMMON_GRAPHICS_CHANNEL);
#define TYPE_COMMON_GRAPHICS_CHANNEL common_graphics_channel_get_type()
-#define COMMON_GRAPHICS_CHANNEL(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST((obj), TYPE_COMMON_GRAPHICS_CHANNEL, CommonGraphicsChannel))
-#define COMMON_GRAPHICS_CHANNEL_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST((klass), TYPE_COMMON_GRAPHICS_CHANNEL, CommonGraphicsChannelClass))
-#define COMMON_IS_GRAPHICS_CHANNEL(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE((obj), TYPE_COMMON_GRAPHICS_CHANNEL))
-#define COMMON_IS_GRAPHICS_CHANNEL_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE((klass), TYPE_COMMON_GRAPHICS_CHANNEL))
-#define COMMON_GRAPHICS_CHANNEL_GET_CLASS(obj) \
- (G_TYPE_INSTANCE_GET_CLASS((obj), TYPE_COMMON_GRAPHICS_CHANNEL, CommonGraphicsChannelClass))
-
-typedef struct CommonGraphicsChannel CommonGraphicsChannel;
-typedef struct CommonGraphicsChannelClass CommonGraphicsChannelClass;
-typedef struct CommonGraphicsChannelPrivate CommonGraphicsChannelPrivate;
-
struct CommonGraphicsChannel
{
RedChannel parent;
@@ -58,8 +44,6 @@ struct CommonGraphicsChannelClass
RedChannelClass parent_class;
};
-GType common_graphics_channel_get_type(void) G_GNUC_CONST;
-
void common_graphics_channel_set_during_target_migrate(CommonGraphicsChannel *self, gboolean value);
gboolean common_graphics_channel_get_during_target_migrate(CommonGraphicsChannel *self);
QXLInstance* common_graphics_channel_get_qxl(CommonGraphicsChannel *self);
@@ -70,26 +54,10 @@ enum {
RED_PIPE_ITEM_TYPE_COMMON_LAST
};
+GOBJECT_DECLARE_TYPE(CommonGraphicsChannelClient, common_graphics_channel_client,
+ COMMON_GRAPHICS_CHANNEL_CLIENT);
#define TYPE_COMMON_GRAPHICS_CHANNEL_CLIENT common_graphics_channel_client_get_type()
-#define COMMON_GRAPHICS_CHANNEL_CLIENT(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST((obj), TYPE_COMMON_GRAPHICS_CHANNEL_CLIENT, \
- CommonGraphicsChannelClient))
-#define COMMON_GRAPHICS_CHANNEL_CLIENT_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST((klass), TYPE_COMMON_GRAPHICS_CHANNEL_CLIENT, \
- CommonGraphicsChannelClientClass))
-#define COMMON_IS_GRAPHICS_CHANNEL_CLIENT(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE((obj), TYPE_COMMON_GRAPHICS_CHANNEL_CLIENT))
-#define COMMON_IS_GRAPHICS_CHANNEL_CLIENT_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE((klass), TYPE_COMMON_GRAPHICS_CHANNEL_CLIENT))
-#define COMMON_GRAPHICS_CHANNEL_CLIENT_GET_CLASS(obj) \
- (G_TYPE_INSTANCE_GET_CLASS((obj), TYPE_COMMON_GRAPHICS_CHANNEL_CLIENT, \
- CommonGraphicsChannelClientClass))
-
-typedef struct CommonGraphicsChannelClient CommonGraphicsChannelClient;
-typedef struct CommonGraphicsChannelClientClass CommonGraphicsChannelClientClass;
-typedef struct CommonGraphicsChannelClientPrivate CommonGraphicsChannelClientPrivate;
-
struct CommonGraphicsChannelClient {
RedChannelClient parent;
@@ -100,8 +68,6 @@ struct CommonGraphicsChannelClientClass {
RedChannelClientClass parent_class;
};
-GType common_graphics_channel_client_get_type(void) G_GNUC_CONST;
-
G_END_DECLS
#endif /* COMMON_GRAPHICS_CHANNEL_H_ */
diff --git a/server/cursor-channel-client.h b/server/cursor-channel-client.h
index dc69369f..a1202952 100644
--- a/server/cursor-channel-client.h
+++ b/server/cursor-channel-client.h
@@ -29,23 +29,9 @@
G_BEGIN_DECLS
+GOBJECT_DECLARE_TYPE(CursorChannelClient, cursor_channel_client, CURSOR_CHANNEL_CLIENT);
#define TYPE_CURSOR_CHANNEL_CLIENT cursor_channel_client_get_type()
-#define CURSOR_CHANNEL_CLIENT(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST((obj), TYPE_CURSOR_CHANNEL_CLIENT, CursorChannelClient))
-#define CURSOR_CHANNEL_CLIENT_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST((klass), TYPE_CURSOR_CHANNEL_CLIENT, CursorChannelClientClass))
-#define IS_CURSOR_CHANNEL_CLIENT(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE((obj), TYPE_CURSOR_CHANNEL_CLIENT))
-#define IS_CURSOR_CHANNEL_CLIENT_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE((klass), TYPE_CURSOR_CHANNEL_CLIENT))
-#define CURSOR_CHANNEL_CLIENT_GET_CLASS(obj) \
- (G_TYPE_INSTANCE_GET_CLASS((obj), TYPE_CURSOR_CHANNEL_CLIENT, CursorChannelClientClass))
-
-typedef struct CursorChannelClient CursorChannelClient;
-typedef struct CursorChannelClientClass CursorChannelClientClass;
-typedef struct CursorChannelClientPrivate CursorChannelClientPrivate;
-
struct CursorChannelClient {
CommonGraphicsChannelClient parent;
@@ -57,8 +43,6 @@ struct CursorChannelClientClass
RedChannelClientClass parent_class;
};
-GType cursor_channel_client_get_type(void) G_GNUC_CONST;
-
CursorChannelClient* cursor_channel_client_new(CursorChannel *cursor,
RedClient *client,
RedsStream *stream,
diff --git a/server/cursor-channel.h b/server/cursor-channel.h
index f279aafc..868d2f04 100644
--- a/server/cursor-channel.h
+++ b/server/cursor-channel.h
@@ -29,21 +29,10 @@ G_BEGIN_DECLS
* movements.
* A pointer to CursorChannel can be converted to a RedChannel.
*/
-typedef struct CursorChannel CursorChannel;
-typedef struct CursorChannelClass CursorChannelClass;
+GOBJECT_DECLARE_TYPE(CursorChannel, cursor_channel, CURSOR_CHANNEL);
#define TYPE_CURSOR_CHANNEL cursor_channel_get_type()
-#define CURSOR_CHANNEL(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), TYPE_CURSOR_CHANNEL, CursorChannel))
-#define CURSOR_CHANNEL_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST((klass), TYPE_CURSOR_CHANNEL, CursorChannelClass))
-#define IS_CURSOR_CHANNEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), TYPE_CURSOR_CHANNEL))
-#define IS_CURSOR_CHANNEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), TYPE_CURSOR_CHANNEL))
-#define CURSOR_CHANNEL_GET_CLASS(obj) \
- (G_TYPE_INSTANCE_GET_CLASS((obj), TYPE_CURSOR_CHANNEL, CursorChannelClass))
-
-GType cursor_channel_get_type(void) G_GNUC_CONST;
-
/**
* Create CursorChannel.
* Since CursorChannel is intended to be run in a separate thread,
diff --git a/server/dcc.h b/server/dcc.h
index e34e8363..c10ef3f8 100644
--- a/server/dcc.h
+++ b/server/dcc.h
@@ -29,23 +29,9 @@
G_BEGIN_DECLS
+GOBJECT_DECLARE_TYPE(DisplayChannelClient, display_channel_client, DISPLAY_CHANNEL_CLIENT);
#define TYPE_DISPLAY_CHANNEL_CLIENT display_channel_client_get_type()
-#define DISPLAY_CHANNEL_CLIENT(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST((obj), TYPE_DISPLAY_CHANNEL_CLIENT, DisplayChannelClient))
-#define DISPLAY_CHANNEL_CLIENT_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST((klass), TYPE_DISPLAY_CHANNEL_CLIENT, DisplayChannelClientClass))
-#define IS_DISPLAY_CHANNEL_CLIENT(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE((obj), TYPE_DISPLAY_CHANNEL_CLIENT))
-#define IS_DISPLAY_CHANNEL_CLIENT_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE((klass), TYPE_DISPLAY_CHANNEL_CLIENT))
-#define DISPLAY_CHANNEL_CLIENT_GET_CLASS(obj) \
- (G_TYPE_INSTANCE_GET_CLASS((obj), TYPE_DISPLAY_CHANNEL_CLIENT, DisplayChannelClientClass))
-
-typedef struct DisplayChannelClient DisplayChannelClient;
-typedef struct DisplayChannelClientClass DisplayChannelClientClass;
-typedef struct DisplayChannelClientPrivate DisplayChannelClientPrivate;
-
struct DisplayChannelClient {
CommonGraphicsChannelClient parent;
@@ -58,8 +44,6 @@ struct DisplayChannelClientClass {
CommonGraphicsChannelClientClass parent_class;
};
-GType display_channel_client_get_type(void) G_GNUC_CONST;
-
#define PALETTE_CACHE_HASH_SHIFT 8
#define PALETTE_CACHE_HASH_SIZE (1 << PALETTE_CACHE_HASH_SHIFT)
#define PALETTE_CACHE_HASH_MASK (PALETTE_CACHE_HASH_SIZE - 1)
diff --git a/server/dispatcher.h b/server/dispatcher.h
index 41b7389c..40e65ded 100644
--- a/server/dispatcher.h
+++ b/server/dispatcher.h
@@ -23,18 +23,9 @@
#include "red-common.h"
+GOBJECT_DECLARE_TYPE(Dispatcher, dispatcher, DISPATCHER);
#define TYPE_DISPATCHER dispatcher_get_type()
-#define DISPATCHER(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), TYPE_DISPATCHER, Dispatcher))
-#define DISPATCHER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), TYPE_DISPATCHER, DispatcherClass))
-#define IS_DISPATCHER(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), TYPE_DISPATCHER))
-#define IS_DISPATCHER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), TYPE_DISPATCHER))
-#define DISPATCHER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), TYPE_DISPATCHER, DispatcherClass))
-
-typedef struct Dispatcher Dispatcher;
-typedef struct DispatcherClass DispatcherClass;
-typedef struct DispatcherPrivate DispatcherPrivate;
-
struct Dispatcher
{
GObject parent;
@@ -47,8 +38,6 @@ struct DispatcherClass
GObjectClass parent_class;
};
-GType dispatcher_get_type(void) G_GNUC_CONST;
-
Dispatcher *dispatcher_new(size_t max_message_type, void *opaque);
diff --git a/server/display-channel.h b/server/display-channel.h
index d3fc41dd..d9300fb2 100644
--- a/server/display-channel.h
+++ b/server/display-channel.h
@@ -47,21 +47,9 @@
G_BEGIN_DECLS
+GOBJECT_DECLARE_TYPE(DisplayChannel, display_channel, DISPLAY_CHANNEL);
#define TYPE_DISPLAY_CHANNEL display_channel_get_type()
-#define DISPLAY_CHANNEL(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST((obj), TYPE_DISPLAY_CHANNEL, DisplayChannel))
-#define DISPLAY_CHANNEL_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST((klass), TYPE_DISPLAY_CHANNEL, DisplayChannelClass))
-#define IS_DISPLAY_CHANNEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), TYPE_DISPLAY_CHANNEL))
-#define IS_DISPLAY_CHANNEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), TYPE_DISPLAY_CHANNEL))
-#define DISPLAY_CHANNEL_GET_CLASS(obj) \
- (G_TYPE_INSTANCE_GET_CLASS((obj), TYPE_DISPLAY_CHANNEL, DisplayChannelClass))
-
-typedef struct DisplayChannel DisplayChannel;
-typedef struct DisplayChannelClass DisplayChannelClass;
-typedef struct DisplayChannelPrivate DisplayChannelPrivate;
-
struct DisplayChannel
{
CommonGraphicsChannel parent;
@@ -74,8 +62,6 @@ struct DisplayChannelClass
CommonGraphicsChannelClass parent_class;
};
-GType display_channel_get_type(void) G_GNUC_CONST;
-
typedef struct DependItem {
Drawable *drawable;
RingItem ring_item;
diff --git a/server/inputs-channel-client.h b/server/inputs-channel-client.h
index b57a7a79..3d2e0ae6 100644
--- a/server/inputs-channel-client.h
+++ b/server/inputs-channel-client.h
@@ -25,23 +25,9 @@
G_BEGIN_DECLS
+GOBJECT_DECLARE_TYPE(InputsChannelClient, inputs_channel_client, INPUTS_CHANNEL_CLIENT);
#define TYPE_INPUTS_CHANNEL_CLIENT inputs_channel_client_get_type()
-#define INPUTS_CHANNEL_CLIENT(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST((obj), TYPE_INPUTS_CHANNEL_CLIENT, InputsChannelClient))
-#define INPUTS_CHANNEL_CLIENT_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST((klass), TYPE_INPUTS_CHANNEL_CLIENT, InputsChannelClientClass))
-#define IS_INPUTS_CHANNEL_CLIENT(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE((obj), TYPE_INPUTS_CHANNEL_CLIENT))
-#define IS_INPUTS_CHANNEL_CLIENT_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE((klass), TYPE_INPUTS_CHANNEL_CLIENT))
-#define INPUTS_CHANNEL_CLIENT_GET_CLASS(obj) \
- (G_TYPE_INSTANCE_GET_CLASS((obj), TYPE_INPUTS_CHANNEL_CLIENT, InputsChannelClientClass))
-
-typedef struct InputsChannelClient InputsChannelClient;
-typedef struct InputsChannelClientClass InputsChannelClientClass;
-typedef struct InputsChannelClientPrivate InputsChannelClientPrivate;
-
struct InputsChannelClient
{
RedChannelClient parent;
@@ -54,8 +40,6 @@ struct InputsChannelClientClass
RedChannelClientClass parent_class;
};
-GType inputs_channel_client_get_type(void) G_GNUC_CONST;
-
RedChannelClient* inputs_channel_client_create(RedChannel *channel,
RedClient *client,
RedsStream *stream,
diff --git a/server/inputs-channel.h b/server/inputs-channel.h
index 27d81a87..17e131b3 100644
--- a/server/inputs-channel.h
+++ b/server/inputs-channel.h
@@ -29,21 +29,9 @@
G_BEGIN_DECLS
+GOBJECT_DECLARE_TYPE(InputsChannel, inputs_channel, INPUTS_CHANNEL);
#define TYPE_INPUTS_CHANNEL inputs_channel_get_type()
-#define INPUTS_CHANNEL(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), TYPE_INPUTS_CHANNEL, InputsChannel))
-#define INPUTS_CHANNEL_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST((klass), TYPE_INPUTS_CHANNEL, InputsChannelClass))
-#define INPUTS_IS_CHANNEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), TYPE_INPUTS_CHANNEL))
-#define INPUTS_IS_CHANNEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), TYPE_INPUTS_CHANNEL))
-#define INPUTS_CHANNEL_GET_CLASS(obj) \
- (G_TYPE_INSTANCE_GET_CLASS((obj), TYPE_INPUTS_CHANNEL, InputsChannelClass))
-
-typedef struct InputsChannel InputsChannel;
-typedef struct InputsChannelClass InputsChannelClass;
-
-GType inputs_channel_get_type(void) G_GNUC_CONST;
-
InputsChannel* inputs_channel_new(RedsState *reds);
const VDAgentMouseState *inputs_channel_get_mouse_state(InputsChannel *inputs);
diff --git a/server/main-channel-client.h b/server/main-channel-client.h
index 0f8e4f49..abe85e74 100644
--- a/server/main-channel-client.h
+++ b/server/main-channel-client.h
@@ -26,23 +26,9 @@
G_BEGIN_DECLS
+GOBJECT_DECLARE_TYPE(MainChannelClient, main_channel_client, MAIN_CHANNEL_CLIENT);
#define TYPE_MAIN_CHANNEL_CLIENT main_channel_client_get_type()
-#define MAIN_CHANNEL_CLIENT(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST((obj), TYPE_MAIN_CHANNEL_CLIENT, MainChannelClient))
-#define MAIN_CHANNEL_CLIENT_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST((klass), TYPE_MAIN_CHANNEL_CLIENT, MainChannelClientClass))
-#define IS_MAIN_CHANNEL_CLIENT(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE((obj), TYPE_MAIN_CHANNEL_CLIENT))
-#define IS_MAIN_CHANNEL_CLIENT_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE((klass), TYPE_MAIN_CHANNEL_CLIENT))
-#define MAIN_CHANNEL_CLIENT_GET_CLASS(obj) \
- (G_TYPE_INSTANCE_GET_CLASS((obj), TYPE_MAIN_CHANNEL_CLIENT, MainChannelClientClass))
-
-typedef struct MainChannelClient MainChannelClient;
-typedef struct MainChannelClientClass MainChannelClientClass;
-typedef struct MainChannelClientPrivate MainChannelClientPrivate;
-
struct MainChannelClient
{
RedChannelClient parent;
@@ -55,8 +41,6 @@ struct MainChannelClientClass
RedChannelClientClass parent_class;
};
-GType main_channel_client_get_type(void) G_GNUC_CONST;
-
MainChannelClient *main_channel_client_create(MainChannel *main_chan, RedClient *client,
RedsStream *stream, uint32_t connection_id,
RedChannelCapabilities *caps);
diff --git a/server/main-channel.h b/server/main-channel.h
index eb3bcec3..9f3c01da 100644
--- a/server/main-channel.h
+++ b/server/main-channel.h
@@ -27,21 +27,9 @@
G_BEGIN_DECLS
+GOBJECT_DECLARE_TYPE(MainChannel, main_channel, MAIN_CHANNEL);
#define TYPE_MAIN_CHANNEL main_channel_get_type()
-#define MAIN_CHANNEL(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), TYPE_MAIN_CHANNEL, MainChannel))
-#define MAIN_CHANNEL_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST((klass), TYPE_MAIN_CHANNEL, MainChannelClass))
-#define IS_MAIN_CHANNEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), TYPE_MAIN_CHANNEL))
-#define IS_MAIN_CHANNEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), TYPE_MAIN_CHANNEL))
-#define MAIN_CHANNEL_GET_CLASS(obj) \
- (G_TYPE_INSTANCE_GET_CLASS((obj), TYPE_MAIN_CHANNEL, MainChannelClass))
-
-typedef struct MainChannel MainChannel;
-typedef struct MainChannelClass MainChannelClass;
-
-GType main_channel_get_type(void) G_GNUC_CONST;
-
// TODO: Defines used to calculate receive buffer size, and also by reds.c
// other options: is to make a reds_main_consts.h, to duplicate defines.
#define REDS_AGENT_WINDOW_SIZE 10
diff --git a/server/main-dispatcher.h b/server/main-dispatcher.h
index 088a5c21..994a9fb1 100644
--- a/server/main-dispatcher.h
+++ b/server/main-dispatcher.h
@@ -23,18 +23,9 @@
#include "dispatcher.h"
#include "red-channel.h"
+GOBJECT_DECLARE_TYPE(MainDispatcher, main_dispatcher, MAIN_DISPATCHER);
#define TYPE_MAIN_DISPATCHER main_dispatcher_get_type()
-#define MAIN_DISPATCHER(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), TYPE_MAIN_DISPATCHER, MainDispatcher))
-#define MAIN_DISPATCHER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), TYPE_MAIN_DISPATCHER, MainDispatcherClass))
-#define IS_MAIN_DISPATCHER(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), TYPE_MAIN_DISPATCHER))
-#define IS_MAIN_DISPATCHER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), TYPE_MAIN_DISPATCHER))
-#define MAIN_DISPATCHER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), TYPE_MAIN_DISPATCHER, MainDispatcherClass))
-
-typedef struct MainDispatcher MainDispatcher;
-typedef struct MainDispatcherClass MainDispatcherClass;
-typedef struct MainDispatcherPrivate MainDispatcherPrivate;
-
struct MainDispatcher
{
Dispatcher parent;
@@ -47,8 +38,6 @@ struct MainDispatcherClass
DispatcherClass parent_class;
};
-GType main_dispatcher_get_type(void) G_GNUC_CONST;
-
void main_dispatcher_channel_event(MainDispatcher *self, int event, SpiceChannelEventInfo *info);
void main_dispatcher_seamless_migrate_dst_complete(MainDispatcher *self, RedClient *client);
void main_dispatcher_set_mm_time_latency(MainDispatcher *self, RedClient *client, uint32_t latency);
diff --git a/server/red-channel-client.h b/server/red-channel-client.h
index 3665dacc..09caef88 100644
--- a/server/red-channel-client.h
+++ b/server/red-channel-client.h
@@ -30,22 +30,7 @@ G_BEGIN_DECLS
#define RED_TYPE_CHANNEL_CLIENT red_channel_client_get_type()
-#define RED_CHANNEL_CLIENT(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST((obj), RED_TYPE_CHANNEL_CLIENT, RedChannelClient))
-#define RED_CHANNEL_CLIENT_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST((klass), RED_TYPE_CHANNEL_CLIENT, RedChannelClientClass))
-#define RED_IS_CHANNEL_CLIENT(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE((obj), RED_TYPE_CHANNEL_CLIENT))
-#define RED_IS_CHANNEL_CLIENT_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE((klass), RED_TYPE_CHANNEL_CLIENT))
-#define RED_CHANNEL_CLIENT_GET_CLASS(obj) \
- (G_TYPE_INSTANCE_GET_CLASS((obj), RED_TYPE_CHANNEL_CLIENT, RedChannelClientClass))
-
-typedef struct RedChannelClient RedChannelClient;
-typedef struct RedChannelClientClass RedChannelClientClass;
-typedef struct RedChannelClientPrivate RedChannelClientPrivate;
-
-GType red_channel_client_get_type(void) G_GNUC_CONST;
+GOBJECT_DECLARE_TYPE(RedChannelClient, red_channel_client, RED_CHANNEL_CLIENT);
gboolean red_channel_client_is_connected(RedChannelClient *rcc);
void red_channel_client_default_migrate(RedChannelClient *rcc);
diff --git a/server/red-channel.h b/server/red-channel.h
index 8ea5a711..2a45bd98 100644
--- a/server/red-channel.h
+++ b/server/red-channel.h
@@ -38,7 +38,9 @@
G_BEGIN_DECLS
-typedef struct RedChannel RedChannel;
+GOBJECT_DECLARE_TYPE(RedChannel, red_channel, RED_CHANNEL);
+#define RED_TYPE_CHANNEL red_channel_get_type()
+
typedef struct RedChannelClient RedChannelClient;
typedef struct RedClient RedClient;
typedef struct MainChannelClient MainChannelClient;
@@ -76,19 +78,6 @@ static inline gboolean test_capability(const uint32_t *caps, int num_caps, uint3
return VD_AGENT_HAS_CAPABILITY(caps, num_caps, cap);
}
-#define RED_TYPE_CHANNEL red_channel_get_type()
-
-#define RED_CHANNEL(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), RED_TYPE_CHANNEL, RedChannel))
-#define RED_CHANNEL_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST((klass), RED_TYPE_CHANNEL, RedChannelClass))
-#define RED_IS_CHANNEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), RED_TYPE_CHANNEL))
-#define RED_IS_CHANNEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), RED_TYPE_CHANNEL))
-#define RED_CHANNEL_GET_CLASS(obj) \
- (G_TYPE_INSTANCE_GET_CLASS((obj), RED_TYPE_CHANNEL, RedChannelClass))
-
-typedef struct RedChannelClass RedChannelClass;
-typedef struct RedChannelPrivate RedChannelPrivate;
-
struct RedChannel
{
GObject parent;
@@ -126,8 +115,6 @@ struct RedChannelClass
/* Red Channel interface */
-GType red_channel_get_type(void) G_GNUC_CONST;
-
void red_channel_add_client(RedChannel *channel, RedChannelClient *rcc);
void red_channel_remove_client(RedChannel *channel, RedChannelClient *rcc);
diff --git a/server/red-client.h b/server/red-client.h
index 20e2dc26..005417ac 100644
--- a/server/red-client.h
+++ b/server/red-client.h
@@ -25,20 +25,9 @@
G_BEGIN_DECLS
+GOBJECT_DECLARE_TYPE(RedClient, red_client, RED_CLIENT);
#define RED_TYPE_CLIENT red_client_get_type()
-#define RED_CLIENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RED_TYPE_CLIENT, RedClient))
-#define RED_CLIENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RED_TYPE_CLIENT, RedClientClass))
-#define RED_IS_CLIENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RED_TYPE_CLIENT))
-#define RED_IS_CLIENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RED_TYPE_CLIENT))
-#define RED_CLIENT_GET_CLASS(obj) \
- (G_TYPE_INSTANCE_GET_CLASS ((obj), RED_TYPE_CLIENT, RedClientClass))
-
-typedef struct RedClient RedClient;
-typedef struct RedClientClass RedClientClass;
-
-GType red_client_get_type (void) G_GNUC_CONST;
-
RedClient *red_client_new(RedsState *reds, int migrated);
/*
diff --git a/server/reds.c b/server/reds.c
index b6ecc6c6..366b1bcd 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -261,17 +261,9 @@ typedef struct __attribute__ ((__packed__)) VDInternalBuf {
u;
} VDInternalBuf;
+GOBJECT_DECLARE_TYPE(RedCharDeviceVDIPort, red_char_device_vdi_port, RED_CHAR_DEVICE_VDIPORT);
#define RED_TYPE_CHAR_DEVICE_VDIPORT red_char_device_vdi_port_get_type()
-#define RED_CHAR_DEVICE_VDIPORT(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), RED_TYPE_CHAR_DEVICE_VDIPORT, RedCharDeviceVDIPort))
-#define RED_CHAR_DEVICE_VDIPORT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), RED_TYPE_CHAR_DEVICE_VDIPORT, RedCharDeviceVDIPortClass))
-#define RED_IS_CHAR_DEVICE_VDIPORT(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), RED_TYPE_CHAR_DEVICE_VDIPORT))
-#define RED_IS_CHAR_DEVICE_VDIPORT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), RED_TYPE_CHAR_DEVICE_VDIPORT))
-#define RED_CHAR_DEVICE_VDIPORT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), RED_TYPE_CHAR_DEVICE_VDIPORT, RedCharDeviceVDIPortClass))
-
-typedef struct RedCharDeviceVDIPortClass RedCharDeviceVDIPortClass;
-typedef struct RedCharDeviceVDIPortPrivate RedCharDeviceVDIPortPrivate;
-
struct RedCharDeviceVDIPort
{
RedCharDevice parent;
@@ -284,8 +276,6 @@ struct RedCharDeviceVDIPortClass
RedCharDeviceClass parent_class;
};
-static GType red_char_device_vdi_port_get_type(void) G_GNUC_CONST;
-
G_DEFINE_TYPE(RedCharDeviceVDIPort, red_char_device_vdi_port, RED_TYPE_CHAR_DEVICE)
#define RED_CHAR_DEVICE_VDIPORT_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), RED_TYPE_CHAR_DEVICE_VDIPORT, RedCharDeviceVDIPortPrivate))
diff --git a/server/smartcard-channel-client.h b/server/smartcard-channel-client.h
index fffad231..2e89ff74 100644
--- a/server/smartcard-channel-client.h
+++ b/server/smartcard-channel-client.h
@@ -24,23 +24,9 @@
G_BEGIN_DECLS
+GOBJECT_DECLARE_TYPE(SmartCardChannelClient, smart_card_channel_client, SMARTCARD_CHANNEL_CLIENT);
#define TYPE_SMARTCARD_CHANNEL_CLIENT smart_card_channel_client_get_type()
-#define SMARTCARD_CHANNEL_CLIENT(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST((obj), TYPE_SMARTCARD_CHANNEL_CLIENT, SmartCardChannelClient))
-#define SMARTCARD_CHANNEL_CLIENT_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST((klass), TYPE_SMARTCARD_CHANNEL_CLIENT, SmartCardChannelClientClass))
-#define IS_SMARTCARD_CHANNEL_CLIENT(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE((obj), TYPE_SMARTCARD_CHANNEL_CLIENT))
-#define IS_SMARTCARD_CHANNEL_CLIENT_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE((klass), TYPE_SMARTCARD_CHANNEL_CLIENT))
-#define SMARTCARD_CHANNEL_CLIENT_GET_CLASS(obj) \
- (G_TYPE_INSTANCE_GET_CLASS((obj), TYPE_SMARTCARD_CHANNEL_CLIENT, SmartCardChannelClientClass))
-
-typedef struct SmartCardChannelClient SmartCardChannelClient;
-typedef struct SmartCardChannelClientClass SmartCardChannelClientClass;
-typedef struct SmartCardChannelClientPrivate SmartCardChannelClientPrivate;
-
struct SmartCardChannelClient
{
RedChannelClient parent;
@@ -53,8 +39,6 @@ struct SmartCardChannelClientClass
RedChannelClientClass parent_class;
};
-GType smart_card_channel_client_get_type(void) G_GNUC_CONST;
-
SmartCardChannelClient* smartcard_channel_client_create(RedChannel *channel,
RedClient *client, RedsStream *stream,
RedChannelCapabilities *caps);
diff --git a/server/smartcard.c b/server/smartcard.c
index 73f24851..7b5f448d 100644
--- a/server/smartcard.c
+++ b/server/smartcard.c
@@ -49,22 +49,9 @@
// Maximal length of APDU
#define APDUBufSize 270
+GOBJECT_DECLARE_TYPE(RedSmartcardChannel, red_smartcard_channel, RED_SMARTCARD_CHANNEL);
#define RED_TYPE_SMARTCARD_CHANNEL red_smartcard_channel_get_type()
-#define RED_SMARTCARD_CHANNEL(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST((obj), RED_TYPE_SMARTCARD_CHANNEL, RedSmartcardChannel))
-#define RED_SMARTCARD_CHANNEL_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST((klass), RED_TYPE_SMARTCARD_CHANNEL, RedSmartcardChannelClass))
-#define RED_IS_SMARTCARD_CHANNEL(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE((obj), RED_TYPE_SMARTCARD_CHANNEL))
-#define RED_IS_SMARTCARD_CHANNEL_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE((klass), RED_TYPE_SMARTCARD_CHANNEL))
-#define RED_SMARTCARD_CHANNEL_GET_CLASS(obj) \
- (G_TYPE_INSTANCE_GET_CLASS((obj), RED_TYPE_SMARTCARD_CHANNEL, RedSmartcardChannelClass))
-
-typedef struct RedSmartcardChannel RedSmartcardChannel;
-typedef struct RedSmartcardChannelClass RedSmartcardChannelClass;
-
struct RedSmartcardChannel
{
RedChannel parent;
@@ -75,8 +62,6 @@ struct RedSmartcardChannelClass
RedChannelClass parent_class;
};
-GType red_smartcard_channel_get_type(void) G_GNUC_CONST;
-
G_DEFINE_TYPE(RedSmartcardChannel, red_smartcard_channel, RED_TYPE_CHANNEL)
static void
@@ -300,7 +285,7 @@ static RedCharDeviceSmartcard *smartcard_device_new(RedsState *reds, SpiceCharDe
void smartcard_device_disconnect(SpiceCharDeviceInstance *char_device)
{
- g_return_if_fail(RED_IS_CHAR_DEVICE_SMARTCARD(char_device->st));
+ g_return_if_fail(IS_RED_CHAR_DEVICE_SMARTCARD(char_device->st));
g_object_unref(char_device->st);
}
diff --git a/server/smartcard.h b/server/smartcard.h
index 11d334f1..68e67876 100644
--- a/server/smartcard.h
+++ b/server/smartcard.h
@@ -24,17 +24,9 @@
#include "char-device.h"
#include "red-channel-client.h"
+GOBJECT_DECLARE_TYPE(RedCharDeviceSmartcard, red_char_device_smartcard, RED_CHAR_DEVICE_SMARTCARD);
#define RED_TYPE_CHAR_DEVICE_SMARTCARD red_char_device_smartcard_get_type()
-#define RED_CHAR_DEVICE_SMARTCARD(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), RED_TYPE_CHAR_DEVICE_SMARTCARD, RedCharDeviceSmartcard))
-#define RED_CHAR_DEVICE_SMARTCARD_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), RED_TYPE_CHAR_DEVICE_SMARTCARD, RedCharDeviceSmartcardClass))
-#define RED_IS_CHAR_DEVICE_SMARTCARD(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), RED_TYPE_CHAR_DEVICE_SMARTCARD))
-#define RED_IS_CHAR_DEVICE_SMARTCARD_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), RED_TYPE_CHAR_DEVICE_SMARTCARD))
-#define RED_CHAR_DEVICE_SMARTCARD_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), RED_TYPE_CHAR_DEVICE_SMARTCARD, RedCharDeviceSmartcardClass))
-
-typedef struct RedCharDeviceSmartcard RedCharDeviceSmartcard;
-typedef struct RedCharDeviceSmartcardClass RedCharDeviceSmartcardClass;
-typedef struct RedCharDeviceSmartcardPrivate RedCharDeviceSmartcardPrivate;
typedef struct SmartCardChannelClient SmartCardChannelClient;
struct RedCharDeviceSmartcard
@@ -49,8 +41,6 @@ struct RedCharDeviceSmartcardClass
RedCharDeviceClass parent_class;
};
-GType red_char_device_smartcard_get_type(void) G_GNUC_CONST;
-
/*
* connect to smartcard interface, used by smartcard channel
*/
diff --git a/server/sound.c b/server/sound.c
index de51a467..68615a66 100644
--- a/server/sound.c
+++ b/server/sound.c
@@ -65,22 +65,32 @@ enum PlaybackCommand {
#define SND_PLAYBACK_PCM_MASK (1 << SND_PLAYBACK_PCM)
#define SND_PLAYBACK_LATENCY_MASK ( 1 << SND_PLAYBACK_LATENCY)
-typedef struct SndChannelClient SndChannelClient;
-typedef struct SndChannel SndChannel;
-typedef struct PlaybackChannelClient PlaybackChannelClient;
-typedef struct RecordChannelClient RecordChannelClient;
+
typedef struct AudioFrame AudioFrame;
typedef struct AudioFrameContainer AudioFrameContainer;
typedef struct SpicePlaybackState PlaybackChannel;
typedef struct SpiceRecordState RecordChannel;
-typedef void (*snd_channel_on_message_done_proc)(SndChannelClient *client);
+GOBJECT_DECLARE_TYPE(SndChannelClient, snd_channel_client, SND_CHANNEL_CLIENT);
+#define TYPE_SND_CHANNEL_CLIENT snd_channel_client_get_type()
+
+GOBJECT_DECLARE_TYPE(PlaybackChannelClient, playback_channel_client, PLAYBACK_CHANNEL_CLIENT)
+#define TYPE_PLAYBACK_CHANNEL_CLIENT playback_channel_client_get_type()
+GOBJECT_DECLARE_TYPE(SndChannel, snd_channel, SND_CHANNEL)
+#define TYPE_SND_CHANNEL snd_channel_get_type()
+
+GOBJECT_DECLARE_TYPE_STRUCT(PlaybackChannel, playback_channel, PLAYBACK_CHANNEL, SpicePlaybackState)
+#define TYPE_PLAYBACK_CHANNEL playback_channel_get_type()
+
+GOBJECT_DECLARE_TYPE_STRUCT(RecordChannel, record_channel, RECORD_CHANNEL, SpiceRecordState)
+#define TYPE_RECORD_CHANNEL record_channel_get_type()
+
+GOBJECT_DECLARE_TYPE(RecordChannelClient, record_channel_client, RECORD_CHANNEL_CLIENT)
+#define TYPE_RECORD_CHANNEL_CLIENT record_channel_client_get_type()
+
+typedef void (*snd_channel_on_message_done_proc)(SndChannelClient *client);
-#define TYPE_SND_CHANNEL_CLIENT snd_channel_client_get_type()
-#define SND_CHANNEL_CLIENT(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST((obj), TYPE_SND_CHANNEL_CLIENT, SndChannelClient))
-GType snd_channel_client_get_type(void) G_GNUC_CONST;
/* Connects an audio client to a Spice client */
struct SndChannelClient {
@@ -99,9 +109,9 @@ struct SndChannelClient {
snd_channel_on_message_done_proc on_message_done;
};
-typedef struct SndChannelClientClass {
+struct SndChannelClientClass {
RedChannelClientClass parent_class;
-} SndChannelClientClass;
+};
G_DEFINE_TYPE(SndChannelClient, snd_channel_client, RED_TYPE_CHANNEL_CLIENT)
@@ -127,11 +137,6 @@ struct AudioFrameContainer
AudioFrame items[NUM_AUDIO_FRAMES];
};
-#define TYPE_PLAYBACK_CHANNEL_CLIENT playback_channel_client_get_type()
-#define PLAYBACK_CHANNEL_CLIENT(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST((obj), TYPE_PLAYBACK_CHANNEL_CLIENT, PlaybackChannelClient))
-GType playback_channel_client_get_type(void) G_GNUC_CONST;
-
struct PlaybackChannelClient {
SndChannelClient parent;
@@ -145,9 +150,9 @@ struct PlaybackChannelClient {
uint8_t encode_buf[SND_CODEC_MAX_COMPRESSED_BYTES];
};
-typedef struct PlaybackChannelClientClass {
+struct PlaybackChannelClientClass {
SndChannelClientClass parent_class;
-} PlaybackChannelClientClass;
+};
G_DEFINE_TYPE(PlaybackChannelClient, playback_channel_client, TYPE_SND_CHANNEL_CLIENT)
@@ -158,10 +163,6 @@ typedef struct SpiceVolumeState {
int mute;
} SpiceVolumeState;
-#define TYPE_SND_CHANNEL snd_channel_get_type()
-#define SND_CHANNEL(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), TYPE_SND_CHANNEL, SndChannel))
-GType snd_channel_get_type(void) G_GNUC_CONST;
-
/* Base class for SpicePlaybackState and SpiceRecordState */
struct SndChannel {
RedChannel parent;
@@ -171,49 +172,35 @@ struct SndChannel {
uint32_t frequency;
};
-typedef struct SndChannelClass {
+struct SndChannelClass {
RedChannelClass parent_class;
-} SndChannelClass;
+};
G_DEFINE_TYPE(SndChannel, snd_channel, RED_TYPE_CHANNEL)
-#define TYPE_PLAYBACK_CHANNEL playback_channel_get_type()
-#define PLAYBACK_CHANNEL(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST((obj), TYPE_PLAYBACK_CHANNEL, PlaybackChannel))
-GType playback_channel_get_type(void) G_GNUC_CONST;
-
struct SpicePlaybackState {
SndChannel channel;
};
-typedef struct PlaybackChannelClass {
+struct PlaybackChannelClass {
SndChannelClass parent_class;
-} PlaybackChannelClass;
+};
G_DEFINE_TYPE(PlaybackChannel, playback_channel, TYPE_SND_CHANNEL)
-#define TYPE_RECORD_CHANNEL record_channel_get_type()
-#define RECORD_CHANNEL(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), TYPE_RECORD_CHANNEL, RecordChannel))
-GType record_channel_get_type(void) G_GNUC_CONST;
-
struct SpiceRecordState {
SndChannel channel;
};
-typedef struct RecordChannelClass {
+struct RecordChannelClass {
SndChannelClass parent_class;
-} RecordChannelClass;
+};
G_DEFINE_TYPE(RecordChannel, record_channel, TYPE_SND_CHANNEL)
-#define TYPE_RECORD_CHANNEL_CLIENT record_channel_client_get_type()
-#define RECORD_CHANNEL_CLIENT(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST((obj), TYPE_RECORD_CHANNEL_CLIENT, RecordChannelClient))
-GType record_channel_client_get_type(void) G_GNUC_CONST;
-
struct RecordChannelClient {
SndChannelClient parent;
uint32_t samples[RECORD_SAMPLES_SIZE];
@@ -226,9 +213,9 @@ struct RecordChannelClient {
uint8_t decode_buf[SND_CODEC_MAX_FRAME_BYTES];
};
-typedef struct RecordChannelClientClass {
+struct RecordChannelClientClass {
SndChannelClientClass parent_class;
-} RecordChannelClientClass;
+};
G_DEFINE_TYPE(RecordChannelClient, record_channel_client, TYPE_SND_CHANNEL_CLIENT)
@@ -651,7 +638,7 @@ static void snd_send(SndChannelClient * client)
{
RedChannelClient *rcc;
- g_return_if_fail(RED_IS_CHANNEL_CLIENT(client));
+ g_return_if_fail(IS_RED_CHANNEL_CLIENT(client));
rcc = RED_CHANNEL_CLIENT(client);
if (!red_channel_client_pipe_is_empty(rcc) || !client->command) {
diff --git a/server/spicevmc.c b/server/spicevmc.c
index 6b9b96fc..9677d356 100644
--- a/server/spicevmc.c
+++ b/server/spicevmc.c
@@ -44,8 +44,23 @@
#define BUF_SIZE (64 * 1024 + 32)
#define COMPRESS_THRESHOLD 1000
-typedef struct RedVmcChannel RedVmcChannel;
-typedef struct RedVmcChannelClass RedVmcChannelClass;
+GOBJECT_DECLARE_TYPE(RedCharDeviceSpiceVmc, red_char_device_spicevmc, RED_CHAR_DEVICE_SPICEVMC);
+#define RED_TYPE_CHAR_DEVICE_SPICEVMC red_char_device_spicevmc_get_type()
+
+GOBJECT_DECLARE_TYPE(RedVmcChannel, red_vmc_channel, RED_VMC_CHANNEL);
+#define RED_TYPE_VMC_CHANNEL red_vmc_channel_get_type()
+
+GOBJECT_DECLARE_TYPE(RedVmcChannelPort, red_vmc_channel_port, RED_VMC_CHANNEL_PORT);
+#define RED_TYPE_VMC_CHANNEL_PORT red_vmc_channel_port_get_type()
+
+GOBJECT_DECLARE_TYPE(VmcChannelClient, vmc_channel_client, VMC_CHANNEL_CLIENT);
+#define TYPE_VMC_CHANNEL_CLIENT vmc_channel_client_get_type()
+
+GOBJECT_DECLARE_TYPE(RedVmcChannelUsbredir, red_vmc_channel_usbredir, RED_VMC_CHANNEL_USBREDIR);
+#define RED_TYPE_VMC_CHANNEL_USBREDIR red_vmc_channel_usbredir_get_type()
+
+GOBJECT_DECLARE_TYPE(RedVmcChannelWebdav, red_vmc_channel_webdav, RED_VMC_CHANNEL_WEBDAV);
+#define RED_TYPE_VMC_CHANNEL_WEBDAV red_vmc_channel_webdav_get_type()
typedef struct RedVmcPipeItem {
RedPipeItem base;
@@ -57,22 +72,6 @@ typedef struct RedVmcPipeItem {
uint32_t buf_used;
} RedVmcPipeItem;
-#define RED_TYPE_CHAR_DEVICE_SPICEVMC red_char_device_spicevmc_get_type()
-
-#define RED_CHAR_DEVICE_SPICEVMC(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST((obj), RED_TYPE_CHAR_DEVICE_SPICEVMC, RedCharDeviceSpiceVmc))
-#define RED_CHAR_DEVICE_SPICEVMC_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST((klass), RED_TYPE_CHAR_DEVICE_SPICEVMC, RedCharDeviceSpiceVmcClass))
-#define RED_IS_CHAR_DEVICE_SPICEVMC(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE((obj), RED_TYPE_CHAR_DEVICE_SPICEVMC))
-#define RED_IS_CHAR_DEVICE_SPICEVMC_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE((klass), RED_TYPE_CHAR_DEVICE_SPICEVMC))
-#define RED_CHAR_DEVICE_SPICEVMC_GET_CLASS(obj) \
- (G_TYPE_INSTANCE_GET_CLASS((obj), RED_TYPE_CHAR_DEVICE_SPICEVMC, RedCharDeviceSpiceVmcClass))
-
-typedef struct RedCharDeviceSpiceVmc RedCharDeviceSpiceVmc;
-typedef struct RedCharDeviceSpiceVmcClass RedCharDeviceSpiceVmcClass;
-
struct RedCharDeviceSpiceVmc {
RedCharDevice parent;
RedVmcChannel *channel;
@@ -83,24 +82,12 @@ struct RedCharDeviceSpiceVmcClass
RedCharDeviceClass parent_class;
};
-static GType red_char_device_spicevmc_get_type(void) G_GNUC_CONST;
static RedCharDevice *red_char_device_spicevmc_new(SpiceCharDeviceInstance *sin,
RedsState *reds,
RedVmcChannel *channel);
G_DEFINE_TYPE(RedCharDeviceSpiceVmc, red_char_device_spicevmc, RED_TYPE_CHAR_DEVICE)
-#define RED_TYPE_VMC_CHANNEL red_vmc_channel_get_type()
-
-#define RED_VMC_CHANNEL(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST((obj), RED_TYPE_VMC_CHANNEL, RedVmcChannel))
-#define RED_VMC_CHANNEL_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST((klass), RED_TYPE_VMC_CHANNEL, RedVmcChannelClass))
-#define RED_IS_VMC_CHANNEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), RED_TYPE_VMC_CHANNEL))
-#define RED_IS_VMC_CHANNEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), RED_TYPE_VMC_CHANNEL))
-#define RED_VMC_CHANNEL_GET_CLASS(obj) \
- (G_TYPE_INSTANCE_GET_CLASS((obj), RED_TYPE_VMC_CHANNEL, RedVmcChannelClass))
-
struct RedVmcChannel
{
RedChannel parent;
@@ -124,81 +111,56 @@ struct RedVmcChannelClass
RedChannelClass parent_class;
};
-GType red_vmc_channel_get_type(void) G_GNUC_CONST;
-
G_DEFINE_TYPE(RedVmcChannel, red_vmc_channel, RED_TYPE_CHANNEL)
-#define RED_TYPE_VMC_CHANNEL_USBREDIR red_vmc_channel_usbredir_get_type()
-typedef struct
+struct RedVmcChannelUsbredir
{
RedVmcChannel parent;
-} RedVmcChannelUsbredir;
+};
-typedef struct
+struct RedVmcChannelUsbredirClass
{
RedVmcChannelClass parent_class;
-} RedVmcChannelUsbredirClass;
+};
-GType red_vmc_channel_usbredir_get_type(void) G_GNUC_CONST;
static void red_vmc_channel_usbredir_init(RedVmcChannelUsbredir *self)
{
}
G_DEFINE_TYPE(RedVmcChannelUsbredir, red_vmc_channel_usbredir, RED_TYPE_VMC_CHANNEL)
-#define RED_TYPE_VMC_CHANNEL_WEBDAV red_vmc_channel_webdav_get_type()
-typedef struct
+struct RedVmcChannelWebdav
{
RedVmcChannel parent;
-} RedVmcChannelWebdav;
+};
-typedef struct
+struct RedVmcChannelWebdavClass
{
RedVmcChannelClass parent_class;
-} RedVmcChannelWebdavClass;
+};
-GType red_vmc_channel_webdav_get_type(void) G_GNUC_CONST;
static void red_vmc_channel_webdav_init(RedVmcChannelWebdav *self)
{
}
G_DEFINE_TYPE(RedVmcChannelWebdav, red_vmc_channel_webdav, RED_TYPE_VMC_CHANNEL)
-#define RED_TYPE_VMC_CHANNEL_PORT red_vmc_channel_port_get_type()
-typedef struct
+struct RedVmcChannelPort
{
RedVmcChannel parent;
-} RedVmcChannelPort;
+};
-typedef struct
+struct RedVmcChannelPortClass
{
RedVmcChannelClass parent_class;
-} RedVmcChannelPortClass;
+};
-GType red_vmc_channel_port_get_type(void) G_GNUC_CONST;
static void red_vmc_channel_port_init(RedVmcChannelPort *self)
{
}
G_DEFINE_TYPE(RedVmcChannelPort, red_vmc_channel_port, RED_TYPE_VMC_CHANNEL)
-#define TYPE_VMC_CHANNEL_CLIENT vmc_channel_client_get_type()
-
-#define VMC_CHANNEL_CLIENT(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST((obj), TYPE_VMC_CHANNEL_CLIENT, VmcChannelClient))
-#define VMC_CHANNEL_CLIENT_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST((klass), TYPE_VMC_CHANNEL_CLIENT, VmcChannelClientClass))
-#define COMMON_IS_GRAPHICS_CHANNEL_CLIENT(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE((obj), TYPE_VMC_CHANNEL_CLIENT))
-#define COMMON_IS_GRAPHICS_CHANNEL_CLIENT_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE((klass), TYPE_VMC_CHANNEL_CLIENT))
-#define VMC_CHANNEL_CLIENT_GET_CLASS(obj) \
- (G_TYPE_INSTANCE_GET_CLASS((obj), TYPE_VMC_CHANNEL_CLIENT, VmcChannelClientClass))
-
-typedef struct VmcChannelClient VmcChannelClient;
-typedef struct VmcChannelClientClass VmcChannelClientClass;
-typedef struct VmcChannelClientPrivate VmcChannelClientPrivate;
-
struct VmcChannelClient {
RedChannelClient parent;
};
@@ -207,8 +169,6 @@ struct VmcChannelClientClass {
RedChannelClientClass parent_class;
};
-GType vmc_channel_client_get_type(void) G_GNUC_CONST;
-
G_DEFINE_TYPE(VmcChannelClient, vmc_channel_client, RED_TYPE_CHANNEL_CLIENT)
static RedChannelClient *
--
2.13.5
More information about the Spice-devel
mailing list