* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General
- * Public License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
- * Boston, MA 02111-1307, USA.
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
*
* Authors: Christian Kellner <gicmo@gnome.org>
* Samuel Cormier-Iijima <sciyoshi@gmail.com>
#include "gsocket.h"
#include "glibintl.h"
-#include "gsimpleasyncresult.h"
#include "gcancellable.h"
#include "gpollableinputstream.h"
#include "gpollableoutputstream.h"
#include "glibintl.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);
#ifdef G_OS_UNIX
static void g_socket_output_stream_file_descriptor_based_iface_init (GFileDescriptorBasedIface *iface);
#ifdef G_OS_UNIX
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_FILE_DESCRIPTOR_BASED, g_socket_output_stream_file_descriptor_based_iface_init)
)
#else
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)
)
#endif
PROP_SOCKET
};
-struct _GSocketOutputStreamPrivate
-{
- GSocket *socket;
-
- /* pending operation metadata */
- GSimpleAsyncResult *result;
- GCancellable *cancellable;
- gconstpointer buffer;
- gsize count;
-};
-
static void
g_socket_output_stream_get_property (GObject *object,
guint prop_id,
if (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
GObjectClass *gobject_class = G_OBJECT_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->get_property = g_socket_output_stream_get_property;
gobject_class->set_property = g_socket_output_stream_set_property;
static void
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_instance_private (stream);
}
GSocketOutputStream *
_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);
}