Hiroyuki Ikezoe
ikezo****@users*****
Sat Dec 2 20:54:50 JST 2006
Index: kazehakase/src/net/kz-file.c diff -u kazehakase/src/net/kz-file.c:1.13 kazehakase/src/net/kz-file.c:1.14 --- kazehakase/src/net/kz-file.c:1.13 Mon May 9 10:20:13 2005 +++ kazehakase/src/net/kz-file.c Sat Dec 2 20:54:50 2006 @@ -19,21 +19,18 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include "gobject-utils.h" #include <glib/gi18n.h> #include "kz-file.h" -static void kz_file_class_init (KzFileClass *klass); -static void kz_file_init (KzFile *file); -static void kz_file_set_property (GObject *object, - guint prop_id, - const GValue *value, - GParamSpec *pspec); -static void kz_file_get_property (GObject *object, - guint prop_id, - GValue *value, - GParamSpec *pspec); -static void kz_file_dispose (GObject *object); +static void set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec); +static void get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec); +static void dispose (GObject *object); static void file_start (KzIO *io); static GIOStatus read_from_io (KzIO *io, @@ -55,11 +52,7 @@ #define BUFFER_SIZE 1024 -static KzIOClass *parent_class = NULL; - -KZ_OBJECT_GET_TYPE(kz_file, "KzFile", KzFile, - kz_file_class_init, kz_file_init, - KZ_TYPE_IO) +G_DEFINE_TYPE(KzFile, kz_file, KZ_TYPE_IO) static void kz_file_class_init (KzFileClass *klass) @@ -67,13 +60,12 @@ GObjectClass *object_class; KzIOClass *io_class; - parent_class = g_type_class_peek_parent (klass); object_class = (GObjectClass *) klass; io_class = (KzIOClass *) klass; - object_class->dispose = kz_file_dispose; - object_class->set_property = kz_file_set_property; - object_class->get_property = kz_file_get_property; + object_class->dispose = dispose; + object_class->set_property = set_property; + object_class->get_property = get_property; io_class->read_from_io = read_from_io; io_class->write_to_io = write_to_io; @@ -102,7 +94,7 @@ static void -kz_file_dispose (GObject *object) +dispose (GObject *object) { KzFilePrivate *priv = KZ_FILE_GET_PRIVATE (object); @@ -112,16 +104,16 @@ } priv->filename = NULL; - if (G_OBJECT_CLASS (parent_class)->dispose) - G_OBJECT_CLASS (parent_class)->dispose(object); + if (G_OBJECT_CLASS (kz_file_parent_class)->dispose) + G_OBJECT_CLASS (kz_file_parent_class)->dispose(object); } static void -kz_file_set_property (GObject *object, - guint prop_id, - const GValue *value, - GParamSpec *pspec) +set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec) { KzFilePrivate *priv = KZ_FILE_GET_PRIVATE (object); @@ -139,10 +131,10 @@ static void -kz_file_get_property (GObject *object, - guint prop_id, - GValue *value, - GParamSpec *pspec) +get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec) { KzFilePrivate *priv = KZ_FILE_GET_PRIVATE (object); @@ -185,7 +177,7 @@ { if (g_file_test(filename, G_FILE_TEST_EXISTS) == FALSE) { - KZ_IO_CLASS (parent_class)->io_error(io); + KZ_IO_CLASS (kz_file_parent_class)->io_error(io); return G_IO_STATUS_ERROR; } io->iochannel = g_io_channel_new_file(filename, "r", NULL); @@ -215,7 +207,7 @@ if (iostatus == G_IO_STATUS_NORMAL) { - KZ_IO_CLASS (parent_class)->io_to_buffer(io, bytes_read, buffer); + KZ_IO_CLASS (kz_file_parent_class)->io_to_buffer(io, bytes_read, buffer); /* Check for EOF */ if (bytes_read == 0) iostatus = G_IO_STATUS_EOF; @@ -227,7 +219,7 @@ static GIOStatus write_to_io(KzIO *io, GIOChannel *iochannel) { - KZ_IO_CLASS (parent_class)->buffer_to_io(io, 0, NULL); + KZ_IO_CLASS (kz_file_parent_class)->buffer_to_io(io, 0, NULL); return G_IO_STATUS_NORMAL; } @@ -240,10 +232,10 @@ if (iostatus != G_IO_STATUS_NORMAL) { - KZ_IO_CLASS (parent_class)->io_error(io); + KZ_IO_CLASS (kz_file_parent_class)->io_error(io); return; } /* call io_set_iochannel, start to loading */ - KZ_IO_CLASS (parent_class)->io_set_channel(io); + KZ_IO_CLASS (kz_file_parent_class)->io_set_channel(io); } Index: kazehakase/src/net/kz-http.c diff -u kazehakase/src/net/kz-http.c:1.82 kazehakase/src/net/kz-http.c:1.83 --- kazehakase/src/net/kz-http.c:1.82 Tue Dec 6 07:52:41 2005 +++ kazehakase/src/net/kz-http.c Sat Dec 2 20:54:50 2006 @@ -35,7 +35,6 @@ #include <gnutls/gnutls.h> #endif -#include "gobject-utils.h" #include "kz-http.h" #include "gnet.h" #include "kazehakase.h" @@ -123,17 +122,15 @@ #define KZ_HTTP_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), KZ_TYPE_HTTP, KzHTTPPrivate)) -static void kz_http_class_init (KzHTTPClass *klass); -static void kz_http_init (KzHTTP *http); -static void kz_http_set_property (GObject *object, - guint prop_id, - const GValue *value, - GParamSpec *pspec); -static void kz_http_get_property (GObject *object, - guint prop_id, - GValue *value, - GParamSpec *pspec); -static void kz_http_dispose (GObject *object); +static void set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec); +static void get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec); +static void dispose (GObject *object); static GIOStatus kz_http_in_header (KzHTTP *http, GIOChannel *iochannel); @@ -193,12 +190,7 @@ return etype; } - -static KzIOClass *parent_class = NULL; - -KZ_OBJECT_GET_TYPE(kz_http, "KzHTTP", KzHTTP, - kz_http_class_init, kz_http_init, - KZ_TYPE_IO) +G_DEFINE_TYPE(KzHTTP, kz_http, KZ_TYPE_IO) static void kz_http_class_init (KzHTTPClass *klass) @@ -206,13 +198,12 @@ GObjectClass *object_class; KzIOClass *io_class; - parent_class = g_type_class_peek_parent (klass); object_class = (GObjectClass *) klass; io_class = (KzIOClass *) klass; - object_class->dispose = kz_http_dispose; - object_class->set_property = kz_http_set_property; - object_class->get_property = kz_http_get_property; + object_class->dispose = dispose; + object_class->set_property = set_property; + object_class->get_property = get_property; io_class->read_from_io = kz_http_read_from_io; io_class->io_start = kz_http_start; @@ -293,7 +284,7 @@ void -kz_http_dispose (GObject *object) +dispose (GObject *object) { KzHTTPPrivate *priv = KZ_HTTP_GET_PRIVATE (object); @@ -355,16 +346,16 @@ priv->post_data = NULL; priv->auth_param = NULL; - if (G_OBJECT_CLASS (parent_class)->dispose) - G_OBJECT_CLASS (parent_class)->dispose(object); + if (G_OBJECT_CLASS (kz_http_parent_class)->dispose) + G_OBJECT_CLASS (kz_http_parent_class)->dispose(object); } static void -kz_http_set_property (GObject *object, - guint prop_id, - const GValue *value, - GParamSpec *pspec) +set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec) { KzHTTPPrivate *priv = KZ_HTTP_GET_PRIVATE (object); @@ -392,10 +383,10 @@ static void -kz_http_get_property (GObject *object, - guint prop_id, - GValue *value, - GParamSpec *pspec) +get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec) { KzHTTPPrivate *priv = KZ_HTTP_GET_PRIVATE (object); @@ -933,7 +924,7 @@ &bytes_read); if (iostatus == G_IO_STATUS_NORMAL) { - KZ_IO_CLASS (parent_class)->io_to_buffer(KZ_IO(http), bytes_read, buffer); + KZ_IO_CLASS (kz_http_parent_class)->io_to_buffer(KZ_IO(http), bytes_read, buffer); priv->chunk_size -= bytes_read; } @@ -977,7 +968,7 @@ if (iostatus == G_IO_STATUS_NORMAL) { - KZ_IO_CLASS (parent_class)->io_to_buffer(KZ_IO(http), bytes_read, buffer); + KZ_IO_CLASS (kz_http_parent_class)->io_to_buffer(KZ_IO(http), bytes_read, buffer); if (bytes_read == 0) iostatus = G_IO_STATUS_EOF; } @@ -1211,7 +1202,7 @@ } /* call io_set_iochannel, start to loading */ - KZ_IO_CLASS (parent_class)->io_set_channel(KZ_IO(http)); + KZ_IO_CLASS (kz_http_parent_class)->io_set_channel(KZ_IO(http)); } static void @@ -1295,7 +1286,7 @@ { g_return_if_fail(KZ_IS_HTTP(http)); - KZ_IO_CLASS (parent_class)->io_error(KZ_IO(http)); + KZ_IO_CLASS (kz_http_parent_class)->io_error(KZ_IO(http)); } Index: kazehakase/src/net/kz-io.c diff -u kazehakase/src/net/kz-io.c:1.41 kazehakase/src/net/kz-io.c:1.42 --- kazehakase/src/net/kz-io.c:1.41 Mon May 22 08:48:54 2006 +++ kazehakase/src/net/kz-io.c Sat Dec 2 20:54:50 2006 @@ -27,7 +27,6 @@ #include <string.h> #include <glib/gi18n.h> -#include "gobject-utils.h" #include "kz-io.h" #include "kz-http.h" #include "kz-file.h" @@ -50,17 +49,15 @@ PROP_FILESIZE }; -static void kz_io_class_init (KzIOClass *klass); -static void kz_io_init (KzIO *io); -static void kz_io_set_property (GObject *object, - guint prop_id, - const GValue *value, - GParamSpec *pspec); -static void kz_io_get_property (GObject *object, - guint prop_id, - GValue *value, - GParamSpec *pspec); -static void kz_io_dispose (GObject *object); +static void set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec); +static void get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec); +static void dispose (GObject *object); static void kz_io_set_mode (KzIO *io, KzIOMode mode); /* read or write mode */ static void kz_io_set_buffer_mode (KzIO *io); @@ -125,29 +122,23 @@ return etype; } - -static GObjectClass *parent_class = NULL; static gint kz_io_signals[IO_LAST_SIGNAL] = {0}; static GQuark error_quark = 0; /* static GQuark redirect_quark = 0; */ - -KZ_OBJECT_GET_TYPE(kz_io, "KzIO", KzIO, - kz_io_class_init, kz_io_init, - G_TYPE_OBJECT) +G_DEFINE_TYPE(KzIO, kz_io, G_TYPE_OBJECT) static void kz_io_class_init (KzIOClass *klass) { GObjectClass *object_class; - parent_class = g_type_class_peek_parent (klass); object_class = (GObjectClass *) klass; - object_class->dispose = kz_io_dispose; - object_class->set_property = kz_io_set_property; - object_class->get_property = kz_io_get_property; + object_class->dispose = dispose; + object_class->set_property = set_property; + object_class->get_property = get_property; klass->io_progress = NULL; klass->io_completed = NULL; @@ -252,7 +243,7 @@ void -kz_io_dispose (GObject *object) +dispose (GObject *object) { KzIO *io; KzIOPrivate *priv = KZ_IO_GET_PRIVATE (object); @@ -285,16 +276,16 @@ priv->buffer = NULL; priv->error = NULL; - if (G_OBJECT_CLASS (parent_class)->dispose) - G_OBJECT_CLASS (parent_class)->dispose(object); + if (G_OBJECT_CLASS (kz_io_parent_class)->dispose) + G_OBJECT_CLASS (kz_io_parent_class)->dispose(object); } static void -kz_io_set_property (GObject *object, - guint prop_id, - const GValue *value, - GParamSpec *pspec) +set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec) { KzIOPrivate *priv = KZ_IO_GET_PRIVATE (object); @@ -321,10 +312,10 @@ static void -kz_io_get_property (GObject *object, - guint prop_id, - GValue *value, - GParamSpec *pspec) +get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec) { KzIOPrivate *priv = KZ_IO_GET_PRIVATE (object); @@ -479,37 +470,29 @@ switch (iostatus) { case G_IO_STATUS_EOF: + if(priv->localfile) { - if(priv->localfile) - { - g_io_channel_flush(priv->localfileio, NULL); - } - g_signal_emit(io, - kz_io_signals[IO_COMPLETED_SIGNAL], - 0, NULL); - return FALSE; + g_io_channel_flush(priv->localfileio, NULL); } + g_signal_emit(io, + kz_io_signals[IO_COMPLETED_SIGNAL], + 0, NULL); + return FALSE; case G_IO_STATUS_NORMAL: - { - return TRUE; - } + return TRUE; case G_IO_STATUS_AGAIN : + if(priv->localfile) { - if(priv->localfile) - { - g_io_channel_flush(priv->localfileio, NULL); - g_io_channel_unref(priv->localfileio); - priv->localfileio = NULL; - } - - kz_io_start(io); - return FALSE; + g_io_channel_flush(priv->localfileio, NULL); + g_io_channel_unref(priv->localfileio); + priv->localfileio = NULL; } + + kz_io_start(io); + return FALSE; default: - { - io_error(io); - return FALSE; - } + io_error(io); + return FALSE; } } @@ -544,22 +527,16 @@ switch (iostatus) { case G_IO_STATUS_EOF: - { - g_io_channel_flush(iochannel, NULL); - g_signal_emit(io, - kz_io_signals[IO_COMPLETED_SIGNAL], - 0, NULL); - return FALSE; - } + g_io_channel_flush(iochannel, NULL); + g_signal_emit(io, + kz_io_signals[IO_COMPLETED_SIGNAL], + 0, NULL); + return FALSE; case G_IO_STATUS_NORMAL: - { - return TRUE; - } + return TRUE; default: - { - io_error(io); - return FALSE; - } + io_error(io); + return FALSE; } } Index: kazehakase/src/net/kz-xmlrpc.c diff -u kazehakase/src/net/kz-xmlrpc.c:1.7 kazehakase/src/net/kz-xmlrpc.c:1.8 --- kazehakase/src/net/kz-xmlrpc.c:1.7 Mon May 9 10:20:13 2005 +++ kazehakase/src/net/kz-xmlrpc.c Sat Dec 2 20:54:50 2006 @@ -23,7 +23,6 @@ #include <glib/gi18n.h> #include "kz-xmlrpc.h" -#include "gobject-utils.h" #include "kz-http.h" #include "kz-xml.h" @@ -39,17 +38,15 @@ #define KZ_XML_RPC_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), KZ_TYPE_XML_RPC, KzXMLRPCPrivate)) -static void kz_xml_rpc_class_init (KzXMLRPCClass *klass); -static void kz_xml_rpc_init (KzXMLRPC *xmlrpc); -static void kz_xml_rpc_set_property (GObject *object, - guint prop_id, - const GValue *value, - GParamSpec *pspec); -static void kz_xml_rpc_get_property (GObject *object, - guint prop_id, - GValue *value, - GParamSpec *pspec); -static void kz_xml_rpc_dispose (GObject *object); +static void set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec); +static void get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec); +static void dispose (GObject *object); typedef struct _KzXMLRPCPrivate KzXMLRPCPrivate; struct _KzXMLRPCPrivate @@ -60,24 +57,20 @@ }; -static GObjectClass *parent_class = NULL; static gint kz_xml_rpc_signals[XMLRPC_LAST_SIGNAL] = {0}; -KZ_OBJECT_GET_TYPE(kz_xml_rpc, "KzXMLRPC", KzXMLRPC, - kz_xml_rpc_class_init, kz_xml_rpc_init, - G_TYPE_OBJECT) +G_DEFINE_TYPE(KzXMLRPC, kz_xml_rpc, G_TYPE_OBJECT) static void kz_xml_rpc_class_init (KzXMLRPCClass *klass) { GObjectClass *object_class; - parent_class = g_type_class_peek_parent (klass); object_class = (GObjectClass *) klass; - object_class->dispose = kz_xml_rpc_dispose; - object_class->set_property = kz_xml_rpc_set_property; - object_class->get_property = kz_xml_rpc_get_property; + object_class->dispose = dispose; + object_class->set_property = set_property; + object_class->get_property = get_property; klass->xml_rpc_completed = NULL; @@ -115,7 +108,7 @@ void -kz_xml_rpc_dispose (GObject *object) +dispose (GObject *object) { KzXMLRPCPrivate *priv = KZ_XML_RPC_GET_PRIVATE (object); @@ -137,16 +130,16 @@ priv->xmlrpc_uri = NULL; - if (G_OBJECT_CLASS (parent_class)->dispose) - G_OBJECT_CLASS (parent_class)->dispose(object); + if (G_OBJECT_CLASS (kz_xml_rpc_parent_class)->dispose) + G_OBJECT_CLASS (kz_xml_rpc_parent_class)->dispose(object); } static void -kz_xml_rpc_set_property (GObject *object, - guint prop_id, - const GValue *value, - GParamSpec *pspec) +set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec) { KzXMLRPCPrivate *priv = KZ_XML_RPC_GET_PRIVATE (object); @@ -163,10 +156,10 @@ static void -kz_xml_rpc_get_property (GObject *object, - guint prop_id, - GValue *value, - GParamSpec *pspec) +get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec) { KzXMLRPCPrivate *priv = KZ_XML_RPC_GET_PRIVATE (object);