gio: Use the new private instance data declaration

Use the newly added macros, and remove the explicit calls to
g_type_class_add_private().

https://bugzilla.gnome.org/show_bug.cgi?id=700035
This commit is contained in:
Emmanuele Bassi 2013-06-11 00:29:58 +01:00
parent aba80eea6c
commit 32747def4b
76 changed files with 387 additions and 730 deletions

View File

@ -788,14 +788,14 @@ enum {
LAST_SIGNAL LAST_SIGNAL
}; };
guint signals[LAST_SIGNAL] = { 0 };
G_DEFINE_TYPE (GAppLaunchContext, g_app_launch_context, G_TYPE_OBJECT);
struct _GAppLaunchContextPrivate { struct _GAppLaunchContextPrivate {
char **envp; char **envp;
}; };
static guint signals[LAST_SIGNAL] = { 0 };
G_DEFINE_TYPE_WITH_PRIVATE (GAppLaunchContext, g_app_launch_context, G_TYPE_OBJECT)
/** /**
* g_app_launch_context_new: * g_app_launch_context_new:
* *
@ -825,8 +825,6 @@ g_app_launch_context_class_init (GAppLaunchContextClass *klass)
{ {
GObjectClass *object_class = G_OBJECT_CLASS (klass); GObjectClass *object_class = G_OBJECT_CLASS (klass);
g_type_class_add_private (klass, sizeof (GAppLaunchContextPrivate));
object_class->finalize = g_app_launch_context_finalize; object_class->finalize = g_app_launch_context_finalize;
/* /*
@ -873,7 +871,7 @@ g_app_launch_context_class_init (GAppLaunchContextClass *klass)
static void static void
g_app_launch_context_init (GAppLaunchContext *context) g_app_launch_context_init (GAppLaunchContext *context)
{ {
context->priv = G_TYPE_INSTANCE_GET_PRIVATE (context, G_TYPE_APP_LAUNCH_CONTEXT, GAppLaunchContextPrivate); context->priv = g_app_launch_context_get_private (context);
} }
/** /**

View File

@ -278,6 +278,7 @@ static guint g_application_signals[NR_SIGNALS];
static void g_application_action_group_iface_init (GActionGroupInterface *); static void g_application_action_group_iface_init (GActionGroupInterface *);
static void g_application_action_map_iface_init (GActionMapInterface *); static void g_application_action_map_iface_init (GActionMapInterface *);
G_DEFINE_TYPE_WITH_CODE (GApplication, g_application, G_TYPE_OBJECT, G_DEFINE_TYPE_WITH_CODE (GApplication, g_application, G_TYPE_OBJECT,
G_ADD_PRIVATE (GApplication)
G_IMPLEMENT_INTERFACE (G_TYPE_ACTION_GROUP, g_application_action_group_iface_init) G_IMPLEMENT_INTERFACE (G_TYPE_ACTION_GROUP, g_application_action_group_iface_init)
G_IMPLEMENT_INTERFACE (G_TYPE_ACTION_MAP, g_application_action_map_iface_init)) G_IMPLEMENT_INTERFACE (G_TYPE_ACTION_MAP, g_application_action_map_iface_init))
@ -692,9 +693,7 @@ g_application_finalize (GObject *object)
static void static void
g_application_init (GApplication *application) g_application_init (GApplication *application)
{ {
application->priv = G_TYPE_INSTANCE_GET_PRIVATE (application, application->priv = g_application_get_private (application);
G_TYPE_APPLICATION,
GApplicationPrivate);
application->priv->actions = g_application_exported_actions_new (application); application->priv->actions = g_application_exported_actions_new (application);
@ -845,8 +844,6 @@ g_application_class_init (GApplicationClass *class)
g_signal_accumulator_first_wins, NULL, g_signal_accumulator_first_wins, NULL,
NULL, NULL,
G_TYPE_INT, 1, G_TYPE_APPLICATION_COMMAND_LINE); G_TYPE_INT, 1, G_TYPE_APPLICATION_COMMAND_LINE);
g_type_class_add_private (class, sizeof (GApplicationPrivate));
} }
static GVariant * static GVariant *

View File

@ -39,8 +39,6 @@
#include "gwin32inputstream.h" #include "gwin32inputstream.h"
#endif #endif
G_DEFINE_TYPE (GApplicationCommandLine, g_application_command_line, G_TYPE_OBJECT)
/** /**
* SECTION:gapplicationcommandline * SECTION:gapplicationcommandline
* @title: GApplicationCommandLine * @title: GApplicationCommandLine
@ -156,6 +154,8 @@ struct _GApplicationCommandLinePrivate
gint exit_status; gint exit_status;
}; };
G_DEFINE_TYPE_WITH_PRIVATE (GApplicationCommandLine, g_application_command_line, G_TYPE_OBJECT)
/* All subclasses represent remote invocations of some kind. */ /* All subclasses represent remote invocations of some kind. */
#define IS_REMOTE(cmdline) (G_TYPE_FROM_INSTANCE (cmdline) != \ #define IS_REMOTE(cmdline) (G_TYPE_FROM_INSTANCE (cmdline) != \
G_TYPE_APPLICATION_COMMAND_LINE) G_TYPE_APPLICATION_COMMAND_LINE)
@ -282,10 +282,7 @@ g_application_command_line_finalize (GObject *object)
static void static void
g_application_command_line_init (GApplicationCommandLine *cmdline) g_application_command_line_init (GApplicationCommandLine *cmdline)
{ {
cmdline->priv = cmdline->priv = g_application_command_line_get_private (cmdline);
G_TYPE_INSTANCE_GET_PRIVATE (cmdline,
G_TYPE_APPLICATION_COMMAND_LINE,
GApplicationCommandLinePrivate);
} }
static void static void
@ -340,8 +337,6 @@ g_application_command_line_class_init (GApplicationCommandLineClass *class)
P_("TRUE if this is a remote commandline"), P_("TRUE if this is a remote commandline"),
FALSE, FALSE,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)); G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
g_type_class_add_private (class, sizeof (GApplicationCommandLinePrivate));
} }

View File

@ -136,6 +136,7 @@ static void compact_buffer (GBufferedInputStream *stream);
G_DEFINE_TYPE_WITH_CODE (GBufferedInputStream, G_DEFINE_TYPE_WITH_CODE (GBufferedInputStream,
g_buffered_input_stream, g_buffered_input_stream,
G_TYPE_FILTER_INPUT_STREAM, G_TYPE_FILTER_INPUT_STREAM,
G_ADD_PRIVATE (GBufferedInputStream)
G_IMPLEMENT_INTERFACE (G_TYPE_SEEKABLE, G_IMPLEMENT_INTERFACE (G_TYPE_SEEKABLE,
g_buffered_input_stream_seekable_iface_init)) g_buffered_input_stream_seekable_iface_init))
@ -146,8 +147,6 @@ g_buffered_input_stream_class_init (GBufferedInputStreamClass *klass)
GInputStreamClass *istream_class; GInputStreamClass *istream_class;
GBufferedInputStreamClass *bstream_class; GBufferedInputStreamClass *bstream_class;
g_type_class_add_private (klass, sizeof (GBufferedInputStreamPrivate));
object_class = G_OBJECT_CLASS (klass); object_class = G_OBJECT_CLASS (klass);
object_class->get_property = g_buffered_input_stream_get_property; object_class->get_property = g_buffered_input_stream_get_property;
object_class->set_property = g_buffered_input_stream_set_property; object_class->set_property = g_buffered_input_stream_set_property;
@ -317,9 +316,7 @@ g_buffered_input_stream_seekable_iface_init (GSeekableIface *iface)
static void static void
g_buffered_input_stream_init (GBufferedInputStream *stream) g_buffered_input_stream_init (GBufferedInputStream *stream)
{ {
stream->priv = G_TYPE_INSTANCE_GET_PRIVATE (stream, stream->priv = g_buffered_input_stream_get_private (stream);
G_TYPE_BUFFERED_INPUT_STREAM,
GBufferedInputStreamPrivate);
} }

View File

