diff options
Diffstat (limited to 'camel/camel-medium.c')
-rw-r--r-- | camel/camel-medium.c | 75 |
1 files changed, 32 insertions, 43 deletions
diff --git a/camel/camel-medium.c b/camel/camel-medium.c index dcc5d31d67..4507c93595 100644 --- a/camel/camel-medium.c +++ b/camel/camel-medium.c @@ -35,7 +35,7 @@ static CamelDataWrapperClass *parent_class = NULL; /* Returns the class for a CamelMedium */ -#define CM_CLASS(so) CAMEL_MEDIUM_CLASS (GTK_OBJECT (so)->klass) +#define CM_CLASS(so) CAMEL_MEDIUM_CLASS (CAMEL_OBJECT_GET_CLASS(so)) static void add_header (CamelMedium *medium, const gchar *header_name, const void *header_value); @@ -46,17 +46,16 @@ static const void *get_header (CamelMedium *medium, const gchar *header_name); static CamelDataWrapper *get_content_object (CamelMedium *medium); static void set_content_object (CamelMedium *medium, CamelDataWrapper *content); -static void finalize (GtkObject *object); static void camel_medium_class_init (CamelMediumClass *camel_medium_class) { - CamelDataWrapperClass *camel_data_wrapper_class = - CAMEL_DATA_WRAPPER_CLASS (camel_medium_class); - GtkObjectClass *gtk_object_class = - GTK_OBJECT_CLASS (camel_data_wrapper_class); + /* + * CamelDataWrapperClass *camel_data_wrapper_class = + * CAMEL_DATA_WRAPPER_CLASS (camel_medium_class); + */ - parent_class = gtk_type_class (camel_data_wrapper_get_type ()); + parent_class = CAMEL_DATA_WRAPPER_CLASS (camel_type_get_global_classfuncs (camel_data_wrapper_get_type ())); /* virtual method definition */ camel_medium_class->add_header = add_header; @@ -66,8 +65,6 @@ camel_medium_class_init (CamelMediumClass *camel_medium_class) camel_medium_class->set_content_object = set_content_object; camel_medium_class->get_content_object = get_content_object; - - gtk_object_class->finalize = finalize; } static void @@ -78,47 +75,39 @@ camel_medium_init (gpointer object, gpointer klass) camel_medium->content = NULL; } - -GtkType -camel_medium_get_type (void) -{ - static GtkType camel_medium_type = 0; - - if (!camel_medium_type) { - GtkTypeInfo camel_medium_info = - { - "CamelMedium", - sizeof (CamelMedium), - sizeof (CamelMediumClass), - (GtkClassInitFunc) camel_medium_class_init, - (GtkObjectInitFunc) camel_medium_init, - /* reserved_1 */ NULL, - /* reserved_2 */ NULL, - (GtkClassInitFunc) NULL, - }; - - camel_medium_type = gtk_type_unique (camel_data_wrapper_get_type (), &camel_medium_info); - } - - return camel_medium_type; -} - static void -finalize (GtkObject *object) +camel_medium_finalize (CamelObject *object) { CamelMedium *medium = CAMEL_MEDIUM (object); if (medium->content) - gtk_object_unref (GTK_OBJECT (medium->content)); + camel_object_unref (CAMEL_OBJECT (medium->content)); +} + + +CamelType +camel_medium_get_type (void) +{ + static CamelType camel_medium_type = CAMEL_INVALID_TYPE; + + if (camel_medium_type == CAMEL_INVALID_TYPE) { + camel_medium_type = camel_type_register (CAMEL_DATA_WRAPPER_TYPE, "medium", + sizeof (CamelMedium), + sizeof (CamelMediumClass), + (CamelObjectClassInitFunc) camel_medium_class_init, + NULL, + (CamelObjectInitFunc) camel_medium_init, + (CamelObjectFinalizeFunc) camel_medium_finalize); + } - GTK_OBJECT_CLASS (parent_class)->finalize (object); + return camel_medium_type; } static void add_header (CamelMedium *medium, const gchar *header_name, const void *header_value) { - g_warning("No %s::add_header implemented, adding %s", gtk_type_name(((GtkObject *)medium)->klass->type), header_name); + g_warning("No %s::add_header implemented, adding %s", camel_type_to_name(CAMEL_OBJECT_GET_TYPE(medium)), header_name); } /** @@ -147,7 +136,7 @@ camel_medium_add_header (CamelMedium *medium, const gchar *header_name, static void set_header (CamelMedium *medium, const gchar *header_name, const void *header_value) { - g_warning("No %s::set_header implemented, setting %s", gtk_type_name(((GtkObject *)medium)->klass->type), header_name); + g_warning("No %s::set_header implemented, setting %s", camel_type_to_name(CAMEL_OBJECT_GET_TYPE(medium)), header_name); } /** @@ -172,7 +161,7 @@ camel_medium_set_header (CamelMedium *medium, const gchar *header_name, const vo static void remove_header (CamelMedium *medium, const gchar *header_name) { - g_warning("No %s::remove_header implemented, removing %s", gtk_type_name(((GtkObject *)medium)->klass->type), header_name); + g_warning("No %s::remove_header implemented, removing %s", camel_type_to_name(CAMEL_OBJECT_GET_TYPE(medium)), header_name); } /** @@ -196,7 +185,7 @@ camel_medium_remove_header (CamelMedium *medium, const gchar *header_name) static const void * get_header (CamelMedium *medium, const gchar *header_name) { - g_warning("No %s::get_header implemented, getting %s", gtk_type_name(((GtkObject *)medium)->klass->type), header_name); + g_warning("No %s::get_header implemented, getting %s", camel_type_to_name(CAMEL_OBJECT_GET_TYPE(medium)), header_name); return NULL; } @@ -252,8 +241,8 @@ static void set_content_object (CamelMedium *medium, CamelDataWrapper *content) { if (medium->content) - gtk_object_unref (GTK_OBJECT (medium->content)); - gtk_object_ref (GTK_OBJECT (content)); + camel_object_unref (CAMEL_OBJECT (medium->content)); + camel_object_ref (CAMEL_OBJECT (content)); medium->content = content; } |