@ -124,6 +124,7 @@ static gboolean g_buffered_output_stream_truncate (GSeekable *s
G_DEFINE_TYPE_WITH_CODE (GBufferedOutputStream, G_DEFINE_TYPE_WITH_CODE (GBufferedOutputStream,
g_buffered_output_stream, g_buffered_output_stream,
G_TYPE_FILTER_OUTPUT_STREAM, G_TYPE_FILTER_OUTPUT_STREAM,
G_ADD_PRIVATE (GBufferedOutputStream)
G_IMPLEMENT_INTERFACE (G_TYPE_SEEKABLE, G_IMPLEMENT_INTERFACE (G_TYPE_SEEKABLE,
g_buffered_output_stream_seekable_iface_init)) g_buffered_output_stream_seekable_iface_init))
@ -133,8 +134,6 @@ g_buffered_output_stream_class_init (GBufferedOutputStreamClass *klass)
{ {
GObjectClass *object_class; GObjectClass *object_class;
GOutputStreamClass *ostream_class; GOutputStreamClass *ostream_class;
g_type_class_add_private (klass, sizeof (GBufferedOutputStreamPrivate));
object_class = G_OBJECT_CLASS (klass); object_class = G_OBJECT_CLASS (klass);
object_class->get_property = g_buffered_output_stream_get_property; object_class->get_property = g_buffered_output_stream_get_property;
@ -345,10 +344,7 @@ g_buffered_output_stream_finalize (GObject *object)
static void static void
g_buffered_output_stream_init (GBufferedOutputStream *stream) g_buffered_output_stream_init (GBufferedOutputStream *stream)
{ {
stream->priv = G_TYPE_INSTANCE_GET_PRIVATE (stream, stream->priv = g_buffered_output_stream_get_private (stream);
G_TYPE_BUFFERED_OUTPUT_STREAM,
GBufferedOutputStreamPrivate);
} }
static void static void

View File

@ -55,7 +55,7 @@ struct _GCancellablePrivate
static guint signals[LAST_SIGNAL] = { 0 }; static guint signals[LAST_SIGNAL] = { 0 };
G_DEFINE_TYPE (GCancellable, g_cancellable, G_TYPE_OBJECT); G_DEFINE_TYPE_WITH_PRIVATE (GCancellable, g_cancellable, G_TYPE_OBJECT)
static GPrivate current_cancellable; static GPrivate current_cancellable;
static GMutex cancellable_mutex; static GMutex cancellable_mutex;
@ -77,8 +77,6 @@ g_cancellable_class_init (GCancellableClass *klass)
{ {
GObjectClass *gobject_class = G_OBJECT_CLASS (klass); GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
g_type_class_add_private (klass, sizeof (GCancellablePrivate));
gobject_class->finalize = g_cancellable_finalize; gobject_class->finalize = g_cancellable_finalize;
/** /**
@ -153,9 +151,7 @@ g_cancellable_class_init (GCancellableClass *klass)
static void static void
g_cancellable_init (GCancellable *cancellable) g_cancellable_init (GCancellable *cancellable)
{ {
cancellable->priv = G_TYPE_INSTANCE_GET_PRIVATE (cancellable, cancellable->priv = g_cancellable_get_private (cancellable);
G_TYPE_CANCELLABLE,
GCancellablePrivate);
} }
/** /**

View File

@ -99,9 +99,9 @@ static void g_converter_input_stream_pollable_iface_init (GPollableInputStreamI
G_DEFINE_TYPE_WITH_CODE (GConverterInputStream, G_DEFINE_TYPE_WITH_CODE (GConverterInputStream,
g_converter_input_stream, g_converter_input_stream,
G_TYPE_FILTER_INPUT_STREAM, G_TYPE_FILTER_INPUT_STREAM,
G_ADD_PRIVATE (GConverterInputStream)
G_IMPLEMENT_INTERFACE (G_TYPE_POLLABLE_INPUT_STREAM, G_IMPLEMENT_INTERFACE (G_TYPE_POLLABLE_INPUT_STREAM,
g_converter_input_stream_pollable_iface_init); g_converter_input_stream_pollable_iface_init))
)
static void static void
g_converter_input_stream_class_init (GConverterInputStreamClass *klass) g_converter_input_stream_class_init (GConverterInputStreamClass *klass)
@ -109,8 +109,6 @@ g_converter_input_stream_class_init (GConverterInputStreamClass *klass)
GObjectClass *object_class; GObjectClass *object_class;
GInputStreamClass *istream_class; GInputStreamClass *istream_class;
g_type_class_add_private (klass, sizeof (GConverterInputStreamPrivate));
object_class = G_OBJECT_CLASS (klass); object_class = G_OBJECT_CLASS (klass);
object_class->get_property = g_converter_input_stream_get_property; object_class->get_property = g_converter_input_stream_get_property;
object_class->set_property = g_converter_input_stream_set_property; object_class->set_property = g_converter_input_stream_set_property;
@ -207,9 +205,7 @@ g_converter_input_stream_get_property (GObject *object,
static void static void
g_converter_input_stream_init (GConverterInputStream *stream) g_converter_input_stream_init (GConverterInputStream *stream)
{ {
stream->priv = G_TYPE_INSTANCE_GET_PRIVATE (stream, stream->priv = g_converter_input_stream_get_private (stream);
G_TYPE_CONVERTER_INPUT_STREAM,
GConverterInputStreamPrivate);
} }
/** /**

View File

@ -114,9 +114,9 @@ static void g_converter_output_stream_pollable_iface_init (GPollableOutputStream
G_DEFINE_TYPE_WITH_CODE (GConverterOutputStream, G_DEFINE_TYPE_WITH_CODE (GConverterOutputStream,
g_converter_output_stream, g_converter_output_stream,
G_TYPE_FILTER_OUTPUT_STREAM, G_TYPE_FILTER_OUTPUT_STREAM,
G_ADD_PRIVATE (GConverterOutputStream)
G_IMPLEMENT_INTERFACE (G_TYPE_POLLABLE_OUTPUT_STREAM, G_IMPLEMENT_INTERFACE (G_TYPE_POLLABLE_OUTPUT_STREAM,
g_converter_output_stream_pollable_iface_init); g_converter_output_stream_pollable_iface_init))
)
static void static void
g_converter_output_stream_class_init (GConverterOutputStreamClass *klass) g_converter_output_stream_class_init (GConverterOutputStreamClass *klass)
@ -124,8 +124,6 @@ g_converter_output_stream_class_init (GConverterOutputStreamClass *klass)
GObjectClass *object_class; GObjectClass *object_class;
GOutputStreamClass *istream_class; GOutputStreamClass *istream_class;
g_type_class_add_private (klass, sizeof (GConverterOutputStreamPrivate));
object_class = G_OBJECT_CLASS (klass); object_class = G_OBJECT_CLASS (klass);
object_class->get_property = g_converter_output_stream_get_property; object_class->get_property = g_converter_output_stream_get_property;
object_class->set_property = g_converter_output_stream_set_property; object_class->set_property = g_converter_output_stream_set_property;
@ -223,9 +221,7 @@ g_converter_output_stream_get_property (GObject *object,
static void static void
g_converter_output_stream_init (GConverterOutputStream *stream) g_converter_output_stream_init (GConverterOutputStream *stream)
{ {
stream->priv = G_TYPE_INSTANCE_GET_PRIVATE (stream, stream->priv = g_converter_output_stream_get_private (stream);
G_TYPE_CONVERTER_OUTPUT_STREAM,
GConverterOutputStreamPrivate);
} }
/** /**

View File

@ -63,9 +63,9 @@ static void g_data_input_stream_get_property (GObject *object,
GValue *value, GValue *value,
GParamSpec *pspec); GParamSpec *pspec);
G_DEFINE_TYPE (GDataInputStream, G_DEFINE_TYPE_WITH_PRIVATE (GDataInputStream,
g_data_input_stream, g_data_input_stream,
G_TYPE_BUFFERED_INPUT_STREAM) G_TYPE_BUFFERED_INPUT_STREAM)
static void static void
@ -73,8 +73,6 @@ g_data_input_stream_class_init (GDataInputStreamClass *klass)
{ {
GObjectClass *object_class; GObjectClass *object_class;
g_type_class_add_private (klass, sizeof (GDataInputStreamPrivate));
object_class = G_OBJECT_CLASS (klass); object_class = G_OBJECT_CLASS (klass);
object_class->get_property = g_data_input_stream_get_property; object_class->get_property = g_data_input_stream_get_property;
object_class->set_property = g_data_input_stream_set_property; object_class->set_property = g_data_input_stream_set_property;
@ -169,10 +167,7 @@ g_data_input_stream_get_property (GObject *object,
static void static void
g_data_input_stream_init (GDataInputStream *stream) g_data_input_stream_init (GDataInputStream *stream)
{ {
stream->priv = G_TYPE_INSTANCE_GET_PRIVATE (stream, stream->priv = g_data_input_stream_get_private (stream);
G_TYPE_DATA_INPUT_STREAM,
GDataInputStreamPrivate);
stream->priv->byte_order = G_DATA_STREAM_BYTE_ORDER_BIG_ENDIAN; stream->priv->byte_order = G_DATA_STREAM_BYTE_ORDER_BIG_ENDIAN;
stream->priv->newline_type = G_DATA_STREAM_NEWLINE_TYPE_LF; stream->priv->newline_type = G_DATA_STREAM_NEWLINE_TYPE_LF;
} }

View File

@ -77,6 +77,7 @@ static gboolean g_data_output_stream_truncate (GSeekable *seeka
G_DEFINE_TYPE_WITH_CODE (GDataOutputStream, G_DEFINE_TYPE_WITH_CODE (GDataOutputStream,
g_data_output_stream, g_data_output_stream,
G_TYPE_FILTER_OUTPUT_STREAM, G_TYPE_FILTER_OUTPUT_STREAM,
G_ADD_PRIVATE (GDataOutputStream)
G_IMPLEMENT_INTERFACE (G_TYPE_SEEKABLE, G_IMPLEMENT_INTERFACE (G_TYPE_SEEKABLE,
g_data_output_stream_seekable_iface_init)) g_data_output_stream_seekable_iface_init))
@ -86,8 +87,6 @@ g_data_output_stream_class_init (GDataOutputStreamClass *klass)
{ {
GObjectClass *object_class; GObjectClass *object_class;
g_type_class_add_private (klass, sizeof (GDataOutputStreamPrivate));
object_class = G_OBJECT_CLASS (klass); object_class = G_OBJECT_CLASS (klass);
object_class->get_property = g_data_output_stream_get_property; object_class->get_property = g_data_output_stream_get_property;
object_class->set_property = g_data_output_stream_set_property; object_class->set_property = g_data_output_stream_set_property;
@ -158,10 +157,7 @@ g_data_output_stream_get_property (GObject *object,
static void static void
g_data_output_stream_init (GDataOutputStream *stream) g_data_output_stream_init (GDataOutputStream *stream)
{ {
stream->priv = G_TYPE_INSTANCE_GET_PRIVATE (stream, stream->priv = g_data_output_stream_get_private (stream);
G_TYPE_DATA_OUTPUT_STREAM,
GDataOutputStreamPrivate);
stream->priv->byte_order = G_DATA_STREAM_BYTE_ORDER_BIG_ENDIAN; stream->priv->byte_order = G_DATA_STREAM_BYTE_ORDER_BIG_ENDIAN;
} }

View File

@ -1570,6 +1570,7 @@ class CodeGenerator:
self.c.write('static void %s_proxy_iface_init (%sIface *iface);\n' self.c.write('static void %s_proxy_iface_init (%sIface *iface);\n'
'\n'%(i.name_lower, i.camel_name)) '\n'%(i.name_lower, i.camel_name))
self.c.write('G_DEFINE_TYPE_WITH_CODE (%sProxy, %s_proxy, G_TYPE_DBUS_PROXY,\n'%(i.camel_name, i.name_lower)) self.c.write('G_DEFINE_TYPE_WITH_CODE (%sProxy, %s_proxy, G_TYPE_DBUS_PROXY,\n'%(i.camel_name, i.name_lower))
self.c.write(' G_ADD_PRIVATE (%sProxy)\n'%(i.camel_name))
self.c.write(' G_IMPLEMENT_INTERFACE (%sTYPE_%s, %s_proxy_iface_init));\n\n'%(i.ns_upper, i.name_upper, i.name_lower)) self.c.write(' G_IMPLEMENT_INTERFACE (%sTYPE_%s, %s_proxy_iface_init));\n\n'%(i.ns_upper, i.name_upper, i.name_lower))
# finalize # finalize
@ -1794,12 +1795,12 @@ class CodeGenerator:
self.c.write('static void\n' self.c.write('static void\n'
'%s_proxy_init (%sProxy *proxy)\n' '%s_proxy_init (%sProxy *proxy)\n'
'{\n' '{\n'
' proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, %sTYPE_%s_PROXY, %sProxyPrivate);\n' ' proxy->priv = %s_proxy_get_private (proxy);\n'
' g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), %s_interface_info ());\n' ' g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), %s_interface_info ());\n'
'}\n' '}\n'
'\n' '\n'
%(i.name_lower, i.camel_name, %(i.name_lower, i.camel_name,
i.ns_upper, i.name_upper, i.camel_name, i.name_lower,
i.name_lower)) i.name_lower))
self.c.write('static void\n' self.c.write('static void\n'
'%s_proxy_class_init (%sProxyClass *klass)\n' '%s_proxy_class_init (%sProxyClass *klass)\n'
@ -1807,8 +1808,6 @@ class CodeGenerator:
' GObjectClass *gobject_class;\n' ' GObjectClass *gobject_class;\n'
' GDBusProxyClass *proxy_class;\n' ' GDBusProxyClass *proxy_class;\n'
'\n' '\n'
' g_type_class_add_private (klass, sizeof (%sProxyPrivate));\n'
'\n'
' gobject_class = G_OBJECT_CLASS (klass);\n' ' gobject_class = G_OBJECT_CLASS (klass);\n'
' gobject_class->finalize = %s_proxy_finalize;\n' ' gobject_class->finalize = %s_proxy_finalize;\n'
' gobject_class->get_property = %s_proxy_get_property;\n' ' gobject_class->get_property = %s_proxy_get_property;\n'
@ -1818,7 +1817,6 @@ class CodeGenerator:
' proxy_class->g_signal = %s_proxy_g_signal;\n' ' proxy_class->g_signal = %s_proxy_g_signal;\n'
' proxy_class->g_properties_changed = %s_proxy_g_properties_changed;\n' ' proxy_class->g_properties_changed = %s_proxy_g_properties_changed;\n'
'\n'%(i.name_lower, i.camel_name, '\n'%(i.name_lower, i.camel_name,
i.camel_name,
i.name_lower, i.name_lower, i.name_lower, i.name_lower, i.name_lower)) i.name_lower, i.name_lower, i.name_lower, i.name_lower, i.name_lower))
if len(i.properties) > 0: if len(i.properties) > 0:
self.c.write('\n' self.c.write('\n'
@ -2341,6 +2339,7 @@ class CodeGenerator:
%(i.name_lower, i.camel_name)) %(i.name_lower, i.camel_name))
self.c.write('G_DEFINE_TYPE_WITH_CODE (%sSkeleton, %s_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,\n'%(i.camel_name, i.name_lower)) self.c.write('G_DEFINE_TYPE_WITH_CODE (%sSkeleton, %s_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,\n'%(i.camel_name, i.name_lower))
self.c.write(' G_ADD_PRIVATE (%sSkeleton)\n'%(i.camel_name))
self.c.write(' G_IMPLEMENT_INTERFACE (%sTYPE_%s, %s_skeleton_iface_init));\n\n'%(i.ns_upper, i.name_upper, i.name_lower)) self.c.write(' G_IMPLEMENT_INTERFACE (%sTYPE_%s, %s_skeleton_iface_init));\n\n'%(i.ns_upper, i.name_upper, i.name_lower))
# finalize # finalize
@ -2534,8 +2533,9 @@ class CodeGenerator:
self.c.write('static void\n' self.c.write('static void\n'
'%s_skeleton_init (%sSkeleton *skeleton)\n' '%s_skeleton_init (%sSkeleton *skeleton)\n'
'{\n' '{\n'
' skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, %sTYPE_%s_SKELETON, %sSkeletonPrivate);\n' ' skeleton->priv = %s_skeleton_get_private (skeleton);\n'
%(i.name_lower, i.camel_name, i.ns_upper, i.name_upper, i.camel_name)) %(i.name_lower, i.camel_name,
i.name_lower))
self.c.write(' g_mutex_init (&skeleton->priv->lock);\n') self.c.write(' g_mutex_init (&skeleton->priv->lock);\n')
self.c.write(' skeleton->priv->context = g_main_context_ref_thread_default ();\n') self.c.write(' skeleton->priv->context = g_main_context_ref_thread_default ();\n')
if len(i.properties) > 0: if len(i.properties) > 0:
@ -2571,11 +2571,9 @@ class CodeGenerator:
' GObjectClass *gobject_class;\n' ' GObjectClass *gobject_class;\n'
' GDBusInterfaceSkeletonClass *skeleton_class;\n' ' GDBusInterfaceSkeletonClass *skeleton_class;\n'
'\n' '\n'
' g_type_class_add_private (klass, sizeof (%sSkeletonPrivate));\n'
'\n'
' gobject_class = G_OBJECT_CLASS (klass);\n' ' gobject_class = G_OBJECT_CLASS (klass);\n'
' gobject_class->finalize = %s_skeleton_finalize;\n' ' gobject_class->finalize = %s_skeleton_finalize;\n'
%(i.name_lower, i.camel_name, i.camel_name, i.name_lower)) %(i.name_lower, i.camel_name, i.name_lower))
if len(i.properties) > 0: if len(i.properties) > 0:
self.c.write(' gobject_class->get_property = %s_skeleton_get_property;\n' self.c.write(' gobject_class->get_property = %s_skeleton_get_property;\n'
' gobject_class->set_property = %s_skeleton_set_property;\n' ' gobject_class->set_property = %s_skeleton_set_property;\n'

View File

@ -104,7 +104,7 @@ enum
PROP_STREAM PROP_STREAM
}; };
G_DEFINE_TYPE (GDBusAuth, _g_dbus_auth, G_TYPE_OBJECT); G_DEFINE_TYPE_WITH_PRIVATE (GDBusAuth, _g_dbus_auth, G_TYPE_OBJECT)
/* ---------------------------------------------------------------------------------------------------- */ /* ---------------------------------------------------------------------------------------------------- */
@ -166,8 +166,6 @@ _g_dbus_auth_class_init (GDBusAuthClass *klass)
{ {
GObjectClass *gobject_class; GObjectClass *gobject_class;
g_type_class_add_private (klass, sizeof (GDBusAuthPrivate));
gobject_class = G_OBJECT_CLASS (klass); gobject_class = G_OBJECT_CLASS (klass);
gobject_class->get_property = _g_dbus_auth_get_property; gobject_class->get_property = _g_dbus_auth_get_property;
gobject_class->set_property = _g_dbus_auth_set_property; gobject_class->set_property = _g_dbus_auth_set_property;
@ -226,8 +224,7 @@ mech_compare_func (Mechanism *a, Mechanism *b)
static void static void
_g_dbus_auth_init (GDBusAuth *auth) _g_dbus_auth_init (GDBusAuth *auth)
{ {
auth->priv = G_TYPE_INSTANCE_GET_PRIVATE (auth, G_TYPE_DBUS_AUTH, GDBusAuthPrivate); auth->priv = _g_dbus_auth_get_private (auth);
} }
static void static void

View File

@ -45,7 +45,7 @@ enum
PROP_CREDENTIALS PROP_CREDENTIALS
}; };
G_DEFINE_ABSTRACT_TYPE (GDBusAuthMechanism, _g_dbus_auth_mechanism, G_TYPE_OBJECT); G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (GDBusAuthMechanism, _g_dbus_auth_mechanism, G_TYPE_OBJECT)
/* ---------------------------------------------------------------------------------------------------- */ /* ---------------------------------------------------------------------------------------------------- */
@ -115,8 +115,6 @@ _g_dbus_auth_mechanism_class_init (GDBusAuthMechanismClass *klass)
{ {
GObjectClass *gobject_class; GObjectClass *gobject_class;
g_type_class_add_private (klass, sizeof (GDBusAuthMechanismPrivate));
gobject_class = G_OBJECT_CLASS (klass); gobject_class = G_OBJECT_CLASS (klass);
gobject_class->get_property = _g_dbus_auth_mechanism_get_property; gobject_class->get_property = _g_dbus_auth_mechanism_get_property;
gobject_class->set_property = _g_dbus_auth_mechanism_set_property; gobject_class->set_property = _g_dbus_auth_mechanism_set_property;
@ -161,10 +159,7 @@ _g_dbus_auth_mechanism_class_init (GDBusAuthMechanismClass *klass)
static void static void
_g_dbus_auth_mechanism_init (GDBusAuthMechanism *mechanism) _g_dbus_auth_mechanism_init (GDBusAuthMechanism *mechanism)
{ {
/* not used for now */ mechanism->priv = _g_dbus_auth_mechanism_get_private (mechanism);
mechanism->priv = G_TYPE_INSTANCE_GET_PRIVATE (mechanism,
G_TYPE_DBUS_AUTH_MECHANISM,
GDBusAuthMechanismPrivate);
} }
/* ---------------------------------------------------------------------------------------------------- */ /* ---------------------------------------------------------------------------------------------------- */

View File

@ -70,7 +70,7 @@ static void mechanism_client_shutdown (GDBusAuthMe
/* ---------------------------------------------------------------------------------------------------- */ /* ---------------------------------------------------------------------------------------------------- */
G_DEFINE_TYPE (GDBusAuthMechanismAnon, _g_dbus_auth_mechanism_anon, G_TYPE_DBUS_AUTH_MECHANISM); G_DEFINE_TYPE_WITH_PRIVATE (GDBusAuthMechanismAnon, _g_dbus_auth_mechanism_anon, G_TYPE_DBUS_AUTH_MECHANISM)
/* ---------------------------------------------------------------------------------------------------- */ /* ---------------------------------------------------------------------------------------------------- */
@ -89,8 +89,6 @@ _g_dbus_auth_mechanism_anon_class_init (GDBusAuthMechanismAnonClass *klass)
GObjectClass *gobject_class; GObjectClass *gobject_class;
GDBusAuthMechanismClass *mechanism_class; GDBusAuthMechanismClass *mechanism_class;
g_type_class_add_private (klass, sizeof (GDBusAuthMechanismAnonPrivate));
gobject_class = G_OBJECT_CLASS (klass); gobject_class = G_OBJECT_CLASS (klass);
gobject_class->finalize = _g_dbus_auth_mechanism_anon_finalize; gobject_class->finalize = _g_dbus_auth_mechanism_anon_finalize;
@ -116,9 +114,7 @@ _g_dbus_auth_mechanism_anon_class_init (GDBusAuthMechanismAnonClass *klass)
static void static void
_g_dbus_auth_mechanism_anon_init (GDBusAuthMechanismAnon *mechanism) _g_dbus_auth_mechanism_anon_init (GDBusAuthMechanismAnon *mechanism)
{ {
mechanism->priv = G_TYPE_INSTANCE_GET_PRIVATE (mechanism, mechanism->priv = _g_dbus_auth_mechanism_anon_get_private (mechanism);
G_TYPE_DBUS_AUTH_MECHANISM_ANON,
GDBusAuthMechanismAnonPrivate);
} }
/* ---------------------------------------------------------------------------------------------------- */ /* ---------------------------------------------------------------------------------------------------- */

View File

@ -77,7 +77,7 @@ static void mechanism_client_shutdown (GDBusAuthMe
/* ---------------------------------------------------------------------------------------------------- */ /* ---------------------------------------------------------------------------------------------------- */
G_DEFINE_TYPE (GDBusAuthMechanismExternal, _g_dbus_auth_mechanism_external, G_TYPE_DBUS_AUTH_MECHANISM); G_DEFINE_TYPE_WITH_PRIVATE (GDBusAuthMechanismExternal, _g_dbus_auth_mechanism_external, G_TYPE_DBUS_AUTH_MECHANISM)
/* ---------------------------------------------------------------------------------------------------- */ /* ---------------------------------------------------------------------------------------------------- */
@ -96,8 +96,6 @@ _g_dbus_auth_mechanism_external_class_init (GDBusAuthMechanismExternalClass *kla
GObjectClass *gobject_class; GObjectClass *gobject_class;
GDBusAuthMechanismClass *mechanism_class; GDBusAuthMechanismClass *mechanism_class;
g_type_class_add_private (klass, sizeof (GDBusAuthMechanismExternalPrivate));
gobject_class = G_OBJECT_CLASS (klass); gobject_class = G_OBJECT_CLASS (klass);
gobject_class->finalize = _g_dbus_auth_mechanism_external_finalize; gobject_class->finalize = _g_dbus_auth_mechanism_external_finalize;
@ -123,9 +121,7 @@ _g_dbus_auth_mechanism_external_class_init (GDBusAuthMechanismExternalClass *kla
static void static void
_g_dbus_auth_mechanism_external_init (GDBusAuthMechanismExternal *mechanism) _g_dbus_auth_mechanism_external_init (GDBusAuthMechanismExternal *mechanism)
{ {
mechanism->priv = G_TYPE_INSTANCE_GET_PRIVATE (mechanism, mechanism->priv = _g_dbus_auth_mechanism_external_get_private (mechanism);
G_TYPE_DBUS_AUTH_MECHANISM_EXTERNAL,
GDBusAuthMechanismExternalPrivate);
} }
/* ---------------------------------------------------------------------------------------------------- */ /* ---------------------------------------------------------------------------------------------------- */

View File

@ -93,7 +93,7 @@ static void mechanism_client_shutdown (GDBusAuthMe
/* ---------------------------------------------------------------------------------------------------- */ /* ---------------------------------------------------------------------------------------------------- */
G_DEFINE_TYPE (GDBusAuthMechanismSha1, _g_dbus_auth_mechanism_sha1, G_TYPE_DBUS_AUTH_MECHANISM); G_DEFINE_TYPE_WITH_PRIVATE (GDBusAuthMechanismSha1, _g_dbus_auth_mechanism_sha1, G_TYPE_DBUS_AUTH_MECHANISM)
/* ---------------------------------------------------------------------------------------------------- */ /* ---------------------------------------------------------------------------------------------------- */
@ -117,8 +117,6 @@ _g_dbus_auth_mechanism_sha1_class_init (GDBusAuthMechanismSha1Class *klass)
GObjectClass *gobject_class; GObjectClass *gobject_class;
GDBusAuthMechanismClass *mechanism_class; GDBusAuthMechanismClass *mechanism_class;
g_type_class_add_private (klass, sizeof (GDBusAuthMechanismSha1Private));
gobject_class = G_OBJECT_CLASS (klass); gobject_class = G_OBJECT_CLASS (klass);
gobject_class->finalize = _g_dbus_auth_mechanism_sha1_finalize; gobject_class->finalize = _g_dbus_auth_mechanism_sha1_finalize;
@ -144,9 +142,7 @@ _g_dbus_auth_mechanism_sha1_class_init (GDBusAuthMechanismSha1Class *klass)
static void static void
_g_dbus_auth_mechanism_sha1_init (GDBusAuthMechanismSha1 *mechanism) _g_dbus_auth_mechanism_sha1_init (GDBusAuthMechanismSha1 *mechanism)
{ {
mechanism->priv = G_TYPE_INSTANCE_GET_PRIVATE (mechanism, mechanism->priv = _g_dbus_auth_mechanism_sha1_get_private (mechanism);
G_TYPE_DBUS_AUTH_MECHANISM_SHA1,
GDBusAuthMechanismSha1Private);
} }
/* ---------------------------------------------------------------------------------------------------- */ /* ---------------------------------------------------------------------------------------------------- */

View File

@ -91,7 +91,8 @@ static void skeleton_intercept_handle_method_call (GDBusConnect
G_DEFINE_ABSTRACT_TYPE_WITH_CODE (GDBusInterfaceSkeleton, g_dbus_interface_skeleton, G_TYPE_OBJECT, G_DEFINE_ABSTRACT_TYPE_WITH_CODE (GDBusInterfaceSkeleton, g_dbus_interface_skeleton, G_TYPE_OBJECT,
G_IMPLEMENT_INTERFACE (G_TYPE_DBUS_INTERFACE, dbus_interface_interface_init)); G_ADD_PRIVATE (GDBusInterfaceSkeleton)
G_IMPLEMENT_INTERFACE (G_TYPE_DBUS_INTERFACE, dbus_interface_interface_init))
static void static void
g_dbus_interface_skeleton_finalize (GObject *object) g_dbus_interface_skeleton_finalize (GObject *object)
@ -253,14 +254,12 @@ g_dbus_interface_skeleton_class_init (GDBusInterfaceSkeletonClass *klass)
G_TYPE_BOOLEAN, G_TYPE_BOOLEAN,
1, 1,
G_TYPE_DBUS_METHOD_INVOCATION); G_TYPE_DBUS_METHOD_INVOCATION);
g_type_class_add_private (klass, sizeof (GDBusInterfaceSkeletonPrivate));
} }
static void static void
g_dbus_interface_skeleton_init (GDBusInterfaceSkeleton *interface) g_dbus_interface_skeleton_init (GDBusInterfaceSkeleton *interface)
{ {
interface->priv = G_TYPE_INSTANCE_GET_PRIVATE (interface, G_TYPE_DBUS_INTERFACE_SKELETON, GDBusInterfaceSkeletonPrivate); interface->priv = g_dbus_interface_skeleton_get_private (interface);
g_mutex_init (&interface->priv->lock); g_mutex_init (&interface->priv->lock);
} }

View File

@ -174,6 +174,7 @@ static void async_initable_iface_init (GAsyncInitableIface *async_initable_iface
static void dbus_object_manager_interface_init (GDBusObjectManagerIface *iface); static void dbus_object_manager_interface_init (GDBusObjectManagerIface *iface);
G_DEFINE_TYPE_WITH_CODE (GDBusObjectManagerClient, g_dbus_object_manager_client, G_TYPE_OBJECT, G_DEFINE_TYPE_WITH_CODE (GDBusObjectManagerClient, g_dbus_object_manager_client, G_TYPE_OBJECT,
G_ADD_PRIVATE (GDBusObjectManagerClient)
G_IMPLEMENT_INTERFACE (G_TYPE_INITABLE, initable_iface_init) G_IMPLEMENT_INTERFACE (G_TYPE_INITABLE, initable_iface_init)
G_IMPLEMENT_INTERFACE (G_TYPE_ASYNC_INITABLE, async_initable_iface_init) G_IMPLEMENT_INTERFACE (G_TYPE_ASYNC_INITABLE, async_initable_iface_init)
G_IMPLEMENT_INTERFACE (G_TYPE_DBUS_OBJECT_MANAGER, dbus_object_manager_interface_init)); G_IMPLEMENT_INTERFACE (G_TYPE_DBUS_OBJECT_MANAGER, dbus_object_manager_interface_init));
@ -564,16 +565,12 @@ g_dbus_object_manager_client_class_init (GDBusObjectManagerClientClass *klass)
G_TYPE_DBUS_PROXY, G_TYPE_DBUS_PROXY,
G_TYPE_VARIANT, G_TYPE_VARIANT,
G_TYPE_STRV); G_TYPE_STRV);
g_type_class_add_private (klass, sizeof (GDBusObjectManagerClientPrivate));
} }
static void static void
g_dbus_object_manager_client_init (GDBusObjectManagerClient *manager) g_dbus_object_manager_client_init (GDBusObjectManagerClient *manager)
{ {
manager->priv = G_TYPE_INSTANCE_GET_PRIVATE (manager, manager->priv = g_dbus_object_manager_client_get_private (manager);
G_TYPE_DBUS_OBJECT_MANAGER_CLIENT,
GDBusObjectManagerClientPrivate);
g_mutex_init (&manager->priv->lock); g_mutex_init (&manager->priv->lock);
manager->priv->map_object_path_to_object_proxy = g_hash_table_new_full (g_str_hash, manager->priv->map_object_path_to_object_proxy = g_hash_table_new_full (g_str_hash,
g_str_equal, g_str_equal,

View File

@ -99,7 +99,8 @@ enum
static void dbus_object_manager_interface_init (GDBusObjectManagerIface *iface); static void dbus_object_manager_interface_init (GDBusObjectManagerIface *iface);
G_DEFINE_TYPE_WITH_CODE (GDBusObjectManagerServer, g_dbus_object_manager_server, G_TYPE_OBJECT, G_DEFINE_TYPE_WITH_CODE (GDBusObjectManagerServer, g_dbus_object_manager_server, G_TYPE_OBJECT,
G_IMPLEMENT_INTERFACE (G_TYPE_DBUS_OBJECT_MANAGER, dbus_object_manager_interface_init)); G_ADD_PRIVATE (GDBusObjectManagerServer)
G_IMPLEMENT_INTERFACE (G_TYPE_DBUS_OBJECT_MANAGER, dbus_object_manager_interface_init))
static void g_dbus_object_manager_server_constructed (GObject *object); static void g_dbus_object_manager_server_constructed (GObject *object);
@ -220,16 +221,12 @@ g_dbus_object_manager_server_class_init (GDBusObjectManagerServerClass *klass)
G_PARAM_WRITABLE | G_PARAM_WRITABLE |
G_PARAM_CONSTRUCT_ONLY | G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS)); G_PARAM_STATIC_STRINGS));
g_type_class_add_private (klass, sizeof (GDBusObjectManagerServerPrivate));
} }
static void static void
g_dbus_object_manager_server_init (GDBusObjectManagerServer *manager) g_dbus_object_manager_server_init (GDBusObjectManagerServer *manager)
{ {
manager->priv = G_TYPE_INSTANCE_GET_PRIVATE (manager, manager->priv = g_dbus_object_manager_server_get_private (manager);
G_TYPE_DBUS_OBJECT_MANAGER_SERVER,
GDBusObjectManagerServerPrivate);
g_mutex_init (&manager->priv->lock); g_mutex_init (&manager->priv->lock);
manager->priv->map_object_path_to_data = g_hash_table_new_full (g_str_hash, manager->priv->map_object_path_to_data = g_hash_table_new_full (g_str_hash,
g_str_equal, g_str_equal,

View File

@ -62,7 +62,8 @@ enum
static void dbus_object_interface_init (GDBusObjectIface *iface); static void dbus_object_interface_init (GDBusObjectIface *iface);
G_DEFINE_TYPE_WITH_CODE (GDBusObjectProxy, g_dbus_object_proxy, G_TYPE_OBJECT, G_DEFINE_TYPE_WITH_CODE (GDBusObjectProxy, g_dbus_object_proxy, G_TYPE_OBJECT,
G_IMPLEMENT_INTERFACE (G_TYPE_DBUS_OBJECT, dbus_object_interface_init)); G_ADD_PRIVATE (GDBusObjectProxy)
G_IMPLEMENT_INTERFACE (G_TYPE_DBUS_OBJECT, dbus_object_interface_init))
static void static void
g_dbus_object_proxy_finalize (GObject *object) g_dbus_object_proxy_finalize (GObject *object)
@ -177,16 +178,12 @@ g_dbus_object_proxy_class_init (GDBusObjectProxyClass *klass)
G_PARAM_READWRITE | G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY | G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS)); G_PARAM_STATIC_STRINGS));
g_type_class_add_private (klass, sizeof (GDBusObjectProxyPrivate));
} }
static void static void
g_dbus_object_proxy_init (GDBusObjectProxy *proxy) g_dbus_object_proxy_init (GDBusObjectProxy *proxy)
{ {
proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, proxy->priv = g_dbus_object_proxy_get_private (proxy);
G_TYPE_DBUS_OBJECT_PROXY,
GDBusObjectProxyPrivate);
g_mutex_init (&proxy->priv->lock); g_mutex_init (&proxy->priv->lock);
proxy->priv->map_name_to_iface = g_hash_table_new_full (g_str_hash, proxy->priv->map_name_to_iface = g_hash_table_new_full (g_str_hash,
g_str_equal, g_str_equal,

View File

@ -69,7 +69,8 @@ static guint signals[LAST_SIGNAL] = {0};
static void dbus_object_interface_init (GDBusObjectIface *iface); static void dbus_object_interface_init (GDBusObjectIface *iface);
G_DEFINE_TYPE_WITH_CODE (GDBusObjectSkeleton, g_dbus_object_skeleton, G_TYPE_OBJECT, G_DEFINE_TYPE_WITH_CODE (GDBusObjectSkeleton, g_dbus_object_skeleton, G_TYPE_OBJECT,
G_IMPLEMENT_INTERFACE (G_TYPE_DBUS_OBJECT, dbus_object_interface_init)); G_ADD_PRIVATE (GDBusObjectSkeleton)
G_IMPLEMENT_INTERFACE (G_TYPE_DBUS_OBJECT, dbus_object_interface_init))
static void static void
@ -196,14 +197,12 @@ g_dbus_object_skeleton_class_init (GDBusObjectSkeletonClass *klass)
2, 2,
G_TYPE_DBUS_INTERFACE_SKELETON, G_TYPE_DBUS_INTERFACE_SKELETON,
G_TYPE_DBUS_METHOD_INVOCATION); G_TYPE_DBUS_METHOD_INVOCATION);
g_type_class_add_private (klass, sizeof (GDBusObjectSkeletonPrivate));
} }
static void static void
g_dbus_object_skeleton_init (GDBusObjectSkeleton *object) g_dbus_object_skeleton_init (GDBusObjectSkeleton *object)
{ {
object->priv = G_TYPE_INSTANCE_GET_PRIVATE (object, G_TYPE_DBUS_OBJECT_SKELETON, GDBusObjectSkeletonPrivate); object->priv = g_dbus_object_skeleton_get_private (object);
g_mutex_init (&object->priv->lock); g_mutex_init (&object->priv->lock);
object->priv->map_name_to_iface = g_hash_table_new_full (g_str_hash, object->priv->map_name_to_iface = g_hash_table_new_full (g_str_hash,
g_str_equal, g_str_equal,

View File

@ -187,10 +187,10 @@ static void initable_iface_init (GInitableIface *initable_iface);
static void async_initable_iface_init (GAsyncInitableIface *async_initable_iface); static void async_initable_iface_init (GAsyncInitableIface *async_initable_iface);
G_DEFINE_TYPE_WITH_CODE (GDBusProxy, g_dbus_proxy, G_TYPE_OBJECT, G_DEFINE_TYPE_WITH_CODE (GDBusProxy, g_dbus_proxy, G_TYPE_OBJECT,
G_ADD_PRIVATE (GDBusProxy)
G_IMPLEMENT_INTERFACE (G_TYPE_DBUS_INTERFACE, dbus_interface_iface_init) G_IMPLEMENT_INTERFACE (G_TYPE_DBUS_INTERFACE, dbus_interface_iface_init)
G_IMPLEMENT_INTERFACE (G_TYPE_INITABLE, initable_iface_init) G_IMPLEMENT_INTERFACE (G_TYPE_INITABLE, initable_iface_init)
G_IMPLEMENT_INTERFACE (G_TYPE_ASYNC_INITABLE, async_initable_iface_init) G_IMPLEMENT_INTERFACE (G_TYPE_ASYNC_INITABLE, async_initable_iface_init))
);
static void static void
g_dbus_proxy_dispose (GObject *object) g_dbus_proxy_dispose (GObject *object)
@ -633,14 +633,12 @@ g_dbus_proxy_class_init (GDBusProxyClass *klass)
G_TYPE_STRING, G_TYPE_STRING,
G_TYPE_VARIANT); G_TYPE_VARIANT);
g_type_class_add_private (klass, sizeof (GDBusProxyPrivate));
} }
static void static void
g_dbus_proxy_init (GDBusProxy *proxy) g_dbus_proxy_init (GDBusProxy *proxy)
{ {
proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, G_TYPE_DBUS_PROXY, GDBusProxyPrivate); proxy->priv = g_dbus_proxy_get_private (proxy);
proxy->priv->signal_subscription_data = g_slice_new0 (SignalSubscriptionData); proxy->priv->signal_subscription_data = g_slice_new0 (SignalSubscriptionData);
proxy->priv->signal_subscription_data->ref_count = 1; proxy->priv->signal_subscription_data->ref_count = 1;
proxy->priv->signal_subscription_data->proxy = proxy; proxy->priv->signal_subscription_data->proxy = proxy;

View File

@ -37,9 +37,9 @@ struct _GDelayedSettingsBackendPrivate
gpointer owner; gpointer owner;
}; };
G_DEFINE_TYPE (GDelayedSettingsBackend, G_DEFINE_TYPE_WITH_PRIVATE (GDelayedSettingsBackend,
g_delayed_settings_backend, g_delayed_settings_backend,
G_TYPE_SETTINGS_BACKEND) G_TYPE_SETTINGS_BACKEND)
static gboolean static gboolean
invoke_notify_unapplied (gpointer data) invoke_notify_unapplied (gpointer data)
@ -428,8 +428,6 @@ g_delayed_settings_backend_class_init (GDelayedSettingsBackendClass *class)
GSettingsBackendClass *backend_class = G_SETTINGS_BACKEND_CLASS (class); GSettingsBackendClass *backend_class = G_SETTINGS_BACKEND_CLASS (class);
GObjectClass *object_class = G_OBJECT_CLASS (class); GObjectClass *object_class = G_OBJECT_CLASS (class);
g_type_class_add_private (class, sizeof (GDelayedSettingsBackendPrivate));
backend_class->read = g_delayed_settings_backend_read; backend_class->read = g_delayed_settings_backend_read;
backend_class->write = g_delayed_settings_backend_write; backend_class->write = g_delayed_settings_backend_write;
backend_class->write_tree = g_delayed_settings_backend_write_tree; backend_class->write_tree = g_delayed_settings_backend_write_tree;
@ -445,10 +443,7 @@ g_delayed_settings_backend_class_init (GDelayedSettingsBackendClass *class)
static void static void
g_delayed_settings_backend_init (GDelayedSettingsBackend *delayed) g_delayed_settings_backend_init (GDelayedSettingsBackend *delayed)
{ {
delayed->priv = delayed->priv = g_delayed_settings_backend_get_private (delayed);
G_TYPE_INSTANCE_GET_PRIVATE (delayed, G_TYPE_DELAYED_SETTINGS_BACKEND,
GDelayedSettingsBackendPrivate);
delayed->priv->delayed = g_settings_backend_create_tree (); delayed->priv->delayed = g_settings_backend_create_tree ();
g_mutex_init (&delayed->priv->lock); g_mutex_init (&delayed->priv->lock);
} }

View File

@ -61,6 +61,7 @@ static GParamSpec *properties[NUM_PROPERTIES] = { NULL, };
static void g_emblemed_icon_icon_iface_init (GIconIface *iface); static void g_emblemed_icon_icon_iface_init (GIconIface *iface);
G_DEFINE_TYPE_WITH_CODE (GEmblemedIcon, g_emblemed_icon, G_TYPE_OBJECT, G_DEFINE_TYPE_WITH_CODE (GEmblemedIcon, g_emblemed_icon, G_TYPE_OBJECT,
G_ADD_PRIVATE (GEmblemedIcon)
G_IMPLEMENT_INTERFACE (G_TYPE_ICON, G_IMPLEMENT_INTERFACE (G_TYPE_ICON,
g_emblemed_icon_icon_iface_init)) g_emblemed_icon_icon_iface_init))
@ -133,16 +134,12 @@ g_emblemed_icon_class_init (GEmblemedIconClass *klass)
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS); G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS);
g_object_class_install_properties (gobject_class, NUM_PROPERTIES, properties); g_object_class_install_properties (gobject_class, NUM_PROPERTIES, properties);
g_type_class_add_private (klass, sizeof (GEmblemedIconPrivate));
} }
static void static void
g_emblemed_icon_init (GEmblemedIcon *emblemed) g_emblemed_icon_init (GEmblemedIcon *emblemed)
{ {
emblemed->priv = emblemed->priv = g_emblemed_icon_get_private (emblemed);
G_TYPE_INSTANCE_GET_PRIVATE (emblemed, G_TYPE_EMBLEMED_ICON,
GEmblemedIconPrivate);
} }
/** /**

View File

@ -29,6 +29,14 @@
#include "gioerror.h" #include "gioerror.h"
#include "glibintl.h" #include "glibintl.h"
struct _GFileEnumeratorPrivate {
/* TODO: Should be public for subclasses? */
GFile *container;
guint closed : 1;
guint pending : 1;
GAsyncReadyCallback outstanding_callback;
GError *outstanding_error;
};
/** /**
* SECTION:gfileenumerator * SECTION:gfileenumerator
@ -64,16 +72,7 @@
* *
**/ **/
G_DEFINE_TYPE (GFileEnumerator, g_file_enumerator, G_TYPE_OBJECT); G_DEFINE_TYPE_WITH_PRIVATE (GFileEnumerator, g_file_enumerator, G_TYPE_OBJECT)
struct _GFileEnumeratorPrivate {
/* TODO: Should be public for subclasses? */
GFile *container;
guint closed : 1;
guint pending : 1;
GAsyncReadyCallback outstanding_callback;
GError *outstanding_error;
};
enum { enum {
PROP_0, PROP_0,
@ -150,9 +149,7 @@ static void
g_file_enumerator_class_init (GFileEnumeratorClass *klass) g_file_enumerator_class_init (GFileEnumeratorClass *klass)
{ {
GObjectClass *gobject_class = G_OBJECT_CLASS (klass); GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
g_type_class_add_private (klass, sizeof (GFileEnumeratorPrivate));
gobject_class->set_property = g_file_enumerator_set_property; gobject_class->set_property = g_file_enumerator_set_property;
gobject_class->dispose = g_file_enumerator_dispose; gobject_class->dispose = g_file_enumerator_dispose;
gobject_class->finalize = g_file_enumerator_finalize; gobject_class->finalize = g_file_enumerator_finalize;
@ -175,9 +172,7 @@ g_file_enumerator_class_init (GFileEnumeratorClass *klass)
static void static void
g_file_enumerator_init (GFileEnumerator *enumerator) g_file_enumerator_init (GFileEnumerator *enumerator)
{ {
enumerator->priv = G_TYPE_INSTANCE_GET_PRIVATE (enumerator, enumerator->priv = g_file_enumerator_get_private (enumerator);
G_TYPE_FILE_ENUMERATOR,
GFileEnumeratorPrivate);
} }
/** /**

View File

@ -84,8 +84,6 @@ struct _GFileInputStreamPrivate {
static void static void
g_file_input_stream_class_init (GFileInputStreamClass *klass) g_file_input_stream_class_init (GFileInputStreamClass *klass)
{ {
g_type_class_add_private (klass, sizeof (GFileInputStreamPrivate));
klass->query_info_async = g_file_input_stream_real_query_info_async; klass->query_info_async = g_file_input_stream_real_query_info_async;
klass->query_info_finish = g_file_input_stream_real_query_info_finish; klass->query_info_finish = g_file_input_stream_real_query_info_finish;
} }
@ -103,9 +101,7 @@ g_file_input_stream_seekable_iface_init (GSeekableIface *iface)
static void static void
g_file_input_stream_init (GFileInputStream *stream) g_file_input_stream_init (GFileInputStream *stream)
{ {
stream->priv = G_TYPE_INSTANCE_GET_PRIVATE (stream, stream->priv = g_file_input_stream_get_private (stream);
G_TYPE_FILE_INPUT_STREAM,
GFileInputStreamPrivate);
} }
/** /**

View File

@ -85,14 +85,15 @@ static GFileInfo *g_file_io_stream_real_query_info_finish (GFileIOStream *str
GAsyncResult *result, GAsyncResult *result,
GError **error); GError **error);
G_DEFINE_TYPE_WITH_CODE (GFileIOStream, g_file_io_stream, G_TYPE_IO_STREAM,
G_IMPLEMENT_INTERFACE (G_TYPE_SEEKABLE,
g_file_io_stream_seekable_iface_init));
struct _GFileIOStreamPrivate { struct _GFileIOStreamPrivate {
GAsyncReadyCallback outstanding_callback; GAsyncReadyCallback outstanding_callback;
}; };
G_DEFINE_TYPE_WITH_CODE (GFileIOStream, g_file_io_stream, G_TYPE_IO_STREAM,
G_ADD_PRIVATE (GFileIOStream)
G_IMPLEMENT_INTERFACE (G_TYPE_SEEKABLE,
g_file_io_stream_seekable_iface_init))
static void static void
g_file_io_stream_seekable_iface_init (GSeekableIface *iface) g_file_io_stream_seekable_iface_init (GSeekableIface *iface)
{ {
@ -106,9 +107,7 @@ g_file_io_stream_seekable_iface_init (GSeekableIface *iface)
static void static void
g_file_io_stream_init (GFileIOStream *stream) g_file_io_stream_init (GFileIOStream *stream)
{ {
stream->priv = G_TYPE_INSTANCE_GET_PRIVATE (stream, stream->priv = g_file_io_stream_get_private (stream);
G_TYPE_FILE_IO_STREAM,
GFileIOStreamPrivate);
} }
/** /**
@ -654,8 +653,6 @@ g_file_io_stream_real_query_info_finish (GFileIOStream *stream,
static void static void
g_file_io_stream_class_init (GFileIOStreamClass *klass) g_file_io_stream_class_init (GFileIOStreamClass *klass)
{ {
g_type_class_add_private (klass, sizeof (GFileIOStreamPrivate));
klass->tell = g_file_io_stream_real_tell; klass->tell = g_file_io_stream_real_tell;
klass->can_seek = g_file_io_stream_real_can_seek; klass->can_seek = g_file_io_stream_real_can_seek;
klass->seek = g_file_io_stream_real_seek; klass->seek = g_file_io_stream_real_seek;

View File

@ -62,11 +62,6 @@ enum {
LAST_SIGNAL LAST_SIGNAL
}; };
/* work around a limitation of the aliasing foo */
#undef g_file_monitor
G_DEFINE_ABSTRACT_TYPE (GFileMonitor, g_file_monitor, G_TYPE_OBJECT);
typedef struct { typedef struct {
GFile *file; GFile *file;
guint32 last_sent_change_time; /* 0 == not sent */ guint32 last_sent_change_time; /* 0 == not sent */
@ -97,6 +92,11 @@ enum {
PROP_CANCELLED PROP_CANCELLED
}; };
/* work around a limitation of the aliasing foo */
#undef g_file_monitor
G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (GFileMonitor, g_file_monitor, G_TYPE_OBJECT)
static void static void
g_file_monitor_set_property (GObject *object, g_file_monitor_set_property (GObject *object,
guint prop_id, guint prop_id,
@ -210,9 +210,7 @@ static void
g_file_monitor_class_init (GFileMonitorClass *klass) g_file_monitor_class_init (GFileMonitorClass *klass)
{ {
GObjectClass *object_class; GObjectClass *object_class;
g_type_class_add_private (klass, sizeof (GFileMonitorPrivate));
object_class = G_OBJECT_CLASS (klass); object_class = G_OBJECT_CLASS (klass);
object_class->finalize = g_file_monitor_finalize; object_class->finalize = g_file_monitor_finalize;
object_class->dispose = g_file_monitor_dispose; object_class->dispose = g_file_monitor_dispose;
@ -267,9 +265,7 @@ g_file_monitor_class_init (GFileMonitorClass *klass)
static void static void
g_file_monitor_init (GFileMonitor *monitor) g_file_monitor_init (GFileMonitor *monitor)
{ {
monitor->priv = G_TYPE_INSTANCE_GET_PRIVATE (monitor, monitor->priv = g_file_monitor_get_private (monitor);
G_TYPE_FILE_MONITOR,
GFileMonitorPrivate);
monitor->priv->rate_limit_msec = DEFAULT_RATE_LIMIT_MSECS; monitor->priv->rate_limit_msec = DEFAULT_RATE_LIMIT_MSECS;
monitor->priv->rate_limiter = g_hash_table_new_full (g_file_hash, (GEqualFunc)g_file_equal, monitor->priv->rate_limiter = g_hash_table_new_full (g_file_hash, (GEqualFunc)g_file_equal,
NULL, (GDestroyNotify) rate_limiter_free); NULL, (GDestroyNotify) rate_limiter_free);

View File

@ -77,19 +77,18 @@ static GFileInfo *g_file_output_stream_real_query_info_finish (GFileOutputStream
GAsyncResult *result, GAsyncResult *result,
GError **error); GError **error);
G_DEFINE_TYPE_WITH_CODE (GFileOutputStream, g_file_output_stream, G_TYPE_OUTPUT_STREAM,
G_IMPLEMENT_INTERFACE (G_TYPE_SEEKABLE,
g_file_output_stream_seekable_iface_init));
struct _GFileOutputStreamPrivate { struct _GFileOutputStreamPrivate {
GAsyncReadyCallback outstanding_callback; GAsyncReadyCallback outstanding_callback;
}; };
G_DEFINE_TYPE_WITH_CODE (GFileOutputStream, g_file_output_stream, G_TYPE_OUTPUT_STREAM,
G_ADD_PRIVATE (GFileOutputStream)
G_IMPLEMENT_INTERFACE (G_TYPE_SEEKABLE,
g_file_output_stream_seekable_iface_init));
static void static void
g_file_output_stream_class_init (GFileOutputStreamClass *klass) g_file_output_stream_class_init (GFileOutputStreamClass *klass)
{ {
g_type_class_add_private (klass, sizeof (GFileOutputStreamPrivate));
klass->query_info_async = g_file_output_stream_real_query_info_async; klass->query_info_async = g_file_output_stream_real_query_info_async;
klass->query_info_finish = g_file_output_stream_real_query_info_finish; klass->query_info_finish = g_file_output_stream_real_query_info_finish;
} }
@ -107,9 +106,7 @@ g_file_output_stream_seekable_iface_init (GSeekableIface *iface)
static void static void
g_file_output_stream_init (GFileOutputStream *stream) g_file_output_stream_init (GFileOutputStream *stream)
{ {
stream->priv = G_TYPE_INSTANCE_GET_PRIVATE (stream, stream->priv = g_file_output_stream_get_private (stream);
G_TYPE_FILE_OUTPUT_STREAM,
GFileOutputStreamPrivate);
} }
/** /**

View File

@ -68,16 +68,13 @@ static gboolean g_filter_input_stream_close (GInputStream *stream
GCancellable *cancellable, GCancellable *cancellable,
GError **error); GError **error);
G_DEFINE_ABSTRACT_TYPE (GFilterInputStream, g_filter_input_stream, G_TYPE_INPUT_STREAM)
#define GET_PRIVATE(inst) G_TYPE_INSTANCE_GET_PRIVATE (inst, \
G_TYPE_FILTER_INPUT_STREAM, GFilterInputStreamPrivate)
typedef struct typedef struct
{ {
gboolean close_base; gboolean close_base;
} GFilterInputStreamPrivate; } GFilterInputStreamPrivate;
G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (GFilterInputStream, g_filter_input_stream, G_TYPE_INPUT_STREAM)
static void static void
g_filter_input_stream_class_init (GFilterInputStreamClass *klass) g_filter_input_stream_class_init (GFilterInputStreamClass *klass)
{ {
@ -94,8 +91,6 @@ g_filter_input_stream_class_init (GFilterInputStreamClass *klass)
istream_class->skip = g_filter_input_stream_skip; istream_class->skip = g_filter_input_stream_skip;
istream_class->close_fn = g_filter_input_stream_close; istream_class->close_fn = g_filter_input_stream_close;
g_type_class_add_private (klass, sizeof (GFilterInputStreamPrivate));
g_object_class_install_property (object_class, g_object_class_install_property (object_class,
PROP_BASE_STREAM, PROP_BASE_STREAM,
g_param_spec_object ("base-stream", g_param_spec_object ("base-stream",
@ -151,8 +146,10 @@ g_filter_input_stream_get_property (GObject *object,
GParamSpec *pspec) GParamSpec *pspec)
{ {
GFilterInputStream *filter_stream; GFilterInputStream *filter_stream;
GFilterInputStreamPrivate *priv;
filter_stream = G_FILTER_INPUT_STREAM (object); filter_stream = G_FILTER_INPUT_STREAM (object);
priv = g_filter_input_stream_get_private (filter_stream);
switch (prop_id) switch (prop_id)
{ {
@ -161,7 +158,7 @@ g_filter_input_stream_get_property (GObject *object,
break; break;
case PROP_CLOSE_BASE: case PROP_CLOSE_BASE:
g_value_set_boolean (value, GET_PRIVATE (filter_stream)->close_base); g_value_set_boolean (value, priv->close_base);
break; break;
default: default:
@ -186,7 +183,6 @@ g_filter_input_stream_finalize (GObject *object)
static void static void
g_filter_input_stream_init (GFilterInputStream *stream) g_filter_input_stream_init (GFilterInputStream *stream)
{ {
} }
/** /**
@ -217,9 +213,13 @@ g_filter_input_stream_get_base_stream (GFilterInputStream *stream)
gboolean gboolean
g_filter_input_stream_get_close_base_stream (GFilterInputStream *stream) g_filter_input_stream_get_close_base_stream (GFilterInputStream *stream)
{ {
GFilterInputStreamPrivate *priv;
g_return_val_if_fail (G_IS_FILTER_INPUT_STREAM (stream), FALSE); g_return_val_if_fail (G_IS_FILTER_INPUT_STREAM (stream), FALSE);
return GET_PRIVATE (stream)->close_base; priv = g_filter_input_stream_get_private (stream);
return priv->close_base;
} }
/** /**
@ -239,7 +239,7 @@ g_filter_input_stream_set_close_base_stream (GFilterInputStream *stream,
close_base = !!close_base; close_base = !!close_base;
priv = GET_PRIVATE (stream); priv = g_filter_input_stream_get_private (stream);
if (priv->close_base != close_base) if (priv->close_base != close_base)
{ {
@ -296,17 +296,13 @@ g_filter_input_stream_close (GInputStream *stream,
GCancellable *cancellable, GCancellable *cancellable,
GError **error) GError **error)
{ {
GFilterInputStream *filter_stream = G_FILTER_INPUT_STREAM (stream);
GFilterInputStreamPrivate *priv = g_filter_input_stream_get_private (filter_stream);
gboolean res = TRUE; gboolean res = TRUE;
if (GET_PRIVATE (stream)->close_base) if (priv->close_base)
{ {
GFilterInputStream *filter_stream; res = g_input_stream_close (filter_stream->base_stream,
GInputStream *base_stream;
filter_stream = G_FILTER_INPUT_STREAM (stream);
base_stream = filter_stream->base_stream;
res = g_input_stream_close (base_stream,
cancellable, cancellable,
error); error);
} }

View File

@ -67,16 +67,13 @@ static gboolean g_filter_output_stream_close (GOutputStream *stream,
GCancellable *cancellable, GCancellable *cancellable,
GError **error); GError **error);
G_DEFINE_ABSTRACT_TYPE (GFilterOutputStream, g_filter_output_stream, G_TYPE_OUTPUT_STREAM)
#define GET_PRIVATE(inst) G_TYPE_INSTANCE_GET_PRIVATE (inst, \
G_TYPE_FILTER_OUTPUT_STREAM, GFilterOutputStreamPrivate)
typedef struct typedef struct
{ {
gboolean close_base; gboolean close_base;
} GFilterOutputStreamPrivate; } GFilterOutputStreamPrivate;
G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (GFilterOutputStream, g_filter_output_stream, G_TYPE_OUTPUT_STREAM)
static void static void
g_filter_output_stream_class_init (GFilterOutputStreamClass *klass) g_filter_output_stream_class_init (GFilterOutputStreamClass *klass)
{ {
@ -93,8 +90,6 @@ g_filter_output_stream_class_init (GFilterOutputStreamClass *klass)
ostream_class->flush = g_filter_output_stream_flush; ostream_class->flush = g_filter_output_stream_flush;
ostream_class->close_fn = g_filter_output_stream_close; ostream_class->close_fn = g_filter_output_stream_close;
g_type_class_add_private (klass, sizeof (GFilterOutputStreamPrivate));
g_object_class_install_property (object_class, g_object_class_install_property (object_class,
PROP_BASE_STREAM, PROP_BASE_STREAM,
g_param_spec_object ("base-stream", g_param_spec_object ("base-stream",
@ -150,8 +145,10 @@ g_filter_output_stream_get_property (GObject *object,
GParamSpec *pspec) GParamSpec *pspec)
{ {
GFilterOutputStream *filter_stream; GFilterOutputStream *filter_stream;
GFilterOutputStreamPrivate *priv;
filter_stream = G_FILTER_OUTPUT_STREAM (object); filter_stream = G_FILTER_OUTPUT_STREAM (object);
priv = g_filter_output_stream_get_private (filter_stream);
switch (prop_id) switch (prop_id)
{ {
@ -160,7 +157,7 @@ g_filter_output_stream_get_property (GObject *object,
break; break;
case PROP_CLOSE_BASE: case PROP_CLOSE_BASE:
g_value_set_boolean (value, GET_PRIVATE (filter_stream)->close_base); g_value_set_boolean (value, priv->close_base);
break; break;
default: default:
@ -220,9 +217,13 @@ g_filter_output_stream_get_base_stream (GFilterOutputStream *stream)
gboolean gboolean
g_filter_output_stream_get_close_base_stream (GFilterOutputStream *stream) g_filter_output_stream_get_close_base_stream (GFilterOutputStream *stream)
{ {
GFilterOutputStreamPrivate *priv;
g_return_val_if_fail (G_IS_FILTER_OUTPUT_STREAM (stream), FALSE); g_return_val_if_fail (G_IS_FILTER_OUTPUT_STREAM (stream), FALSE);
return GET_PRIVATE (stream)->close_base; priv = g_filter_output_stream_get_private (stream);
return priv->close_base;
} }
/** /**
@ -242,7 +243,7 @@ g_filter_output_stream_set_close_base_stream (GFilterOutputStream *stream,
close_base = !!close_base; close_base = !!close_base;
priv = GET_PRIVATE (stream); priv = g_filter_output_stream_get_private (stream);
if (priv->close_base != close_base) if (priv->close_base != close_base)
{ {
@ -294,14 +295,12 @@ g_filter_output_stream_close (GOutputStream *stream,
GCancellable *cancellable, GCancellable *cancellable,
GError **error) GError **error)
{ {
GFilterOutputStream *filter_stream = G_FILTER_OUTPUT_STREAM (stream);
GFilterOutputStreamPrivate *priv = g_filter_output_stream_get_private (filter_stream);
gboolean res = TRUE; gboolean res = TRUE;
if (GET_PRIVATE (stream)->close_base) if (priv->close_base)
{ {
GFilterOutputStream *filter_stream;
filter_stream = G_FILTER_OUTPUT_STREAM (stream);
res = g_output_stream_close (filter_stream->base_stream, res = g_output_stream_close (filter_stream->base_stream,
cancellable, cancellable,
error); error);

View File

@ -33,6 +33,14 @@
#include "glibintl.h" #include "glibintl.h"
#include "gnetworkingprivate.h" #include "gnetworkingprivate.h"
struct _GInetAddressPrivate
{
GSocketFamily family;
union {
struct in_addr ipv4;
struct in6_addr ipv6;
} addr;
};
/** /**
* SECTION:ginetaddress * SECTION:ginetaddress
@ -57,17 +65,9 @@
*/ */
G_DEFINE_TYPE_WITH_CODE (GInetAddress, g_inet_address, G_TYPE_OBJECT, G_DEFINE_TYPE_WITH_CODE (GInetAddress, g_inet_address, G_TYPE_OBJECT,
G_ADD_PRIVATE (GInetAddress)
g_networking_init ();) g_networking_init ();)
struct _GInetAddressPrivate
{
GSocketFamily family;
union {
struct in_addr ipv4;
struct in6_addr ipv6;
} addr;
};
enum enum
{ {
PROP_0, PROP_0,
@ -181,8 +181,6 @@ g_inet_address_class_init (GInetAddressClass *klass)
{ {
GObjectClass *gobject_class = G_OBJECT_CLASS (klass); GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
g_type_class_add_private (klass, sizeof (GInetAddressPrivate));
gobject_class->set_property = g_inet_address_set_property; gobject_class->set_property = g_inet_address_set_property;
gobject_class->get_property = g_inet_address_get_property; gobject_class->get_property = g_inet_address_get_property;
@ -369,9 +367,7 @@ g_inet_address_class_init (GInetAddressClass *klass)
static void static void
g_inet_address_init (GInetAddress *address) g_inet_address_init (GInetAddress *address)
{ {
address->priv = G_TYPE_INSTANCE_GET_PRIVATE (address, address->priv = g_inet_address_get_private (address);
G_TYPE_INET_ADDRESS,
GInetAddressPrivate);
} }
/** /**

View File

@ -49,18 +49,19 @@
* Since: 2.32 * Since: 2.32
*/ */
static void g_inet_address_mask_initable_iface_init (GInitableIface *iface);
G_DEFINE_TYPE_WITH_CODE (GInetAddressMask, g_inet_address_mask, G_TYPE_OBJECT,
G_IMPLEMENT_INTERFACE (G_TYPE_INITABLE,
g_inet_address_mask_initable_iface_init));
struct _GInetAddressMaskPrivate struct _GInetAddressMaskPrivate
{ {
GInetAddress *addr; GInetAddress *addr;
guint length; guint length;
}; };
static void g_inet_address_mask_initable_iface_init (GInitableIface *iface);
G_DEFINE_TYPE_WITH_CODE (GInetAddressMask, g_inet_address_mask, G_TYPE_OBJECT,
G_ADD_PRIVATE (GInetAddressMask)
G_IMPLEMENT_INTERFACE (G_TYPE_INITABLE,
g_inet_address_mask_initable_iface_init))
enum enum
{ {
PROP_0, PROP_0,
@ -138,8 +139,6 @@ g_inet_address_mask_class_init (GInetAddressMaskClass *klass)
{ {
GObjectClass *gobject_class = G_OBJECT_CLASS (klass); GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
g_type_class_add_private (klass, sizeof (GInetAddressMaskPrivate));
gobject_class->set_property = g_inet_address_mask_set_property; gobject_class->set_property = g_inet_address_mask_set_property;
gobject_class->get_property = g_inet_address_mask_get_property; gobject_class->get_property = g_inet_address_mask_get_property;
gobject_class->dispose = g_inet_address_mask_dispose; gobject_class->dispose = g_inet_address_mask_dispose;
@ -238,9 +237,7 @@ g_inet_address_mask_initable_iface_init (GInitableIface *iface)
static void static void
g_inet_address_mask_init (GInetAddressMask *mask) g_inet_address_mask_init (GInetAddressMask *mask)
{ {
mask->priv = G_TYPE_INSTANCE_GET_PRIVATE (mask, mask->priv = g_inet_address_mask_get_private (mask);
G_TYPE_INET_ADDRESS_MASK,
GInetAddressMaskPrivate);
} }
/** /**

View File

@ -46,15 +46,6 @@
* An IPv4 or IPv6 socket address, corresponding to a <type>struct * An IPv4 or IPv6 socket address, corresponding to a <type>struct
* sockaddr_in</type> or <type>struct sockaddr_in6</type>. * sockaddr_in</type> or <type>struct sockaddr_in6</type>.
*/ */
G_DEFINE_TYPE (GInetSocketAddress, g_inet_socket_address, G_TYPE_SOCKET_ADDRESS);
enum {
PROP_0,
PROP_ADDRESS,
PROP_PORT,
PROP_FLOWINFO,
PROP_SCOPE_ID
};
struct _GInetSocketAddressPrivate struct _GInetSocketAddressPrivate
{ {
@ -64,24 +55,24 @@ struct _GInetSocketAddressPrivate
guint32 scope_id; guint32 scope_id;
}; };
static void G_DEFINE_TYPE_WITH_PRIVATE (GInetSocketAddress, g_inet_socket_address, G_TYPE_SOCKET_ADDRESS)
g_inet_socket_address_finalize (GObject *object)
{
GInetSocketAddress *address G_GNUC_UNUSED = G_INET_SOCKET_ADDRESS (object);
if (G_OBJECT_CLASS (g_inet_socket_address_parent_class)->finalize) enum {
(*G_OBJECT_CLASS (g_inet_socket_address_parent_class)->finalize) (object); PROP_0,
} PROP_ADDRESS,
PROP_PORT,
PROP_FLOWINFO,
PROP_SCOPE_ID
};
static void static void
g_inet_socket_address_dispose (GObject *object) g_inet_socket_address_dispose (GObject *object)
{ {
GInetSocketAddress *address G_GNUC_UNUSED = G_INET_SOCKET_ADDRESS (object); GInetSocketAddress *address = G_INET_SOCKET_ADDRESS (object);
g_object_unref (address->priv->address); g_clear_object (&(address->priv->address));
if (G_OBJECT_CLASS (g_inet_socket_address_parent_class)->dispose) G_OBJECT_CLASS (g_inet_socket_address_parent_class)->dispose (object);
(*G_OBJECT_CLASS (g_inet_socket_address_parent_class)->dispose) (object);
} }
static void static void
@ -246,9 +237,6 @@ g_inet_socket_address_class_init (GInetSocketAddressClass *klass)
GObjectClass *gobject_class = G_OBJECT_CLASS (klass); GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
GSocketAddressClass *gsocketaddress_class = G_SOCKET_ADDRESS_CLASS (klass); GSocketAddressClass *gsocketaddress_class = G_SOCKET_ADDRESS_CLASS (klass);
g_type_class_add_private (klass, sizeof (GInetSocketAddressPrivate));
gobject_class->finalize = g_inet_socket_address_finalize;
gobject_class->dispose = g_inet_socket_address_dispose; gobject_class->dispose = g_inet_socket_address_dispose;
gobject_class->set_property = g_inet_socket_address_set_property; gobject_class->set_property = g_inet_socket_address_set_property;
gobject_class->get_property = g_inet_socket_address_get_property; gobject_class->get_property = g_inet_socket_address_get_property;
@ -317,9 +305,7 @@ g_inet_socket_address_class_init (GInetSocketAddressClass *klass)
static void static void
g_inet_socket_address_init (GInetSocketAddress *address) g_inet_socket_address_init (GInetSocketAddress *address)
{ {
address->priv = G_TYPE_INSTANCE_GET_PRIVATE (address, address->priv = g_inet_socket_address_get_private (address);
G_TYPE_INET_SOCKET_ADDRESS,
GInetSocketAddressPrivate);
} }
/** /**

View File

@ -46,14 +46,14 @@
* All of these functions have async variants too. * All of these functions have async variants too.
**/ **/
G_DEFINE_ABSTRACT_TYPE (GInputStream, g_input_stream, G_TYPE_OBJECT);
struct _GInputStreamPrivate { struct _GInputStreamPrivate {
guint closed : 1; guint closed : 1;
guint pending : 1; guint pending : 1;
GAsyncReadyCallback outstanding_callback; GAsyncReadyCallback outstanding_callback;
}; };
G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (GInputStream, g_input_stream, G_TYPE_OBJECT)
static gssize g_input_stream_real_skip (GInputStream *stream, static gssize g_input_stream_real_skip (GInputStream *stream,
gsize count, gsize count,
GCancellable *cancellable, GCancellable *cancellable,
@ -86,12 +86,6 @@ static gboolean g_input_stream_real_close_finish (GInputStream *stream,
GAsyncResult *result, GAsyncResult *result,
GError **error); GError **error);
static void
g_input_stream_finalize (GObject *object)
{
G_OBJECT_CLASS (g_input_stream_parent_class)->finalize (object);
}
static void static void
g_input_stream_dispose (GObject *object) g_input_stream_dispose (GObject *object)
{ {
@ -111,9 +105,6 @@ g_input_stream_class_init (GInputStreamClass *klass)
{ {
GObjectClass *gobject_class = G_OBJECT_CLASS (klass); GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
g_type_class_add_private (klass, sizeof (GInputStreamPrivate));
gobject_class->finalize = g_input_stream_finalize;
gobject_class->dispose = g_input_stream_dispose; gobject_class->dispose = g_input_stream_dispose;
klass->skip = g_input_stream_real_skip; klass->skip = g_input_stream_real_skip;
@ -128,9 +119,7 @@ g_input_stream_class_init (GInputStreamClass *klass)
static void static void
g_input_stream_init (GInputStream *stream) g_input_stream_init (GInputStream *stream)
{ {
stream->priv = G_TYPE_INSTANCE_GET_PRIVATE (stream, stream->priv = g_input_stream_get_private (stream);
G_TYPE_INPUT_STREAM,
GInputStreamPrivate);
} }
/** /**

View File

@ -30,8 +30,6 @@
#include "gasyncresult.h" #include "gasyncresult.h"
#include "gtask.h" #include "gtask.h"
G_DEFINE_ABSTRACT_TYPE (GIOStream, g_io_stream, G_TYPE_OBJECT);
/** /**
* SECTION:giostream * SECTION:giostream
* @short_description: Base class for implementing read/write streams * @short_description: Base class for implementing read/write streams
@ -92,11 +90,7 @@ static gboolean g_io_stream_real_close_finish (GIOStream *stream,
GAsyncResult *result, GAsyncResult *result,
GError **error); GError **error);
static void G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (GIOStream, g_io_stream, G_TYPE_OBJECT)
g_io_stream_finalize (GObject *object)
{
G_OBJECT_CLASS (g_io_stream_parent_class)->finalize (object);
}
static void static void
g_io_stream_dispose (GObject *object) g_io_stream_dispose (GObject *object)
@ -114,9 +108,7 @@ g_io_stream_dispose (GObject *object)
static void static void
g_io_stream_init (GIOStream *stream) g_io_stream_init (GIOStream *stream)
{ {
stream->priv = G_TYPE_INSTANCE_GET_PRIVATE (stream, stream->priv = g_io_stream_get_private (stream);
G_TYPE_IO_STREAM,
GIOStreamPrivate);
} }
static void static void
@ -151,9 +143,6 @@ g_io_stream_class_init (GIOStreamClass *klass)
{ {
GObjectClass *gobject_class = G_OBJECT_CLASS (klass); GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
g_type_class_add_private (klass, sizeof (GIOStreamPrivate));
gobject_class->finalize = g_io_stream_finalize;
gobject_class->dispose = g_io_stream_dispose; gobject_class->dispose = g_io_stream_dispose;
gobject_class->get_property = g_io_stream_get_property; gobject_class->get_property = g_io_stream_get_property;

View File

@ -47,7 +47,10 @@
#include <io.h> #include <io.h>
#endif #endif
struct _GLocalFileInputStreamPrivate {
int fd;
guint do_close : 1;
};
#ifdef G_OS_UNIX #ifdef G_OS_UNIX
static void g_file_descriptor_based_iface_init (GFileDescriptorBasedIface *iface); static void g_file_descriptor_based_iface_init (GFileDescriptorBasedIface *iface);
@ -56,18 +59,14 @@ static void g_file_descriptor_based_iface_init (GFileDescriptorBasedIfac
#define g_local_file_input_stream_get_type _g_local_file_input_stream_get_type #define g_local_file_input_stream_get_type _g_local_file_input_stream_get_type
#ifdef G_OS_UNIX #ifdef G_OS_UNIX
G_DEFINE_TYPE_WITH_CODE (GLocalFileInputStream, g_local_file_input_stream, G_TYPE_FILE_INPUT_STREAM, G_DEFINE_TYPE_WITH_CODE (GLocalFileInputStream, g_local_file_input_stream, G_TYPE_FILE_INPUT_STREAM,
G_ADD_PRIVATE (GLocalFileInputStream)
G_IMPLEMENT_INTERFACE (G_TYPE_FILE_DESCRIPTOR_BASED, G_IMPLEMENT_INTERFACE (G_TYPE_FILE_DESCRIPTOR_BASED,
g_file_descriptor_based_iface_init) g_file_descriptor_based_iface_init))
);
#else #else
G_DEFINE_TYPE_WITH_CODE (GLocalFileInputStream, g_local_file_input_stream, G_TYPE_FILE_INPUT_STREAM,); G_DEFINE_TYPE_WITH_CODE (GLocalFileInputStream, g_local_file_input_stream, G_TYPE_FILE_INPUT_STREAM,
G_ADD_PRIVATE (GLocalFileInputStream))
#endif #endif
struct _GLocalFileInputStreamPrivate {
int fd;
guint do_close : 1;
};
static gssize g_local_file_input_stream_read (GInputStream *stream, static gssize g_local_file_input_stream_read (GInputStream *stream,
void *buffer, void *buffer,
gsize count, gsize count,
@ -95,12 +94,6 @@ static GFileInfo *g_local_file_input_stream_query_info (GFileInputStream *strea
static int g_local_file_input_stream_get_fd (GFileDescriptorBased *stream); static int g_local_file_input_stream_get_fd (GFileDescriptorBased *stream);
#endif #endif
static void
g_local_file_input_stream_finalize (GObject *object)
{
G_OBJECT_CLASS (g_local_file_input_stream_parent_class)->finalize (object);
}
void void
_g_local_file_input_stream_set_do_close (GLocalFileInputStream *in, _g_local_file_input_stream_set_do_close (GLocalFileInputStream *in,
gboolean do_close) gboolean do_close)
@ -111,13 +104,8 @@ _g_local_file_input_stream_set_do_close (GLocalFileInputStream *in,
static void static void
g_local_file_input_stream_class_init (GLocalFileInputStreamClass *klass) g_local_file_input_stream_class_init (GLocalFileInputStreamClass *klass)
{ {
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
GInputStreamClass *stream_class = G_INPUT_STREAM_CLASS (klass); GInputStreamClass *stream_class = G_INPUT_STREAM_CLASS (klass);
GFileInputStreamClass *file_stream_class = G_FILE_INPUT_STREAM_CLASS (klass); GFileInputStreamClass *file_stream_class = G_FILE_INPUT_STREAM_CLASS (klass);
g_type_class_add_private (klass, sizeof (GLocalFileInputStreamPrivate));
gobject_class->finalize = g_local_file_input_stream_finalize;
stream_class->read_fn = g_local_file_input_stream_read; stream_class->read_fn = g_local_file_input_stream_read;
stream_class->skip = g_local_file_input_stream_skip; stream_class->skip = g_local_file_input_stream_skip;
@ -139,9 +127,7 @@ g_file_descriptor_based_iface_init (GFileDescriptorBasedIface *iface)
static void static void
g_local_file_input_stream_init (GLocalFileInputStream *info) g_local_file_input_stream_init (GLocalFileInputStream *info)
{ {
info->priv = G_TYPE_INSTANCE_GET_PRIVATE (info, info->priv = g_local_file_input_stream_get_private (info);
G_TYPE_LOCAL_FILE_INPUT_STREAM,
GLocalFileInputStreamPrivate);
info->priv->do_close = TRUE; info->priv->do_close = TRUE;
} }

View File

@ -58,28 +58,6 @@
#define O_BINARY 0 #define O_BINARY 0
#endif #endif
#ifdef G_OS_UNIX
static void g_file_descriptor_based_iface_init (GFileDescriptorBasedIface *iface);
#endif
#define g_local_file_output_stream_get_type _g_local_file_output_stream_get_type
#ifdef G_OS_UNIX
G_DEFINE_TYPE_WITH_CODE (GLocalFileOutputStream, g_local_file_output_stream, G_TYPE_FILE_OUTPUT_STREAM,
G_IMPLEMENT_INTERFACE (G_TYPE_FILE_DESCRIPTOR_BASED,
g_file_descriptor_based_iface_init)
);
#else
G_DEFINE_TYPE_WITH_CODE (GLocalFileOutputStream, g_local_file_output_stream, G_TYPE_FILE_OUTPUT_STREAM,);
#endif
/* Some of the file replacement code was based on the code from gedit,
* relicenced to LGPL with permissions from the authors.
*/
#define BACKUP_EXTENSION "~"
struct _GLocalFileOutputStreamPrivate { struct _GLocalFileOutputStreamPrivate {
char *tmp_filename; char *tmp_filename;
char *original_filename; char *original_filename;
@ -90,6 +68,28 @@ struct _GLocalFileOutputStreamPrivate {
int fd; int fd;
}; };
#ifdef G_OS_UNIX
static void g_file_descriptor_based_iface_init (GFileDescriptorBasedIface *iface);
#endif
#define g_local_file_output_stream_get_type _g_local_file_output_stream_get_type
#ifdef G_OS_UNIX
G_DEFINE_TYPE_WITH_CODE (GLocalFileOutputStream, g_local_file_output_stream, G_TYPE_FILE_OUTPUT_STREAM,
G_ADD_PRIVATE (GLocalFileOutputStream)
G_IMPLEMENT_INTERFACE (G_TYPE_FILE_DESCRIPTOR_BASED,
g_file_descriptor_based_iface_init))
#else
G_DEFINE_TYPE_WITH_CODE (GLocalFileOutputStream, g_local_file_output_stream, G_TYPE_FILE_OUTPUT_STREAM,
G_ADD_PRIVATE (GLocalFileOutputStream))
#endif
/* Some of the file replacement code was based on the code from gedit,
* relicenced to LGPL with permissions from the authors.
*/
#define BACKUP_EXTENSION "~"
static gssize g_local_file_output_stream_write (GOutputStream *stream, static gssize g_local_file_output_stream_write (GOutputStream *stream,
const void *buffer, const void *buffer,
gsize count, gsize count,
@ -134,16 +134,13 @@ g_local_file_output_stream_finalize (GObject *object)
G_OBJECT_CLASS (g_local_file_output_stream_parent_class)->finalize (object); G_OBJECT_CLASS (g_local_file_output_stream_parent_class)->finalize (object);
} }
static void static void
g_local_file_output_stream_class_init (GLocalFileOutputStreamClass *klass) g_local_file_output_stream_class_init (GLocalFileOutputStreamClass *klass)
{ {
GObjectClass *gobject_class = G_OBJECT_CLASS (klass); GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
GOutputStreamClass *stream_class = G_OUTPUT_STREAM_CLASS (klass); GOutputStreamClass *stream_class = G_OUTPUT_STREAM_CLASS (klass);
GFileOutputStreamClass *file_stream_class = G_FILE_OUTPUT_STREAM_CLASS (klass); GFileOutputStreamClass *file_stream_class = G_FILE_OUTPUT_STREAM_CLASS (klass);
g_type_class_add_private (klass, sizeof (GLocalFileOutputStreamPrivate));
gobject_class->finalize = g_local_file_output_stream_finalize; gobject_class->finalize = g_local_file_output_stream_finalize;
stream_class->write_fn = g_local_file_output_stream_write; stream_class->write_fn = g_local_file_output_stream_write;
@ -168,9 +165,7 @@ g_file_descriptor_based_iface_init (GFileDescriptorBasedIface *iface)
static void static void
g_local_file_output_stream_init (GLocalFileOutputStream *stream) g_local_file_output_stream_init (GLocalFileOutputStream *stream)
{ {
stream->priv = G_TYPE_INSTANCE_GET_PRIVATE (stream, stream->priv = g_local_file_output_stream_get_private (stream);
G_TYPE_LOCAL_FILE_OUTPUT_STREAM,
GLocalFileOutputStreamPrivate);
stream->priv->do_close = TRUE; stream->priv->do_close = TRUE;
} }

View File

@ -102,6 +102,7 @@ static GSource *g_memory_input_stream_create_source (GPollableInputStream
static void g_memory_input_stream_finalize (GObject *object); static void g_memory_input_stream_finalize (GObject *object);
G_DEFINE_TYPE_WITH_CODE (GMemoryInputStream, g_memory_input_stream, G_TYPE_INPUT_STREAM, G_DEFINE_TYPE_WITH_CODE (GMemoryInputStream, g_memory_input_stream, G_TYPE_INPUT_STREAM,
G_ADD_PRIVATE (GMemoryInputStream)
G_IMPLEMENT_INTERFACE (G_TYPE_SEEKABLE, G_IMPLEMENT_INTERFACE (G_TYPE_SEEKABLE,
g_memory_input_stream_seekable_iface_init); g_memory_input_stream_seekable_iface_init);
G_IMPLEMENT_INTERFACE (G_TYPE_POLLABLE_INPUT_STREAM, G_IMPLEMENT_INTERFACE (G_TYPE_POLLABLE_INPUT_STREAM,
@ -115,8 +116,6 @@ g_memory_input_stream_class_init (GMemoryInputStreamClass *klass)
GObjectClass *object_class; GObjectClass *object_class;
GInputStreamClass *istream_class; GInputStreamClass *istream_class;
g_type_class_add_private (klass, sizeof (GMemoryInputStreamPrivate));
object_class = G_OBJECT_CLASS (klass); object_class = G_OBJECT_CLASS (klass);
object_class->finalize = g_memory_input_stream_finalize; object_class->finalize = g_memory_input_stream_finalize;
@ -165,9 +164,7 @@ g_memory_input_stream_pollable_iface_init (GPollableInputStreamInterface *iface)
static void static void
g_memory_input_stream_init (GMemoryInputStream *stream) g_memory_input_stream_init (GMemoryInputStream *stream)
{ {
stream->priv = G_TYPE_INSTANCE_GET_PRIVATE (stream, stream->priv = g_memory_input_stream_get_private (stream);
G_TYPE_MEMORY_INPUT_STREAM,
GMemoryInputStreamPrivate);
} }
/** /**

View File

@ -119,6 +119,7 @@ static GSource *g_memory_output_stream_create_source (GPollableOutputStream
static void g_memory_output_stream_pollable_iface_init (GPollableOutputStreamInterface *iface); static void g_memory_output_stream_pollable_iface_init (GPollableOutputStreamInterface *iface);
G_DEFINE_TYPE_WITH_CODE (GMemoryOutputStream, g_memory_output_stream, G_TYPE_OUTPUT_STREAM, G_DEFINE_TYPE_WITH_CODE (GMemoryOutputStream, g_memory_output_stream, G_TYPE_OUTPUT_STREAM,
G_ADD_PRIVATE (GMemoryOutputStream)
G_IMPLEMENT_INTERFACE (G_TYPE_SEEKABLE, G_IMPLEMENT_INTERFACE (G_TYPE_SEEKABLE,
g_memory_output_stream_seekable_iface_init); g_memory_output_stream_seekable_iface_init);
G_IMPLEMENT_INTERFACE (G_TYPE_POLLABLE_OUTPUT_STREAM, G_IMPLEMENT_INTERFACE (G_TYPE_POLLABLE_OUTPUT_STREAM,
@ -131,8 +132,6 @@ g_memory_output_stream_class_init (GMemoryOutputStreamClass *klass)
GOutputStreamClass *ostream_class; GOutputStreamClass *ostream_class;
GObjectClass *gobject_class; GObjectClass *gobject_class;
g_type_class_add_private (klass, sizeof (GMemoryOutputStreamPrivate));
gobject_class = G_OBJECT_CLASS (klass); gobject_class = G_OBJECT_CLASS (klass);
gobject_class->set_property = g_memory_output_stream_set_property; gobject_class->set_property = g_memory_output_stream_set_property;
gobject_class->get_property = g_memory_output_stream_get_property; gobject_class->get_property = g_memory_output_stream_get_property;
@ -326,9 +325,7 @@ g_memory_output_stream_seekable_iface_init (GSeekableIface *iface)
static void static void
g_memory_output_stream_init (GMemoryOutputStream *stream) g_memory_output_stream_init (GMemoryOutputStream *stream)
{ {
stream->priv = G_TYPE_INSTANCE_GET_PRIVATE (stream, stream->priv = g_memory_output_stream_get_private (stream);
G_TYPE_MEMORY_OUTPUT_STREAM,
GMemoryOutputStreamPrivate);
stream->priv->pos = 0; stream->priv->pos = 0;
stream->priv->valid_len = 0; stream->priv->valid_len = 0;
} }

View File

@ -706,8 +706,6 @@ g_menu_model_items_changed (GMenuModel *model,
g_signal_emit (model, g_menu_model_items_changed_signal, 0, position, removed, added); g_signal_emit (model, g_menu_model_items_changed_signal, 0, position, removed, added);
} }
G_DEFINE_ABSTRACT_TYPE (GMenuAttributeIter, g_menu_attribute_iter, G_TYPE_OBJECT)
struct _GMenuAttributeIterPrivate struct _GMenuAttributeIterPrivate
{ {
GQuark name; GQuark name;
@ -715,6 +713,8 @@ struct _GMenuAttributeIterPrivate
gboolean valid; gboolean valid;
}; };
G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (GMenuAttributeIter, g_menu_attribute_iter, G_TYPE_OBJECT)
/** /**
* g_menu_attribute_iter_get_next: * g_menu_attribute_iter_get_next:
* @iter: a #GMenuAttributeIter * @iter: a #GMenuAttributeIter
@ -851,7 +851,7 @@ g_menu_attribute_iter_finalize (GObject *object)
static void static void
g_menu_attribute_iter_init (GMenuAttributeIter *iter) g_menu_attribute_iter_init (GMenuAttributeIter *iter)
{ {
iter->priv = G_TYPE_INSTANCE_GET_PRIVATE (iter, G_TYPE_MENU_ATTRIBUTE_ITER, GMenuAttributeIterPrivate); iter->priv = g_menu_attribute_iter_get_private (iter);
} }
static void static void
@ -860,12 +860,8 @@ g_menu_attribute_iter_class_init (GMenuAttributeIterClass *class)
GObjectClass *object_class = G_OBJECT_CLASS (class); GObjectClass *object_class = G_OBJECT_CLASS (class);
object_class->finalize = g_menu_attribute_iter_finalize; object_class->finalize = g_menu_attribute_iter_finalize;
g_type_class_add_private (class, sizeof (GMenuAttributeIterPrivate));
} }
G_DEFINE_ABSTRACT_TYPE (GMenuLinkIter, g_menu_link_iter, G_TYPE_OBJECT)
struct _GMenuLinkIterPrivate struct _GMenuLinkIterPrivate
{ {
GQuark name; GQuark name;
@ -873,6 +869,8 @@ struct _GMenuLinkIterPrivate
gboolean valid; gboolean valid;
}; };
G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (GMenuLinkIter, g_menu_link_iter, G_TYPE_OBJECT)
/** /**
* g_menu_link_iter_get_next: * g_menu_link_iter_get_next:
* @iter: a #GMenuLinkIter * @iter: a #GMenuLinkIter
@ -1007,7 +1005,7 @@ g_menu_link_iter_finalize (GObject *object)
static void static void
g_menu_link_iter_init (GMenuLinkIter *iter) g_menu_link_iter_init (GMenuLinkIter *iter)
{ {
iter->priv = G_TYPE_INSTANCE_GET_PRIVATE (iter, G_TYPE_MENU_LINK_ITER, GMenuLinkIterPrivate); iter->priv = g_menu_link_iter_get_private (iter);
} }
static void static void
@ -1016,6 +1014,4 @@ g_menu_link_iter_class_init (GMenuLinkIterClass *class)
GObjectClass *object_class = G_OBJECT_CLASS (class); GObjectClass *object_class = G_OBJECT_CLASS (class);
object_class->finalize = g_menu_link_iter_finalize; object_class->finalize = g_menu_link_iter_finalize;
g_type_class_add_private (class, sizeof (GMenuLinkIterPrivate));
} }

View File

@ -51,8 +51,6 @@
* passed, see each method taking a #GMountOperation for details. * passed, see each method taking a #GMountOperation for details.
*/ */
G_DEFINE_TYPE (GMountOperation, g_mount_operation, G_TYPE_OBJECT);
enum { enum {
ASK_PASSWORD, ASK_PASSWORD,
ASK_QUESTION, ASK_QUESTION,
@ -84,6 +82,8 @@ enum {
PROP_CHOICE PROP_CHOICE
}; };
G_DEFINE_TYPE_WITH_PRIVATE (GMountOperation, g_mount_operation, G_TYPE_OBJECT)
static void static void
g_mount_operation_set_property (GObject *object, g_mount_operation_set_property (GObject *object,
guint prop_id, guint prop_id,
@ -253,8 +253,6 @@ static void
g_mount_operation_class_init (GMountOperationClass *klass) g_mount_operation_class_init (GMountOperationClass *klass)
{ {
GObjectClass *object_class; GObjectClass *object_class;
g_type_class_add_private (klass, sizeof (GMountOperationPrivate));
object_class = G_OBJECT_CLASS (klass); object_class = G_OBJECT_CLASS (klass);
object_class->finalize = g_mount_operation_finalize; object_class->finalize = g_mount_operation_finalize;
@ -513,9 +511,7 @@ g_mount_operation_class_init (GMountOperationClass *klass)
static void static void
g_mount_operation_init (GMountOperation *operation) g_mount_operation_init (GMountOperation *operation)
{ {
operation->priv = G_TYPE_INSTANCE_GET_PRIVATE (operation, operation->priv = g_mount_operation_get_private (operation);
G_TYPE_MOUNT_OPERATION,
GMountOperationPrivate);
} }
/** /**

View File

@ -90,6 +90,7 @@ static GSocketAddressEnumerator *g_network_address_connectable_enumerate
static GSocketAddressEnumerator *g_network_address_connectable_proxy_enumerate (GSocketConnectable *connectable); static GSocketAddressEnumerator *g_network_address_connectable_proxy_enumerate (GSocketConnectable *connectable);
G_DEFINE_TYPE_WITH_CODE (GNetworkAddress, g_network_address, G_TYPE_OBJECT, G_DEFINE_TYPE_WITH_CODE (GNetworkAddress, g_network_address, G_TYPE_OBJECT,
G_ADD_PRIVATE (GNetworkAddress)
G_IMPLEMENT_INTERFACE (G_TYPE_SOCKET_CONNECTABLE, G_IMPLEMENT_INTERFACE (G_TYPE_SOCKET_CONNECTABLE,
g_network_address_connectable_iface_init)) g_network_address_connectable_iface_init))
@ -118,8 +119,6 @@ g_network_address_class_init (GNetworkAddressClass *klass)
{ {
GObjectClass *gobject_class = G_OBJECT_CLASS (klass); GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
g_type_class_add_private (klass, sizeof (GNetworkAddressPrivate));
gobject_class->set_property = g_network_address_set_property; gobject_class->set_property = g_network_address_set_property;
gobject_class->get_property = g_network_address_get_property; gobject_class->get_property = g_network_address_get_property;
gobject_class->finalize = g_network_address_finalize; gobject_class->finalize = g_network_address_finalize;
@ -161,8 +160,7 @@ g_network_address_connectable_iface_init (GSocketConnectableIface *connectable_i
static void static void
g_network_address_init (GNetworkAddress *addr) g_network_address_init (GNetworkAddress *addr)
{ {
addr->priv = G_TYPE_INSTANCE_GET_PRIVATE (addr, G_TYPE_NETWORK_ADDRESS, addr->priv = g_network_address_get_private (addr);
GNetworkAddressPrivate);
} }
static void static void

View File

@ -36,17 +36,6 @@
static void g_network_monitor_base_iface_init (GNetworkMonitorInterface *iface); static void g_network_monitor_base_iface_init (GNetworkMonitorInterface *iface);
static void g_network_monitor_base_initable_iface_init (GInitableIface *iface); static void g_network_monitor_base_initable_iface_init (GInitableIface *iface);
G_DEFINE_TYPE_WITH_CODE (GNetworkMonitorBase, g_network_monitor_base, G_TYPE_OBJECT,
G_IMPLEMENT_INTERFACE (G_TYPE_INITABLE,
g_network_monitor_base_initable_iface_init)
G_IMPLEMENT_INTERFACE (G_TYPE_NETWORK_MONITOR,
g_network_monitor_base_iface_init)
_g_io_modules_ensure_extension_points_registered ();
g_io_extension_point_implement (G_NETWORK_MONITOR_EXTENSION_POINT_NAME,
g_define_type_id,
"base",
0))
enum enum
{ {
PROP_0, PROP_0,
@ -70,13 +59,22 @@ static guint network_changed_signal = 0;
static void queue_network_changed (GNetworkMonitorBase *monitor); static void queue_network_changed (GNetworkMonitorBase *monitor);
G_DEFINE_TYPE_WITH_CODE (GNetworkMonitorBase, g_network_monitor_base, G_TYPE_OBJECT,
G_ADD_PRIVATE (GNetworkMonitorBase)
G_IMPLEMENT_INTERFACE (G_TYPE_INITABLE,
g_network_monitor_base_initable_iface_init)
G_IMPLEMENT_INTERFACE (G_TYPE_NETWORK_MONITOR,
g_network_monitor_base_iface_init)
_g_io_modules_ensure_extension_points_registered ();
g_io_extension_point_implement (G_NETWORK_MONITOR_EXTENSION_POINT_NAME,
g_define_type_id,
"base",
0))
static void static void
g_network_monitor_base_init (GNetworkMonitorBase *monitor) g_network_monitor_base_init (GNetworkMonitorBase *monitor)
{ {
monitor->priv = G_TYPE_INSTANCE_GET_PRIVATE (monitor, monitor->priv = g_network_monitor_base_get_private (monitor);
G_TYPE_NETWORK_MONITOR_BASE,
GNetworkMonitorBasePrivate);
monitor->priv->networks = g_ptr_array_new_with_free_func (g_object_unref); monitor->priv->networks = g_ptr_array_new_with_free_func (g_object_unref);
monitor->priv->context = g_main_context_get_thread_default (); monitor->priv->context = g_main_context_get_thread_default ();
if (monitor->priv->context) if (monitor->priv->context)
@ -150,8 +148,6 @@ g_network_monitor_base_class_init (GNetworkMonitorBaseClass *monitor_class)
{ {
GObjectClass *gobject_class = G_OBJECT_CLASS (monitor_class); GObjectClass *gobject_class = G_OBJECT_CLASS (monitor_class);
g_type_class_add_private (monitor_class, sizeof (GNetworkMonitorBasePrivate));
gobject_class->constructed = g_network_monitor_base_constructed; gobject_class->constructed = g_network_monitor_base_constructed;
gobject_class->get_property = g_network_monitor_base_get_property; gobject_class->get_property = g_network_monitor_base_get_property;
gobject_class->finalize = g_network_monitor_base_finalize; gobject_class->finalize = g_network_monitor_base_finalize;

View File

@ -43,18 +43,6 @@
static void g_network_monitor_netlink_iface_init (GNetworkMonitorInterface *iface); static void g_network_monitor_netlink_iface_init (GNetworkMonitorInterface *iface);
static void g_network_monitor_netlink_initable_iface_init (GInitableIface *iface); static void g_network_monitor_netlink_initable_iface_init (GInitableIface *iface);
#define g_network_monitor_netlink_get_type _g_network_monitor_netlink_get_type
G_DEFINE_TYPE_WITH_CODE (GNetworkMonitorNetlink, g_network_monitor_netlink, G_TYPE_NETWORK_MONITOR_BASE,
G_IMPLEMENT_INTERFACE (G_TYPE_NETWORK_MONITOR,
g_network_monitor_netlink_iface_init)
G_IMPLEMENT_INTERFACE (G_TYPE_INITABLE,
g_network_monitor_netlink_initable_iface_init)
_g_io_modules_ensure_extension_points_registered ();
g_io_extension_point_implement (G_NETWORK_MONITOR_EXTENSION_POINT_NAME,
g_define_type_id,
"netlink",
20))
struct _GNetworkMonitorNetlinkPrivate struct _GNetworkMonitorNetlinkPrivate
{ {
GSocket *sock; GSocket *sock;
@ -69,12 +57,23 @@ static gboolean read_netlink_messages (GSocket *socket,
static gboolean request_dump (GNetworkMonitorNetlink *nl, static gboolean request_dump (GNetworkMonitorNetlink *nl,
GError **error); GError **error);
#define g_network_monitor_netlink_get_type _g_network_monitor_netlink_get_type
G_DEFINE_TYPE_WITH_CODE (GNetworkMonitorNetlink, g_network_monitor_netlink, G_TYPE_NETWORK_MONITOR_BASE,
G_ADD_PRIVATE (GNetworkMonitorNetlink)
G_IMPLEMENT_INTERFACE (G_TYPE_NETWORK_MONITOR,
g_network_monitor_netlink_iface_init)
G_IMPLEMENT_INTERFACE (G_TYPE_INITABLE,
g_network_monitor_netlink_initable_iface_init)
_g_io_modules_ensure_extension_points_registered ();
g_io_extension_point_implement (G_NETWORK_MONITOR_EXTENSION_POINT_NAME,
g_define_type_id,
"netlink",
20))
static void static void
g_network_monitor_netlink_init (GNetworkMonitorNetlink *nl) g_network_monitor_netlink_init (GNetworkMonitorNetlink *nl)
{ {
nl->priv = G_TYPE_INSTANCE_GET_PRIVATE (nl, nl->priv = g_network_monitor_netlink_get_private (nl);
G_TYPE_NETWORK_MONITOR_NETLINK,
GNetworkMonitorNetlinkPrivate);
} }
@ -451,8 +450,6 @@ g_network_monitor_netlink_class_init (GNetworkMonitorNetlinkClass *nl_class)
{ {
GObjectClass *gobject_class = G_OBJECT_CLASS (nl_class); GObjectClass *gobject_class = G_OBJECT_CLASS (nl_class);
g_type_class_add_private (nl_class, sizeof (GNetworkMonitorNetlinkPrivate));
gobject_class->finalize = g_network_monitor_netlink_finalize; gobject_class->finalize = g_network_monitor_netlink_finalize;
} }

View File

@ -93,6 +93,7 @@ static GSocketAddressEnumerator *g_network_service_connectable_enumerate
static GSocketAddressEnumerator *g_network_service_connectable_proxy_enumerate (GSocketConnectable *connectable); static GSocketAddressEnumerator *g_network_service_connectable_proxy_enumerate (GSocketConnectable *connectable);
G_DEFINE_TYPE_WITH_CODE (GNetworkService, g_network_service, G_TYPE_OBJECT, G_DEFINE_TYPE_WITH_CODE (GNetworkService, g_network_service, G_TYPE_OBJECT,
G_ADD_PRIVATE (GNetworkService)
G_IMPLEMENT_INTERFACE (G_TYPE_SOCKET_CONNECTABLE, G_IMPLEMENT_INTERFACE (G_TYPE_SOCKET_CONNECTABLE,
g_network_service_connectable_iface_init)) g_network_service_connectable_iface_init))
@ -117,8 +118,6 @@ g_network_service_class_init (GNetworkServiceClass *klass)
{ {
GObjectClass *gobject_class = G_OBJECT_CLASS (klass); GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
g_type_class_add_private (klass, sizeof (GNetworkServicePrivate));
gobject_class->set_property = g_network_service_set_property; gobject_class->set_property = g_network_service_set_property;
gobject_class->get_property = g_network_service_get_property; gobject_class->get_property = g_network_service_get_property;
gobject_class->finalize = g_network_service_finalize; gobject_class->finalize = g_network_service_finalize;
@ -167,8 +166,7 @@ g_network_service_connectable_iface_init (GSocketConnectableIface *connectable_i
static void static void
g_network_service_init (GNetworkService *srv) g_network_service_init (GNetworkService *srv)
{ {
srv->priv = G_TYPE_INSTANCE_GET_PRIVATE (srv, G_TYPE_NETWORK_SERVICE, srv->priv = g_network_service_get_private (srv);
GNetworkServicePrivate);
} }
static void static void

View File

@ -45,8 +45,6 @@
* All of these functions have async variants too. * All of these functions have async variants too.
**/ **/
G_DEFINE_ABSTRACT_TYPE (GOutputStream, g_output_stream, G_TYPE_OBJECT);
struct _GOutputStreamPrivate { struct _GOutputStreamPrivate {
guint closed : 1; guint closed : 1;
guint pending : 1; guint pending : 1;
@ -54,6 +52,8 @@ struct _GOutputStreamPrivate {
GAsyncReadyCallback outstanding_callback; GAsyncReadyCallback outstanding_callback;
}; };
G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (GOutputStream, g_output_stream, G_TYPE_OBJECT)
static gssize g_output_stream_real_splice (GOutputStream *stream, static gssize g_output_stream_real_splice (GOutputStream *stream,
GInputStream *source, GInputStream *source,
GOutputStreamSpliceFlags flags, GOutputStreamSpliceFlags flags,
@ -99,12 +99,6 @@ static gboolean _g_output_stream_close_internal (GOutputStream *s
GCancellable *cancellable, GCancellable *cancellable,
GError **error); GError **error);
static void
g_output_stream_finalize (GObject *object)
{
G_OBJECT_CLASS (g_output_stream_parent_class)->finalize (object);
}
static void static void
g_output_stream_dispose (GObject *object) g_output_stream_dispose (GObject *object)
{ {
@ -122,10 +116,7 @@ static void
g_output_stream_class_init (GOutputStreamClass *klass) g_output_stream_class_init (GOutputStreamClass *klass)
{ {
GObjectClass *gobject_class = G_OBJECT_CLASS (klass); GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
g_type_class_add_private (klass, sizeof (GOutputStreamPrivate));
gobject_class->finalize = g_output_stream_finalize;
gobject_class->dispose = g_output_stream_dispose; gobject_class->dispose = g_output_stream_dispose;
klass->splice = g_output_stream_real_splice; klass->splice = g_output_stream_real_splice;
@ -143,9 +134,7 @@ g_output_stream_class_init (GOutputStreamClass *klass)
static void static void
g_output_stream_init (GOutputStream *stream) g_output_stream_init (GOutputStream *stream)
{ {
stream->priv = G_TYPE_INSTANCE_GET_PRIVATE (stream, stream->priv = g_output_stream_get_private (stream);
G_TYPE_OUTPUT_STREAM,
GOutputStreamPrivate);
} }
/** /**

View File

@ -60,8 +60,6 @@
* using the following functions. * using the following functions.
**/ **/
G_DEFINE_ABSTRACT_TYPE (GPermission, g_permission, G_TYPE_OBJECT)
struct _GPermissionPrivate struct _GPermissionPrivate
{ {
gboolean allowed; gboolean allowed;
@ -76,6 +74,8 @@ enum {
PROP_CAN_RELEASE PROP_CAN_RELEASE
}; };
G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (GPermission, g_permission, G_TYPE_OBJECT)
/** /**
* g_permission_acquire: * g_permission_acquire:
* @permission: a #GPermission instance * @permission: a #GPermission instance
@ -375,9 +375,7 @@ g_permission_get_property (GObject *object, guint prop_id,
static void static void
g_permission_init (GPermission *permission) g_permission_init (GPermission *permission)
{ {
permission->priv = G_TYPE_INSTANCE_GET_PRIVATE (permission, permission->priv = g_permission_get_private (permission);
G_TYPE_PERMISSION,
GPermissionPrivate);
} }
static gboolean static gboolean
@ -464,6 +462,4 @@ g_permission_class_init (GPermissionClass *class)
P_("If calling g_permission_release() makes sense"), P_("If calling g_permission_release() makes sense"),
FALSE, FALSE,
G_PARAM_STATIC_STRINGS | G_PARAM_READABLE)); G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
g_type_class_add_private (class, sizeof (GPermissionPrivate));
} }

View File

@ -43,7 +43,6 @@
* *
* Since: 2.26 * Since: 2.26
**/ **/
G_DEFINE_TYPE (GProxyAddress, g_proxy_address, G_TYPE_INET_SOCKET_ADDRESS);
enum enum
{ {
@ -68,6 +67,8 @@ struct _GProxyAddressPrivate
guint16 dest_port; guint16 dest_port;
}; };
G_DEFINE_TYPE_WITH_PRIVATE (GProxyAddress, g_proxy_address, G_TYPE_INET_SOCKET_ADDRESS)
static void static void
g_proxy_address_finalize (GObject *object) g_proxy_address_finalize (GObject *object)
{ {
@ -180,8 +181,6 @@ g_proxy_address_class_init (GProxyAddressClass *klass)
{ {
GObjectClass *gobject_class = G_OBJECT_CLASS (klass); GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
g_type_class_add_private (klass, sizeof (GProxyAddressPrivate));
gobject_class->finalize = g_proxy_address_finalize; gobject_class->finalize = g_proxy_address_finalize;
gobject_class->set_property = g_proxy_address_set_property; gobject_class->set_property = g_proxy_address_set_property;
gobject_class->get_property = g_proxy_address_get_property; gobject_class->get_property = g_proxy_address_get_property;
@ -276,9 +275,7 @@ g_proxy_address_class_init (GProxyAddressClass *klass)
static void static void
g_proxy_address_init (GProxyAddress *proxy) g_proxy_address_init (GProxyAddress *proxy)
{ {
proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, proxy->priv = g_proxy_address_get_private (proxy);
G_TYPE_PROXY_ADDRESS,
GProxyAddressPrivate);
proxy->priv->protocol = NULL; proxy->priv->protocol = NULL;
proxy->priv->username = NULL; proxy->priv->username = NULL;
proxy->priv->password = NULL; proxy->priv->password = NULL;

View File

@ -39,8 +39,6 @@
#include "gsocketaddressenumerator.h" #include "gsocketaddressenumerator.h"
#include "gsocketconnectable.h" #include "gsocketconnectable.h"
G_DEFINE_TYPE (GProxyAddressEnumerator, g_proxy_address_enumerator, G_TYPE_SOCKET_ADDRESS_ENUMERATOR);
#define GET_PRIVATE(o) (G_PROXY_ADDRESS_ENUMERATOR (o)->priv) #define GET_PRIVATE(o) (G_PROXY_ADDRESS_ENUMERATOR (o)->priv)
enum enum
@ -77,6 +75,8 @@ struct _GProxyAddressEnumeratorPrivate
GError *last_error; GError *last_error;
}; };
G_DEFINE_TYPE_WITH_PRIVATE (GProxyAddressEnumerator, g_proxy_address_enumerator, G_TYPE_SOCKET_ADDRESS_ENUMERATOR)
static void static void
save_userinfo (GProxyAddressEnumeratorPrivate *priv, save_userinfo (GProxyAddressEnumeratorPrivate *priv,
const gchar *proxy) const gchar *proxy)
@ -697,9 +697,7 @@ g_proxy_address_enumerator_finalize (GObject *object)
static void static void
g_proxy_address_enumerator_init (GProxyAddressEnumerator *self) g_proxy_address_enumerator_init (GProxyAddressEnumerator *self)
{ {
self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, self->priv = g_proxy_address_enumerator_get_private (self);
G_TYPE_PROXY_ADDRESS_ENUMERATOR,
GProxyAddressEnumeratorPrivate);
} }
static void static void
@ -708,9 +706,6 @@ g_proxy_address_enumerator_class_init (GProxyAddressEnumeratorClass *proxy_enume
GObjectClass *object_class = G_OBJECT_CLASS (proxy_enumerator_class); GObjectClass *object_class = G_OBJECT_CLASS (proxy_enumerator_class);
GSocketAddressEnumeratorClass *enumerator_class = G_SOCKET_ADDRESS_ENUMERATOR_CLASS (proxy_enumerator_class); GSocketAddressEnumeratorClass *enumerator_class = G_SOCKET_ADDRESS_ENUMERATOR_CLASS (proxy_enumerator_class);
g_type_class_add_private (enumerator_class,
sizeof (GProxyAddressEnumeratorPrivate));
object_class->constructed = g_proxy_address_enumerator_constructed; object_class->constructed = g_proxy_address_enumerator_constructed;
object_class->set_property = g_proxy_address_enumerator_set_property; object_class->set_property = g_proxy_address_enumerator_set_property;
object_class->get_property = g_proxy_address_enumerator_get_property; object_class->get_property = g_proxy_address_enumerator_get_property;

View File

@ -77,6 +77,7 @@ struct _GResolverPrivate {
* to get the default resolver. * to get the default resolver.
*/ */
G_DEFINE_TYPE_WITH_CODE (GResolver, g_resolver, G_TYPE_OBJECT, G_DEFINE_TYPE_WITH_CODE (GResolver, g_resolver, G_TYPE_OBJECT,
G_ADD_PRIVATE (GResolver)
g_networking_init ();) g_networking_init ();)
static GList * static GList *
@ -152,8 +153,6 @@ g_resolver_class_init (GResolverClass *resolver_class)
resolver_class->lookup_service_async = g_resolver_real_lookup_service_async; resolver_class->lookup_service_async = g_resolver_real_lookup_service_async;
resolver_class->lookup_service_finish = g_resolver_real_lookup_service_finish; resolver_class->lookup_service_finish = g_resolver_real_lookup_service_finish;
g_type_class_add_private (resolver_class, sizeof (GResolverPrivate));
/** /**
* GResolver::reload: * GResolver::reload:
* @resolver: a #GResolver * @resolver: a #GResolver
@ -178,7 +177,7 @@ g_resolver_init (GResolver *resolver)
struct stat st; struct stat st;
#endif #endif
resolver->priv = G_TYPE_INSTANCE_GET_PRIVATE (resolver, G_TYPE_RESOLVER, GResolverPrivate); resolver->priv = g_resolver_get_private (resolver);
#ifdef G_OS_UNIX #ifdef G_OS_UNIX
if (stat (_PATH_RESCONF, &st) == 0) if (stat (_PATH_RESCONF, &st) == 0)

View File

@ -265,7 +265,7 @@ enum
static guint g_settings_signals[N_SIGNALS]; static guint g_settings_signals[N_SIGNALS];
G_DEFINE_TYPE (GSettings, g_settings, G_TYPE_OBJECT) G_DEFINE_TYPE_WITH_PRIVATE (GSettings, g_settings, G_TYPE_OBJECT)
/* Signals {{{1 */ /* Signals {{{1 */
static gboolean static gboolean
@ -603,10 +603,7 @@ g_settings_finalize (GObject *object)
static void static void
g_settings_init (GSettings *settings) g_settings_init (GSettings *settings)
{ {
settings->priv = G_TYPE_INSTANCE_GET_PRIVATE (settings, settings->priv = g_settings_get_private (settings);
G_TYPE_SETTINGS,
GSettingsPrivate);
settings->priv->main_context = g_main_context_ref_thread_default (); settings->priv->main_context = g_main_context_ref_thread_default ();
} }
@ -623,8 +620,6 @@ g_settings_class_init (GSettingsClass *class)
object_class->constructed = g_settings_constructed; object_class->constructed = g_settings_constructed;
object_class->finalize = g_settings_finalize; object_class->finalize = g_settings_finalize;
g_type_class_add_private (object_class, sizeof (GSettingsPrivate));
/** /**
* GSettings::changed: * GSettings::changed:
* @settings: the object on which the signal was emitted * @settings: the object on which the signal was emitted

View File

@ -33,8 +33,6 @@
#include <glibintl.h> #include <glibintl.h>
G_DEFINE_ABSTRACT_TYPE (GSettingsBackend, g_settings_backend, G_TYPE_OBJECT)
typedef struct _GSettingsBackendClosure GSettingsBackendClosure; typedef struct _GSettingsBackendClosure GSettingsBackendClosure;
typedef struct _GSettingsBackendWatch GSettingsBackendWatch; typedef struct _GSettingsBackendWatch GSettingsBackendWatch;
@ -44,6 +42,8 @@ struct _GSettingsBackendPrivate
GMutex lock; GMutex lock;
}; };
G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (GSettingsBackend, g_settings_backend, G_TYPE_OBJECT)
/* For g_settings_backend_sync_default(), we only want to actually do /* For g_settings_backend_sync_default(), we only want to actually do
* the sync if the backend already exists. This avoids us creating an * the sync if the backend already exists. This avoids us creating an
* entire GSettingsBackend in order to call a do-nothing sync() * entire GSettingsBackend in order to call a do-nothing sync()
@ -906,9 +906,7 @@ ignore_subscription (GSettingsBackend *backend,
static void static void
g_settings_backend_init (GSettingsBackend *backend) g_settings_backend_init (GSettingsBackend *backend)
{ {
backend->priv = G_TYPE_INSTANCE_GET_PRIVATE (backend, backend->priv = g_settings_backend_get_private (backend);
G_TYPE_SETTINGS_BACKEND,
GSettingsBackendPrivate);
g_mutex_init (&backend->priv->lock); g_mutex_init (&backend->priv->lock);
} }
@ -921,8 +919,6 @@ g_settings_backend_class_init (GSettingsBackendClass *class)
class->unsubscribe = ignore_subscription; class->unsubscribe = ignore_subscription;
gobject_class->finalize = g_settings_backend_finalize; gobject_class->finalize = g_settings_backend_finalize;
g_type_class_add_private (class, sizeof (GSettingsBackendPrivate));
} }
static void static void

View File

@ -45,6 +45,7 @@ static void g_simple_action_group_iface_init (GActionGroupInterface *);
static void g_simple_action_group_map_iface_init (GActionMapInterface *); static void g_simple_action_group_map_iface_init (GActionMapInterface *);
G_DEFINE_TYPE_WITH_CODE (GSimpleActionGroup, G_DEFINE_TYPE_WITH_CODE (GSimpleActionGroup,
g_simple_action_group, G_TYPE_OBJECT, g_simple_action_group, G_TYPE_OBJECT,
G_ADD_PRIVATE (GSimpleActionGroup)
G_IMPLEMENT_INTERFACE (G_TYPE_ACTION_GROUP, G_IMPLEMENT_INTERFACE (G_TYPE_ACTION_GROUP,
g_simple_action_group_iface_init); g_simple_action_group_iface_init);
G_IMPLEMENT_INTERFACE (G_TYPE_ACTION_MAP, G_IMPLEMENT_INTERFACE (G_TYPE_ACTION_MAP,
@ -251,9 +252,7 @@ g_simple_action_group_finalize (GObject *object)
static void static void
g_simple_action_group_init (GSimpleActionGroup *simple) g_simple_action_group_init (GSimpleActionGroup *simple)
{ {
simple->priv = G_TYPE_INSTANCE_GET_PRIVATE (simple, simple->priv = g_simple_action_group_get_private (simple);
G_TYPE_SIMPLE_ACTION_GROUP,
GSimpleActionGroupPrivate);
simple->priv->table = g_hash_table_new_full (g_str_hash, g_str_equal, simple->priv->table = g_hash_table_new_full (g_str_hash, g_str_equal,
g_free, g_object_unref); g_free, g_object_unref);
} }
@ -264,8 +263,6 @@ g_simple_action_group_class_init (GSimpleActionGroupClass *class)
GObjectClass *object_class = G_OBJECT_CLASS (class); GObjectClass *object_class = G_OBJECT_CLASS (class);
object_class->finalize = g_simple_action_group_finalize; object_class->finalize = g_simple_action_group_finalize;
g_type_class_add_private (class, sizeof (GSimpleActionGroupPrivate));
} }
static void static void

View File

@ -65,6 +65,7 @@ struct _GSimpleProxyResolverPrivate {
static void g_simple_proxy_resolver_iface_init (GProxyResolverInterface *iface); static void g_simple_proxy_resolver_iface_init (GProxyResolverInterface *iface);
G_DEFINE_TYPE_WITH_CODE (GSimpleProxyResolver, g_simple_proxy_resolver, G_TYPE_OBJECT, G_DEFINE_TYPE_WITH_CODE (GSimpleProxyResolver, g_simple_proxy_resolver, G_TYPE_OBJECT,
G_ADD_PRIVATE (GSimpleProxyResolver)
G_IMPLEMENT_INTERFACE (G_TYPE_PROXY_RESOLVER, G_IMPLEMENT_INTERFACE (G_TYPE_PROXY_RESOLVER,
g_simple_proxy_resolver_iface_init)) g_simple_proxy_resolver_iface_init))
@ -96,9 +97,7 @@ g_simple_proxy_resolver_finalize (GObject *object)
static void static void
g_simple_proxy_resolver_init (GSimpleProxyResolver *resolver) g_simple_proxy_resolver_init (GSimpleProxyResolver *resolver)
{ {
resolver->priv = G_TYPE_INSTANCE_GET_PRIVATE (resolver, resolver->priv = g_simple_proxy_resolver_get_private (resolver);
G_TYPE_SIMPLE_PROXY_RESOLVER,
GSimpleProxyResolverPrivate);
resolver->priv->uri_proxies = g_hash_table_new_full (g_str_hash, g_str_equal, resolver->priv->uri_proxies = g_hash_table_new_full (g_str_hash, g_str_equal,
g_free, g_free); g_free, g_free);
} }
@ -403,8 +402,6 @@ g_simple_proxy_resolver_class_init (GSimpleProxyResolverClass *resolver_class)
{ {
GObjectClass *object_class = G_OBJECT_CLASS (resolver_class); GObjectClass *object_class = G_OBJECT_CLASS (resolver_class);
g_type_class_add_private (resolver_class, sizeof (GSimpleProxyResolverPrivate));
object_class->get_property = g_simple_proxy_resolver_get_property; object_class->get_property = g_simple_proxy_resolver_get_property;
object_class->set_property = g_simple_proxy_resolver_set_property; object_class->set_property = g_simple_proxy_resolver_set_property;
object_class->finalize = g_simple_proxy_resolver_finalize; object_class->finalize = g_simple_proxy_resolver_finalize;

View File

@ -126,11 +126,6 @@ static gboolean g_socket_initable_init (GInitable *initable,
GCancellable *cancellable, GCancellable *cancellable,
GError **error); GError **error);
G_DEFINE_TYPE_WITH_CODE (GSocket, g_socket, G_TYPE_OBJECT,
g_networking_init ();
G_IMPLEMENT_INTERFACE (G_TYPE_INITABLE,
g_socket_initable_iface_init));
enum enum
{ {
PROP_0, PROP_0,
@ -187,6 +182,12 @@ struct _GSocketPrivate
} recv_addr_cache[RECV_ADDR_CACHE_SIZE]; } recv_addr_cache[RECV_ADDR_CACHE_SIZE];
}; };
G_DEFINE_TYPE_WITH_CODE (GSocket, g_socket, G_TYPE_OBJECT,
G_ADD_PRIVATE (GSocket)
g_networking_init ();
G_IMPLEMENT_INTERFACE (G_TYPE_INITABLE,
g_socket_initable_iface_init));
static int static int
get_socket_errno (void) get_socket_errno (void)
{ {
@ -786,8 +787,6 @@ g_socket_class_init (GSocketClass *klass)
signal (SIGPIPE, SIG_IGN); signal (SIGPIPE, SIG_IGN);
#endif #endif
g_type_class_add_private (klass, sizeof (GSocketPrivate));
gobject_class->finalize = g_socket_finalize; gobject_class->finalize = g_socket_finalize;
gobject_class->constructed = g_socket_constructed; gobject_class->constructed = g_socket_constructed;
gobject_class->set_property = g_socket_set_property; gobject_class->set_property = g_socket_set_property;
@ -963,7 +962,7 @@ g_socket_initable_iface_init (GInitableIface *iface)
static void static void
g_socket_init (GSocket *socket) g_socket_init (GSocket *socket)
{ {
socket->priv = G_TYPE_INSTANCE_GET_PRIVATE (socket, G_TYPE_SOCKET, GSocketPrivate); socket->priv = g_socket_get_private (socket);
socket->priv->fd = -1; socket->priv->fd = -1;
socket->priv->blocking = TRUE; socket->priv->blocking = TRUE;

View File

@ -75,8 +75,6 @@
*/ */
G_DEFINE_TYPE (GSocketClient, g_socket_client, G_TYPE_OBJECT);
enum enum
{ {
EVENT, EVENT,
@ -113,6 +111,8 @@ struct _GSocketClientPrivate
GProxyResolver *proxy_resolver; GProxyResolver *proxy_resolver;
}; };
G_DEFINE_TYPE_WITH_PRIVATE (GSocketClient, g_socket_client, G_TYPE_OBJECT)
static GSocket * static GSocket *
create_socket (GSocketClient *client, create_socket (GSocketClient *client,
GSocketAddress *dest_address, GSocketAddress *dest_address,
@ -199,9 +199,7 @@ clarify_connect_error (GError *error,
static void static void
g_socket_client_init (GSocketClient *client) g_socket_client_init (GSocketClient *client)
{ {
client->priv = G_TYPE_INSTANCE_GET_PRIVATE (client, client->priv = g_socket_client_get_private (client);
G_TYPE_SOCKET_CLIENT,
GSocketClientPrivate);
client->priv->type = G_SOCKET_TYPE_STREAM; client->priv->type = G_SOCKET_TYPE_STREAM;
client->priv->app_proxies = g_hash_table_new_full (g_str_hash, client->priv->app_proxies = g_hash_table_new_full (g_str_hash,
g_str_equal, g_str_equal,
@ -233,8 +231,7 @@ g_socket_client_finalize (GObject *object)
g_clear_object (&client->priv->local_address); g_clear_object (&client->priv->local_address);
g_clear_object (&client->priv->proxy_resolver); g_clear_object (&client->priv->proxy_resolver);
if (G_OBJECT_CLASS (g_socket_client_parent_class)->finalize) G_OBJECT_CLASS (g_socket_client_parent_class)->finalize (object);
(*G_OBJECT_CLASS (g_socket_client_parent_class)->finalize) (object);
g_hash_table_unref (client->priv->app_proxies); g_hash_table_unref (client->priv->app_proxies);
} }
@ -762,8 +759,6 @@ g_socket_client_class_init (GSocketClientClass *class)
{ {
GObjectClass *gobject_class = G_OBJECT_CLASS (class); GObjectClass *gobject_class = G_OBJECT_CLASS (class);
g_type_class_add_private (class, sizeof (GSocketClientPrivate));
gobject_class->finalize = g_socket_client_finalize; gobject_class->finalize = g_socket_client_finalize;
gobject_class->set_property = g_socket_client_set_property; gobject_class->set_property = g_socket_client_set_property;
gobject_class->get_property = g_socket_client_get_property; gobject_class->get_property = g_socket_client_get_property;

View File

@ -60,8 +60,6 @@
* Since: 2.22 * Since: 2.22
*/ */
G_DEFINE_TYPE (GSocketConnection, g_socket_connection, G_TYPE_IO_STREAM);
enum enum
{ {
PROP_NONE, PROP_NONE,
@ -89,6 +87,8 @@ static gboolean g_socket_connection_close_finish (GIOStream *stream,
GAsyncResult *result, GAsyncResult *result,
GError **error); GError **error);
G_DEFINE_TYPE_WITH_PRIVATE (GSocketConnection, g_socket_connection, G_TYPE_IO_STREAM)
static GInputStream * static GInputStream *
g_socket_connection_get_input_stream (GIOStream *io_stream) g_socket_connection_get_input_stream (GIOStream *io_stream)
{ {
@ -399,8 +399,6 @@ g_socket_connection_class_init (GSocketConnectionClass *klass)
GObjectClass *gobject_class = G_OBJECT_CLASS (klass); GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
GIOStreamClass *stream_class = G_IO_STREAM_CLASS (klass); GIOStreamClass *stream_class = G_IO_STREAM_CLASS (klass);
g_type_class_add_private (klass, sizeof (GSocketConnectionPrivate));
gobject_class->set_property = g_socket_connection_set_property; gobject_class->set_property = g_socket_connection_set_property;
gobject_class->get_property = g_socket_connection_get_property; gobject_class->get_property = g_socket_connection_get_property;
gobject_class->constructed = g_socket_connection_constructed; gobject_class->constructed = g_socket_connection_constructed;
@ -427,9 +425,7 @@ g_socket_connection_class_init (GSocketConnectionClass *klass)
static void static void
g_socket_connection_init (GSocketConnection *connection) g_socket_connection_init (GSocketConnection *connection)
{ {
connection->priv = G_TYPE_INSTANCE_GET_PRIVATE (connection, connection->priv = g_socket_connection_get_private (connection);
G_TYPE_SOCKET_CONNECTION,
GSocketConnectionPrivate);
} }
static gboolean static gboolean

View File

@ -32,6 +32,15 @@
#include "gioerror.h" #include "gioerror.h"
#include "gfiledescriptorbased.h" #include "gfiledescriptorbased.h"
struct _GSocketInputStreamPrivate
{
GSocket *socket;
/* pending operation metadata */
gpointer buffer;
gsize count;
};
static void g_socket_input_stream_pollable_iface_init (GPollableInputStreamInterface *iface); static void g_socket_input_stream_pollable_iface_init (GPollableInputStreamInterface *iface);
#ifdef G_OS_UNIX #ifdef G_OS_UNIX
static void g_socket_input_stream_file_descriptor_based_iface_init (GFileDescriptorBasedIface *iface); static void g_socket_input_stream_file_descriptor_based_iface_init (GFileDescriptorBasedIface *iface);
@ -41,11 +50,13 @@ static void g_socket_input_stream_file_descriptor_based_iface_init (GFileDescrip
#ifdef G_OS_UNIX #ifdef G_OS_UNIX
G_DEFINE_TYPE_WITH_CODE (GSocketInputStream, g_socket_input_stream, G_TYPE_INPUT_STREAM, G_DEFINE_TYPE_WITH_CODE (GSocketInputStream, g_socket_input_stream, G_TYPE_INPUT_STREAM,
G_ADD_PRIVATE (GSocketInputStream)
G_IMPLEMENT_INTERFACE (G_TYPE_POLLABLE_INPUT_STREAM, g_socket_input_stream_pollable_iface_init) G_IMPLEMENT_INTERFACE (G_TYPE_POLLABLE_INPUT_STREAM, g_socket_input_stream_pollable_iface_init)
G_IMPLEMENT_INTERFACE (G_TYPE_FILE_DESCRIPTOR_BASED, g_socket_input_stream_file_descriptor_based_iface_init) G_IMPLEMENT_INTERFACE (G_TYPE_FILE_DESCRIPTOR_BASED, g_socket_input_stream_file_descriptor_based_iface_init)
) )
#else #else
G_DEFINE_TYPE_WITH_CODE (GSocketInputStream, g_socket_input_stream, G_TYPE_INPUT_STREAM, G_DEFINE_TYPE_WITH_CODE (GSocketInputStream, g_socket_input_stream, G_TYPE_INPUT_STREAM,
G_ADD_PRIVATE (GSocketInputStream)
G_IMPLEMENT_INTERFACE (G_TYPE_POLLABLE_INPUT_STREAM, g_socket_input_stream_pollable_iface_init) G_IMPLEMENT_INTERFACE (G_TYPE_POLLABLE_INPUT_STREAM, g_socket_input_stream_pollable_iface_init)
) )
#endif #endif
@ -56,15 +67,6 @@ enum
PROP_SOCKET PROP_SOCKET
}; };
struct _GSocketInputStreamPrivate
{
GSocket *socket;
/* pending operation metadata */
gpointer buffer;
gsize count;
};
static void static void
g_socket_input_stream_get_property (GObject *object, g_socket_input_stream_get_property (GObject *object,
guint prop_id, guint prop_id,
@ -111,8 +113,7 @@ g_socket_input_stream_finalize (GObject *object)
if (stream->priv->socket) if (stream->priv->socket)
g_object_unref (stream->priv->socket); g_object_unref (stream->priv->socket);
if (G_OBJECT_CLASS (g_socket_input_stream_parent_class)->finalize) G_OBJECT_CLASS (g_socket_input_stream_parent_class)->finalize (object);
(*G_OBJECT_CLASS (g_socket_input_stream_parent_class)->finalize) (object);
} }
static gssize static gssize
@ -183,8 +184,6 @@ g_socket_input_stream_class_init (GSocketInputStreamClass *klass)
GObjectClass *gobject_class = G_OBJECT_CLASS (klass); GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
GInputStreamClass *ginputstream_class = G_INPUT_STREAM_CLASS (klass); GInputStreamClass *ginputstream_class = G_INPUT_STREAM_CLASS (klass);
g_type_class_add_private (klass, sizeof (GSocketInputStreamPrivate));
gobject_class->finalize = g_socket_input_stream_finalize; gobject_class->finalize = g_socket_input_stream_finalize;
gobject_class->get_property = g_socket_input_stream_get_property; gobject_class->get_property = g_socket_input_stream_get_property;
gobject_class->set_property = g_socket_input_stream_set_property; gobject_class->set_property = g_socket_input_stream_set_property;
@ -218,11 +217,11 @@ g_socket_input_stream_pollable_iface_init (GPollableInputStreamInterface *iface)
static void static void
g_socket_input_stream_init (GSocketInputStream *stream) g_socket_input_stream_init (GSocketInputStream *stream)
{ {
stream->priv = G_TYPE_INSTANCE_GET_PRIVATE (stream, G_TYPE_SOCKET_INPUT_STREAM, GSocketInputStreamPrivate); stream->priv = g_socket_input_stream_get_private (stream);
} }
GSocketInputStream * GSocketInputStream *
_g_socket_input_stream_new (GSocket *socket) _g_socket_input_stream_new (GSocket *socket)
{ {
return G_SOCKET_INPUT_STREAM (g_object_new (G_TYPE_SOCKET_INPUT_STREAM, "socket", socket, NULL)); return g_object_new (G_TYPE_SOCKET_INPUT_STREAM, "socket", socket, NULL);
} }

View File

@ -56,8 +56,6 @@
* Since: 2.22 * Since: 2.22
*/ */
G_DEFINE_TYPE (GSocketListener, g_socket_listener, G_TYPE_OBJECT);
enum enum
{ {
PROP_0, PROP_0,
@ -75,6 +73,8 @@ struct _GSocketListenerPrivate
guint closed : 1; guint closed : 1;
}; };
G_DEFINE_TYPE_WITH_PRIVATE (GSocketListener, g_socket_listener, G_TYPE_OBJECT)
static void static void
g_socket_listener_finalize (GObject *object) g_socket_listener_finalize (GObject *object)
{ {
@ -136,8 +136,6 @@ g_socket_listener_class_init (GSocketListenerClass *klass)
{ {
GObjectClass *gobject_class G_GNUC_UNUSED = G_OBJECT_CLASS (klass); GObjectClass *gobject_class G_GNUC_UNUSED = G_OBJECT_CLASS (klass);
g_type_class_add_private (klass, sizeof (GSocketListenerPrivate));
gobject_class->finalize = g_socket_listener_finalize; gobject_class->finalize = g_socket_listener_finalize;
gobject_class->set_property = g_socket_listener_set_property; gobject_class->set_property = g_socket_listener_set_property;
gobject_class->get_property = g_socket_listener_get_property; gobject_class->get_property = g_socket_listener_get_property;
@ -156,9 +154,7 @@ g_socket_listener_class_init (GSocketListenerClass *klass)
static void static void
g_socket_listener_init (GSocketListener *listener) g_socket_listener_init (GSocketListener *listener)
{ {
listener->priv = G_TYPE_INSTANCE_GET_PRIVATE (listener, listener->priv = g_socket_listener_get_private (listener);
G_TYPE_SOCKET_LISTENER,
GSocketListenerPrivate);
listener->priv->sockets = listener->priv->sockets =
g_ptr_array_new_with_free_func ((GDestroyNotify) g_object_unref); g_ptr_array_new_with_free_func ((GDestroyNotify) g_object_unref);
listener->priv->listen_backlog = 10; listener->priv->listen_backlog = 10;

View File

@ -36,6 +36,15 @@
#include "glibintl.h" #include "glibintl.h"
#include "gfiledescriptorbased.h" #include "gfiledescriptorbased.h"
struct _GSocketOutputStreamPrivate
{
GSocket *socket;
/* pending operation metadata */
gconstpointer buffer;
gsize count;
};
static void g_socket_output_stream_pollable_iface_init (GPollableOutputStreamInterface *iface); static void g_socket_output_stream_pollable_iface_init (GPollableOutputStreamInterface *iface);
#ifdef G_OS_UNIX #ifdef G_OS_UNIX
static void g_socket_output_stream_file_descriptor_based_iface_init (GFileDescriptorBasedIface *iface); static void g_socket_output_stream_file_descriptor_based_iface_init (GFileDescriptorBasedIface *iface);
@ -45,11 +54,13 @@ static void g_socket_output_stream_file_descriptor_based_iface_init (GFileDescri
#ifdef G_OS_UNIX #ifdef G_OS_UNIX
G_DEFINE_TYPE_WITH_CODE (GSocketOutputStream, g_socket_output_stream, G_TYPE_OUTPUT_STREAM, G_DEFINE_TYPE_WITH_CODE (GSocketOutputStream, g_socket_output_stream, G_TYPE_OUTPUT_STREAM,
G_ADD_PRIVATE (GSocketOutputStream)
G_IMPLEMENT_INTERFACE (G_TYPE_POLLABLE_OUTPUT_STREAM, g_socket_output_stream_pollable_iface_init) G_IMPLEMENT_INTERFACE (G_TYPE_POLLABLE_OUTPUT_STREAM, g_socket_output_stream_pollable_iface_init)
G_IMPLEMENT_INTERFACE (G_TYPE_FILE_DESCRIPTOR_BASED, g_socket_output_stream_file_descriptor_based_iface_init) G_IMPLEMENT_INTERFACE (G_TYPE_FILE_DESCRIPTOR_BASED, g_socket_output_stream_file_descriptor_based_iface_init)
) )
#else #else
G_DEFINE_TYPE_WITH_CODE (GSocketOutputStream, g_socket_output_stream, G_TYPE_OUTPUT_STREAM, G_DEFINE_TYPE_WITH_CODE (GSocketOutputStream, g_socket_output_stream, G_TYPE_OUTPUT_STREAM,
G_ADD_PRIVATE (GSocketOutputStream)
G_IMPLEMENT_INTERFACE (G_TYPE_POLLABLE_OUTPUT_STREAM, g_socket_output_stream_pollable_iface_init) G_IMPLEMENT_INTERFACE (G_TYPE_POLLABLE_OUTPUT_STREAM, g_socket_output_stream_pollable_iface_init)
) )
#endif #endif
@ -60,15 +71,6 @@ enum
PROP_SOCKET PROP_SOCKET
}; };
struct _GSocketOutputStreamPrivate
{
GSocket *socket;
/* pending operation metadata */
gconstpointer buffer;
gsize count;
};
static void static void
g_socket_output_stream_get_property (GObject *object, g_socket_output_stream_get_property (GObject *object,
guint prop_id, guint prop_id,
@ -115,8 +117,7 @@ g_socket_output_stream_finalize (GObject *object)
if (stream->priv->socket) if (stream->priv->socket)
g_object_unref (stream->priv->socket); g_object_unref (stream->priv->socket);
if (G_OBJECT_CLASS (g_socket_output_stream_parent_class)->finalize) G_OBJECT_CLASS (g_socket_output_stream_parent_class)->finalize (object);
(*G_OBJECT_CLASS (g_socket_output_stream_parent_class)->finalize) (object);
} }
static gssize static gssize
@ -187,8 +188,6 @@ g_socket_output_stream_class_init (GSocketOutputStreamClass *klass)
GObjectClass *gobject_class = G_OBJECT_CLASS (klass); GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
GOutputStreamClass *goutputstream_class = G_OUTPUT_STREAM_CLASS (klass); GOutputStreamClass *goutputstream_class = G_OUTPUT_STREAM_CLASS (klass);
g_type_class_add_private (klass, sizeof (GSocketOutputStreamPrivate));
gobject_class->finalize = g_socket_output_stream_finalize; gobject_class->finalize = g_socket_output_stream_finalize;
gobject_class->get_property = g_socket_output_stream_get_property; gobject_class->get_property = g_socket_output_stream_get_property;
gobject_class->set_property = g_socket_output_stream_set_property; gobject_class->set_property = g_socket_output_stream_set_property;
@ -222,11 +221,11 @@ g_socket_output_stream_pollable_iface_init (GPollableOutputStreamInterface *ifac
static void static void
g_socket_output_stream_init (GSocketOutputStream *stream) g_socket_output_stream_init (GSocketOutputStream *stream)
{ {
stream->priv = G_TYPE_INSTANCE_GET_PRIVATE (stream, G_TYPE_SOCKET_OUTPUT_STREAM, GSocketOutputStreamPrivate); stream->priv = g_socket_output_stream_get_private (stream);
} }
GSocketOutputStream * GSocketOutputStream *
_g_socket_output_stream_new (GSocket *socket) _g_socket_output_stream_new (GSocket *socket)
{ {
return G_SOCKET_OUTPUT_STREAM (g_object_new (G_TYPE_SOCKET_OUTPUT_STREAM, "socket", socket, NULL)); return g_object_new (G_TYPE_SOCKET_OUTPUT_STREAM, "socket", socket, NULL);
} }

View File

@ -65,13 +65,6 @@
#include "gsocketlistener.h" #include "gsocketlistener.h"
#include "gsocketconnection.h" #include "gsocketconnection.h"
static guint g_socket_service_incoming_signal;
G_DEFINE_TYPE (GSocketService, g_socket_service, G_TYPE_SOCKET_LISTENER);
G_LOCK_DEFINE_STATIC(active);
struct _GSocketServicePrivate struct _GSocketServicePrivate
{ {
GCancellable *cancellable; GCancellable *cancellable;
@ -79,6 +72,12 @@ struct _GSocketServicePrivate
guint outstanding_accept : 1; guint outstanding_accept : 1;
}; };
static guint g_socket_service_incoming_signal;
G_LOCK_DEFINE_STATIC(active);
G_DEFINE_TYPE_WITH_PRIVATE (GSocketService, g_socket_service, G_TYPE_SOCKET_LISTENER)
static void g_socket_service_ready (GObject *object, static void g_socket_service_ready (GObject *object,
GAsyncResult *result, GAsyncResult *result,
gpointer user_data); gpointer user_data);
@ -94,9 +93,7 @@ g_socket_service_real_incoming (GSocketService *service,
static void static void
g_socket_service_init (GSocketService *service) g_socket_service_init (GSocketService *service)
{ {
service->priv = G_TYPE_INSTANCE_GET_PRIVATE (service, service->priv = g_socket_service_get_private (service);
G_TYPE_SOCKET_SERVICE,
GSocketServicePrivate);
service->priv->cancellable = g_cancellable_new (); service->priv->cancellable = g_cancellable_new ();
service->priv->active = TRUE; service->priv->active = TRUE;
} }
@ -244,8 +241,6 @@ g_socket_service_class_init (GSocketServiceClass *class)
GObjectClass *gobject_class = G_OBJECT_CLASS (class); GObjectClass *gobject_class = G_OBJECT_CLASS (class);
GSocketListenerClass *listener_class = G_SOCKET_LISTENER_CLASS (class); GSocketListenerClass *listener_class = G_SOCKET_LISTENER_CLASS (class);
g_type_class_add_private (class, sizeof (GSocketServicePrivate));
gobject_class->finalize = g_socket_service_finalize; gobject_class->finalize = g_socket_service_finalize;
listener_class->changed = g_socket_service_changed; listener_class->changed = g_socket_service_changed;
class->incoming = g_socket_service_real_incoming; class->incoming = g_socket_service_real_incoming;

View File

@ -29,9 +29,14 @@
#include "giostream.h" #include "giostream.h"
#include "glibintl.h" #include "glibintl.h"
struct _GTcpConnectionPrivate
{
guint graceful_disconnect : 1;
};
G_DEFINE_TYPE_WITH_CODE (GTcpConnection, g_tcp_connection, G_DEFINE_TYPE_WITH_CODE (GTcpConnection, g_tcp_connection,
G_TYPE_SOCKET_CONNECTION, G_TYPE_SOCKET_CONNECTION,
G_ADD_PRIVATE (GTcpConnection)
g_socket_connection_factory_register_type (g_define_type_id, g_socket_connection_factory_register_type (g_define_type_id,
G_SOCKET_FAMILY_IPV4, G_SOCKET_FAMILY_IPV4,
G_SOCKET_TYPE_STREAM, G_SOCKET_TYPE_STREAM,
@ -59,11 +64,6 @@ static void g_tcp_connection_close_async (GIOStream *stream,
GAsyncReadyCallback callback, GAsyncReadyCallback callback,
gpointer user_data); gpointer user_data);
struct _GTcpConnectionPrivate
{
guint graceful_disconnect : 1;
};
enum enum
{ {
@ -74,9 +74,7 @@ enum
static void static void
g_tcp_connection_init (GTcpConnection *connection) g_tcp_connection_init (GTcpConnection *connection)
{ {
connection->priv = G_TYPE_INSTANCE_GET_PRIVATE (connection, connection->priv = g_tcp_connection_get_private (connection);
G_TYPE_TCP_CONNECTION,
GTcpConnectionPrivate);
connection->priv->graceful_disconnect = FALSE; connection->priv->graceful_disconnect = FALSE;
} }
@ -125,8 +123,6 @@ g_tcp_connection_class_init (GTcpConnectionClass *class)
GObjectClass *gobject_class = G_OBJECT_CLASS (class); GObjectClass *gobject_class = G_OBJECT_CLASS (class);
GIOStreamClass *stream_class = G_IO_STREAM_CLASS (class); GIOStreamClass *stream_class = G_IO_STREAM_CLASS (class);
g_type_class_add_private (class, sizeof (GTcpConnectionPrivate));
gobject_class->set_property = g_tcp_connection_set_property; gobject_class->set_property = g_tcp_connection_set_property;
gobject_class->get_property = g_tcp_connection_get_property; gobject_class->get_property = g_tcp_connection_get_property;

View File

@ -42,8 +42,12 @@
#include "gtcpconnection.h" #include "gtcpconnection.h"
#include "glibintl.h" #include "glibintl.h"
G_DEFINE_TYPE (GTcpWrapperConnection, struct _GTcpWrapperConnectionPrivate
g_tcp_wrapper_connection, G_TYPE_TCP_CONNECTION); {
GIOStream *base_io_stream;
};
G_DEFINE_TYPE_WITH_PRIVATE (GTcpWrapperConnection, g_tcp_wrapper_connection, G_TYPE_TCP_CONNECTION)
enum enum
{ {
@ -51,11 +55,6 @@ enum
PROP_BASE_IO_STREAM PROP_BASE_IO_STREAM
}; };
struct _GTcpWrapperConnectionPrivate
{
GIOStream *base_io_stream;
};
static GInputStream * static GInputStream *
g_tcp_wrapper_connection_get_input_stream (GIOStream *io_stream) g_tcp_wrapper_connection_get_input_stream (GIOStream *io_stream)
{ {
@ -127,8 +126,6 @@ g_tcp_wrapper_connection_class_init (GTcpWrapperConnectionClass *klass)
GObjectClass *gobject_class = G_OBJECT_CLASS (klass); GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
GIOStreamClass *stream_class = G_IO_STREAM_CLASS (klass); GIOStreamClass *stream_class = G_IO_STREAM_CLASS (klass);
g_type_class_add_private (klass, sizeof (GTcpWrapperConnectionPrivate));
gobject_class->set_property = g_tcp_wrapper_connection_set_property; gobject_class->set_property = g_tcp_wrapper_connection_set_property;
gobject_class->get_property = g_tcp_wrapper_connection_get_property; gobject_class->get_property = g_tcp_wrapper_connection_get_property;
gobject_class->finalize = g_tcp_wrapper_connection_finalize; gobject_class->finalize = g_tcp_wrapper_connection_finalize;
@ -150,9 +147,7 @@ g_tcp_wrapper_connection_class_init (GTcpWrapperConnectionClass *klass)
static void static void
g_tcp_wrapper_connection_init (GTcpWrapperConnection *connection) g_tcp_wrapper_connection_init (GTcpWrapperConnection *connection)
{ {
connection->priv = G_TYPE_INSTANCE_GET_PRIVATE (connection, connection->priv = g_tcp_wrapper_connection_get_private (connection);
G_TYPE_TCP_WRAPPER_CONNECTION,
GTcpWrapperConnectionPrivate);
} }
/** /**

View File

@ -431,14 +431,12 @@ enum
PROP_FLAGS, PROP_FLAGS,
}; };
G_DEFINE_TYPE (GTestDBus, g_test_dbus, G_TYPE_OBJECT) G_DEFINE_TYPE_WITH_PRIVATE (GTestDBus, g_test_dbus, G_TYPE_OBJECT)
static void static void
g_test_dbus_init (GTestDBus *self) g_test_dbus_init (GTestDBus *self)
{ {
self->priv = G_TYPE_INSTANCE_GET_PRIVATE ((self), G_TYPE_TEST_DBUS, self->priv = g_test_dbus_get_private (self);
GTestDBusPrivate);
self->priv->service_dirs = g_ptr_array_new_with_free_func (g_free); self->priv->service_dirs = g_ptr_array_new_with_free_func (g_free);
} }
@ -512,8 +510,6 @@ g_test_dbus_class_init (GTestDBusClass *klass)
object_class->get_property = g_test_dbus_get_property; object_class->get_property = g_test_dbus_get_property;
object_class->set_property = g_test_dbus_set_property; object_class->set_property = g_test_dbus_set_property;
g_type_class_add_private (object_class, sizeof (GTestDBusPrivate));
/** /**
* GTestDBus:flags: * GTestDBus:flags:
* *

View File

@ -50,12 +50,18 @@
#include "gthreadedsocketservice.h" #include "gthreadedsocketservice.h"
#include "glibintl.h" #include "glibintl.h"
struct _GThreadedSocketServicePrivate
{
GThreadPool *thread_pool;
int max_threads;
gint job_count;
};
static guint g_threaded_socket_service_run_signal; static guint g_threaded_socket_service_run_signal;
G_DEFINE_TYPE (GThreadedSocketService, G_DEFINE_TYPE_WITH_PRIVATE (GThreadedSocketService,
g_threaded_socket_service, g_threaded_socket_service,
G_TYPE_SOCKET_SERVICE); G_TYPE_SOCKET_SERVICE)
enum enum
{ {
@ -63,16 +69,8 @@ enum
PROP_MAX_THREADS PROP_MAX_THREADS
}; };
G_LOCK_DEFINE_STATIC(job_count); G_LOCK_DEFINE_STATIC(job_count);
struct _GThreadedSocketServicePrivate
{
GThreadPool *thread_pool;
int max_threads;
gint job_count;
};
typedef struct typedef struct
{ {
GThreadedSocketService *service; GThreadedSocketService *service;
@ -136,9 +134,7 @@ g_threaded_socket_service_incoming (GSocketService *service,
static void static void
g_threaded_socket_service_init (GThreadedSocketService *service) g_threaded_socket_service_init (GThreadedSocketService *service)
{ {
service->priv = G_TYPE_INSTANCE_GET_PRIVATE (service, service->priv = g_threaded_socket_service_get_private (service);
G_TYPE_THREADED_SOCKET_SERVICE,
GThreadedSocketServicePrivate);
service->priv->max_threads = 10; service->priv->max_threads = 10;
} }
@ -212,8 +208,6 @@ g_threaded_socket_service_class_init (GThreadedSocketServiceClass *class)
GObjectClass *gobject_class = G_OBJECT_CLASS (class); GObjectClass *gobject_class = G_OBJECT_CLASS (class);
GSocketServiceClass *ss_class = &class->parent_class; GSocketServiceClass *ss_class = &class->parent_class;
g_type_class_add_private (class, sizeof (GThreadedSocketServicePrivate));
gobject_class->constructed = g_threaded_socket_service_constructed; gobject_class->constructed = g_threaded_socket_service_constructed;
gobject_class->finalize = g_threaded_socket_service_finalize; gobject_class->finalize = g_threaded_socket_service_finalize;
gobject_class->set_property = g_threaded_socket_service_set_property; gobject_class->set_property = g_threaded_socket_service_set_property;

View File

@ -103,7 +103,7 @@ struct _GTlsInteractionPrivate {
GMainContext *context; GMainContext *context;
}; };
G_DEFINE_TYPE (GTlsInteraction, g_tls_interaction, G_TYPE_OBJECT); G_DEFINE_TYPE_WITH_PRIVATE (GTlsInteraction, g_tls_interaction, G_TYPE_OBJECT)
typedef struct { typedef struct {
GMutex mutex; GMutex mutex;
@ -185,8 +185,7 @@ invoke_closure_wait_and_free (InvokeClosure *closure,
static void static void
g_tls_interaction_init (GTlsInteraction *interaction) g_tls_interaction_init (GTlsInteraction *interaction)
{ {
interaction->priv = G_TYPE_INSTANCE_GET_PRIVATE (interaction, G_TYPE_TLS_INTERACTION, interaction->priv = g_tls_interaction_get_private (interaction);
GTlsInteractionPrivate);
interaction->priv->context = g_main_context_ref_thread_default (); interaction->priv->context = g_main_context_ref_thread_default ();
} }
@ -206,8 +205,6 @@ g_tls_interaction_class_init (GTlsInteractionClass *klass)
GObjectClass *gobject_class = G_OBJECT_CLASS (klass); GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
gobject_class->finalize = g_tls_interaction_finalize; gobject_class->finalize = g_tls_interaction_finalize;
g_type_class_add_private (klass, sizeof (GTlsInteractionPrivate));
} }
static gboolean static gboolean

View File

@ -65,13 +65,12 @@ struct _GTlsPasswordPrivate
gchar *warning; gchar *warning;
}; };
G_DEFINE_TYPE (GTlsPassword, g_tls_password, G_TYPE_OBJECT); G_DEFINE_TYPE_WITH_PRIVATE (GTlsPassword, g_tls_password, G_TYPE_OBJECT)
static void static void
g_tls_password_init (GTlsPassword *password) g_tls_password_init (GTlsPassword *password)
{ {
password->priv = G_TYPE_INSTANCE_GET_PRIVATE (password, G_TYPE_TLS_PASSWORD, password->priv = g_tls_password_get_private (password);
GTlsPasswordPrivate);
} }
static const guchar * static const guchar *
@ -195,8 +194,6 @@ g_tls_password_class_init (GTlsPasswordClass *klass)
gobject_class->set_property = g_tls_password_set_property; gobject_class->set_property = g_tls_password_set_property;
gobject_class->finalize = g_tls_password_finalize; gobject_class->finalize = g_tls_password_finalize;
g_type_class_add_private (klass, sizeof (GTlsPasswordPrivate));
g_object_class_install_property (gobject_class, PROP_FLAGS, g_object_class_install_property (gobject_class, PROP_FLAGS,
g_param_spec_flags ("flags", g_param_spec_flags ("flags",
P_("Flags"), P_("Flags"),

View File

@ -69,8 +69,7 @@ enum
PROP_CREDENTIALS PROP_CREDENTIALS
}; };
G_DEFINE_TYPE (GUnixCredentialsMessage, g_unix_credentials_message, G_TYPE_SOCKET_CONTROL_MESSAGE); G_DEFINE_TYPE_WITH_PRIVATE (GUnixCredentialsMessage, g_unix_credentials_message, G_TYPE_SOCKET_CONTROL_MESSAGE)
static gsize static gsize
g_unix_credentials_message_get_size (GSocketControlMessage *message) g_unix_credentials_message_get_size (GSocketControlMessage *message)
{ {
@ -215,9 +214,7 @@ g_unix_credentials_message_finalize (GObject *object)
static void static void
g_unix_credentials_message_init (GUnixCredentialsMessage *message) g_unix_credentials_message_init (GUnixCredentialsMessage *message)
{ {
message->priv = G_TYPE_INSTANCE_GET_PRIVATE (message, message->priv = g_unix_credentials_message_get_private (message);
G_TYPE_UNIX_CREDENTIALS_MESSAGE,
GUnixCredentialsMessagePrivate);
} }
static void static void
@ -278,8 +275,6 @@ g_unix_credentials_message_class_init (GUnixCredentialsMessageClass *class)
GSocketControlMessageClass *scm_class; GSocketControlMessageClass *scm_class;
GObjectClass *gobject_class; GObjectClass *gobject_class;
g_type_class_add_private (class, sizeof (GUnixCredentialsMessagePrivate));
gobject_class = G_OBJECT_CLASS (class); gobject_class = G_OBJECT_CLASS (class);
gobject_class->get_property = g_unix_credentials_message_get_property; gobject_class->get_property = g_unix_credentials_message_get_property;
gobject_class->set_property = g_unix_credentials_message_set_property; gobject_class->set_property = g_unix_credentials_message_set_property;

View File

@ -42,22 +42,18 @@
#include "gnetworking.h" #include "gnetworking.h"
#include "gioerror.h" #include "gioerror.h"
G_DEFINE_TYPE (GUnixFDList, g_unix_fd_list, G_TYPE_OBJECT)
struct _GUnixFDListPrivate struct _GUnixFDListPrivate
{ {
gint *fds; gint *fds;
gint nfd; gint nfd;
}; };
G_DEFINE_TYPE_WITH_PRIVATE (GUnixFDList, g_unix_fd_list, G_TYPE_OBJECT)
static void static void
g_unix_fd_list_init (GUnixFDList *list) g_unix_fd_list_init (GUnixFDList *list)
{ {
list->priv = G_TYPE_INSTANCE_GET_PRIVATE (list, list->priv = g_unix_fd_list_get_private (list);
G_TYPE_UNIX_FD_LIST,
GUnixFDListPrivate);
} }
static void static void
@ -79,7 +75,6 @@ g_unix_fd_list_class_init (GUnixFDListClass *class)
{ {
GObjectClass *object_class = G_OBJECT_CLASS (class); GObjectClass *object_class = G_OBJECT_CLASS (class);
g_type_class_add_private (class, sizeof (GUnixFDListPrivate));
object_class->finalize = g_unix_fd_list_finalize; object_class->finalize = g_unix_fd_list_finalize;
} }

View File

@ -46,16 +46,13 @@
#include "gnetworking.h" #include "gnetworking.h"
#include "gioerror.h" #include "gioerror.h"
G_DEFINE_TYPE (GUnixFDMessage, g_unix_fd_message,
G_TYPE_SOCKET_CONTROL_MESSAGE);
struct _GUnixFDMessagePrivate struct _GUnixFDMessagePrivate
{ {
GUnixFDList *list; GUnixFDList *list;
}; };
G_DEFINE_TYPE_WITH_PRIVATE (GUnixFDMessage, g_unix_fd_message, G_TYPE_SOCKET_CONTROL_MESSAGE)
static gsize static gsize
g_unix_fd_message_get_size (GSocketControlMessage *message) g_unix_fd_message_get_size (GSocketControlMessage *message)
{ {
@ -184,9 +181,7 @@ g_unix_fd_message_get_property (GObject *object, guint prop_id,
static void static void
g_unix_fd_message_init (GUnixFDMessage *message) g_unix_fd_message_init (GUnixFDMessage *message)
{ {
message->priv = G_TYPE_INSTANCE_GET_PRIVATE (message, message->priv = g_unix_fd_message_get_private (message);
G_TYPE_UNIX_FD_MESSAGE,
GUnixFDMessagePrivate);
} }
static void static void
@ -206,7 +201,6 @@ g_unix_fd_message_class_init (GUnixFDMessageClass *class)
GSocketControlMessageClass *scm_class = G_SOCKET_CONTROL_MESSAGE_CLASS (class); GSocketControlMessageClass *scm_class = G_SOCKET_CONTROL_MESSAGE_CLASS (class);
GObjectClass *object_class = G_OBJECT_CLASS (class); GObjectClass *object_class = G_OBJECT_CLASS (class);
g_type_class_add_private (class, sizeof (GUnixFDMessagePrivate));
scm_class->get_size = g_unix_fd_message_get_size; scm_class->get_size = g_unix_fd_message_get_size;
scm_class->get_level = g_unix_fd_message_get_level; scm_class->get_level = g_unix_fd_message_get_level;
scm_class->get_type = g_unix_fd_message_get_msg_type; scm_class->get_type = g_unix_fd_message_get_msg_type;

View File

@ -63,22 +63,23 @@ enum {
PROP_CLOSE_FD PROP_CLOSE_FD
}; };
static void g_unix_input_stream_pollable_iface_init (GPollableInputStreamInterface *iface);
static void g_unix_input_stream_file_descriptor_based_iface_init (GFileDescriptorBasedIface *iface);
G_DEFINE_TYPE_WITH_CODE (GUnixInputStream, g_unix_input_stream, G_TYPE_INPUT_STREAM,
G_IMPLEMENT_INTERFACE (G_TYPE_POLLABLE_INPUT_STREAM,
g_unix_input_stream_pollable_iface_init)
G_IMPLEMENT_INTERFACE (G_TYPE_FILE_DESCRIPTOR_BASED,
g_unix_input_stream_file_descriptor_based_iface_init)
)
struct _GUnixInputStreamPrivate { struct _GUnixInputStreamPrivate {
int fd; int fd;
guint close_fd : 1; guint close_fd : 1;
guint is_pipe_or_socket : 1; guint is_pipe_or_socket : 1;
}; };
static void g_unix_input_stream_pollable_iface_init (GPollableInputStreamInterface *iface);
static void g_unix_input_stream_file_descriptor_based_iface_init (GFileDescriptorBasedIface *iface);
G_DEFINE_TYPE_WITH_CODE (GUnixInputStream, g_unix_input_stream, G_TYPE_INPUT_STREAM,
G_ADD_PRIVATE (GUnixInputStream)
G_IMPLEMENT_INTERFACE (G_TYPE_POLLABLE_INPUT_STREAM,
g_unix_input_stream_pollable_iface_init)
G_IMPLEMENT_INTERFACE (G_TYPE_FILE_DESCRIPTOR_BASED,
g_unix_input_stream_file_descriptor_based_iface_init)
)
static void g_unix_input_stream_set_property (GObject *object, static void g_unix_input_stream_set_property (GObject *object,
guint prop_id, guint prop_id,
const GValue *value, const GValue *value,
@ -118,23 +119,14 @@ static gboolean g_unix_input_stream_pollable_is_readable (GPollableInputStream
static GSource *g_unix_input_stream_pollable_create_source (GPollableInputStream *stream, static GSource *g_unix_input_stream_pollable_create_source (GPollableInputStream *stream,
GCancellable *cancellable); GCancellable *cancellable);
static void
g_unix_input_stream_finalize (GObject *object)
{
G_OBJECT_CLASS (g_unix_input_stream_parent_class)->finalize (object);
}
static void static void
g_unix_input_stream_class_init (GUnixInputStreamClass *klass) g_unix_input_stream_class_init (GUnixInputStreamClass *klass)
{ {
GObjectClass *gobject_class = G_OBJECT_CLASS (klass); GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
GInputStreamClass *stream_class = G_INPUT_STREAM_CLASS (klass); GInputStreamClass *stream_class = G_INPUT_STREAM_CLASS (klass);
g_type_class_add_private (klass, sizeof (GUnixInputStreamPrivate));
gobject_class->get_property = g_unix_input_stream_get_property; gobject_class->get_property = g_unix_input_stream_get_property;
gobject_class->set_property = g_unix_input_stream_set_property; gobject_class->set_property = g_unix_input_stream_set_property;
gobject_class->finalize = g_unix_input_stream_finalize;
stream_class->read_fn = g_unix_input_stream_read; stream_class->read_fn = g_unix_input_stream_read;
stream_class->close_fn = g_unix_input_stream_close; stream_class->close_fn = g_unix_input_stream_close;
@ -246,10 +238,7 @@ g_unix_input_stream_get_property (GObject *object,
static void static void
g_unix_input_stream_init (GUnixInputStream *unix_stream) g_unix_input_stream_init (GUnixInputStream *unix_stream)
{ {
unix_stream->priv = G_TYPE_INSTANCE_GET_PRIVATE (unix_stream, unix_stream->priv = g_unix_input_stream_get_private (unix_stream);
G_TYPE_UNIX_INPUT_STREAM,
GUnixInputStreamPrivate);
unix_stream->priv->fd = -1; unix_stream->priv->fd = -1;
unix_stream->priv->close_fd = TRUE; unix_stream->priv->close_fd = TRUE;
} }

View File

@ -63,22 +63,23 @@ enum {
PROP_CLOSE_FD PROP_CLOSE_FD
}; };
static void g_unix_output_stream_pollable_iface_init (GPollableOutputStreamInterface *iface);
static void g_unix_output_stream_file_descriptor_based_iface_init (GFileDescriptorBasedIface *iface);
G_DEFINE_TYPE_WITH_CODE (GUnixOutputStream, g_unix_output_stream, G_TYPE_OUTPUT_STREAM,
G_IMPLEMENT_INTERFACE (G_TYPE_POLLABLE_OUTPUT_STREAM,
g_unix_output_stream_pollable_iface_init)
G_IMPLEMENT_INTERFACE (G_TYPE_FILE_DESCRIPTOR_BASED,
g_unix_output_stream_file_descriptor_based_iface_init)
)
struct _GUnixOutputStreamPrivate { struct _GUnixOutputStreamPrivate {
int fd; int fd;
guint close_fd : 1; guint close_fd : 1;
guint is_pipe_or_socket : 1; guint is_pipe_or_socket : 1;
}; };
static void g_unix_output_stream_pollable_iface_init (GPollableOutputStreamInterface *iface);
static void g_unix_output_stream_file_descriptor_based_iface_init (GFileDescriptorBasedIface *iface);
G_DEFINE_TYPE_WITH_CODE (GUnixOutputStream, g_unix_output_stream, G_TYPE_OUTPUT_STREAM,
G_ADD_PRIVATE (GUnixOutputStream)
G_IMPLEMENT_INTERFACE (G_TYPE_POLLABLE_OUTPUT_STREAM,
g_unix_output_stream_pollable_iface_init)
G_IMPLEMENT_INTERFACE (G_TYPE_FILE_DESCRIPTOR_BASED,
g_unix_output_stream_file_descriptor_based_iface_init)
)
static void g_unix_output_stream_set_property (GObject *object, static void g_unix_output_stream_set_property (GObject *object,
guint prop_id, guint prop_id,
const GValue *value, const GValue *value,
@ -109,23 +110,14 @@ static gboolean g_unix_output_stream_pollable_is_writable (GPollableOutputStre
static GSource *g_unix_output_stream_pollable_create_source (GPollableOutputStream *stream, static GSource *g_unix_output_stream_pollable_create_source (GPollableOutputStream *stream,
GCancellable *cancellable); GCancellable *cancellable);
static void
g_unix_output_stream_finalize (GObject *object)
{
G_OBJECT_CLASS (g_unix_output_stream_parent_class)->finalize (object);
}
static void static void
g_unix_output_stream_class_init (GUnixOutputStreamClass *klass) g_unix_output_stream_class_init (GUnixOutputStreamClass *klass)
{ {
GObjectClass *gobject_class = G_OBJECT_CLASS (klass); GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
GOutputStreamClass *stream_class = G_OUTPUT_STREAM_CLASS (klass); GOutputStreamClass *stream_class = G_OUTPUT_STREAM_CLASS (klass);
g_type_class_add_private (klass, sizeof (GUnixOutputStreamPrivate));
gobject_class->get_property = g_unix_output_stream_get_property; gobject_class->get_property = g_unix_output_stream_get_property;
gobject_class->set_property = g_unix_output_stream_set_property; gobject_class->set_property = g_unix_output_stream_set_property;
gobject_class->finalize = g_unix_output_stream_finalize;
stream_class->write_fn = g_unix_output_stream_write; stream_class->write_fn = g_unix_output_stream_write;
stream_class->close_fn = g_unix_output_stream_close; stream_class->close_fn = g_unix_output_stream_close;
@ -231,10 +223,7 @@ g_unix_output_stream_get_property (GObject *object,
static void static void
g_unix_output_stream_init (GUnixOutputStream *unix_stream) g_unix_output_stream_init (GUnixOutputStream *unix_stream)
{ {
unix_stream->priv = G_TYPE_INSTANCE_GET_PRIVATE (unix_stream, unix_stream->priv = g_unix_output_stream_get_private (unix_stream);
G_TYPE_UNIX_OUTPUT_STREAM,
GUnixOutputStreamPrivate);
unix_stream->priv->fd = -1; unix_stream->priv->fd = -1;
unix_stream->priv->close_fd = TRUE; unix_stream->priv->close_fd = TRUE;
} }

View File

@ -57,7 +57,6 @@
* A UNIX-domain (local) socket address, corresponding to a * A UNIX-domain (local) socket address, corresponding to a
* <type>struct sockaddr_un</type>. * <type>struct sockaddr_un</type>.
*/ */
G_DEFINE_TYPE (GUnixSocketAddress, g_unix_socket_address, G_TYPE_SOCKET_ADDRESS);
enum enum
{ {
@ -79,6 +78,8 @@ struct _GUnixSocketAddressPrivate
GUnixSocketAddressType address_type; GUnixSocketAddressType address_type;
}; };
G_DEFINE_TYPE_WITH_PRIVATE (GUnixSocketAddress, g_unix_socket_address, G_TYPE_SOCKET_ADDRESS)
static void static void
g_unix_socket_address_set_property (GObject *object, g_unix_socket_address_set_property (GObject *object,
guint prop_id, guint prop_id,
@ -248,8 +249,6 @@ g_unix_socket_address_class_init (GUnixSocketAddressClass *klass)
GObjectClass *gobject_class = G_OBJECT_CLASS (klass); GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
GSocketAddressClass *gsocketaddress_class = G_SOCKET_ADDRESS_CLASS (klass); GSocketAddressClass *gsocketaddress_class = G_SOCKET_ADDRESS_CLASS (klass);
g_type_class_add_private (klass, sizeof (GUnixSocketAddressPrivate));
gobject_class->set_property = g_unix_socket_address_set_property; gobject_class->set_property = g_unix_socket_address_set_property;
gobject_class->get_property = g_unix_socket_address_get_property; gobject_class->get_property = g_unix_socket_address_get_property;
@ -305,9 +304,7 @@ g_unix_socket_address_class_init (GUnixSocketAddressClass *klass)
static void static void
g_unix_socket_address_init (GUnixSocketAddress *address) g_unix_socket_address_init (GUnixSocketAddress *address)
{ {
address->priv = G_TYPE_INSTANCE_GET_PRIVATE (address, address->priv = g_unix_socket_address_get_private (address);
G_TYPE_UNIX_SOCKET_ADDRESS,
GUnixSocketAddressPrivate);
memset (address->priv->path, 0, sizeof (address->priv->path)); memset (address->priv->path, 0, sizeof (address->priv->path));
address->priv->path_len = -1; address->priv->path_len = -1;

View File

@ -56,13 +56,13 @@ enum {
PROP_CLOSE_HANDLE PROP_CLOSE_HANDLE
}; };
G_DEFINE_TYPE (GWin32InputStream, g_win32_input_stream, G_TYPE_INPUT_STREAM);
struct _GWin32InputStreamPrivate { struct _GWin32InputStreamPrivate {
HANDLE handle; HANDLE handle;
gboolean close_handle; gboolean close_handle;
}; };
G_DEFINE_TYPE_WITH_PRIVATE (GWin32InputStream, g_win32_input_stream, G_TYPE_INPUT_STREAM)
static void g_win32_input_stream_set_property (GObject *object, static void g_win32_input_stream_set_property (GObject *object,
guint prop_id, guint prop_id,
const GValue *value, const GValue *value,
@ -80,23 +80,14 @@ static gboolean g_win32_input_stream_close (GInputStream *stream,
GCancellable *cancellable, GCancellable *cancellable,
GError **error); GError **error);
static void
g_win32_input_stream_finalize (GObject *object)
{
G_OBJECT_CLASS (g_win32_input_stream_parent_class)->finalize (object);
}
static void static void
g_win32_input_stream_class_init (GWin32InputStreamClass *klass) g_win32_input_stream_class_init (GWin32InputStreamClass *klass)
{ {
GObjectClass *gobject_class = G_OBJECT_CLASS (klass); GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
GInputStreamClass *stream_class = G_INPUT_STREAM_CLASS (klass); GInputStreamClass *stream_class = G_INPUT_STREAM_CLASS (klass);
g_type_class_add_private (klass, sizeof (GWin32InputStreamPrivate));
gobject_class->get_property = g_win32_input_stream_get_property; gobject_class->get_property = g_win32_input_stream_get_property;
gobject_class->set_property = g_win32_input_stream_set_property; gobject_class->set_property = g_win32_input_stream_set_property;
gobject_class->finalize = g_win32_input_stream_finalize;
stream_class->read_fn = g_win32_input_stream_read; stream_class->read_fn = g_win32_input_stream_read;
stream_class->close_fn = g_win32_input_stream_close; stream_class->close_fn = g_win32_input_stream_close;
@ -181,10 +172,7 @@ g_win32_input_stream_get_property (GObject *object,
static void static void
g_win32_input_stream_init (GWin32InputStream *win32_stream) g_win32_input_stream_init (GWin32InputStream *win32_stream)
{ {
win32_stream->priv = G_TYPE_INSTANCE_GET_PRIVATE (win32_stream, win32_stream->priv = g_win32_input_stream_get_private (win32_stream);
G_TYPE_WIN32_INPUT_STREAM,
GWin32InputStreamPrivate);
win32_stream->priv->handle = NULL; win32_stream->priv->handle = NULL;
win32_stream->priv->close_handle = TRUE; win32_stream->priv->close_handle = TRUE;
} }

View File

@ -57,14 +57,13 @@ enum {
PROP_CLOSE_HANDLE PROP_CLOSE_HANDLE
}; };
G_DEFINE_TYPE (GWin32OutputStream, g_win32_output_stream, G_TYPE_OUTPUT_STREAM);
struct _GWin32OutputStreamPrivate { struct _GWin32OutputStreamPrivate {
HANDLE handle; HANDLE handle;
gboolean close_handle; gboolean close_handle;
}; };
G_DEFINE_TYPE_WITH_PRIVATE (GWin32OutputStream, g_win32_output_stream, G_TYPE_OUTPUT_STREAM)
static void g_win32_output_stream_set_property (GObject *object, static void g_win32_output_stream_set_property (GObject *object,
guint prop_id, guint prop_id,
const GValue *value, const GValue *value,
@ -83,23 +82,14 @@ static gboolean g_win32_output_stream_close (GOutputStream *stream
GError **error); GError **error);
static void
g_win32_output_stream_finalize (GObject *object)
{
G_OBJECT_CLASS (g_win32_output_stream_parent_class)->finalize (object);
}
static void static void
g_win32_output_stream_class_init (GWin32OutputStreamClass *klass) g_win32_output_stream_class_init (GWin32OutputStreamClass *klass)
{ {
GObjectClass *gobject_class = G_OBJECT_CLASS (klass); GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
GOutputStreamClass *stream_class = G_OUTPUT_STREAM_CLASS (klass); GOutputStreamClass *stream_class = G_OUTPUT_STREAM_CLASS (klass);
g_type_class_add_private (klass, sizeof (GWin32OutputStreamPrivate));
gobject_class->get_property = g_win32_output_stream_get_property; gobject_class->get_property = g_win32_output_stream_get_property;
gobject_class->set_property = g_win32_output_stream_set_property; gobject_class->set_property = g_win32_output_stream_set_property;
gobject_class->finalize = g_win32_output_stream_finalize;
stream_class->write_fn = g_win32_output_stream_write; stream_class->write_fn = g_win32_output_stream_write;
stream_class->close_fn = g_win32_output_stream_close; stream_class->close_fn = g_win32_output_stream_close;
@ -184,10 +174,7 @@ g_win32_output_stream_get_property (GObject *object,
static void static void
g_win32_output_stream_init (GWin32OutputStream *win32_stream) g_win32_output_stream_init (GWin32OutputStream *win32_stream)
{ {
win32_stream->priv = G_TYPE_INSTANCE_GET_PRIVATE (win32_stream, win32_stream->priv = g_win32_output_stream_get_private (win32_stream);
G_TYPE_WIN32_OUTPUT_STREAM,
GWin32OutputStreamPrivate);
win32_stream->priv->handle = NULL; win32_stream->priv->handle = NULL;
win32_stream->priv->close_handle = TRUE; win32_stream->priv->close_handle = TRUE;
} }