From 3727a663a5c967cf627e2a2d5325193497064dc4 Mon Sep 17 00:00:00 2001 From: Daniel Kolesa Date: Tue, 6 Apr 2021 19:10:53 +0200 Subject: require glib 2.62 or newer --- meson.build | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/meson.build b/meson.build index e4993291..a5ec8ef3 100644 --- a/meson.build +++ b/meson.build @@ -76,7 +76,7 @@ cc = meson.get_compiler('c') # Requirements gdata_deps = [ dependency('gobject-2.0'), - dependency('glib-2.0', version: '>= 2.44.0'), + dependency('glib-2.0', version: '>= 2.62.0'), dependency('gio-2.0', version: '>= 2.44.0'), dependency('gio-unix-2.0'), dependency('json-glib-1.0', version: '>= 0.15'), @@ -84,8 +84,8 @@ gdata_deps = [ ] common_c_args = [ - '-DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_44', - '-DGLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_60', + '-DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_62', + '-DGLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_68', ] # Private dependencies for libgdata (specifically used for pkgconfig) -- cgit v1.2.1 From cfd9c5e86cca21333bd28657c6aa9d2d24acc9f8 Mon Sep 17 00:00:00 2001 From: Daniel Kolesa Date: Tue, 16 Mar 2021 18:43:05 +0100 Subject: drop usage of deprecated gobject functions --- gdata/app/gdata-app-categories.c | 6 ++---- gdata/atom/gdata-author.c | 5 ++--- gdata/atom/gdata-category.c | 5 ++--- gdata/atom/gdata-generator.c | 5 ++--- gdata/atom/gdata-link.c | 5 ++--- gdata/exif/gdata-exif-tags.c | 6 ++---- gdata/gcontact/gdata-gcontact-calendar.c | 5 ++--- gdata/gcontact/gdata-gcontact-event.c | 6 ++---- gdata/gcontact/gdata-gcontact-external-id.c | 5 ++--- gdata/gcontact/gdata-gcontact-jot.c | 6 ++---- gdata/gcontact/gdata-gcontact-language.c | 5 ++--- gdata/gcontact/gdata-gcontact-relation.c | 6 ++---- gdata/gcontact/gdata-gcontact-website.c | 5 ++--- gdata/gd/gdata-gd-email-address.c | 5 ++--- gdata/gd/gdata-gd-feed-link.c | 6 ++---- gdata/gd/gdata-gd-im-address.c | 5 ++--- gdata/gd/gdata-gd-name.c | 5 ++--- gdata/gd/gdata-gd-organization.c | 5 ++--- gdata/gd/gdata-gd-phone-number.c | 5 ++--- gdata/gd/gdata-gd-postal-address.c | 5 ++--- gdata/gd/gdata-gd-reminder.c | 5 ++--- gdata/gd/gdata-gd-when.c | 5 ++--- gdata/gd/gdata-gd-where.c | 5 ++--- gdata/gd/gdata-gd-who.c | 5 ++--- gdata/gdata-access-rule.c | 6 ++---- gdata/gdata-authorization-domain.c | 6 ++---- gdata/gdata-batch-operation.c | 15 ++++++--------- gdata/gdata-client-login-authorizer.c | 5 ++--- gdata/gdata-download-stream.c | 5 ++--- gdata/gdata-entry.c | 6 ++---- gdata/gdata-feed.c | 6 ++---- gdata/gdata-goa-authorizer.c | 5 ++--- gdata/gdata-oauth1-authorizer.c | 5 ++--- gdata/gdata-oauth2-authorizer.c | 7 ++----- gdata/gdata-parsable.c | 6 ++---- gdata/gdata-query.c | 6 ++---- gdata/gdata-service.c | 6 ++---- gdata/gdata-upload-stream.c | 6 ++---- gdata/georss/gdata-georss-where.c | 6 ++---- gdata/media/gdata-media-category.c | 6 ++---- gdata/media/gdata-media-content.c | 6 ++---- gdata/media/gdata-media-credit.c | 6 ++---- gdata/media/gdata-media-group.c | 6 ++---- gdata/media/gdata-media-thumbnail.c | 6 ++---- gdata/services/calendar/gdata-calendar-calendar.c | 5 ++--- gdata/services/calendar/gdata-calendar-event.c | 6 ++---- gdata/services/calendar/gdata-calendar-query.c | 6 ++---- gdata/services/contacts/gdata-contacts-contact.c | 6 ++---- gdata/services/contacts/gdata-contacts-group.c | 6 ++---- gdata/services/contacts/gdata-contacts-query.c | 6 ++---- gdata/services/documents/gdata-documents-document.c | 6 ++---- gdata/services/documents/gdata-documents-entry.c | 5 ++--- gdata/services/documents/gdata-documents-metadata.c | 6 ++---- gdata/services/documents/gdata-documents-property.c | 7 +++---- gdata/services/documents/gdata-documents-query.c | 6 ++---- gdata/services/documents/gdata-documents-upload-query.c | 6 ++---- gdata/services/freebase/gdata-freebase-query.c | 6 ++---- gdata/services/freebase/gdata-freebase-result.c | 6 ++---- gdata/services/freebase/gdata-freebase-search-query.c | 6 ++---- gdata/services/freebase/gdata-freebase-search-result.c | 6 ++---- gdata/services/freebase/gdata-freebase-service.c | 6 ++---- gdata/services/freebase/gdata-freebase-topic-query.c | 6 ++---- gdata/services/freebase/gdata-freebase-topic-result.c | 6 ++---- gdata/services/picasaweb/gdata-picasaweb-album.c | 6 ++---- gdata/services/picasaweb/gdata-picasaweb-file.c | 5 ++--- gdata/services/picasaweb/gdata-picasaweb-query.c | 6 ++---- gdata/services/picasaweb/gdata-picasaweb-user.c | 6 ++---- gdata/services/tasks/gdata-tasks-query.c | 6 ++---- gdata/services/tasks/gdata-tasks-task.c | 6 ++---- gdata/services/youtube/gdata-youtube-category.c | 6 ++---- gdata/services/youtube/gdata-youtube-comment.c | 6 ++---- gdata/services/youtube/gdata-youtube-content.c | 6 ++---- gdata/services/youtube/gdata-youtube-credit.c | 6 ++---- gdata/services/youtube/gdata-youtube-query.c | 6 ++---- gdata/services/youtube/gdata-youtube-service.c | 5 ++--- gdata/services/youtube/gdata-youtube-state.c | 6 ++---- gdata/services/youtube/gdata-youtube-video.c | 5 ++--- gdata/tests/gdata-dummy-authorizer.c | 7 ++----- 78 files changed, 161 insertions(+), 292 deletions(-) diff --git a/gdata/app/gdata-app-categories.c b/gdata/app/gdata-app-categories.c index 4a526e32..37207eb6 100644 --- a/gdata/app/gdata-app-categories.c +++ b/gdata/app/gdata-app-categories.c @@ -58,7 +58,7 @@ enum { PROP_IS_FIXED = 1 }; -G_DEFINE_TYPE (GDataAPPCategories, gdata_app_categories, GDATA_TYPE_PARSABLE) +G_DEFINE_TYPE_WITH_PRIVATE (GDataAPPCategories, gdata_app_categories, GDATA_TYPE_PARSABLE) static void gdata_app_categories_class_init (GDataAPPCategoriesClass *klass) @@ -66,8 +66,6 @@ gdata_app_categories_class_init (GDataAPPCategoriesClass *klass) GObjectClass *gobject_class = G_OBJECT_CLASS (klass); GDataParsableClass *parsable_class = GDATA_PARSABLE_CLASS (klass); - g_type_class_add_private (klass, sizeof (GDataAPPCategoriesPrivate)); - gobject_class->get_property = gdata_app_categories_get_property; gobject_class->dispose = gdata_app_categories_dispose; gobject_class->finalize = gdata_app_categories_finalize; @@ -98,7 +96,7 @@ gdata_app_categories_class_init (GDataAPPCategoriesClass *klass) static void gdata_app_categories_init (GDataAPPCategories *self) { - self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, GDATA_TYPE_APP_CATEGORIES, GDataAPPCategoriesPrivate); + self->priv = gdata_app_categories_get_instance_private (self); } static void diff --git a/gdata/atom/gdata-author.c b/gdata/atom/gdata-author.c index 09bf03fc..3819e4e6 100644 --- a/gdata/atom/gdata-author.c +++ b/gdata/atom/gdata-author.c @@ -58,6 +58,7 @@ enum { }; G_DEFINE_TYPE_WITH_CODE (GDataAuthor, gdata_author, GDATA_TYPE_PARSABLE, + G_ADD_PRIVATE (GDataAuthor) G_IMPLEMENT_INTERFACE (GDATA_TYPE_COMPARABLE, gdata_author_comparable_init)) static void @@ -66,8 +67,6 @@ gdata_author_class_init (GDataAuthorClass *klass) GObjectClass *gobject_class = G_OBJECT_CLASS (klass); GDataParsableClass *parsable_class = GDATA_PARSABLE_CLASS (klass); - g_type_class_add_private (klass, sizeof (GDataAuthorPrivate)); - gobject_class->set_property = gdata_author_set_property; gobject_class->get_property = gdata_author_get_property; gobject_class->finalize = gdata_author_finalize; @@ -141,7 +140,7 @@ gdata_author_comparable_init (GDataComparableIface *iface) static void gdata_author_init (GDataAuthor *self) { - self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, GDATA_TYPE_AUTHOR, GDataAuthorPrivate); + self->priv = gdata_author_get_instance_private (self); } static void diff --git a/gdata/atom/gdata-category.c b/gdata/atom/gdata-category.c index c02771ce..dcb60102 100644 --- a/gdata/atom/gdata-category.c +++ b/gdata/atom/gdata-category.c @@ -57,6 +57,7 @@ enum { }; G_DEFINE_TYPE_WITH_CODE (GDataCategory, gdata_category, GDATA_TYPE_PARSABLE, + G_ADD_PRIVATE (GDataCategory) G_IMPLEMENT_INTERFACE (GDATA_TYPE_COMPARABLE, gdata_category_comparable_init)) static void @@ -65,8 +66,6 @@ gdata_category_class_init (GDataCategoryClass *klass) GObjectClass *gobject_class = G_OBJECT_CLASS (klass); GDataParsableClass *parsable_class = GDATA_PARSABLE_CLASS (klass); - g_type_class_add_private (klass, sizeof (GDataCategoryPrivate)); - gobject_class->set_property = gdata_category_set_property; gobject_class->get_property = gdata_category_get_property; gobject_class->finalize = gdata_category_finalize; @@ -142,7 +141,7 @@ gdata_category_comparable_init (GDataComparableIface *iface) static void gdata_category_init (GDataCategory *self) { - self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, GDATA_TYPE_CATEGORY, GDataCategoryPrivate); + self->priv = gdata_category_get_instance_private (self); } static void diff --git a/gdata/atom/gdata-generator.c b/gdata/atom/gdata-generator.c index 69a17d25..72a2d562 100644 --- a/gdata/atom/gdata-generator.c +++ b/gdata/atom/gdata-generator.c @@ -54,6 +54,7 @@ enum { }; G_DEFINE_TYPE_WITH_CODE (GDataGenerator, gdata_generator, GDATA_TYPE_PARSABLE, + G_ADD_PRIVATE (GDataGenerator) G_IMPLEMENT_INTERFACE (GDATA_TYPE_COMPARABLE, gdata_generator_comparable_init)) static void @@ -62,8 +63,6 @@ gdata_generator_class_init (GDataGeneratorClass *klass) GObjectClass *gobject_class = G_OBJECT_CLASS (klass); GDataParsableClass *parsable_class = GDATA_PARSABLE_CLASS (klass); - g_type_class_add_private (klass, sizeof (GDataGeneratorPrivate)); - gobject_class->get_property = gdata_generator_get_property; gobject_class->finalize = gdata_generator_finalize; @@ -138,7 +137,7 @@ gdata_generator_comparable_init (GDataComparableIface *iface) static void gdata_generator_init (GDataGenerator *self) { - self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, GDATA_TYPE_GENERATOR, GDataGeneratorPrivate); + self->priv = gdata_generator_get_instance_private (self); } static void diff --git a/gdata/atom/gdata-link.c b/gdata/atom/gdata-link.c index f9754810..c58d4dc1 100644 --- a/gdata/atom/gdata-link.c +++ b/gdata/atom/gdata-link.c @@ -64,6 +64,7 @@ enum { }; G_DEFINE_TYPE_WITH_CODE (GDataLink, gdata_link, GDATA_TYPE_PARSABLE, + G_ADD_PRIVATE (GDataLink) G_IMPLEMENT_INTERFACE (GDATA_TYPE_COMPARABLE, gdata_link_comparable_init)) static void @@ -72,8 +73,6 @@ gdata_link_class_init (GDataLinkClass *klass) GObjectClass *gobject_class = G_OBJECT_CLASS (klass); GDataParsableClass *parsable_class = GDATA_PARSABLE_CLASS (klass); - g_type_class_add_private (klass, sizeof (GDataLinkPrivate)); - gobject_class->set_property = gdata_link_set_property; gobject_class->get_property = gdata_link_get_property; gobject_class->finalize = gdata_link_finalize; @@ -199,7 +198,7 @@ gdata_link_comparable_init (GDataComparableIface *iface) static void gdata_link_init (GDataLink *self) { - self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, GDATA_TYPE_LINK, GDataLinkPrivate); + self->priv = gdata_link_get_instance_private (self); self->priv->length = -1; self->priv->relation_type = g_strdup (GDATA_LINK_ALTERNATE); } diff --git a/gdata/exif/gdata-exif-tags.c b/gdata/exif/gdata-exif-tags.c index 0a456cf2..4a071c3b 100644 --- a/gdata/exif/gdata-exif-tags.c +++ b/gdata/exif/gdata-exif-tags.c @@ -65,7 +65,7 @@ struct _GDataExifTagsPrivate { gint64 _time; /* in milliseconds! */ }; -G_DEFINE_TYPE (GDataExifTags, gdata_exif_tags, GDATA_TYPE_PARSABLE) +G_DEFINE_TYPE_WITH_PRIVATE (GDataExifTags, gdata_exif_tags, GDATA_TYPE_PARSABLE) static void gdata_exif_tags_class_init (GDataExifTagsClass *klass) @@ -73,8 +73,6 @@ gdata_exif_tags_class_init (GDataExifTagsClass *klass) GObjectClass *gobject_class = G_OBJECT_CLASS (klass); GDataParsableClass *parsable_class = GDATA_PARSABLE_CLASS (klass); - g_type_class_add_private (klass, sizeof (GDataExifTagsPrivate)); - gobject_class->finalize = gdata_exif_tags_finalize; parsable_class->parse_xml = parse_xml; @@ -86,7 +84,7 @@ gdata_exif_tags_class_init (GDataExifTagsClass *klass) static void gdata_exif_tags_init (GDataExifTags *self) { - self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, GDATA_TYPE_EXIF_TAGS, GDataExifTagsPrivate); + self->priv = gdata_exif_tags_get_instance_private (self); self->priv->_time = -1; } diff --git a/gdata/gcontact/gdata-gcontact-calendar.c b/gdata/gcontact/gdata-gcontact-calendar.c index 90562d24..9f0243db 100644 --- a/gdata/gcontact/gdata-gcontact-calendar.c +++ b/gdata/gcontact/gdata-gcontact-calendar.c @@ -60,6 +60,7 @@ enum { }; G_DEFINE_TYPE_WITH_CODE (GDataGContactCalendar, gdata_gcontact_calendar, GDATA_TYPE_PARSABLE, + G_ADD_PRIVATE (GDataGContactCalendar) G_IMPLEMENT_INTERFACE (GDATA_TYPE_COMPARABLE, gdata_gcontact_calendar_comparable_init)) static void @@ -68,8 +69,6 @@ gdata_gcontact_calendar_class_init (GDataGContactCalendarClass *klass) GObjectClass *gobject_class = G_OBJECT_CLASS (klass); GDataParsableClass *parsable_class = GDATA_PARSABLE_CLASS (klass); - g_type_class_add_private (klass, sizeof (GDataGContactCalendarPrivate)); - gobject_class->get_property = gdata_gcontact_calendar_get_property; gobject_class->set_property = gdata_gcontact_calendar_set_property; gobject_class->finalize = gdata_gcontact_calendar_finalize; @@ -165,7 +164,7 @@ gdata_gcontact_calendar_comparable_init (GDataComparableIface *iface) static void gdata_gcontact_calendar_init (GDataGContactCalendar *self) { - self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, GDATA_TYPE_GCONTACT_CALENDAR, GDataGContactCalendarPrivate); + self->priv = gdata_gcontact_calendar_get_instance_private (self); } static void diff --git a/gdata/gcontact/gdata-gcontact-event.c b/gdata/gcontact/gdata-gcontact-event.c index 6ea8257d..33c3b43a 100644 --- a/gdata/gcontact/gdata-gcontact-event.c +++ b/gdata/gcontact/gdata-gcontact-event.c @@ -59,7 +59,7 @@ enum { PROP_LABEL }; -G_DEFINE_TYPE (GDataGContactEvent, gdata_gcontact_event, GDATA_TYPE_PARSABLE) +G_DEFINE_TYPE_WITH_PRIVATE (GDataGContactEvent, gdata_gcontact_event, GDATA_TYPE_PARSABLE) static void gdata_gcontact_event_class_init (GDataGContactEventClass *klass) @@ -67,8 +67,6 @@ gdata_gcontact_event_class_init (GDataGContactEventClass *klass) GObjectClass *gobject_class = G_OBJECT_CLASS (klass); GDataParsableClass *parsable_class = GDATA_PARSABLE_CLASS (klass); - g_type_class_add_private (klass, sizeof (GDataGContactEventPrivate)); - gobject_class->get_property = gdata_gcontact_event_get_property; gobject_class->set_property = gdata_gcontact_event_set_property; gobject_class->finalize = gdata_gcontact_event_finalize; @@ -136,7 +134,7 @@ gdata_gcontact_event_class_init (GDataGContactEventClass *klass) static void gdata_gcontact_event_init (GDataGContactEvent *self) { - self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, GDATA_TYPE_GCONTACT_EVENT, GDataGContactEventPrivate); + self->priv = gdata_gcontact_event_get_instance_private (self); /* Clear the date to an invalid but sane value */ g_date_clear (&(self->priv->date), 1); diff --git a/gdata/gcontact/gdata-gcontact-external-id.c b/gdata/gcontact/gdata-gcontact-external-id.c index 3da3ef07..f7a60a74 100644 --- a/gdata/gcontact/gdata-gcontact-external-id.c +++ b/gdata/gcontact/gdata-gcontact-external-id.c @@ -58,6 +58,7 @@ enum { }; G_DEFINE_TYPE_WITH_CODE (GDataGContactExternalID, gdata_gcontact_external_id, GDATA_TYPE_PARSABLE, + G_ADD_PRIVATE (GDataGContactExternalID) G_IMPLEMENT_INTERFACE (GDATA_TYPE_COMPARABLE, gdata_gcontact_external_id_comparable_init)) static void @@ -66,8 +67,6 @@ gdata_gcontact_external_id_class_init (GDataGContactExternalIDClass *klass) GObjectClass *gobject_class = G_OBJECT_CLASS (klass); GDataParsableClass *parsable_class = GDATA_PARSABLE_CLASS (klass); - g_type_class_add_private (klass, sizeof (GDataGContactExternalIDPrivate)); - gobject_class->get_property = gdata_gcontact_external_id_get_property; gobject_class->set_property = gdata_gcontact_external_id_set_property; gobject_class->finalize = gdata_gcontact_external_id_finalize; @@ -147,7 +146,7 @@ gdata_gcontact_external_id_comparable_init (GDataComparableIface *iface) static void gdata_gcontact_external_id_init (GDataGContactExternalID *self) { - self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, GDATA_TYPE_GCONTACT_EXTERNAL_ID, GDataGContactExternalIDPrivate); + self->priv = gdata_gcontact_external_id_get_instance_private (self); } static void diff --git a/gdata/gcontact/gdata-gcontact-jot.c b/gdata/gcontact/gdata-gcontact-jot.c index 0e58d1b8..7a514724 100644 --- a/gdata/gcontact/gdata-gcontact-jot.c +++ b/gdata/gcontact/gdata-gcontact-jot.c @@ -55,7 +55,7 @@ enum { PROP_RELATION_TYPE }; -G_DEFINE_TYPE (GDataGContactJot, gdata_gcontact_jot, GDATA_TYPE_PARSABLE) +G_DEFINE_TYPE_WITH_PRIVATE (GDataGContactJot, gdata_gcontact_jot, GDATA_TYPE_PARSABLE) static void gdata_gcontact_jot_class_init (GDataGContactJotClass *klass) @@ -63,8 +63,6 @@ gdata_gcontact_jot_class_init (GDataGContactJotClass *klass) GObjectClass *gobject_class = G_OBJECT_CLASS (klass); GDataParsableClass *parsable_class = GDATA_PARSABLE_CLASS (klass); - g_type_class_add_private (klass, sizeof (GDataGContactJotPrivate)); - gobject_class->get_property = gdata_gcontact_jot_get_property; gobject_class->set_property = gdata_gcontact_jot_set_property; gobject_class->finalize = gdata_gcontact_jot_finalize; @@ -113,7 +111,7 @@ gdata_gcontact_jot_class_init (GDataGContactJotClass *klass) static void gdata_gcontact_jot_init (GDataGContactJot *self) { - self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, GDATA_TYPE_GCONTACT_JOT, GDataGContactJotPrivate); + self->priv = gdata_gcontact_jot_get_instance_private (self); } static void diff --git a/gdata/gcontact/gdata-gcontact-language.c b/gdata/gcontact/gdata-gcontact-language.c index 5fe867f9..e0c5f88a 100644 --- a/gdata/gcontact/gdata-gcontact-language.c +++ b/gdata/gcontact/gdata-gcontact-language.c @@ -56,6 +56,7 @@ enum { }; G_DEFINE_TYPE_WITH_CODE (GDataGContactLanguage, gdata_gcontact_language, GDATA_TYPE_PARSABLE, + G_ADD_PRIVATE (GDataGContactLanguage) G_IMPLEMENT_INTERFACE (GDATA_TYPE_COMPARABLE, gdata_gcontact_language_comparable_init)) static void @@ -64,8 +65,6 @@ gdata_gcontact_language_class_init (GDataGContactLanguageClass *klass) GObjectClass *gobject_class = G_OBJECT_CLASS (klass); GDataParsableClass *parsable_class = GDATA_PARSABLE_CLASS (klass); - g_type_class_add_private (klass, sizeof (GDataGContactLanguagePrivate)); - gobject_class->get_property = gdata_gcontact_language_get_property; gobject_class->set_property = gdata_gcontact_language_set_property; gobject_class->finalize = gdata_gcontact_language_finalize; @@ -128,7 +127,7 @@ gdata_gcontact_language_comparable_init (GDataComparableIface *iface) static void gdata_gcontact_language_init (GDataGContactLanguage *self) { - self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, GDATA_TYPE_GCONTACT_LANGUAGE, GDataGContactLanguagePrivate); + self->priv = gdata_gcontact_language_get_instance_private (self); } static void diff --git a/gdata/gcontact/gdata-gcontact-relation.c b/gdata/gcontact/gdata-gcontact-relation.c index b562fa47..172acc21 100644 --- a/gdata/gcontact/gdata-gcontact-relation.c +++ b/gdata/gcontact/gdata-gcontact-relation.c @@ -57,7 +57,7 @@ enum { PROP_LABEL }; -G_DEFINE_TYPE (GDataGContactRelation, gdata_gcontact_relation, GDATA_TYPE_PARSABLE) +G_DEFINE_TYPE_WITH_PRIVATE (GDataGContactRelation, gdata_gcontact_relation, GDATA_TYPE_PARSABLE) static void gdata_gcontact_relation_class_init (GDataGContactRelationClass *klass) @@ -65,8 +65,6 @@ gdata_gcontact_relation_class_init (GDataGContactRelationClass *klass) GObjectClass *gobject_class = G_OBJECT_CLASS (klass); GDataParsableClass *parsable_class = GDATA_PARSABLE_CLASS (klass); - g_type_class_add_private (klass, sizeof (GDataGContactRelationPrivate)); - gobject_class->get_property = gdata_gcontact_relation_get_property; gobject_class->set_property = gdata_gcontact_relation_set_property; gobject_class->finalize = gdata_gcontact_relation_finalize; @@ -132,7 +130,7 @@ gdata_gcontact_relation_class_init (GDataGContactRelationClass *klass) static void gdata_gcontact_relation_init (GDataGContactRelation *self) { - self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, GDATA_TYPE_GCONTACT_RELATION, GDataGContactRelationPrivate); + self->priv = gdata_gcontact_relation_get_instance_private (self); } static void diff --git a/gdata/gcontact/gdata-gcontact-website.c b/gdata/gcontact/gdata-gcontact-website.c index e0ec4c6f..789b7a4b 100644 --- a/gdata/gcontact/gdata-gcontact-website.c +++ b/gdata/gcontact/gdata-gcontact-website.c @@ -60,6 +60,7 @@ enum { }; G_DEFINE_TYPE_WITH_CODE (GDataGContactWebsite, gdata_gcontact_website, GDATA_TYPE_PARSABLE, + G_ADD_PRIVATE (GDataGContactWebsite) G_IMPLEMENT_INTERFACE (GDATA_TYPE_COMPARABLE, gdata_gcontact_website_comparable_init)) static void @@ -68,8 +69,6 @@ gdata_gcontact_website_class_init (GDataGContactWebsiteClass *klass) GObjectClass *gobject_class = G_OBJECT_CLASS (klass); GDataParsableClass *parsable_class = GDATA_PARSABLE_CLASS (klass); - g_type_class_add_private (klass, sizeof (GDataGContactWebsitePrivate)); - gobject_class->get_property = gdata_gcontact_website_get_property; gobject_class->set_property = gdata_gcontact_website_set_property; gobject_class->finalize = gdata_gcontact_website_finalize; @@ -166,7 +165,7 @@ gdata_gcontact_website_comparable_init (GDataComparableIface *iface) static void gdata_gcontact_website_init (GDataGContactWebsite *self) { - self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, GDATA_TYPE_GCONTACT_WEBSITE, GDataGContactWebsitePrivate); + self->priv = gdata_gcontact_website_get_instance_private (self); } static void diff --git a/gdata/gd/gdata-gd-email-address.c b/gdata/gd/gdata-gd-email-address.c index 63ae95bb..8bb4f99a 100644 --- a/gdata/gd/gdata-gd-email-address.c +++ b/gdata/gd/gdata-gd-email-address.c @@ -62,6 +62,7 @@ enum { }; G_DEFINE_TYPE_WITH_CODE (GDataGDEmailAddress, gdata_gd_email_address, GDATA_TYPE_PARSABLE, + G_ADD_PRIVATE (GDataGDEmailAddress) G_IMPLEMENT_INTERFACE (GDATA_TYPE_COMPARABLE, gdata_gd_email_address_comparable_init)) static void @@ -70,8 +71,6 @@ gdata_gd_email_address_class_init (GDataGDEmailAddressClass *klass) GObjectClass *gobject_class = G_OBJECT_CLASS (klass); GDataParsableClass *parsable_class = GDATA_PARSABLE_CLASS (klass); - g_type_class_add_private (klass, sizeof (GDataGDEmailAddressPrivate)); - gobject_class->get_property = gdata_gd_email_address_get_property; gobject_class->set_property = gdata_gd_email_address_set_property; gobject_class->finalize = gdata_gd_email_address_finalize; @@ -178,7 +177,7 @@ gdata_gd_email_address_comparable_init (GDataComparableIface *iface) static void gdata_gd_email_address_init (GDataGDEmailAddress *self) { - self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, GDATA_TYPE_GD_EMAIL_ADDRESS, GDataGDEmailAddressPrivate); + self->priv = gdata_gd_email_address_get_instance_private (self); } static void diff --git a/gdata/gd/gdata-gd-feed-link.c b/gdata/gd/gdata-gd-feed-link.c index e29ee51e..a2c427a3 100644 --- a/gdata/gd/gdata-gd-feed-link.c +++ b/gdata/gd/gdata-gd-feed-link.c @@ -67,7 +67,7 @@ enum { PROP_IS_READ_ONLY, }; -G_DEFINE_TYPE (GDataGDFeedLink, gdata_gd_feed_link, GDATA_TYPE_PARSABLE) +G_DEFINE_TYPE_WITH_PRIVATE (GDataGDFeedLink, gdata_gd_feed_link, GDATA_TYPE_PARSABLE) static void gdata_gd_feed_link_class_init (GDataGDFeedLinkClass *klass) @@ -75,8 +75,6 @@ gdata_gd_feed_link_class_init (GDataGDFeedLinkClass *klass) GObjectClass *gobject_class = G_OBJECT_CLASS (klass); GDataParsableClass *parsable_class = GDATA_PARSABLE_CLASS (klass); - g_type_class_add_private (klass, sizeof (GDataGDFeedLinkPrivate)); - gobject_class->set_property = gdata_gd_feed_link_set_property; gobject_class->get_property = gdata_gd_feed_link_get_property; gobject_class->finalize = gdata_gd_feed_link_finalize; @@ -155,7 +153,7 @@ gdata_gd_feed_link_class_init (GDataGDFeedLinkClass *klass) static void gdata_gd_feed_link_init (GDataGDFeedLink *self) { - self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, GDATA_TYPE_GD_FEED_LINK, GDataGDFeedLinkPrivate); + self->priv = gdata_gd_feed_link_get_instance_private (self); self->priv->count_hint = -1; self->priv->relation_type = g_strdup (GDATA_LINK_ALTERNATE); } diff --git a/gdata/gd/gdata-gd-im-address.c b/gdata/gd/gdata-gd-im-address.c index 5b446801..dfcf8ced 100644 --- a/gdata/gd/gdata-gd-im-address.c +++ b/gdata/gd/gdata-gd-im-address.c @@ -62,6 +62,7 @@ enum { }; G_DEFINE_TYPE_WITH_CODE (GDataGDIMAddress, gdata_gd_im_address, GDATA_TYPE_PARSABLE, + G_ADD_PRIVATE (GDataGDIMAddress) G_IMPLEMENT_INTERFACE (GDATA_TYPE_COMPARABLE, gdata_gd_im_address_comparable_init)) static void @@ -70,8 +71,6 @@ gdata_gd_im_address_class_init (GDataGDIMAddressClass *klass) GObjectClass *gobject_class = G_OBJECT_CLASS (klass); GDataParsableClass *parsable_class = GDATA_PARSABLE_CLASS (klass); - g_type_class_add_private (klass, sizeof (GDataGDIMAddressPrivate)); - gobject_class->get_property = gdata_gd_im_address_get_property; gobject_class->set_property = gdata_gd_im_address_set_property; gobject_class->finalize = gdata_gd_im_address_finalize; @@ -182,7 +181,7 @@ gdata_gd_im_address_comparable_init (GDataComparableIface *iface) static void gdata_gd_im_address_init (GDataGDIMAddress *self) { - self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, GDATA_TYPE_GD_IM_ADDRESS, GDataGDIMAddressPrivate); + self->priv = gdata_gd_im_address_get_instance_private (self); } static void diff --git a/gdata/gd/gdata-gd-name.c b/gdata/gd/gdata-gd-name.c index 4c1fde67..c663bfe1 100644 --- a/gdata/gd/gdata-gd-name.c +++ b/gdata/gd/gdata-gd-name.c @@ -74,6 +74,7 @@ enum { }; G_DEFINE_TYPE_WITH_CODE (GDataGDName, gdata_gd_name, GDATA_TYPE_PARSABLE, + G_ADD_PRIVATE (GDataGDName) G_IMPLEMENT_INTERFACE (GDATA_TYPE_COMPARABLE, gdata_gd_name_comparable_init)) static void @@ -82,8 +83,6 @@ gdata_gd_name_class_init (GDataGDNameClass *klass) GObjectClass *gobject_class = G_OBJECT_CLASS (klass); GDataParsableClass *parsable_class = GDATA_PARSABLE_CLASS (klass); - g_type_class_add_private (klass, sizeof (GDataGDNamePrivate)); - gobject_class->get_property = gdata_gd_name_get_property; gobject_class->set_property = gdata_gd_name_set_property; gobject_class->finalize = gdata_gd_name_finalize; @@ -212,7 +211,7 @@ gdata_gd_name_comparable_init (GDataComparableIface *iface) static void gdata_gd_name_init (GDataGDName *self) { - self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, GDATA_TYPE_GD_NAME, GDataGDNamePrivate); + self->priv = gdata_gd_name_get_instance_private (self); } static void diff --git a/gdata/gd/gdata-gd-organization.c b/gdata/gd/gdata-gd-organization.c index c5d6a23a..43222767 100644 --- a/gdata/gd/gdata-gd-organization.c +++ b/gdata/gd/gdata-gd-organization.c @@ -75,6 +75,7 @@ enum { }; G_DEFINE_TYPE_WITH_CODE (GDataGDOrganization, gdata_gd_organization, GDATA_TYPE_PARSABLE, + G_ADD_PRIVATE (GDataGDOrganization) G_IMPLEMENT_INTERFACE (GDATA_TYPE_COMPARABLE, gdata_gd_organization_comparable_init)) static void @@ -83,8 +84,6 @@ gdata_gd_organization_class_init (GDataGDOrganizationClass *klass) GObjectClass *gobject_class = G_OBJECT_CLASS (klass); GDataParsableClass *parsable_class = GDATA_PARSABLE_CLASS (klass); - g_type_class_add_private (klass, sizeof (GDataGDOrganizationPrivate)); - gobject_class->get_property = gdata_gd_organization_get_property; gobject_class->set_property = gdata_gd_organization_set_property; gobject_class->dispose = gdata_gd_organization_dispose; @@ -263,7 +262,7 @@ gdata_gd_organization_comparable_init (GDataComparableIface *iface) static void gdata_gd_organization_init (GDataGDOrganization *self) { - self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, GDATA_TYPE_GD_ORGANIZATION, GDataGDOrganizationPrivate); + self->priv = gdata_gd_organization_get_instance_private (self); } static void diff --git a/gdata/gd/gdata-gd-phone-number.c b/gdata/gd/gdata-gd-phone-number.c index 06c0be98..f2b1e5d3 100644 --- a/gdata/gd/gdata-gd-phone-number.c +++ b/gdata/gd/gdata-gd-phone-number.c @@ -65,6 +65,7 @@ enum { }; G_DEFINE_TYPE_WITH_CODE (GDataGDPhoneNumber, gdata_gd_phone_number, GDATA_TYPE_PARSABLE, + G_ADD_PRIVATE (GDataGDPhoneNumber) G_IMPLEMENT_INTERFACE (GDATA_TYPE_COMPARABLE, gdata_gd_phone_number_comparable_init)) static void @@ -73,8 +74,6 @@ gdata_gd_phone_number_class_init (GDataGDPhoneNumberClass *klass) GObjectClass *gobject_class = G_OBJECT_CLASS (klass); GDataParsableClass *parsable_class = GDATA_PARSABLE_CLASS (klass); - g_type_class_add_private (klass, sizeof (GDataGDPhoneNumberPrivate)); - gobject_class->get_property = gdata_gd_phone_number_get_property; gobject_class->set_property = gdata_gd_phone_number_set_property; gobject_class->finalize = gdata_gd_phone_number_finalize; @@ -199,7 +198,7 @@ gdata_gd_phone_number_comparable_init (GDataComparableIface *iface) static void gdata_gd_phone_number_init (GDataGDPhoneNumber *self) { - self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, GDATA_TYPE_GD_PHONE_NUMBER, GDataGDPhoneNumberPrivate); + self->priv = gdata_gd_phone_number_get_instance_private (self); } static void diff --git a/gdata/gd/gdata-gd-postal-address.c b/gdata/gd/gdata-gd-postal-address.c index a037b48e..396b9f8b 100644 --- a/gdata/gd/gdata-gd-postal-address.c +++ b/gdata/gd/gdata-gd-postal-address.c @@ -90,6 +90,7 @@ enum { }; G_DEFINE_TYPE_WITH_CODE (GDataGDPostalAddress, gdata_gd_postal_address, GDATA_TYPE_PARSABLE, + G_ADD_PRIVATE (GDataGDPostalAddress) G_IMPLEMENT_INTERFACE (GDATA_TYPE_COMPARABLE, gdata_gd_postal_address_comparable_init)) static void @@ -98,8 +99,6 @@ gdata_gd_postal_address_class_init (GDataGDPostalAddressClass *klass) GObjectClass *gobject_class = G_OBJECT_CLASS (klass); GDataParsableClass *parsable_class = GDATA_PARSABLE_CLASS (klass); - g_type_class_add_private (klass, sizeof (GDataGDPostalAddressPrivate)); - gobject_class->get_property = gdata_gd_postal_address_get_property; gobject_class->set_property = gdata_gd_postal_address_set_property; gobject_class->finalize = gdata_gd_postal_address_finalize; @@ -411,7 +410,7 @@ gdata_gd_postal_address_comparable_init (GDataComparableIface *iface) static void gdata_gd_postal_address_init (GDataGDPostalAddress *self) { - self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, GDATA_TYPE_GD_POSTAL_ADDRESS, GDataGDPostalAddressPrivate); + self->priv = gdata_gd_postal_address_get_instance_private (self); } static void diff --git a/gdata/gd/gdata-gd-reminder.c b/gdata/gd/gdata-gd-reminder.c index 6c1e25d3..ec1357dc 100644 --- a/gdata/gd/gdata-gd-reminder.c +++ b/gdata/gd/gdata-gd-reminder.c @@ -60,6 +60,7 @@ enum { }; G_DEFINE_TYPE_WITH_CODE (GDataGDReminder, gdata_gd_reminder, GDATA_TYPE_PARSABLE, + G_ADD_PRIVATE (GDataGDReminder) G_IMPLEMENT_INTERFACE (GDATA_TYPE_COMPARABLE, gdata_gd_reminder_comparable_init)) static void @@ -68,8 +69,6 @@ gdata_gd_reminder_class_init (GDataGDReminderClass *klass) GObjectClass *gobject_class = G_OBJECT_CLASS (klass); GDataParsableClass *parsable_class = GDATA_PARSABLE_CLASS (klass); - g_type_class_add_private (klass, sizeof (GDataGDReminderPrivate)); - gobject_class->get_property = gdata_gd_reminder_get_property; gobject_class->set_property = gdata_gd_reminder_set_property; gobject_class->finalize = gdata_gd_reminder_finalize; @@ -176,7 +175,7 @@ gdata_gd_reminder_comparable_init (GDataComparableIface *iface) static void gdata_gd_reminder_init (GDataGDReminder *self) { - self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, GDATA_TYPE_GD_REMINDER, GDataGDReminderPrivate); + self->priv = gdata_gd_reminder_get_instance_private (self); self->priv->absolute_time = -1; } diff --git a/gdata/gd/gdata-gd-when.c b/gdata/gd/gdata-gd-when.c index 4df94a22..7815e560 100644 --- a/gdata/gd/gdata-gd-when.c +++ b/gdata/gd/gdata-gd-when.c @@ -68,6 +68,7 @@ enum { }; G_DEFINE_TYPE_WITH_CODE (GDataGDWhen, gdata_gd_when, GDATA_TYPE_PARSABLE, + G_ADD_PRIVATE (GDataGDWhen) G_IMPLEMENT_INTERFACE (GDATA_TYPE_COMPARABLE, gdata_gd_when_comparable_init)) static void @@ -76,8 +77,6 @@ gdata_gd_when_class_init (GDataGDWhenClass *klass) GObjectClass *gobject_class = G_OBJECT_CLASS (klass); GDataParsableClass *parsable_class = GDATA_PARSABLE_CLASS (klass); - g_type_class_add_private (klass, sizeof (GDataGDWhenPrivate)); - gobject_class->get_property = gdata_gd_when_get_property; gobject_class->set_property = gdata_gd_when_set_property; gobject_class->dispose = gdata_gd_when_dispose; @@ -184,7 +183,7 @@ gdata_gd_when_comparable_init (GDataComparableIface *iface) static void gdata_gd_when_init (GDataGDWhen *self) { - self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, GDATA_TYPE_GD_WHEN, GDataGDWhenPrivate); + self->priv = gdata_gd_when_get_instance_private (self); self->priv->end_time = -1; } diff --git a/gdata/gd/gdata-gd-where.c b/gdata/gd/gdata-gd-where.c index ea299c02..2807bced 100644 --- a/gdata/gd/gdata-gd-where.c +++ b/gdata/gd/gdata-gd-where.c @@ -60,6 +60,7 @@ enum { }; G_DEFINE_TYPE_WITH_CODE (GDataGDWhere, gdata_gd_where, GDATA_TYPE_PARSABLE, + G_ADD_PRIVATE (GDataGDWhere) G_IMPLEMENT_INTERFACE (GDATA_TYPE_COMPARABLE, gdata_gd_where_comparable_init)) static void @@ -68,8 +69,6 @@ gdata_gd_where_class_init (GDataGDWhereClass *klass) GObjectClass *gobject_class = G_OBJECT_CLASS (klass); GDataParsableClass *parsable_class = GDATA_PARSABLE_CLASS (klass); - g_type_class_add_private (klass, sizeof (GDataGDWherePrivate)); - gobject_class->get_property = gdata_gd_where_get_property; gobject_class->set_property = gdata_gd_where_set_property; gobject_class->finalize = gdata_gd_where_finalize; @@ -151,7 +150,7 @@ gdata_gd_where_comparable_init (GDataComparableIface *iface) static void gdata_gd_where_init (GDataGDWhere *self) { - self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, GDATA_TYPE_GD_WHERE, GDataGDWherePrivate); + self->priv = gdata_gd_where_get_instance_private (self); } static void diff --git a/gdata/gd/gdata-gd-who.c b/gdata/gd/gdata-gd-who.c index f637ee9a..b98b9c0c 100644 --- a/gdata/gd/gdata-gd-who.c +++ b/gdata/gd/gdata-gd-who.c @@ -60,6 +60,7 @@ enum { }; G_DEFINE_TYPE_WITH_CODE (GDataGDWho, gdata_gd_who, GDATA_TYPE_PARSABLE, + G_ADD_PRIVATE (GDataGDWho) G_IMPLEMENT_INTERFACE (GDATA_TYPE_COMPARABLE, gdata_gd_who_comparable_init)) static void @@ -68,8 +69,6 @@ gdata_gd_who_class_init (GDataGDWhoClass *klass) GObjectClass *gobject_class = G_OBJECT_CLASS (klass); GDataParsableClass *parsable_class = GDATA_PARSABLE_CLASS (klass); - g_type_class_add_private (klass, sizeof (GDataGDWhoPrivate)); - gobject_class->get_property = gdata_gd_who_get_property; gobject_class->set_property = gdata_gd_who_set_property; gobject_class->finalize = gdata_gd_who_finalize; @@ -151,7 +150,7 @@ gdata_gd_who_comparable_init (GDataComparableIface *iface) static void gdata_gd_who_init (GDataGDWho *self) { - self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, GDATA_TYPE_GD_WHO, GDataGDWhoPrivate); + self->priv = gdata_gd_who_get_instance_private (self); } static void diff --git a/gdata/gdata-access-rule.c b/gdata/gdata-access-rule.c index ae501ec0..9fd1ce95 100644 --- a/gdata/gdata-access-rule.c +++ b/gdata/gdata-access-rule.c @@ -114,7 +114,7 @@ enum { PROP_KEY, }; -G_DEFINE_TYPE (GDataAccessRule, gdata_access_rule, GDATA_TYPE_ENTRY) +G_DEFINE_TYPE_WITH_PRIVATE (GDataAccessRule, gdata_access_rule, GDATA_TYPE_ENTRY) static void gdata_access_rule_class_init (GDataAccessRuleClass *klass) @@ -123,8 +123,6 @@ gdata_access_rule_class_init (GDataAccessRuleClass *klass) GDataParsableClass *parsable_class = GDATA_PARSABLE_CLASS (klass); GDataEntryClass *entry_class = GDATA_ENTRY_CLASS (klass); - g_type_class_add_private (klass, sizeof (GDataAccessRulePrivate)); - gobject_class->constructor = gdata_access_rule_constructor; gobject_class->finalize = gdata_access_rule_finalize; gobject_class->get_property = gdata_access_rule_get_property; @@ -240,7 +238,7 @@ notify_role_cb (GDataAccessRule *self, GParamSpec *pspec, gpointer user_data) static void gdata_access_rule_init (GDataAccessRule *self) { - self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, GDATA_TYPE_ACCESS_RULE, GDataAccessRulePrivate); + self->priv = gdata_access_rule_get_instance_private (self); self->priv->edited = -1; /* Listen to change notifications for the entry's title, since it's linked to GDataAccessRule:role */ diff --git a/gdata/gdata-authorization-domain.c b/gdata/gdata-authorization-domain.c index 1867974e..e8c1353a 100644 --- a/gdata/gdata-authorization-domain.c +++ b/gdata/gdata-authorization-domain.c @@ -60,15 +60,13 @@ enum { PROP_SCOPE, }; -G_DEFINE_TYPE (GDataAuthorizationDomain, gdata_authorization_domain, G_TYPE_OBJECT) +G_DEFINE_TYPE_WITH_PRIVATE (GDataAuthorizationDomain, gdata_authorization_domain, G_TYPE_OBJECT) static void gdata_authorization_domain_class_init (GDataAuthorizationDomainClass *klass) { GObjectClass *gobject_class = G_OBJECT_CLASS (klass); - g_type_class_add_private (klass, sizeof (GDataAuthorizationDomainPrivate)); - gobject_class->get_property = get_property; gobject_class->set_property = set_property; gobject_class->finalize = finalize; @@ -105,7 +103,7 @@ gdata_authorization_domain_class_init (GDataAuthorizationDomainClass *klass) static void gdata_authorization_domain_init (GDataAuthorizationDomain *self) { - self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, GDATA_TYPE_AUTHORIZATION_DOMAIN, GDataAuthorizationDomainPrivate); + self->priv = gdata_authorization_domain_get_instance_private (self); } static void diff --git a/gdata/gdata-batch-operation.c b/gdata/gdata-batch-operation.c index adac8b5e..f78801ed 100644 --- a/gdata/gdata-batch-operation.c +++ b/gdata/gdata-batch-operation.c @@ -126,16 +126,13 @@ enum { PROP_AUTHORIZATION_DOMAIN, }; -G_DEFINE_TYPE (GDataBatchOperation, gdata_batch_operation, G_TYPE_OBJECT) -#define GDATA_BATCH_OPERATION_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), GDATA_TYPE_BATCH_OPERATION, GDataBatchOperationPrivate)) +G_DEFINE_TYPE_WITH_PRIVATE (GDataBatchOperation, gdata_batch_operation, G_TYPE_OBJECT) static void gdata_batch_operation_class_init (GDataBatchOperationClass *klass) { GObjectClass *gobject_class = G_OBJECT_CLASS (klass); - g_type_class_add_private (klass, sizeof (GDataBatchOperationPrivate)); - gobject_class->dispose = gdata_batch_operation_dispose; gobject_class->finalize = gdata_batch_operation_finalize; gobject_class->get_property = gdata_batch_operation_get_property; @@ -188,7 +185,7 @@ gdata_batch_operation_class_init (GDataBatchOperationClass *klass) static void gdata_batch_operation_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec) { - GDataBatchOperationPrivate *priv = GDATA_BATCH_OPERATION_GET_PRIVATE (object); + GDataBatchOperationPrivate *priv = gdata_batch_operation_get_instance_private (GDATA_BATCH_OPERATION (object)); switch (property_id) { case PROP_SERVICE: @@ -210,7 +207,7 @@ gdata_batch_operation_get_property (GObject *object, guint property_id, GValue * static void gdata_batch_operation_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec) { - GDataBatchOperationPrivate *priv = GDATA_BATCH_OPERATION_GET_PRIVATE (object); + GDataBatchOperationPrivate *priv = gdata_batch_operation_get_instance_private (GDATA_BATCH_OPERATION (object)); switch (property_id) { case PROP_SERVICE: @@ -233,7 +230,7 @@ gdata_batch_operation_set_property (GObject *object, guint property_id, const GV static void gdata_batch_operation_init (GDataBatchOperation *self) { - self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, GDATA_TYPE_BATCH_OPERATION, GDataBatchOperationPrivate); + self->priv = gdata_batch_operation_get_instance_private (self); self->priv->next_id = 1; /* reserve ID 0 for error conditions */ self->priv->operations = g_hash_table_new_full (g_direct_hash, g_direct_equal, NULL, (GDestroyNotify) operation_free); } @@ -241,7 +238,7 @@ gdata_batch_operation_init (GDataBatchOperation *self) static void gdata_batch_operation_dispose (GObject *object) { - GDataBatchOperationPrivate *priv = GDATA_BATCH_OPERATION_GET_PRIVATE (object); + GDataBatchOperationPrivate *priv = gdata_batch_operation_get_instance_private (GDATA_BATCH_OPERATION (object)); if (priv->authorization_domain != NULL) g_object_unref (priv->authorization_domain); @@ -258,7 +255,7 @@ gdata_batch_operation_dispose (GObject *object) static void gdata_batch_operation_finalize (GObject *object) { - GDataBatchOperationPrivate *priv = GDATA_BATCH_OPERATION_GET_PRIVATE (object); + GDataBatchOperationPrivate *priv = gdata_batch_operation_get_instance_private (GDATA_BATCH_OPERATION (object)); g_free (priv->feed_uri); g_hash_table_destroy (priv->operations); diff --git a/gdata/gdata-client-login-authorizer.c b/gdata/gdata-client-login-authorizer.c index 31edee36..295f5106 100644 --- a/gdata/gdata-client-login-authorizer.c +++ b/gdata/gdata-client-login-authorizer.c @@ -159,6 +159,7 @@ enum { static guint authorizer_signals[LAST_SIGNAL] = { 0, }; G_DEFINE_TYPE_WITH_CODE (GDataClientLoginAuthorizer, gdata_client_login_authorizer, G_TYPE_OBJECT, + G_ADD_PRIVATE (GDataClientLoginAuthorizer) G_IMPLEMENT_INTERFACE (GDATA_TYPE_AUTHORIZER, authorizer_init)) static void @@ -166,8 +167,6 @@ gdata_client_login_authorizer_class_init (GDataClientLoginAuthorizerClass *klass { GObjectClass *gobject_class = G_OBJECT_CLASS (klass); - g_type_class_add_private (klass, sizeof (GDataClientLoginAuthorizerPrivate)); - gobject_class->get_property = get_property; gobject_class->set_property = set_property; gobject_class->dispose = dispose; @@ -302,7 +301,7 @@ authorizer_init (GDataAuthorizerInterface *iface) static void gdata_client_login_authorizer_init (GDataClientLoginAuthorizer *self) { - self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, GDATA_TYPE_CLIENT_LOGIN_AUTHORIZER, GDataClientLoginAuthorizerPrivate); + self->priv = gdata_client_login_authorizer_get_instance_private (self); /* Set up the authentication mutex */ g_rec_mutex_init (&(self->priv->mutex)); diff --git a/gdata/gdata-download-stream.c b/gdata/gdata-download-stream.c index a797de68..a6d64316 100644 --- a/gdata/gdata-download-stream.c +++ b/gdata/gdata-download-stream.c @@ -182,6 +182,7 @@ enum { }; G_DEFINE_TYPE_WITH_CODE (GDataDownloadStream, gdata_download_stream, G_TYPE_INPUT_STREAM, + G_ADD_PRIVATE (GDataDownloadStream) G_IMPLEMENT_INTERFACE (G_TYPE_SEEKABLE, gdata_download_stream_seekable_iface_init)) static void @@ -190,8 +191,6 @@ gdata_download_stream_class_init (GDataDownloadStreamClass *klass) GObjectClass *gobject_class = G_OBJECT_CLASS (klass); GInputStreamClass *stream_class = G_INPUT_STREAM_CLASS (klass); - g_type_class_add_private (klass, sizeof (GDataDownloadStreamPrivate)); - gobject_class->constructor = gdata_download_stream_constructor; gobject_class->dispose = gdata_download_stream_dispose; gobject_class->finalize = gdata_download_stream_finalize; @@ -314,7 +313,7 @@ gdata_download_stream_seekable_iface_init (GSeekableIface *seekable_iface) static void gdata_download_stream_init (GDataDownloadStream *self) { - self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, GDATA_TYPE_DOWNLOAD_STREAM, GDataDownloadStreamPrivate); + self->priv = gdata_download_stream_get_instance_private (self); self->priv->buffer = NULL; /* created when the network thread is started and destroyed when the stream is closed */ self->priv->finished = FALSE; diff --git a/gdata/gdata-entry.c b/gdata/gdata-entry.c index 30488a83..c6127d87 100644 --- a/gdata/gdata-entry.c +++ b/gdata/gdata-entry.c @@ -91,7 +91,7 @@ enum { PROP_CONTENT_URI }; -G_DEFINE_TYPE (GDataEntry, gdata_entry, GDATA_TYPE_PARSABLE) +G_DEFINE_TYPE_WITH_PRIVATE (GDataEntry, gdata_entry, GDATA_TYPE_PARSABLE) static void gdata_entry_class_init (GDataEntryClass *klass) @@ -99,8 +99,6 @@ gdata_entry_class_init (GDataEntryClass *klass) GObjectClass *gobject_class = G_OBJECT_CLASS (klass); GDataParsableClass *parsable_class = GDATA_PARSABLE_CLASS (klass); - g_type_class_add_private (klass, sizeof (GDataEntryPrivate)); - gobject_class->constructed = gdata_entry_constructed; gobject_class->get_property = gdata_entry_get_property; gobject_class->set_property = gdata_entry_set_property; @@ -272,7 +270,7 @@ gdata_entry_class_init (GDataEntryClass *klass) static void gdata_entry_init (GDataEntry *self) { - self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, GDATA_TYPE_ENTRY, GDataEntryPrivate); + self->priv = gdata_entry_get_instance_private (self); self->priv->updated = -1; self->priv->published = -1; } diff --git a/gdata/gdata-feed.c b/gdata/gdata-feed.c index c1e6aa93..e3777543 100644 --- a/gdata/gdata-feed.c +++ b/gdata/gdata-feed.c @@ -97,7 +97,7 @@ enum { PROP_NEXT_PAGE_TOKEN, }; -G_DEFINE_TYPE (GDataFeed, gdata_feed, GDATA_TYPE_PARSABLE) +G_DEFINE_TYPE_WITH_PRIVATE (GDataFeed, gdata_feed, GDATA_TYPE_PARSABLE) static void gdata_feed_class_init (GDataFeedClass *klass) @@ -105,8 +105,6 @@ gdata_feed_class_init (GDataFeedClass *klass) GObjectClass *gobject_class = G_OBJECT_CLASS (klass); GDataParsableClass *parsable_class = GDATA_PARSABLE_CLASS (klass); - g_type_class_add_private (klass, sizeof (GDataFeedPrivate)); - gobject_class->get_property = gdata_feed_get_property; gobject_class->dispose = gdata_feed_dispose; gobject_class->finalize = gdata_feed_finalize; @@ -319,7 +317,7 @@ gdata_feed_class_init (GDataFeedClass *klass) static void gdata_feed_init (GDataFeed *self) { - self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, GDATA_TYPE_FEED, GDataFeedPrivate); + self->priv = gdata_feed_get_instance_private (self); self->priv->updated = -1; } diff --git a/gdata/gdata-goa-authorizer.c b/gdata/gdata-goa-authorizer.c index a5e650d8..b6b33c71 100644 --- a/gdata/gdata-goa-authorizer.c +++ b/gdata/gdata-goa-authorizer.c @@ -96,6 +96,7 @@ enum { }; G_DEFINE_TYPE_WITH_CODE (GDataGoaAuthorizer, gdata_goa_authorizer, G_TYPE_OBJECT, + G_ADD_PRIVATE (GDataGoaAuthorizer) G_IMPLEMENT_INTERFACE (GDATA_TYPE_AUTHORIZER, gdata_goa_authorizer_interface_init)) static void @@ -324,8 +325,6 @@ gdata_goa_authorizer_class_init (GDataGoaAuthorizerClass *class) { GObjectClass *object_class; - g_type_class_add_private (class, sizeof (GDataGoaAuthorizerPrivate)); - object_class = G_OBJECT_CLASS (class); object_class->set_property = gdata_goa_authorizer_set_property; object_class->get_property = gdata_goa_authorizer_get_property; @@ -360,7 +359,7 @@ gdata_goa_authorizer_init (GDataGoaAuthorizer *authorizer) authorization_domains = g_hash_table_new_full ((GHashFunc) g_direct_hash, (GEqualFunc) g_direct_equal, (GDestroyNotify) g_object_unref, (GDestroyNotify) NULL); - authorizer->priv = G_TYPE_INSTANCE_GET_PRIVATE (authorizer, GDATA_TYPE_GOA_AUTHORIZER, GDataGoaAuthorizerPrivate); + authorizer->priv = gdata_goa_authorizer_get_instance_private (authorizer); authorizer->priv->authorization_domains = authorization_domains; } diff --git a/gdata/gdata-oauth1-authorizer.c b/gdata/gdata-oauth1-authorizer.c index 09d766ec..7b857ac0 100644 --- a/gdata/gdata-oauth1-authorizer.c +++ b/gdata/gdata-oauth1-authorizer.c @@ -199,6 +199,7 @@ enum { }; G_DEFINE_TYPE_WITH_CODE (GDataOAuth1Authorizer, gdata_oauth1_authorizer, G_TYPE_OBJECT, + G_ADD_PRIVATE (GDataOAuth1Authorizer) G_IMPLEMENT_INTERFACE (GDATA_TYPE_AUTHORIZER, authorizer_init)) static void @@ -206,8 +207,6 @@ gdata_oauth1_authorizer_class_init (GDataOAuth1AuthorizerClass *klass) { GObjectClass *gobject_class = G_OBJECT_CLASS (klass); - g_type_class_add_private (klass, sizeof (GDataOAuth1AuthorizerPrivate)); - gobject_class->get_property = get_property; gobject_class->set_property = set_property; gobject_class->dispose = dispose; @@ -303,7 +302,7 @@ authorizer_init (GDataAuthorizerInterface *iface) static void gdata_oauth1_authorizer_init (GDataOAuth1Authorizer *self) { - self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, GDATA_TYPE_OAUTH1_AUTHORIZER, GDataOAuth1AuthorizerPrivate); + self->priv = gdata_oauth1_authorizer_get_instance_private (self); /* Set up the authorizer's mutex */ g_mutex_init (&(self->priv->mutex)); diff --git a/gdata/gdata-oauth2-authorizer.c b/gdata/gdata-oauth2-authorizer.c index a08a265f..b81f0d42 100644 --- a/gdata/gdata-oauth2-authorizer.c +++ b/gdata/gdata-oauth2-authorizer.c @@ -213,6 +213,7 @@ enum { G_DEFINE_TYPE_WITH_CODE (GDataOAuth2Authorizer, gdata_oauth2_authorizer, G_TYPE_OBJECT, + G_ADD_PRIVATE (GDataOAuth2Authorizer) G_IMPLEMENT_INTERFACE (GDATA_TYPE_AUTHORIZER, authorizer_init)) @@ -221,8 +222,6 @@ gdata_oauth2_authorizer_class_init (GDataOAuth2AuthorizerClass *klass) { GObjectClass *gobject_class = G_OBJECT_CLASS (klass); - g_type_class_add_private (klass, sizeof (GDataOAuth2AuthorizerPrivate)); - gobject_class->get_property = get_property; gobject_class->set_property = set_property; gobject_class->dispose = dispose; @@ -402,9 +401,7 @@ authorizer_init (GDataAuthorizerInterface *iface) static void gdata_oauth2_authorizer_init (GDataOAuth2Authorizer *self) { - self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, - GDATA_TYPE_OAUTH2_AUTHORIZER, - GDataOAuth2AuthorizerPrivate); + self->priv = gdata_oauth2_authorizer_get_instance_private (self); /* Set up the authorizer's mutex */ g_mutex_init (&self->priv->mutex); diff --git a/gdata/gdata-parsable.c b/gdata/gdata-parsable.c index 80b1a102..6db9e429 100644 --- a/gdata/gdata-parsable.c +++ b/gdata/gdata-parsable.c @@ -70,15 +70,13 @@ enum { PROP_CONSTRUCTED_FROM_XML = 1, }; -G_DEFINE_ABSTRACT_TYPE (GDataParsable, gdata_parsable, G_TYPE_OBJECT) +G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (GDataParsable, gdata_parsable, G_TYPE_OBJECT) static void gdata_parsable_class_init (GDataParsableClass *klass) { GObjectClass *gobject_class = G_OBJECT_CLASS (klass); - g_type_class_add_private (klass, sizeof (GDataParsablePrivate)); - gobject_class->get_property = gdata_parsable_get_property; gobject_class->set_property = gdata_parsable_set_property; gobject_class->finalize = gdata_parsable_finalize; @@ -104,7 +102,7 @@ gdata_parsable_class_init (GDataParsableClass *klass) static void gdata_parsable_init (GDataParsable *self) { - self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, GDATA_TYPE_PARSABLE, GDataParsablePrivate); + self->priv = gdata_parsable_get_instance_private (self); self->priv->extra_xml = g_string_new (""); self->priv->extra_namespaces = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free); diff --git a/gdata/gdata-query.c b/gdata/gdata-query.c index e2d59486..458cab46 100644 --- a/gdata/gdata-query.c +++ b/gdata/gdata-query.c @@ -117,15 +117,13 @@ enum { PROP_ETAG }; -G_DEFINE_TYPE (GDataQuery, gdata_query, G_TYPE_OBJECT) +G_DEFINE_TYPE_WITH_PRIVATE (GDataQuery, gdata_query, G_TYPE_OBJECT) static void gdata_query_class_init (GDataQueryClass *klass) { GObjectClass *gobject_class = G_OBJECT_CLASS (klass); - g_type_class_add_private (klass, sizeof (GDataQueryPrivate)); - gobject_class->set_property = gdata_query_set_property; gobject_class->get_property = gdata_query_get_property; gobject_class->finalize = gdata_query_finalize; @@ -305,7 +303,7 @@ gdata_query_class_init (GDataQueryClass *klass) static void gdata_query_init (GDataQuery *self) { - self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, GDATA_TYPE_QUERY, GDataQueryPrivate); + self->priv = gdata_query_get_instance_private (self); self->priv->updated_min = -1; self->priv->updated_max = -1; self->priv->published_min = -1; diff --git a/gdata/gdata-service.c b/gdata/gdata-service.c index 3597b13f..fce970ec 100644 --- a/gdata/gdata-service.c +++ b/gdata/gdata-service.c @@ -105,15 +105,13 @@ enum { PROP_PROXY_RESOLVER, }; -G_DEFINE_TYPE (GDataService, gdata_service, G_TYPE_OBJECT) +G_DEFINE_TYPE_WITH_PRIVATE (GDataService, gdata_service, G_TYPE_OBJECT) static void gdata_service_class_init (GDataServiceClass *klass) { GObjectClass *gobject_class = G_OBJECT_CLASS (klass); - g_type_class_add_private (klass, sizeof (GDataServicePrivate)); - gobject_class->set_property = gdata_service_set_property; gobject_class->get_property = gdata_service_get_property; gobject_class->dispose = gdata_service_dispose; @@ -220,7 +218,7 @@ gdata_service_class_init (GDataServiceClass *klass) static void gdata_service_init (GDataService *self) { - self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, GDATA_TYPE_SERVICE, GDataServicePrivate); + self->priv = gdata_service_get_instance_private (self); self->priv->session = _gdata_service_build_session (); /* Log handling for all message types except debug */ diff --git a/gdata/gdata-upload-stream.c b/gdata/gdata-upload-stream.c index 85738fd3..71e8b71c 100644 --- a/gdata/gdata-upload-stream.c +++ b/gdata/gdata-upload-stream.c @@ -242,7 +242,7 @@ enum { PROP_CONTENT_LENGTH, }; -G_DEFINE_TYPE (GDataUploadStream, gdata_upload_stream, G_TYPE_OUTPUT_STREAM) +G_DEFINE_TYPE_WITH_PRIVATE (GDataUploadStream, gdata_upload_stream, G_TYPE_OUTPUT_STREAM) static void gdata_upload_stream_class_init (GDataUploadStreamClass *klass) @@ -250,8 +250,6 @@ gdata_upload_stream_class_init (GDataUploadStreamClass *klass) GObjectClass *gobject_class = G_OBJECT_CLASS (klass); GOutputStreamClass *stream_class = G_OUTPUT_STREAM_CLASS (klass); - g_type_class_add_private (klass, sizeof (GDataUploadStreamPrivate)); - gobject_class->constructed = gdata_upload_stream_constructed; gobject_class->dispose = gdata_upload_stream_dispose; gobject_class->finalize = gdata_upload_stream_finalize; @@ -397,7 +395,7 @@ gdata_upload_stream_class_init (GDataUploadStreamClass *klass) static void gdata_upload_stream_init (GDataUploadStream *self) { - self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, GDATA_TYPE_UPLOAD_STREAM, GDataUploadStreamPrivate); + self->priv = gdata_upload_stream_get_instance_private (self); self->priv->buffer = gdata_buffer_new (); g_mutex_init (&(self->priv->write_mutex)); g_cond_init (&(self->priv->write_cond)); diff --git a/gdata/georss/gdata-georss-where.c b/gdata/georss/gdata-georss-where.c index 8673c261..7a7aa5c2 100644 --- a/gdata/georss/gdata-georss-where.c +++ b/gdata/georss/gdata-georss-where.c @@ -54,15 +54,13 @@ struct _GDataGeoRSSWherePrivate { gdouble longitude; }; -G_DEFINE_TYPE (GDataGeoRSSWhere, gdata_georss_where, GDATA_TYPE_PARSABLE) +G_DEFINE_TYPE_WITH_PRIVATE (GDataGeoRSSWhere, gdata_georss_where, GDATA_TYPE_PARSABLE) static void gdata_georss_where_class_init (GDataGeoRSSWhereClass *klass) { GDataParsableClass *parsable_class = GDATA_PARSABLE_CLASS (klass); - g_type_class_add_private (klass, sizeof (GDataGeoRSSWherePrivate)); - parsable_class->get_xml = get_xml; parsable_class->parse_xml = parse_xml; parsable_class->get_namespaces = get_namespaces; @@ -73,7 +71,7 @@ gdata_georss_where_class_init (GDataGeoRSSWhereClass *klass) static void gdata_georss_where_init (GDataGeoRSSWhere *self) { - self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, GDATA_TYPE_GEORSS_WHERE, GDataGeoRSSWherePrivate); + self->priv = gdata_georss_where_get_instance_private (self); self->priv->latitude = G_MAXDOUBLE; self->priv->longitude = G_MAXDOUBLE; diff --git a/gdata/media/gdata-media-category.c b/gdata/media/gdata-media-category.c index da7e1564..228f5e2b 100644 --- a/gdata/media/gdata-media-category.c +++ b/gdata/media/gdata-media-category.c @@ -58,7 +58,7 @@ enum { PROP_LABEL }; -G_DEFINE_TYPE (GDataMediaCategory, gdata_media_category, GDATA_TYPE_PARSABLE) +G_DEFINE_TYPE_WITH_PRIVATE (GDataMediaCategory, gdata_media_category, GDATA_TYPE_PARSABLE) static void gdata_media_category_class_init (GDataMediaCategoryClass *klass) @@ -66,8 +66,6 @@ gdata_media_category_class_init (GDataMediaCategoryClass *klass) GObjectClass *gobject_class = G_OBJECT_CLASS (klass); GDataParsableClass *parsable_class = GDATA_PARSABLE_CLASS (klass); - g_type_class_add_private (klass, sizeof (GDataMediaCategoryPrivate)); - gobject_class->get_property = gdata_media_category_get_property; gobject_class->set_property = gdata_media_category_set_property; gobject_class->finalize = gdata_media_category_finalize; @@ -129,7 +127,7 @@ gdata_media_category_class_init (GDataMediaCategoryClass *klass) static void gdata_media_category_init (GDataMediaCategory *self) { - self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, GDATA_TYPE_MEDIA_CATEGORY, GDataMediaCategoryPrivate); + self->priv = gdata_media_category_get_instance_private (self); } static void diff --git a/gdata/media/gdata-media-content.c b/gdata/media/gdata-media-content.c index 50a35d34..bd2adc00 100644 --- a/gdata/media/gdata-media-content.c +++ b/gdata/media/gdata-media-content.c @@ -71,7 +71,7 @@ enum { PROP_WIDTH }; -G_DEFINE_TYPE (GDataMediaContent, gdata_media_content, GDATA_TYPE_PARSABLE) +G_DEFINE_TYPE_WITH_PRIVATE (GDataMediaContent, gdata_media_content, GDATA_TYPE_PARSABLE) static void gdata_media_content_class_init (GDataMediaContentClass *klass) @@ -79,8 +79,6 @@ gdata_media_content_class_init (GDataMediaContentClass *klass) GObjectClass *gobject_class = G_OBJECT_CLASS (klass); GDataParsableClass *parsable_class = GDATA_PARSABLE_CLASS (klass); - g_type_class_add_private (klass, sizeof (GDataMediaContentPrivate)); - gobject_class->get_property = gdata_media_content_get_property; gobject_class->finalize = gdata_media_content_finalize; @@ -229,7 +227,7 @@ gdata_media_content_class_init (GDataMediaContentClass *klass) static void gdata_media_content_init (GDataMediaContent *self) { - self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, GDATA_TYPE_MEDIA_CONTENT, GDataMediaContentPrivate); + self->priv = gdata_media_content_get_instance_private (self); } static void diff --git a/gdata/media/gdata-media-credit.c b/gdata/media/gdata-media-credit.c index de206779..d4f85391 100644 --- a/gdata/media/gdata-media-credit.c +++ b/gdata/media/gdata-media-credit.c @@ -57,7 +57,7 @@ enum { PROP_ROLE }; -G_DEFINE_TYPE (GDataMediaCredit, gdata_media_credit, GDATA_TYPE_PARSABLE) +G_DEFINE_TYPE_WITH_PRIVATE (GDataMediaCredit, gdata_media_credit, GDATA_TYPE_PARSABLE) static void gdata_media_credit_class_init (GDataMediaCreditClass *klass) @@ -65,8 +65,6 @@ gdata_media_credit_class_init (GDataMediaCreditClass *klass) GObjectClass *gobject_class = G_OBJECT_CLASS (klass); GDataParsableClass *parsable_class = GDATA_PARSABLE_CLASS (klass); - g_type_class_add_private (klass, sizeof (GDataMediaCreditPrivate)); - gobject_class->get_property = gdata_media_credit_get_property; gobject_class->finalize = gdata_media_credit_finalize; @@ -125,7 +123,7 @@ gdata_media_credit_class_init (GDataMediaCreditClass *klass) static void gdata_media_credit_init (GDataMediaCredit *self) { - self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, GDATA_TYPE_MEDIA_CREDIT, GDataMediaCreditPrivate); + self->priv = gdata_media_credit_get_instance_private (self); } static void diff --git a/gdata/media/gdata-media-group.c b/gdata/media/gdata-media-group.c index 6d0db9b6..4469433c 100644 --- a/gdata/media/gdata-media-group.c +++ b/gdata/media/gdata-media-group.c @@ -66,7 +66,7 @@ struct _GDataMediaGroupPrivate { gchar *description; }; -G_DEFINE_TYPE (GDataMediaGroup, gdata_media_group, GDATA_TYPE_PARSABLE) +G_DEFINE_TYPE_WITH_PRIVATE (GDataMediaGroup, gdata_media_group, GDATA_TYPE_PARSABLE) static void gdata_media_group_class_init (GDataMediaGroupClass *klass) @@ -74,8 +74,6 @@ gdata_media_group_class_init (GDataMediaGroupClass *klass) GObjectClass *gobject_class = G_OBJECT_CLASS (klass); GDataParsableClass *parsable_class = GDATA_PARSABLE_CLASS (klass); - g_type_class_add_private (klass, sizeof (GDataMediaGroupPrivate)); - gobject_class->dispose = gdata_media_group_dispose; gobject_class->finalize = gdata_media_group_finalize; @@ -89,7 +87,7 @@ gdata_media_group_class_init (GDataMediaGroupClass *klass) static void gdata_media_group_init (GDataMediaGroup *self) { - self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, GDATA_TYPE_MEDIA_GROUP, GDataMediaGroupPrivate); + self->priv = gdata_media_group_get_instance_private (self); self->priv->restricted_countries = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL); } diff --git a/gdata/media/gdata-media-thumbnail.c b/gdata/media/gdata-media-thumbnail.c index e8b48066..41ccd604 100644 --- a/gdata/media/gdata-media-thumbnail.c +++ b/gdata/media/gdata-media-thumbnail.c @@ -61,7 +61,7 @@ enum { PROP_TIME }; -G_DEFINE_TYPE (GDataMediaThumbnail, gdata_media_thumbnail, GDATA_TYPE_PARSABLE) +G_DEFINE_TYPE_WITH_PRIVATE (GDataMediaThumbnail, gdata_media_thumbnail, GDATA_TYPE_PARSABLE) static void gdata_media_thumbnail_class_init (GDataMediaThumbnailClass *klass) @@ -69,8 +69,6 @@ gdata_media_thumbnail_class_init (GDataMediaThumbnailClass *klass) GObjectClass *gobject_class = G_OBJECT_CLASS (klass); GDataParsableClass *parsable_class = GDATA_PARSABLE_CLASS (klass); - g_type_class_add_private (klass, sizeof (GDataMediaThumbnailPrivate)); - gobject_class->get_property = gdata_media_thumbnail_get_property; gobject_class->finalize = gdata_media_thumbnail_finalize; @@ -144,7 +142,7 @@ gdata_media_thumbnail_class_init (GDataMediaThumbnailClass *klass) static void gdata_media_thumbnail_init (GDataMediaThumbnail *self) { - self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, GDATA_TYPE_MEDIA_THUMBNAIL, GDataMediaThumbnailPrivate); + self->priv = gdata_media_thumbnail_get_instance_private (self); } static void diff --git a/gdata/services/calendar/gdata-calendar-calendar.c b/gdata/services/calendar/gdata-calendar-calendar.c index c7815588..1fefb5ce 100644 --- a/gdata/services/calendar/gdata-calendar-calendar.c +++ b/gdata/services/calendar/gdata-calendar-calendar.c @@ -116,6 +116,7 @@ enum { }; G_DEFINE_TYPE_WITH_CODE (GDataCalendarCalendar, gdata_calendar_calendar, GDATA_TYPE_ENTRY, + G_ADD_PRIVATE (GDataCalendarCalendar) G_IMPLEMENT_INTERFACE (GDATA_TYPE_ACCESS_HANDLER, gdata_calendar_calendar_access_handler_init)) static void @@ -125,8 +126,6 @@ gdata_calendar_calendar_class_init (GDataCalendarCalendarClass *klass) GDataParsableClass *parsable_class = GDATA_PARSABLE_CLASS (klass); GDataEntryClass *entry_class = GDATA_ENTRY_CLASS (klass); - g_type_class_add_private (klass, sizeof (GDataCalendarCalendarPrivate)); - gobject_class->set_property = gdata_calendar_calendar_set_property; gobject_class->get_property = gdata_calendar_calendar_get_property; gobject_class->finalize = gdata_calendar_calendar_finalize; @@ -337,7 +336,7 @@ gdata_calendar_calendar_access_handler_init (GDataAccessHandlerIface *iface) static void gdata_calendar_calendar_init (GDataCalendarCalendar *self) { - self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, GDATA_TYPE_CALENDAR_CALENDAR, GDataCalendarCalendarPrivate); + self->priv = gdata_calendar_calendar_get_instance_private (self); } static void diff --git a/gdata/services/calendar/gdata-calendar-event.c b/gdata/services/calendar/gdata-calendar-event.c index d11f0455..a3a4d713 100644 --- a/gdata/services/calendar/gdata-calendar-event.c +++ b/gdata/services/calendar/gdata-calendar-event.c @@ -150,7 +150,7 @@ enum { PROP_ORIGINAL_EVENT_URI }; -G_DEFINE_TYPE (GDataCalendarEvent, gdata_calendar_event, GDATA_TYPE_ENTRY) +G_DEFINE_TYPE_WITH_PRIVATE (GDataCalendarEvent, gdata_calendar_event, GDATA_TYPE_ENTRY) static void gdata_calendar_event_class_init (GDataCalendarEventClass *klass) @@ -159,8 +159,6 @@ gdata_calendar_event_class_init (GDataCalendarEventClass *klass) GDataParsableClass *parsable_class = GDATA_PARSABLE_CLASS (klass); GDataEntryClass *entry_class = GDATA_ENTRY_CLASS (klass); - g_type_class_add_private (klass, sizeof (GDataCalendarEventPrivate)); - gobject_class->constructor = gdata_calendar_event_constructor; gobject_class->get_property = gdata_calendar_event_get_property; gobject_class->set_property = gdata_calendar_event_set_property; @@ -362,7 +360,7 @@ gdata_calendar_event_class_init (GDataCalendarEventClass *klass) static void gdata_calendar_event_init (GDataCalendarEvent *self) { - self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, GDATA_TYPE_CALENDAR_EVENT, GDataCalendarEventPrivate); + self->priv = gdata_calendar_event_get_instance_private (self); self->priv->edited = -1; } diff --git a/gdata/services/calendar/gdata-calendar-query.c b/gdata/services/calendar/gdata-calendar-query.c index a64960cd..37779bbe 100644 --- a/gdata/services/calendar/gdata-calendar-query.c +++ b/gdata/services/calendar/gdata-calendar-query.c @@ -119,7 +119,7 @@ enum { PROP_SHOW_DELETED, }; -G_DEFINE_TYPE (GDataCalendarQuery, gdata_calendar_query, GDATA_TYPE_QUERY) +G_DEFINE_TYPE_WITH_PRIVATE (GDataCalendarQuery, gdata_calendar_query, GDATA_TYPE_QUERY) static void gdata_calendar_query_class_init (GDataCalendarQueryClass *klass) @@ -127,8 +127,6 @@ gdata_calendar_query_class_init (GDataCalendarQueryClass *klass) GObjectClass *gobject_class = G_OBJECT_CLASS (klass); GDataQueryClass *query_class = GDATA_QUERY_CLASS (klass); - g_type_class_add_private (klass, sizeof (GDataCalendarQueryPrivate)); - gobject_class->set_property = gdata_calendar_query_set_property; gobject_class->get_property = gdata_calendar_query_get_property; gobject_class->finalize = gdata_calendar_query_finalize; @@ -290,7 +288,7 @@ gdata_calendar_query_class_init (GDataCalendarQueryClass *klass) static void gdata_calendar_query_init (GDataCalendarQuery *self) { - self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, GDATA_TYPE_CALENDAR_QUERY, GDataCalendarQueryPrivate); + self->priv = gdata_calendar_query_get_instance_private (self); self->priv->recurrence_expansion_start = -1; self->priv->recurrence_expansion_end = -1; self->priv->start_min = -1; diff --git a/gdata/services/contacts/gdata-contacts-contact.c b/gdata/services/contacts/gdata-contacts-contact.c index fc577f3d..4f511315 100644 --- a/gdata/services/contacts/gdata-contacts-contact.c +++ b/gdata/services/contacts/gdata-contacts-contact.c @@ -234,7 +234,7 @@ enum { PROP_FILE_AS, }; -G_DEFINE_TYPE (GDataContactsContact, gdata_contacts_contact, GDATA_TYPE_ENTRY) +G_DEFINE_TYPE_WITH_PRIVATE (GDataContactsContact, gdata_contacts_contact, GDATA_TYPE_ENTRY) static void gdata_contacts_contact_class_init (GDataContactsContactClass *klass) @@ -243,8 +243,6 @@ gdata_contacts_contact_class_init (GDataContactsContactClass *klass) GDataParsableClass *parsable_class = GDATA_PARSABLE_CLASS (klass); GDataEntryClass *entry_class = GDATA_ENTRY_CLASS (klass); - g_type_class_add_private (klass, sizeof (GDataContactsContactPrivate)); - gobject_class->constructor = gdata_contacts_contact_constructor; gobject_class->get_property = gdata_contacts_contact_get_property; gobject_class->set_property = gdata_contacts_contact_set_property; @@ -533,7 +531,7 @@ notify_full_name_cb (GObject *gobject, GParamSpec *pspec, GDataContactsContact * static void gdata_contacts_contact_init (GDataContactsContact *self) { - self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, GDATA_TYPE_CONTACTS_CONTACT, GDataContactsContactPrivate); + self->priv = gdata_contacts_contact_get_instance_private (self); self->priv->extended_properties = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free); self->priv->user_defined_fields = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free); self->priv->groups = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL); diff --git a/gdata/services/contacts/gdata-contacts-group.c b/gdata/services/contacts/gdata-contacts-group.c index d8ab4a46..055f4255 100644 --- a/gdata/services/contacts/gdata-contacts-group.c +++ b/gdata/services/contacts/gdata-contacts-group.c @@ -130,7 +130,7 @@ enum { PROP_SYSTEM_GROUP_ID }; -G_DEFINE_TYPE (GDataContactsGroup, gdata_contacts_group, GDATA_TYPE_ENTRY) +G_DEFINE_TYPE_WITH_PRIVATE (GDataContactsGroup, gdata_contacts_group, GDATA_TYPE_ENTRY) static void gdata_contacts_group_class_init (GDataContactsGroupClass *klass) @@ -139,8 +139,6 @@ gdata_contacts_group_class_init (GDataContactsGroupClass *klass) GDataParsableClass *parsable_class = GDATA_PARSABLE_CLASS (klass); GDataEntryClass *entry_class = GDATA_ENTRY_CLASS (klass); - g_type_class_add_private (klass, sizeof (GDataContactsGroupPrivate)); - gobject_class->constructor = gdata_contacts_group_constructor; gobject_class->get_property = gdata_contacts_group_get_property; gobject_class->finalize = gdata_contacts_group_finalize; @@ -225,7 +223,7 @@ notify_content_cb (GObject *gobject, GParamSpec *pspec, GDataContactsGroup *self static void gdata_contacts_group_init (GDataContactsGroup *self) { - self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, GDATA_TYPE_CONTACTS_GROUP, GDataContactsGroupPrivate); + self->priv =gdata_contacts_group_get_instance_private (self); self->priv->extended_properties = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free); self->priv->edited = -1; diff --git a/gdata/services/contacts/gdata-contacts-query.c b/gdata/services/contacts/gdata-contacts-query.c index 3f3fab58..d0256559 100644 --- a/gdata/services/contacts/gdata-contacts-query.c +++ b/gdata/services/contacts/gdata-contacts-query.c @@ -105,7 +105,7 @@ enum { PROP_GROUP }; -G_DEFINE_TYPE (GDataContactsQuery, gdata_contacts_query, GDATA_TYPE_QUERY) +G_DEFINE_TYPE_WITH_PRIVATE (GDataContactsQuery, gdata_contacts_query, GDATA_TYPE_QUERY) static void gdata_contacts_query_class_init (GDataContactsQueryClass *klass) @@ -113,8 +113,6 @@ gdata_contacts_query_class_init (GDataContactsQueryClass *klass) GObjectClass *gobject_class = G_OBJECT_CLASS (klass); GDataQueryClass *query_class = GDATA_QUERY_CLASS (klass); - g_type_class_add_private (klass, sizeof (GDataContactsQueryPrivate)); - gobject_class->set_property = gdata_contacts_query_set_property; gobject_class->get_property = gdata_contacts_query_get_property; gobject_class->finalize = gdata_contacts_query_finalize; @@ -180,7 +178,7 @@ gdata_contacts_query_class_init (GDataContactsQueryClass *klass) static void gdata_contacts_query_init (GDataContactsQuery *self) { - self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, GDATA_TYPE_CONTACTS_QUERY, GDataContactsQueryPrivate); + self->priv = gdata_contacts_query_get_instance_private (self); /* https://developers.google.com/google-apps/contacts/v3/reference#contacts-query-parameters-reference * indicates that the Contacts service uses index pagination, but all diff --git a/gdata/services/documents/gdata-documents-document.c b/gdata/services/documents/gdata-documents-document.c index f5d94cd1..bb97edae 100644 --- a/gdata/services/documents/gdata-documents-document.c +++ b/gdata/services/documents/gdata-documents-document.c @@ -220,7 +220,7 @@ struct _GDataDocumentsDocumentPrivate { GHashTable *export_links; /* owned string → owned string */ }; -G_DEFINE_TYPE (GDataDocumentsDocument, gdata_documents_document, GDATA_TYPE_DOCUMENTS_ENTRY) +G_DEFINE_TYPE_WITH_PRIVATE (GDataDocumentsDocument, gdata_documents_document, GDATA_TYPE_DOCUMENTS_ENTRY) static void gdata_documents_document_class_init (GDataDocumentsDocumentClass *klass) @@ -229,8 +229,6 @@ gdata_documents_document_class_init (GDataDocumentsDocumentClass *klass) GDataParsableClass *parsable_class = GDATA_PARSABLE_CLASS (klass); GDataEntryClass *entry_class = GDATA_ENTRY_CLASS (klass); - g_type_class_add_private (klass, sizeof (GDataDocumentsDocumentPrivate)); - gobject_class->finalize = gdata_documents_document_finalize; parsable_class->parse_json = parse_json; parsable_class->post_parse_json = post_parse_json; @@ -240,7 +238,7 @@ gdata_documents_document_class_init (GDataDocumentsDocumentClass *klass) static void gdata_documents_document_init (GDataDocumentsDocument *self) { - self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, GDATA_TYPE_DOCUMENTS_DOCUMENT, GDataDocumentsDocumentPrivate); + self->priv = gdata_documents_document_get_instance_private (self); self->priv->export_links = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free); } diff --git a/gdata/services/documents/gdata-documents-entry.c b/gdata/services/documents/gdata-documents-entry.c index b9b1ffe2..5c225804 100644 --- a/gdata/services/documents/gdata-documents-entry.c +++ b/gdata/services/documents/gdata-documents-entry.c @@ -154,6 +154,7 @@ enum { }; G_DEFINE_ABSTRACT_TYPE_WITH_CODE (GDataDocumentsEntry, gdata_documents_entry, GDATA_TYPE_ENTRY, + G_ADD_PRIVATE (GDataDocumentsEntry) G_IMPLEMENT_INTERFACE (GDATA_TYPE_ACCESS_HANDLER, gdata_documents_entry_access_handler_init)) static void @@ -163,8 +164,6 @@ gdata_documents_entry_class_init (GDataDocumentsEntryClass *klass) GDataParsableClass *parsable_class = GDATA_PARSABLE_CLASS (klass); GDataEntryClass *entry_class = GDATA_ENTRY_CLASS (klass); - g_type_class_add_private (klass, sizeof (GDataDocumentsEntryPrivate)); - gobject_class->get_property = gdata_documents_entry_get_property; gobject_class->set_property = gdata_documents_entry_set_property; gobject_class->finalize = gdata_documents_entry_finalize; @@ -403,7 +402,7 @@ gdata_documents_entry_access_handler_init (GDataAccessHandlerIface *iface) static void gdata_documents_entry_init (GDataDocumentsEntry *self) { - self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, GDATA_TYPE_DOCUMENTS_ENTRY, GDataDocumentsEntryPrivate); + self->priv = gdata_documents_entry_get_instance_private (self); self->priv->last_viewed = -1; } diff --git a/gdata/services/documents/gdata-documents-metadata.c b/gdata/services/documents/gdata-documents-metadata.c index f587af5a..ca5c49cc 100644 --- a/gdata/services/documents/gdata-documents-metadata.c +++ b/gdata/services/documents/gdata-documents-metadata.c @@ -56,7 +56,7 @@ enum { PROP_QUOTA_USED, }; -G_DEFINE_TYPE (GDataDocumentsMetadata, gdata_documents_metadata, GDATA_TYPE_PARSABLE) +G_DEFINE_TYPE_WITH_PRIVATE (GDataDocumentsMetadata, gdata_documents_metadata, GDATA_TYPE_PARSABLE) static void gdata_documents_metadata_class_init (GDataDocumentsMetadataClass *klass) @@ -64,8 +64,6 @@ gdata_documents_metadata_class_init (GDataDocumentsMetadataClass *klass) GObjectClass *gobject_class = G_OBJECT_CLASS (klass); GDataParsableClass *parsable_class = GDATA_PARSABLE_CLASS (klass); - g_type_class_add_private (klass, sizeof (GDataDocumentsMetadataPrivate)); - gobject_class->get_property = gdata_documents_metadata_get_property; gobject_class->set_property = gdata_documents_metadata_set_property; @@ -102,7 +100,7 @@ gdata_documents_metadata_class_init (GDataDocumentsMetadataClass *klass) static void gdata_documents_metadata_init (GDataDocumentsMetadata *self) { - self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, GDATA_TYPE_DOCUMENTS_METADATA, GDataDocumentsMetadataPrivate); + self->priv = gdata_documents_metadata_get_instance_private (self); } static void diff --git a/gdata/services/documents/gdata-documents-property.c b/gdata/services/documents/gdata-documents-property.c index c1d497d5..505afd11 100644 --- a/gdata/services/documents/gdata-documents-property.c +++ b/gdata/services/documents/gdata-documents-property.c @@ -66,7 +66,8 @@ enum { }; G_DEFINE_TYPE_WITH_CODE (GDataDocumentsProperty, gdata_documents_property, GDATA_TYPE_PARSABLE, - G_IMPLEMENT_INTERFACE (GDATA_TYPE_COMPARABLE, gdata_documents_property_comparable_init)) + G_ADD_PRIVATE (GDataDocumentsProperty) + G_IMPLEMENT_INTERFACE (GDATA_TYPE_COMPARABLE, gdata_documents_property_comparable_init)) static void gdata_documents_property_class_init (GDataDocumentsPropertyClass *klass) @@ -74,8 +75,6 @@ gdata_documents_property_class_init (GDataDocumentsPropertyClass *klass) GObjectClass *gobject_class = G_OBJECT_CLASS (klass); GDataParsableClass *parsable_class = GDATA_PARSABLE_CLASS (klass); - g_type_class_add_private (klass, sizeof (GDataDocumentsPropertyPrivate)); - gobject_class->set_property = gdata_documents_property_set_property; gobject_class->get_property = gdata_documents_property_get_property; gobject_class->finalize = gdata_documents_property_finalize; @@ -234,7 +233,7 @@ gdata_documents_property_comparable_init (GDataComparableIface *iface) static void gdata_documents_property_init (GDataDocumentsProperty *self) { - self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, GDATA_TYPE_DOCUMENTS_PROPERTY, GDataDocumentsPropertyPrivate); + self->priv = gdata_documents_property_get_instance_private (self); /* Google Drive sets the default value of a Property Resource to be an empty string (""), * and visibility is %GDATA_DOCUMENTS_PROPERTY_VISIBILITY_PRIVATE by default */ diff --git a/gdata/services/documents/gdata-documents-query.c b/gdata/services/documents/gdata-documents-query.c index 0a5a8d4b..e589b524 100644 --- a/gdata/services/documents/gdata-documents-query.c +++ b/gdata/services/documents/gdata-documents-query.c @@ -120,7 +120,7 @@ enum { PROP_TITLE }; -G_DEFINE_TYPE (GDataDocumentsQuery, gdata_documents_query, GDATA_TYPE_QUERY) +G_DEFINE_TYPE_WITH_PRIVATE (GDataDocumentsQuery, gdata_documents_query, GDATA_TYPE_QUERY) static void gdata_documents_query_class_init (GDataDocumentsQueryClass *klass) @@ -128,8 +128,6 @@ gdata_documents_query_class_init (GDataDocumentsQueryClass *klass) GObjectClass *gobject_class = G_OBJECT_CLASS (klass); GDataQueryClass *query_class = GDATA_QUERY_CLASS (klass); - g_type_class_add_private (klass, sizeof (GDataDocumentsQueryPrivate)); - gobject_class->get_property = gdata_documents_query_get_property; gobject_class->set_property = gdata_documents_query_set_property; gobject_class->dispose = gdata_documents_query_dispose; @@ -207,7 +205,7 @@ gdata_documents_query_class_init (GDataDocumentsQueryClass *klass) static void gdata_documents_query_init (GDataDocumentsQuery *self) { - self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, GDATA_TYPE_DOCUMENTS_QUERY, GDataDocumentsQueryPrivate); + self->priv = gdata_documents_query_get_instance_private (self); /* https://developers.google.com/drive/v3/reference/files/list#q */ _gdata_query_set_pagination_type (GDATA_QUERY (self), diff --git a/gdata/services/documents/gdata-documents-upload-query.c b/gdata/services/documents/gdata-documents-upload-query.c index 383db176..e88bf8cb 100644 --- a/gdata/services/documents/gdata-documents-upload-query.c +++ b/gdata/services/documents/gdata-documents-upload-query.c @@ -157,15 +157,13 @@ enum { PROP_CONVERT, }; -G_DEFINE_TYPE (GDataDocumentsUploadQuery, gdata_documents_upload_query, G_TYPE_OBJECT) +G_DEFINE_TYPE_WITH_PRIVATE (GDataDocumentsUploadQuery, gdata_documents_upload_query, G_TYPE_OBJECT) static void gdata_documents_upload_query_class_init (GDataDocumentsUploadQueryClass *klass) { GObjectClass *gobject_class = G_OBJECT_CLASS (klass); - g_type_class_add_private (klass, sizeof (GDataDocumentsUploadQueryPrivate)); - gobject_class->get_property = gdata_documents_upload_query_get_property; gobject_class->set_property = gdata_documents_upload_query_set_property; gobject_class->dispose = gdata_documents_upload_query_dispose; @@ -209,7 +207,7 @@ gdata_documents_upload_query_class_init (GDataDocumentsUploadQueryClass *klass) static void gdata_documents_upload_query_init (GDataDocumentsUploadQuery *self) { - self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, GDATA_TYPE_DOCUMENTS_UPLOAD_QUERY, GDataDocumentsUploadQueryPrivate); + self->priv = gdata_documents_upload_query_get_instance_private (self); self->priv->convert = TRUE; } diff --git a/gdata/services/freebase/gdata-freebase-query.c b/gdata/services/freebase/gdata-freebase-query.c index 8ec8314f..78d5e196 100644 --- a/gdata/services/freebase/gdata-freebase-query.c +++ b/gdata/services/freebase/gdata-freebase-query.c @@ -62,7 +62,7 @@ enum { PROP_VARIANT = 1, }; -G_DEFINE_TYPE (GDataFreebaseQuery, gdata_freebase_query, GDATA_TYPE_QUERY) +G_DEFINE_TYPE_WITH_PRIVATE (GDataFreebaseQuery, gdata_freebase_query, GDATA_TYPE_QUERY) static void gdata_freebase_query_class_init (GDataFreebaseQueryClass *klass) @@ -70,8 +70,6 @@ gdata_freebase_query_class_init (GDataFreebaseQueryClass *klass) GObjectClass *gobject_class = G_OBJECT_CLASS (klass); GDataQueryClass *query_class = GDATA_QUERY_CLASS (klass); - g_type_class_add_private (klass, sizeof (GDataFreebaseQueryPrivate)); - gobject_class->finalize = gdata_freebase_query_finalize; gobject_class->set_property = gdata_freebase_query_set_property; gobject_class->get_property = gdata_freebase_query_get_property; @@ -99,7 +97,7 @@ gdata_freebase_query_class_init (GDataFreebaseQueryClass *klass) static void gdata_freebase_query_init (GDataFreebaseQuery *self) { - self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, GDATA_TYPE_FREEBASE_QUERY, GDataFreebaseQueryPrivate); + self->priv = gdata_freebase_query_get_instance_private (self); /* https://developers.google.com/freebase/v1/search#cursor */ _gdata_query_set_pagination_type (GDATA_QUERY (self), diff --git a/gdata/services/freebase/gdata-freebase-result.c b/gdata/services/freebase/gdata-freebase-result.c index 56c90223..41cf5064 100644 --- a/gdata/services/freebase/gdata-freebase-result.c +++ b/gdata/services/freebase/gdata-freebase-result.c @@ -59,7 +59,7 @@ static gboolean parse_json (GDataParsable *parsable, JsonReader *reader, gpointe static const gchar *get_content_type (void); static gchar *get_entry_uri (const gchar *id); -G_DEFINE_TYPE (GDataFreebaseResult, gdata_freebase_result, GDATA_TYPE_ENTRY) +G_DEFINE_TYPE_WITH_PRIVATE (GDataFreebaseResult, gdata_freebase_result, GDATA_TYPE_ENTRY) static void gdata_freebase_result_class_init (GDataFreebaseResultClass *klass) @@ -68,8 +68,6 @@ gdata_freebase_result_class_init (GDataFreebaseResultClass *klass) GDataEntryClass *entry_class = GDATA_ENTRY_CLASS (klass); GObjectClass *gobject_class = G_OBJECT_CLASS (klass); - g_type_class_add_private (klass, sizeof (GDataFreebaseResultPrivate)); - gobject_class->finalize = gdata_freebase_result_finalize; gobject_class->get_property = gdata_freebase_result_get_property; @@ -97,7 +95,7 @@ gdata_freebase_result_class_init (GDataFreebaseResultClass *klass) static void gdata_freebase_result_init (GDataFreebaseResult *self) { - self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, GDATA_TYPE_FREEBASE_RESULT, GDataFreebaseResultPrivate); + self->priv = gdata_freebase_result_get_instance_private (self); } static void diff --git a/gdata/services/freebase/gdata-freebase-search-query.c b/gdata/services/freebase/gdata-freebase-search-query.c index fc09a2dd..3b680e07 100644 --- a/gdata/services/freebase/gdata-freebase-search-query.c +++ b/gdata/services/freebase/gdata-freebase-search-query.c @@ -95,7 +95,7 @@ enum { PROP_STEMMED }; -G_DEFINE_TYPE (GDataFreebaseSearchQuery, gdata_freebase_search_query, GDATA_TYPE_QUERY) +G_DEFINE_TYPE_WITH_PRIVATE (GDataFreebaseSearchQuery, gdata_freebase_search_query, GDATA_TYPE_QUERY) static void gdata_freebase_search_query_class_init (GDataFreebaseSearchQueryClass *klass) @@ -103,8 +103,6 @@ gdata_freebase_search_query_class_init (GDataFreebaseSearchQueryClass *klass) GObjectClass *gobject_class = G_OBJECT_CLASS (klass); GDataQueryClass *query_class = GDATA_QUERY_CLASS (klass); - g_type_class_add_private (klass, sizeof (GDataFreebaseSearchQueryPrivate)); - gobject_class->finalize = gdata_freebase_search_query_finalize; gobject_class->set_property = gdata_freebase_search_query_set_property; gobject_class->get_property = gdata_freebase_search_query_get_property; @@ -148,7 +146,7 @@ gdata_freebase_search_query_class_init (GDataFreebaseSearchQueryClass *klass) static void gdata_freebase_search_query_init (GDataFreebaseSearchQuery *self) { - self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, GDATA_TYPE_FREEBASE_SEARCH_QUERY, GDataFreebaseSearchQueryPrivate); + self->priv = gdata_freebase_search_query_get_instance_private (self); } static void diff --git a/gdata/services/freebase/gdata-freebase-search-result.c b/gdata/services/freebase/gdata-freebase-search-result.c index c36ad1cb..0824c1e1 100644 --- a/gdata/services/freebase/gdata-freebase-search-result.c +++ b/gdata/services/freebase/gdata-freebase-search-result.c @@ -67,7 +67,7 @@ static void item_free (GDataFreebaseSearchResultItem *item); G_DEFINE_BOXED_TYPE (GDataFreebaseSearchResultItem, gdata_freebase_search_result_item, item_copy, item_free) -G_DEFINE_TYPE (GDataFreebaseSearchResult, gdata_freebase_search_result, GDATA_TYPE_FREEBASE_RESULT) +G_DEFINE_TYPE_WITH_PRIVATE (GDataFreebaseSearchResult, gdata_freebase_search_result, GDATA_TYPE_FREEBASE_RESULT) static void gdata_freebase_search_result_class_init (GDataFreebaseSearchResultClass *klass) @@ -75,8 +75,6 @@ gdata_freebase_search_result_class_init (GDataFreebaseSearchResultClass *klass) GDataParsableClass *parsable_class = GDATA_PARSABLE_CLASS (klass); GObjectClass *gobject_class = G_OBJECT_CLASS (klass); - g_type_class_add_private (klass, sizeof (GDataFreebaseSearchResultPrivate)); - gobject_class->finalize = gdata_freebase_search_result_finalize; parsable_class->parse_json = parse_json; } @@ -119,7 +117,7 @@ item_copy (const GDataFreebaseSearchResultItem *item) static void gdata_freebase_search_result_init (GDataFreebaseSearchResult *self) { - self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, GDATA_TYPE_FREEBASE_SEARCH_RESULT, GDataFreebaseSearchResultPrivate); + self->priv = gdata_freebase_search_result_get_instance_private (self); self->priv->items = g_ptr_array_new_with_free_func ((GDestroyNotify) item_free); } diff --git a/gdata/services/freebase/gdata-freebase-service.c b/gdata/services/freebase/gdata-freebase-service.c index df1b9251..41ce5c22 100644 --- a/gdata/services/freebase/gdata-freebase-service.c +++ b/gdata/services/freebase/gdata-freebase-service.c @@ -76,7 +76,7 @@ static GList *get_authorization_domains (void); _GDATA_DEFINE_AUTHORIZATION_DOMAIN (freebase, "freebase", "https://www.googleapis.com/auth/freebase.readonly") -G_DEFINE_TYPE (GDataFreebaseService, gdata_freebase_service, GDATA_TYPE_SERVICE) +G_DEFINE_TYPE_WITH_PRIVATE (GDataFreebaseService, gdata_freebase_service, GDATA_TYPE_SERVICE) static void gdata_freebase_service_class_init (GDataFreebaseServiceClass *klass) @@ -84,8 +84,6 @@ gdata_freebase_service_class_init (GDataFreebaseServiceClass *klass) GObjectClass *gobject_class = G_OBJECT_CLASS (klass); GDataServiceClass *service_class = GDATA_SERVICE_CLASS (klass); - g_type_class_add_private (klass, sizeof (GDataFreebaseServicePrivate)); - gobject_class->set_property = gdata_freebase_service_set_property; gobject_class->get_property = gdata_freebase_service_get_property; gobject_class->finalize = gdata_freebase_service_finalize; @@ -113,7 +111,7 @@ gdata_freebase_service_class_init (GDataFreebaseServiceClass *klass) static void gdata_freebase_service_init (GDataFreebaseService *self) { - self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, GDATA_TYPE_FREEBASE_SERVICE, GDataFreebaseServicePrivate); + self->priv = gdata_freebase_service_get_instance_private (self); } static void diff --git a/gdata/services/freebase/gdata-freebase-topic-query.c b/gdata/services/freebase/gdata-freebase-topic-query.c index 05740bae..97ab36db 100644 --- a/gdata/services/freebase/gdata-freebase-topic-query.c +++ b/gdata/services/freebase/gdata-freebase-topic-query.c @@ -64,7 +64,7 @@ enum { PROP_FILTER }; -G_DEFINE_TYPE (GDataFreebaseTopicQuery, gdata_freebase_topic_query, GDATA_TYPE_QUERY) +G_DEFINE_TYPE_WITH_PRIVATE (GDataFreebaseTopicQuery, gdata_freebase_topic_query, GDATA_TYPE_QUERY) static void gdata_freebase_topic_query_class_init (GDataFreebaseTopicQueryClass *klass) @@ -72,8 +72,6 @@ gdata_freebase_topic_query_class_init (GDataFreebaseTopicQueryClass *klass) GObjectClass *gobject_class = G_OBJECT_CLASS (klass); GDataQueryClass *query_class = GDATA_QUERY_CLASS (klass); - g_type_class_add_private (klass, sizeof (GDataFreebaseTopicQueryPrivate)); - gobject_class->finalize = gdata_freebase_topic_query_finalize; gobject_class->set_property = gdata_freebase_topic_query_set_property; gobject_class->get_property = gdata_freebase_topic_query_get_property; @@ -116,7 +114,7 @@ gdata_freebase_topic_query_class_init (GDataFreebaseTopicQueryClass *klass) static void gdata_freebase_topic_query_init (GDataFreebaseTopicQuery *self) { - self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, GDATA_TYPE_FREEBASE_TOPIC_QUERY, GDataFreebaseTopicQueryPrivate); + self->priv = gdata_freebase_topic_query_get_instance_private (self); } static void diff --git a/gdata/services/freebase/gdata-freebase-topic-result.c b/gdata/services/freebase/gdata-freebase-topic-result.c index 1796efcf..ac67e55d 100644 --- a/gdata/services/freebase/gdata-freebase-topic-result.c +++ b/gdata/services/freebase/gdata-freebase-topic-result.c @@ -103,7 +103,7 @@ static gboolean reader_get_properties (JsonReader *reader, GDataFreebaseTopicObj G_DEFINE_BOXED_TYPE (GDataFreebaseTopicObject, gdata_freebase_topic_object, gdata_freebase_topic_object_ref, gdata_freebase_topic_object_unref) G_DEFINE_BOXED_TYPE (GDataFreebaseTopicValue, gdata_freebase_topic_value, gdata_freebase_topic_value_ref, gdata_freebase_topic_value_unref) -G_DEFINE_TYPE (GDataFreebaseTopicResult, gdata_freebase_topic_result, GDATA_TYPE_FREEBASE_RESULT) +G_DEFINE_TYPE_WITH_PRIVATE (GDataFreebaseTopicResult, gdata_freebase_topic_result, GDATA_TYPE_FREEBASE_RESULT) static void gdata_freebase_topic_result_class_init (GDataFreebaseTopicResultClass *klass) @@ -111,8 +111,6 @@ gdata_freebase_topic_result_class_init (GDataFreebaseTopicResultClass *klass) GDataParsableClass *parsable_class = GDATA_PARSABLE_CLASS (klass); GObjectClass *gobject_class = G_OBJECT_CLASS (klass); - g_type_class_add_private (klass, sizeof (GDataFreebaseTopicResultPrivate)); - gobject_class->finalize = gdata_freebase_topic_result_finalize; parsable_class->parse_json = parse_json; } @@ -120,7 +118,7 @@ gdata_freebase_topic_result_class_init (GDataFreebaseTopicResultClass *klass) static void gdata_freebase_topic_result_init (GDataFreebaseTopicResult *self) { - self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, GDATA_TYPE_FREEBASE_TOPIC_RESULT, GDataFreebaseTopicResultPrivate); + self->priv = gdata_freebase_topic_result_get_instance_private (self); } static void diff --git a/gdata/services/picasaweb/gdata-picasaweb-album.c b/gdata/services/picasaweb/gdata-picasaweb-album.c index cb55c04e..40fd8cfb 100644 --- a/gdata/services/picasaweb/gdata-picasaweb-album.c +++ b/gdata/services/picasaweb/gdata-picasaweb-album.c @@ -147,7 +147,7 @@ enum { PROP_ALBUM_ID }; -G_DEFINE_TYPE (GDataPicasaWebAlbum, gdata_picasaweb_album, GDATA_TYPE_ENTRY) +G_DEFINE_TYPE_WITH_PRIVATE (GDataPicasaWebAlbum, gdata_picasaweb_album, GDATA_TYPE_ENTRY) static void gdata_picasaweb_album_class_init (GDataPicasaWebAlbumClass *klass) @@ -156,8 +156,6 @@ gdata_picasaweb_album_class_init (GDataPicasaWebAlbumClass *klass) GDataParsableClass *parsable_class = GDATA_PARSABLE_CLASS (klass); GDataEntryClass *entry_class = GDATA_ENTRY_CLASS (klass); - g_type_class_add_private (klass, sizeof (GDataPicasaWebAlbumPrivate)); - gobject_class->constructor = gdata_picasaweb_album_constructor; gobject_class->get_property = gdata_picasaweb_album_get_property; gobject_class->set_property = gdata_picasaweb_album_set_property; @@ -477,7 +475,7 @@ notify_visibility_cb (GDataPicasaWebAlbum *self, GParamSpec *pspec, gpointer use static void gdata_picasaweb_album_init (GDataPicasaWebAlbum *self) { - self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, GDATA_TYPE_PICASAWEB_ALBUM, GDataPicasaWebAlbumPrivate); + self->priv = gdata_picasaweb_album_get_instance_private (self); self->priv->media_group = g_object_new (GDATA_TYPE_MEDIA_GROUP, NULL); self->priv->georss_where = g_object_new (GDATA_TYPE_GEORSS_WHERE, NULL); self->priv->edited = -1; diff --git a/gdata/services/picasaweb/gdata-picasaweb-file.c b/gdata/services/picasaweb/gdata-picasaweb-file.c index d669d084..53aab33b 100644 --- a/gdata/services/picasaweb/gdata-picasaweb-file.c +++ b/gdata/services/picasaweb/gdata-picasaweb-file.c @@ -180,6 +180,7 @@ enum { }; G_DEFINE_TYPE_WITH_CODE (GDataPicasaWebFile, gdata_picasaweb_file, GDATA_TYPE_ENTRY, + G_ADD_PRIVATE (GDataPicasaWebFile) G_IMPLEMENT_INTERFACE (GDATA_TYPE_COMMENTABLE, gdata_picasaweb_file_commentable_init)) static void @@ -189,8 +190,6 @@ gdata_picasaweb_file_class_init (GDataPicasaWebFileClass *klass) GDataParsableClass *parsable_class = GDATA_PARSABLE_CLASS (klass); GDataEntryClass *entry_class = GDATA_ENTRY_CLASS (klass); - g_type_class_add_private (klass, sizeof (GDataPicasaWebFilePrivate)); - gobject_class->constructor = gdata_picasaweb_file_constructor; gobject_class->get_property = gdata_picasaweb_file_get_property; gobject_class->set_property = gdata_picasaweb_file_set_property; @@ -667,7 +666,7 @@ notify_summary_cb (GDataPicasaWebFile *self, GParamSpec *pspec, gpointer user_da static void gdata_picasaweb_file_init (GDataPicasaWebFile *self) { - self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, GDATA_TYPE_PICASAWEB_FILE, GDataPicasaWebFilePrivate); + self->priv = gdata_picasaweb_file_get_instance_private (self); self->priv->media_group = g_object_new (GDATA_TYPE_MEDIA_GROUP, NULL); self->priv->exif_tags = g_object_new (GDATA_TYPE_EXIF_TAGS, NULL); self->priv->georss_where = g_object_new (GDATA_TYPE_GEORSS_WHERE, NULL); diff --git a/gdata/services/picasaweb/gdata-picasaweb-query.c b/gdata/services/picasaweb/gdata-picasaweb-query.c index 57851575..2b3f7576 100644 --- a/gdata/services/picasaweb/gdata-picasaweb-query.c +++ b/gdata/services/picasaweb/gdata-picasaweb-query.c @@ -71,7 +71,7 @@ enum { PROP_LOCATION }; -G_DEFINE_TYPE (GDataPicasaWebQuery, gdata_picasaweb_query, GDATA_TYPE_QUERY) +G_DEFINE_TYPE_WITH_PRIVATE (GDataPicasaWebQuery, gdata_picasaweb_query, GDATA_TYPE_QUERY) static void gdata_picasaweb_query_class_init (GDataPicasaWebQueryClass *klass) @@ -79,8 +79,6 @@ gdata_picasaweb_query_class_init (GDataPicasaWebQueryClass *klass) GObjectClass *gobject_class = G_OBJECT_CLASS (klass); GDataQueryClass *query_class = GDATA_QUERY_CLASS (klass); - g_type_class_add_private (klass, sizeof (GDataPicasaWebQueryPrivate)); - gobject_class->get_property = gdata_picasaweb_query_get_property; gobject_class->set_property = gdata_picasaweb_query_set_property; gobject_class->finalize = gdata_picasaweb_query_finalize; @@ -166,7 +164,7 @@ gdata_picasaweb_query_class_init (GDataPicasaWebQueryClass *klass) static void gdata_picasaweb_query_init (GDataPicasaWebQuery *self) { - self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, GDATA_TYPE_PICASAWEB_QUERY, GDataPicasaWebQueryPrivate); + self->priv = gdata_picasaweb_query_get_instance_private (self); /* https://developers.google.com/picasa-web/docs/3.0/reference#Parameters */ _gdata_query_set_pagination_type (GDATA_QUERY (self), diff --git a/gdata/services/picasaweb/gdata-picasaweb-user.c b/gdata/services/picasaweb/gdata-picasaweb-user.c index 38db73f6..c2798b74 100644 --- a/gdata/services/picasaweb/gdata-picasaweb-user.c +++ b/gdata/services/picasaweb/gdata-picasaweb-user.c @@ -60,7 +60,7 @@ enum { PROP_THUMBNAIL_URI }; -G_DEFINE_TYPE (GDataPicasaWebUser, gdata_picasaweb_user, GDATA_TYPE_ENTRY) +G_DEFINE_TYPE_WITH_PRIVATE (GDataPicasaWebUser, gdata_picasaweb_user, GDATA_TYPE_ENTRY) static void gdata_picasaweb_user_class_init (GDataPicasaWebUserClass *klass) @@ -69,8 +69,6 @@ gdata_picasaweb_user_class_init (GDataPicasaWebUserClass *klass) GDataParsableClass *parsable_class = GDATA_PARSABLE_CLASS (klass); GDataEntryClass *entry_class = GDATA_ENTRY_CLASS (klass); - g_type_class_add_private (klass, sizeof (GDataPicasaWebUserPrivate)); - gobject_class->get_property = gdata_picasaweb_user_get_property; gobject_class->finalize = gdata_picasaweb_user_finalize; @@ -173,7 +171,7 @@ gdata_picasaweb_user_class_init (GDataPicasaWebUserClass *klass) static void gdata_picasaweb_user_init (GDataPicasaWebUser *self) { - self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, GDATA_TYPE_PICASAWEB_USER, GDataPicasaWebUserPrivate); + self->priv = gdata_picasaweb_user_get_instance_private (self); /* Initialise the properties whose values we can theoretically not know */ self->priv->quota_limit = self->priv->quota_current = self->priv->max_photos_per_album = -1; diff --git a/gdata/services/tasks/gdata-tasks-query.c b/gdata/services/tasks/gdata-tasks-query.c index 627dc862..74a8855c 100644 --- a/gdata/services/tasks/gdata-tasks-query.c +++ b/gdata/services/tasks/gdata-tasks-query.c @@ -67,7 +67,7 @@ enum { PROP_SHOW_HIDDEN, }; -G_DEFINE_TYPE (GDataTasksQuery, gdata_tasks_query, GDATA_TYPE_QUERY) +G_DEFINE_TYPE_WITH_PRIVATE (GDataTasksQuery, gdata_tasks_query, GDATA_TYPE_QUERY) static void gdata_tasks_query_class_init (GDataTasksQueryClass *klass) @@ -75,8 +75,6 @@ gdata_tasks_query_class_init (GDataTasksQueryClass *klass) GObjectClass *gobject_class = G_OBJECT_CLASS (klass); GDataQueryClass *query_class = GDATA_QUERY_CLASS (klass); - g_type_class_add_private (klass, sizeof (GDataTasksQueryPrivate)); - gobject_class->set_property = gdata_tasks_query_set_property; gobject_class->get_property = gdata_tasks_query_get_property; gobject_class->finalize = gdata_tasks_query_finalize; @@ -181,7 +179,7 @@ gdata_tasks_query_class_init (GDataTasksQueryClass *klass) static void gdata_tasks_query_init (GDataTasksQuery *self) { - self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, GDATA_TYPE_TASKS_QUERY, GDataTasksQueryPrivate); + self->priv = gdata_tasks_query_get_instance_private (self); self->priv->completed_min = -1; self->priv->completed_max = -1; self->priv->due_min = -1; diff --git a/gdata/services/tasks/gdata-tasks-task.c b/gdata/services/tasks/gdata-tasks-task.c index 265dd137..e217555b 100644 --- a/gdata/services/tasks/gdata-tasks-task.c +++ b/gdata/services/tasks/gdata-tasks-task.c @@ -75,7 +75,7 @@ enum { PROP_HIDDEN, }; -G_DEFINE_TYPE (GDataTasksTask, gdata_tasks_task, GDATA_TYPE_ENTRY) +G_DEFINE_TYPE_WITH_PRIVATE (GDataTasksTask, gdata_tasks_task, GDATA_TYPE_ENTRY) static void gdata_tasks_task_class_init (GDataTasksTaskClass *klass) @@ -84,8 +84,6 @@ gdata_tasks_task_class_init (GDataTasksTaskClass *klass) GDataParsableClass *parsable_class = GDATA_PARSABLE_CLASS (klass); GDataEntryClass *entry_class = GDATA_ENTRY_CLASS (klass); - g_type_class_add_private (klass, sizeof (GDataTasksTaskPrivate)); - gobject_class->get_property = gdata_tasks_task_get_property; gobject_class->set_property = gdata_tasks_task_set_property; gobject_class->finalize = gdata_tasks_task_finalize; @@ -222,7 +220,7 @@ gdata_tasks_task_class_init (GDataTasksTaskClass *klass) static void gdata_tasks_task_init (GDataTasksTask *self) { - self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, GDATA_TYPE_TASKS_TASK, GDataTasksTaskPrivate); + self->priv = gdata_tasks_task_get_instance_private (self); self->priv->due = -1; self->priv->completed = -1; } diff --git a/gdata/services/youtube/gdata-youtube-category.c b/gdata/services/youtube/gdata-youtube-category.c index 20af9102..7eba4735 100644 --- a/gdata/services/youtube/gdata-youtube-category.c +++ b/gdata/services/youtube/gdata-youtube-category.c @@ -55,7 +55,7 @@ enum { PROP_IS_DEPRECATED }; -G_DEFINE_TYPE (GDataYouTubeCategory, gdata_youtube_category, GDATA_TYPE_CATEGORY) +G_DEFINE_TYPE_WITH_PRIVATE (GDataYouTubeCategory, gdata_youtube_category, GDATA_TYPE_CATEGORY) static void gdata_youtube_category_class_init (GDataYouTubeCategoryClass *klass) @@ -63,8 +63,6 @@ gdata_youtube_category_class_init (GDataYouTubeCategoryClass *klass) GObjectClass *gobject_class = G_OBJECT_CLASS (klass); GDataParsableClass *parsable_class = GDATA_PARSABLE_CLASS (klass); - g_type_class_add_private (klass, sizeof (GDataYouTubeCategoryPrivate)); - gobject_class->get_property = gdata_youtube_category_get_property; gobject_class->finalize = gdata_youtube_category_finalize; @@ -101,7 +99,7 @@ gdata_youtube_category_class_init (GDataYouTubeCategoryClass *klass) static void gdata_youtube_category_init (GDataYouTubeCategory *self) { - self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, GDATA_TYPE_YOUTUBE_CATEGORY, GDataYouTubeCategoryPrivate); + self->priv = gdata_youtube_category_get_instance_private (self); } static void diff --git a/gdata/services/youtube/gdata-youtube-comment.c b/gdata/services/youtube/gdata-youtube-comment.c index 1a19847b..c285fcf2 100644 --- a/gdata/services/youtube/gdata-youtube-comment.c +++ b/gdata/services/youtube/gdata-youtube-comment.c @@ -63,7 +63,7 @@ enum { PROP_PARENT_COMMENT_URI = 1, }; -G_DEFINE_TYPE (GDataYouTubeComment, gdata_youtube_comment, GDATA_TYPE_COMMENT) +G_DEFINE_TYPE_WITH_PRIVATE (GDataYouTubeComment, gdata_youtube_comment, GDATA_TYPE_COMMENT) static void gdata_youtube_comment_class_init (GDataYouTubeCommentClass *klass) @@ -72,8 +72,6 @@ gdata_youtube_comment_class_init (GDataYouTubeCommentClass *klass) GDataParsableClass *parsable_class = GDATA_PARSABLE_CLASS (klass); GDataEntryClass *entry_class = GDATA_ENTRY_CLASS (klass); - g_type_class_add_private (klass, sizeof (GDataYouTubeCommentPrivate)); - gobject_class->get_property = gdata_youtube_comment_get_property; gobject_class->set_property = gdata_youtube_comment_set_property; gobject_class->finalize = gdata_youtube_comment_finalize; @@ -103,7 +101,7 @@ gdata_youtube_comment_class_init (GDataYouTubeCommentClass *klass) static void gdata_youtube_comment_init (GDataYouTubeComment *self) { - self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, GDATA_TYPE_YOUTUBE_COMMENT, GDataYouTubeCommentPrivate); + self->priv = gdata_youtube_comment_get_instance_private (self); } static void diff --git a/gdata/services/youtube/gdata-youtube-content.c b/gdata/services/youtube/gdata-youtube-content.c index 3b9126e7..9face379 100644 --- a/gdata/services/youtube/gdata-youtube-content.c +++ b/gdata/services/youtube/gdata-youtube-content.c @@ -54,7 +54,7 @@ enum { PROP_FORMAT = 1 }; -G_DEFINE_TYPE (GDataYouTubeContent, gdata_youtube_content, GDATA_TYPE_MEDIA_CONTENT) +G_DEFINE_TYPE_WITH_PRIVATE (GDataYouTubeContent, gdata_youtube_content, GDATA_TYPE_MEDIA_CONTENT) static void gdata_youtube_content_class_init (GDataYouTubeContentClass *klass) @@ -62,8 +62,6 @@ gdata_youtube_content_class_init (GDataYouTubeContentClass *klass) GObjectClass *gobject_class = G_OBJECT_CLASS (klass); GDataParsableClass *parsable_class = GDATA_PARSABLE_CLASS (klass); - g_type_class_add_private (klass, sizeof (GDataYouTubeContentPrivate)); - gobject_class->get_property = gdata_youtube_content_get_property; parsable_class->pre_parse_xml = pre_parse_xml; @@ -93,7 +91,7 @@ gdata_youtube_content_class_init (GDataYouTubeContentClass *klass) static void gdata_youtube_content_init (GDataYouTubeContent *self) { - self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, GDATA_TYPE_YOUTUBE_CONTENT, GDataYouTubeContentPrivate); + self->priv = gdata_youtube_content_get_instance_private (self); } static void diff --git a/gdata/services/youtube/gdata-youtube-credit.c b/gdata/services/youtube/gdata-youtube-credit.c index b1b7f603..c219e6ed 100644 --- a/gdata/services/youtube/gdata-youtube-credit.c +++ b/gdata/services/youtube/gdata-youtube-credit.c @@ -55,7 +55,7 @@ enum { PROP_ENTITY_TYPE = 1 }; -G_DEFINE_TYPE (GDataYouTubeCredit, gdata_youtube_credit, GDATA_TYPE_MEDIA_CREDIT) +G_DEFINE_TYPE_WITH_PRIVATE (GDataYouTubeCredit, gdata_youtube_credit, GDATA_TYPE_MEDIA_CREDIT) static void gdata_youtube_credit_class_init (GDataYouTubeCreditClass *klass) @@ -63,8 +63,6 @@ gdata_youtube_credit_class_init (GDataYouTubeCreditClass *klass) GObjectClass *gobject_class = G_OBJECT_CLASS (klass); GDataParsableClass *parsable_class = GDATA_PARSABLE_CLASS (klass); - g_type_class_add_private (klass, sizeof (GDataYouTubeCreditPrivate)); - gobject_class->get_property = gdata_youtube_credit_get_property; gobject_class->finalize = gdata_youtube_credit_finalize; @@ -95,7 +93,7 @@ gdata_youtube_credit_class_init (GDataYouTubeCreditClass *klass) static void gdata_youtube_credit_init (GDataYouTubeCredit *self) { - self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, GDATA_TYPE_YOUTUBE_CREDIT, GDataYouTubeCreditPrivate); + self->priv = gdata_youtube_credit_get_instance_private (self); } static void diff --git a/gdata/services/youtube/gdata-youtube-query.c b/gdata/services/youtube/gdata-youtube-query.c index 99ae9961..212a0d10 100644 --- a/gdata/services/youtube/gdata-youtube-query.c +++ b/gdata/services/youtube/gdata-youtube-query.c @@ -87,7 +87,7 @@ enum { PROP_LICENSE, }; -G_DEFINE_TYPE (GDataYouTubeQuery, gdata_youtube_query, GDATA_TYPE_QUERY) +G_DEFINE_TYPE_WITH_PRIVATE (GDataYouTubeQuery, gdata_youtube_query, GDATA_TYPE_QUERY) static void gdata_youtube_query_class_init (GDataYouTubeQueryClass *klass) @@ -95,8 +95,6 @@ gdata_youtube_query_class_init (GDataYouTubeQueryClass *klass) GObjectClass *gobject_class = G_OBJECT_CLASS (klass); GDataQueryClass *query_class = GDATA_QUERY_CLASS (klass); - g_type_class_add_private (klass, sizeof (GDataYouTubeQueryPrivate)); - gobject_class->set_property = gdata_youtube_query_set_property; gobject_class->get_property = gdata_youtube_query_get_property; gobject_class->finalize = gdata_youtube_query_finalize; @@ -351,7 +349,7 @@ gdata_youtube_query_class_init (GDataYouTubeQueryClass *klass) static void gdata_youtube_query_init (GDataYouTubeQuery *self) { - self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, GDATA_TYPE_YOUTUBE_QUERY, GDataYouTubeQueryPrivate); + self->priv = gdata_youtube_query_get_instance_private (self); self->priv->latitude = G_MAXDOUBLE; self->priv->longitude = G_MAXDOUBLE; diff --git a/gdata/services/youtube/gdata-youtube-service.c b/gdata/services/youtube/gdata-youtube-service.c index 89d44bb5..75134e57 100644 --- a/gdata/services/youtube/gdata-youtube-service.c +++ b/gdata/services/youtube/gdata-youtube-service.c @@ -292,6 +292,7 @@ _GDATA_DEFINE_AUTHORIZATION_DOMAIN (youtube, "youtube", _GDATA_DEFINE_AUTHORIZATION_DOMAIN (youtube_force_ssl, "youtube-force-ssl", "https://www.googleapis.com/auth/youtube.force-ssl") G_DEFINE_TYPE_WITH_CODE (GDataYouTubeService, gdata_youtube_service, GDATA_TYPE_SERVICE, + G_ADD_PRIVATE (GDataYouTubeService) G_IMPLEMENT_INTERFACE (GDATA_TYPE_BATCHABLE, gdata_youtube_service_batchable_init)) @@ -301,8 +302,6 @@ gdata_youtube_service_class_init (GDataYouTubeServiceClass *klass) GObjectClass *gobject_class = G_OBJECT_CLASS (klass); GDataServiceClass *service_class = GDATA_SERVICE_CLASS (klass); - g_type_class_add_private (klass, sizeof (GDataYouTubeServicePrivate)); - gobject_class->set_property = gdata_youtube_service_set_property; gobject_class->get_property = gdata_youtube_service_get_property; gobject_class->finalize = gdata_youtube_service_finalize; @@ -346,7 +345,7 @@ gdata_youtube_service_batchable_init (GDataBatchableIface *iface) static void gdata_youtube_service_init (GDataYouTubeService *self) { - self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, GDATA_TYPE_YOUTUBE_SERVICE, GDataYouTubeServicePrivate); + self->priv = gdata_youtube_service_get_instance_private (self); } static void diff --git a/gdata/services/youtube/gdata-youtube-state.c b/gdata/services/youtube/gdata-youtube-state.c index be1fa0f5..5887e04b 100644 --- a/gdata/services/youtube/gdata-youtube-state.c +++ b/gdata/services/youtube/gdata-youtube-state.c @@ -56,15 +56,13 @@ enum { PROP_MESSAGE }; -G_DEFINE_TYPE (GDataYouTubeState, gdata_youtube_state, GDATA_TYPE_PARSABLE) +G_DEFINE_TYPE_WITH_PRIVATE (GDataYouTubeState, gdata_youtube_state, GDATA_TYPE_PARSABLE) static void gdata_youtube_state_class_init (GDataYouTubeStateClass *klass) { GObjectClass *gobject_class = G_OBJECT_CLASS (klass); - g_type_class_add_private (klass, sizeof (GDataYouTubeStatePrivate)); - gobject_class->get_property = gdata_youtube_state_get_property; gobject_class->set_property = gdata_youtube_state_set_property; gobject_class->finalize = gdata_youtube_state_finalize; @@ -146,7 +144,7 @@ gdata_youtube_state_class_init (GDataYouTubeStateClass *klass) static void gdata_youtube_state_init (GDataYouTubeState *self) { - self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, GDATA_TYPE_YOUTUBE_STATE, GDataYouTubeStatePrivate); + self->priv = gdata_youtube_state_get_instance_private (self); } static void diff --git a/gdata/services/youtube/gdata-youtube-video.c b/gdata/services/youtube/gdata-youtube-video.c index f44272d6..85a3bb84 100644 --- a/gdata/services/youtube/gdata-youtube-video.c +++ b/gdata/services/youtube/gdata-youtube-video.c @@ -160,6 +160,7 @@ enum { }; G_DEFINE_TYPE_WITH_CODE (GDataYouTubeVideo, gdata_youtube_video, GDATA_TYPE_ENTRY, + G_ADD_PRIVATE (GDataYouTubeVideo) G_IMPLEMENT_INTERFACE (GDATA_TYPE_COMMENTABLE, gdata_youtube_video_commentable_init)) static void @@ -169,8 +170,6 @@ gdata_youtube_video_class_init (GDataYouTubeVideoClass *klass) GDataParsableClass *parsable_class = GDATA_PARSABLE_CLASS (klass); GDataEntryClass *entry_class = GDATA_ENTRY_CLASS (klass); - g_type_class_add_private (klass, sizeof (GDataYouTubeVideoPrivate)); - gobject_class->get_property = gdata_youtube_video_get_property; gobject_class->set_property = gdata_youtube_video_set_property; gobject_class->dispose = gdata_youtube_video_dispose; @@ -525,7 +524,7 @@ gdata_youtube_video_commentable_init (GDataCommentableInterface *iface) static void gdata_youtube_video_init (GDataYouTubeVideo *self) { - self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, GDATA_TYPE_YOUTUBE_VIDEO, GDataYouTubeVideoPrivate); + self->priv = gdata_youtube_video_get_instance_private (self); self->priv->recorded = -1; self->priv->access_controls = g_hash_table_new_full (g_str_hash, g_str_equal, (GDestroyNotify) g_free, NULL); self->priv->latitude = G_MAXDOUBLE; diff --git a/gdata/tests/gdata-dummy-authorizer.c b/gdata/tests/gdata-dummy-authorizer.c index b9b246e0..c6b2c219 100644 --- a/gdata/tests/gdata-dummy-authorizer.c +++ b/gdata/tests/gdata-dummy-authorizer.c @@ -62,6 +62,7 @@ struct _GDataDummyAuthorizerPrivate { G_DEFINE_TYPE_WITH_CODE (GDataDummyAuthorizer, gdata_dummy_authorizer, G_TYPE_OBJECT, + G_ADD_PRIVATE (GDataDummyAuthorizer) G_IMPLEMENT_INTERFACE (GDATA_TYPE_AUTHORIZER, authorizer_init)) @@ -70,8 +71,6 @@ gdata_dummy_authorizer_class_init (GDataDummyAuthorizerClass *klass) { GObjectClass *gobject_class = G_OBJECT_CLASS (klass); - g_type_class_add_private (klass, sizeof (GDataDummyAuthorizerPrivate)); - gobject_class->finalize = finalize; } @@ -85,9 +84,7 @@ authorizer_init (GDataAuthorizerInterface *iface) static void gdata_dummy_authorizer_init (GDataDummyAuthorizer *self) { - self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, - GDATA_TYPE_DUMMY_AUTHORIZER, - GDataDummyAuthorizerPrivate); + self->priv = gdata_dummy_authorizer_get_instance_private (self); /* Set up the authorizer's mutex */ g_mutex_init (&(self->priv->mutex)); -- cgit v1.2.1 From ef8722baa444958601bfddfee3a977ccf4f7c02c Mon Sep 17 00:00:00 2001 From: Daniel Kolesa Date: Tue, 16 Mar 2021 17:22:08 +0100 Subject: drop usage of deprecated GTimeVal --- demos/calendar/calendar-cli.c | 90 +++++++++++++++--------- demos/tasks/tasks-cli.c | 31 ++++---- demos/youtube/youtube-cli.c | 9 ++- gdata/gdata-access-rule.c | 4 +- gdata/gdata-batch-operation.c | 8 +-- gdata/gdata-oauth1-authorizer.c | 6 +- gdata/gdata-parser.c | 48 +++++++------ gdata/gdata-service.c | 5 +- gdata/services/calendar/gdata-calendar-event.c | 18 ++--- gdata/services/calendar/gdata-calendar-query.c | 6 +- gdata/services/contacts/gdata-contacts-contact.c | 4 +- gdata/services/contacts/gdata-contacts-group.c | 4 +- gdata/services/documents/gdata-documents-query.c | 8 +-- gdata/services/picasaweb/gdata-picasaweb-album.c | 8 +-- gdata/services/picasaweb/gdata-picasaweb-file.c | 8 +-- gdata/services/youtube/gdata-youtube-query.c | 18 ++--- gdata/services/youtube/gdata-youtube-service.c | 10 +-- gdata/tests/calendar.c | 60 +++++++++------- gdata/tests/contacts.c | 22 +++--- gdata/tests/general.c | 7 +- gdata/tests/perf.c | 15 ++-- gdata/tests/picasaweb.c | 14 ++-- gdata/tests/youtube.c | 14 ++-- 23 files changed, 231 insertions(+), 186 deletions(-) diff --git a/demos/calendar/calendar-cli.c b/demos/calendar/calendar-cli.c index a1d84f67..4f601f48 100644 --- a/demos/calendar/calendar-cli.c +++ b/demos/calendar/calendar-cli.c @@ -38,13 +38,13 @@ print_usage (char *argv[]) return -1; } -/* Convert a GTimeVal to an ISO 8601 date string (without a time component). */ +/* Convert a unix time to an ISO 8601 date string (without a time component). */ static gchar * -tv_to_iso8601_date (GTimeVal *tv) +tv_to_iso8601_date (gint64 tv) { struct tm *tm; - tm = gmtime (&tv->tv_sec); + tm = gmtime (&tv); return g_strdup_printf ("%04d-%02d-%02d", tm->tm_year + 1900, @@ -81,8 +81,9 @@ print_event (GDataCalendarEvent *event) { const gchar *title, *id, *description, *status, *visibility; const gchar *transparency, *uid; - GTimeVal date_published_tv = { 0, }; - GTimeVal date_edited_tv = { 0, }; + GDateTime *tmp; + gint64 date_published_tv; + gint64 date_edited_tv; gchar *date_published = NULL; /* owned */ gchar *date_edited = NULL; /* owned */ guint sequence; @@ -95,10 +96,14 @@ print_event (GDataCalendarEvent *event) title = gdata_entry_get_title (GDATA_ENTRY (event)); id = gdata_entry_get_id (GDATA_ENTRY (event)); description = gdata_entry_get_content (GDATA_ENTRY (event)); - date_published_tv.tv_sec = gdata_entry_get_published (GDATA_ENTRY (event)); - date_published = g_time_val_to_iso8601 (&date_published_tv); - date_edited_tv.tv_sec = gdata_calendar_event_get_edited (event); - date_edited = g_time_val_to_iso8601 (&date_edited_tv); + date_published_tv = gdata_entry_get_published (GDATA_ENTRY (event)); + tmp = g_date_time_new_from_unix_utc (date_published_tv); + date_published = g_date_time_format_iso8601 (tmp); + g_date_time_unref (tmp); + date_edited_tv = gdata_calendar_event_get_edited (event); + tmp = g_date_time_new_from_unix_utc (date_edited_tv); + date_edited = g_date_time_format_iso8601 (tmp); + g_date_time_unref (tmp); status = gdata_calendar_event_get_status (event); visibility = gdata_calendar_event_get_visibility (event); transparency = gdata_calendar_event_get_transparency (event); @@ -155,20 +160,25 @@ print_event (GDataCalendarEvent *event) for (; times != NULL; times = times->next) { GDataGDWhen *when; - GTimeVal start_time = { 0, }, end_time = { 0, }; + gint64 start_time, end_time; gchar *start = NULL, *end = NULL; /* owned */ when = GDATA_GD_WHEN (times->data); - start_time.tv_sec = gdata_gd_when_get_start_time (when); - end_time.tv_sec = gdata_gd_when_get_end_time (when); + start_time = gdata_gd_when_get_start_time (when); + end_time = gdata_gd_when_get_end_time (when); if (gdata_gd_when_is_date (when)) { - start = tv_to_iso8601_date (&start_time); - end = tv_to_iso8601_date (&end_time); + start = tv_to_iso8601_date (start_time); + end = tv_to_iso8601_date (end_time); } else { - start = g_time_val_to_iso8601 (&start_time); - end = g_time_val_to_iso8601 (&end_time); + GDateTime *tmp; + tmp = g_date_time_new_from_unix_utc (start_time); + start = g_date_time_format_iso8601 (tmp); + g_date_time_unref (tmp); + tmp = g_date_time_new_from_unix_utc (end_time); + end = g_date_time_format_iso8601 (tmp); + g_date_time_unref (tmp); } g_print (" • %s to %s (%s)\n", @@ -416,8 +426,7 @@ command_insert_event (int argc, char *argv[]) GDataAuthorizer *authorizer = NULL; GDataGDWhen *when = NULL; gboolean is_date; - gchar *start_with_time = NULL, *end_with_time = NULL; - GTimeVal start_tv = { 0, }, end_tv = { 0, }; + GDateTime *start_tv = NULL, *end_tv = NULL; gint i; if (argc < 7) { @@ -454,25 +463,38 @@ command_insert_event (int argc, char *argv[]) event = gdata_calendar_event_new (NULL); gdata_entry_set_title (GDATA_ENTRY (event), title); - start_with_time = g_strconcat (start, "T00:00:00Z", NULL); - end_with_time = g_strconcat (end, "T00:00:00Z", NULL); - - if (g_time_val_from_iso8601 (start, &start_tv) && - g_time_val_from_iso8601 (end, &end_tv)) { + start_tv = g_date_time_new_from_iso8601 (start, NULL); + end_tv = g_date_time_new_from_iso8601 (end, NULL); + if (start_tv && end_tv) { /* Includes time. */ is_date = FALSE; - } else if (g_time_val_from_iso8601 (start_with_time, &start_tv) && - g_time_val_from_iso8601 (end_with_time, &end_tv)) { - /* Does not include time. */ - is_date = TRUE; } else { - g_printerr ("%s: Could not parse start time ‘%s’ and end time " - "‘%s’ as ISO 8601.\n", argv[0], start, end); - retval = 1; - goto done; + gchar *start_with_time, *end_with_time; + + g_clear_pointer (&start_tv, g_date_time_unref); + g_clear_pointer (&end_tv, g_date_time_unref); + + start_with_time = g_strconcat (start, "T00:00:00Z", NULL); + end_with_time = g_strconcat (end, "T00:00:00Z", NULL); + + start_tv = g_date_time_new_from_iso8601 (start_with_time, NULL); + end_tv = g_date_time_new_from_iso8601 (end_with_time, NULL); + + g_free (start_with_time); + g_free (end_with_time); + + if (start_tv && end_tv) { + /* Does not include time. */ + is_date = TRUE; + } else { + g_printerr ("%s: Could not parse start time ‘%s’ and end time " + "‘%s’ as ISO 8601.\n", argv[0], start, end); + retval = 1; + goto done; + } } - when = gdata_gd_when_new (start_tv.tv_sec, end_tv.tv_sec, is_date); + when = gdata_gd_when_new (g_date_time_to_unix (start_tv), g_date_time_to_unix (end_tv), is_date); gdata_calendar_event_add_time (event, when); g_object_unref (when); @@ -507,8 +529,8 @@ command_insert_event (int argc, char *argv[]) print_event (inserted_event); done: - g_free (start_with_time); - g_free (end_with_time); + g_clear_pointer (&start_tv, g_date_time_unref); + g_clear_pointer (&end_tv, g_date_time_unref); g_clear_object (&inserted_event); g_clear_object (&event); g_clear_object (&authorizer); diff --git a/demos/tasks/tasks-cli.c b/demos/tasks/tasks-cli.c index c795761a..ef4ae900 100644 --- a/demos/tasks/tasks-cli.c +++ b/demos/tasks/tasks-cli.c @@ -67,35 +67,42 @@ print_task (GDataTasksTask *task) { const gchar *title, *id, *description, *parent_id, *position, *notes; const gchar *status; - GTimeVal date_published_tv = { 0, }; + GDateTime *tmp; + gint64 date_published_tv; gchar *date_published = NULL; /* owned */ - GTimeVal due_tv = { 0, }; + gint64 due_tv; gchar *due = NULL; /* owned */ - GTimeVal completed_tv = { 0, }; + gint64 completed_tv; gchar *completed = NULL; /* owned */ gboolean is_deleted, is_hidden; title = gdata_entry_get_title (GDATA_ENTRY (task)); id = gdata_entry_get_id (GDATA_ENTRY (task)); description = gdata_entry_get_content (GDATA_ENTRY (task)); - date_published_tv.tv_sec = gdata_entry_get_published (GDATA_ENTRY (task)); - date_published = g_time_val_to_iso8601 (&date_published_tv); + date_published_tv = gdata_entry_get_published (GDATA_ENTRY (task)); + tmp = g_date_time_new_from_unix_utc (date_published_tv); + date_published = g_date_time_format_iso8601 (tmp); + g_date_time_unref (tmp); parent_id = gdata_tasks_task_get_parent (task); position = gdata_tasks_task_get_position (task); notes = gdata_tasks_task_get_notes (task); status = gdata_tasks_task_get_status (task); - due_tv.tv_sec = gdata_tasks_task_get_due (task); - due = g_time_val_to_iso8601 (&due_tv); - completed_tv.tv_sec = gdata_tasks_task_get_completed (task); - completed = g_time_val_to_iso8601 (&completed_tv); + due_tv = gdata_tasks_task_get_due (task); + tmp = g_date_time_new_from_unix_utc (due_tv); + due = g_date_time_format_iso8601 (tmp); + g_date_time_unref (tmp); + completed_tv = gdata_tasks_task_get_completed (task); + tmp = g_date_time_new_from_unix_utc (completed_tv); + completed = g_date_time_format_iso8601 (tmp); + g_date_time_unref (tmp); is_deleted = gdata_tasks_task_is_deleted (task); is_hidden = gdata_tasks_task_is_hidden (task); g_print ("%s — %s\n", id, title); - g_print (" Published: %s\n", date_published_tv.tv_sec != 0 ? date_published : "unknown"); + g_print (" Published: %s\n", date_published_tv != 0 ? date_published : "unknown"); g_print (" Status: %s\n", format_status (status)); - g_print (" Due: %s\n", due_tv.tv_sec != 0 ? due : "not set"); - g_print (" Completed: %s\n", completed_tv.tv_sec != 0 ? completed : "not yet"); + g_print (" Due: %s\n", due_tv != 0 ? due : "not set"); + g_print (" Completed: %s\n", completed_tv != 0 ? completed : "not yet"); g_print (" Deleted? %s\n", is_deleted ? "Yes" : "No"); g_print (" Hidden? %s\n", is_hidden ? "Yes" : "No"); g_print (" Position: %s\n", position); diff --git a/demos/youtube/youtube-cli.c b/demos/youtube/youtube-cli.c index 37ff4afc..e3e0e3dc 100644 --- a/demos/youtube/youtube-cli.c +++ b/demos/youtube/youtube-cli.c @@ -46,7 +46,8 @@ print_video (GDataYouTubeVideo *video) { const gchar *title, *player_uri, *id, *description; GList/**/ *thumbnails; - GTimeVal date_published_tv = { 0, }; + GDateTime *tmp; + gint64 date_published_tv; gchar *date_published = NULL; /* owned */ guint duration; /* seconds */ guint rating_min = 0, rating_max = 0, rating_count = 0; @@ -57,8 +58,10 @@ print_video (GDataYouTubeVideo *video) id = gdata_entry_get_id (GDATA_ENTRY (video)); description = gdata_youtube_video_get_description (video); thumbnails = gdata_youtube_video_get_thumbnails (video); - date_published_tv.tv_sec = gdata_entry_get_published (GDATA_ENTRY (video)); - date_published = g_time_val_to_iso8601 (&date_published_tv); + date_published_tv = gdata_entry_get_published (GDATA_ENTRY (video)); + tmp = g_date_time_new_from_unix_utc (date_published_tv); + date_published = g_date_time_format_iso8601 (tmp); + g_date_time_unref (tmp); duration = gdata_youtube_video_get_duration (video); gdata_youtube_video_get_rating (video, &rating_min, &rating_max, &rating_count, &rating_average); diff --git a/gdata/gdata-access-rule.c b/gdata/gdata-access-rule.c index 9fd1ce95..0064623f 100644 --- a/gdata/gdata-access-rule.c +++ b/gdata/gdata-access-rule.c @@ -257,12 +257,10 @@ gdata_access_rule_constructor (GType type, guint n_construct_params, GObjectCons /* We can't create these in init, or they would collide with the group and control created when parsing the XML */ if (_gdata_parsable_is_constructed_from_xml (GDATA_PARSABLE (object)) == FALSE) { GDataAccessRulePrivate *priv = GDATA_ACCESS_RULE (object)->priv; - GTimeVal time_val; /* Set the edited property to the current time (creation time). We don't do this in *_init() since that would cause * setting it from parse_xml() to fail (duplicate element). */ - g_get_current_time (&time_val); - priv->edited = time_val.tv_sec; + priv->edited = g_get_real_time () / G_USEC_PER_SEC; /* Set up the role and scope type */ priv->role = g_strdup (GDATA_ACCESS_ROLE_NONE); diff --git a/gdata/gdata-batch-operation.c b/gdata/gdata-batch-operation.c index f78801ed..212fcb0b 100644 --- a/gdata/gdata-batch-operation.c +++ b/gdata/gdata-batch-operation.c @@ -598,7 +598,7 @@ gdata_batch_operation_run (GDataBatchOperation *self, GCancellable *cancellable, GDataBatchOperationPrivate *priv = self->priv; SoupMessage *message; GDataFeed *feed; - GTimeVal updated; + gint64 updated; gchar *upload_data; guint status; GHashTableIter iter; @@ -638,9 +638,9 @@ gdata_batch_operation_run (GDataBatchOperation *self, GCancellable *cancellable, message = _gdata_service_build_message (priv->service, priv->authorization_domain, SOUP_METHOD_POST, priv->feed_uri, NULL, TRUE); /* Build the request */ - g_get_current_time (&updated); + updated = g_get_real_time () / G_USEC_PER_SEC; feed = _gdata_feed_new (GDATA_TYPE_FEED, "Batch operation feed", - "batch1", updated.tv_sec); + "batch1", updated); g_hash_table_iter_init (&iter, priv->operations); while (g_hash_table_iter_next (&iter, &op_id, (gpointer*) &op) == TRUE) { @@ -658,7 +658,7 @@ gdata_batch_operation_run (GDataBatchOperation *self, GCancellable *cancellable, g_free (entry_uri); gdata_entry_set_title (entry, "Batch operation query"); - _gdata_entry_set_updated (entry, updated.tv_sec); + _gdata_entry_set_updated (entry, updated); _gdata_entry_set_batch_data (entry, op->id, op->type); _gdata_feed_add_entry (feed, entry); diff --git a/gdata/gdata-oauth1-authorizer.c b/gdata/gdata-oauth1-authorizer.c index 7b857ac0..6d5fd5ec 100644 --- a/gdata/gdata-oauth1-authorizer.c +++ b/gdata/gdata-oauth1-authorizer.c @@ -471,7 +471,7 @@ sign_message (GDataOAuth1Authorizer *self, SoupMessage *message, const gchar *to gchar *uri, *signature, *timestamp; char *nonce; gboolean is_first = TRUE; - GTimeVal time_val; + gint64 time_val; guchar signature_buf[HMAC_SHA1_LEN]; gsize signature_buf_len; GHmac *signature_hmac; @@ -494,8 +494,8 @@ sign_message (GDataOAuth1Authorizer *self, SoupMessage *message, const gchar *to /* Add various standard parameters to the list (note: this modifies the hash table belonging to the caller) */ nonce = oauth_gen_nonce (); - g_get_current_time (&time_val); - timestamp = g_strdup_printf ("%li", time_val.tv_sec); + time_val = g_get_real_time () / G_USEC_PER_SEC; + timestamp = g_strdup_printf ("%li", time_val); if (parameters == NULL) { parameters = g_hash_table_new (g_str_hash, g_str_equal); diff --git a/gdata/gdata-parser.c b/gdata/gdata-parser.c index c1cfe00d..d6ab92e2 100644 --- a/gdata/gdata-parser.c +++ b/gdata/gdata-parser.c @@ -207,21 +207,22 @@ gboolean gdata_parser_int64_from_date (const gchar *date, gint64 *_time) { gchar *iso8601_date; - gboolean success; - GTimeVal time_val; + g_autoptr(GDateTime) time_val = NULL; if (strlen (date) != 10 && strlen (date) != 8) return FALSE; /* Note: This doesn't need translating, as it's outputting an ISO 8601 time string */ iso8601_date = g_strdup_printf ("%sT00:00:00Z", date); - success = g_time_val_from_iso8601 (iso8601_date, &time_val); + time_val = g_date_time_new_from_iso8601 (iso8601_date, NULL); g_free (iso8601_date); - if (success == TRUE) - *_time = time_val.tv_sec; + if (time_val) { + *_time = g_date_time_to_unix (time_val); + return TRUE; + } - return success; + return FALSE; } gchar * @@ -240,21 +241,24 @@ gdata_parser_date_from_int64 (gint64 _time) gchar * gdata_parser_int64_to_iso8601 (gint64 _time) { - GTimeVal time_val; + g_autoptr(GDateTime) time_val = NULL; + + time_val = g_date_time_new_from_unix_utc (_time); - time_val.tv_sec = _time; - time_val.tv_usec = 0; + if (!time_val) + return NULL; - return g_time_val_to_iso8601 (&time_val); + return g_date_time_format_iso8601 (time_val); } gboolean gdata_parser_int64_from_iso8601 (const gchar *date, gint64 *_time) { - GTimeVal time_val; + g_autoptr(GDateTime) time_val = NULL; - if (g_time_val_from_iso8601 (date, &time_val) == TRUE) { - *_time = time_val.tv_sec; + time_val = g_date_time_new_from_iso8601 (date, NULL); + if (time_val) { + *_time = g_date_time_to_unix (time_val); return TRUE; } @@ -479,7 +483,7 @@ gdata_parser_int64_time_from_element (xmlNode *element, const gchar *element_nam gint64 *output, gboolean *success, GError **error) { xmlChar *text; - GTimeVal time_val; + g_autoptr(GDateTime) time_val = NULL; /* Check it's the right element */ if (xmlStrcmp (element->name, (xmlChar*) element_name) != 0) @@ -499,14 +503,15 @@ gdata_parser_int64_time_from_element (xmlNode *element, const gchar *element_nam return TRUE; } - /* Attempt to parse the string as a GTimeVal */ - if (g_time_val_from_iso8601 ((gchar*) text, &time_val) == FALSE) { + /* Attempt to parse the string as a GDateTune */ + time_val = g_date_time_new_from_iso8601 ((gchar *) text, NULL); + if (!time_val) { *success = gdata_parser_error_not_iso8601_format (element, (gchar*) text, error); xmlFree (text); return TRUE; } - *output = time_val.tv_sec; + *output = g_date_time_to_unix (time_val); /* Success! */ xmlFree (text); @@ -911,7 +916,7 @@ gdata_parser_int64_time_from_json_member (JsonReader *reader, const gchar *membe gint64 *output, gboolean *success, GError **error) { const gchar *text; - GTimeVal time_val; + g_autoptr(GDateTime) time_val = NULL; const GError *child_error = NULL; /* Check if there's such element */ @@ -935,14 +940,15 @@ gdata_parser_int64_time_from_json_member (JsonReader *reader, const gchar *membe return TRUE; } - /* Attempt to parse the string as a GTimeVal */ - if (g_time_val_from_iso8601 ((gchar*) text, &time_val) == FALSE) { + /* Attempt to parse the string as a GDateTime */ + time_val = g_date_time_new_from_iso8601 (text, NULL); + if (!time_val) { *success = gdata_parser_error_not_iso8601_format_json (reader, text, error); return TRUE; } /* Success! */ - *output = time_val.tv_sec; + *output = g_date_time_to_unix (time_val); *success = TRUE; return TRUE; diff --git a/gdata/gdata-service.c b/gdata/gdata-service.c index fce970ec..40fbaf84 100644 --- a/gdata/gdata-service.c +++ b/gdata/gdata-service.c @@ -956,12 +956,9 @@ __gdata_service_query (GDataService *self, GDataAuthorizationDomain *domain, con /* Are we off the end of the final page? */ if (query != NULL && _gdata_query_is_finished (query)) { - GTimeVal updated; - /* Build an empty dummy feed to signify the end of the list. */ - g_get_current_time (&updated); return _gdata_feed_new (klass->feed_type, "Empty feed", "feed1", - updated.tv_sec); + g_get_real_time () / G_USEC_PER_SEC); } /* Send the request. */ diff --git a/gdata/services/calendar/gdata-calendar-event.c b/gdata/services/calendar/gdata-calendar-event.c index a3a4d713..4cdf2700 100644 --- a/gdata/services/calendar/gdata-calendar-event.c +++ b/gdata/services/calendar/gdata-calendar-event.c @@ -37,7 +37,7 @@ * GDataGDWhere *where; * GDataGDWho *who; * GDataGDWhen *when; - * GTimeVal current_time; + * gint64 current_time; * GError *error = NULL; * * /* Create a service */ @@ -58,8 +58,8 @@ * gdata_calendar_event_add_person (event, who); * g_object_unref (who); * - * g_get_current_time (¤t_time); - * when = gdata_gd_when_new (current_time.tv_sec, current_time.tv_sec + 3600, FALSE); + * current_time = g_get_real_time () / G_USEC_PER_SEC; + * when = gdata_gd_when_new (current_time, current_time + 3600, FALSE); * gdata_calendar_event_add_time (event, when); * g_object_unref (when); * @@ -374,12 +374,10 @@ gdata_calendar_event_constructor (GType type, guint n_construct_params, GObjectC if (_gdata_parsable_is_constructed_from_xml (GDATA_PARSABLE (object)) == FALSE) { GDataCalendarEventPrivate *priv = GDATA_CALENDAR_EVENT (object)->priv; - GTimeVal time_val; /* Set the edited property to the current time (creation time). We don't do this in *_init() since that would cause * setting it from parse_xml() to fail (duplicate element). */ - g_get_current_time (&time_val); - priv->edited = time_val.tv_sec; + priv->edited = g_get_real_time () / G_USEC_PER_SEC; } return object; @@ -554,7 +552,7 @@ date_object_from_json (JsonReader *reader, if (json_reader_read_member (reader, "dateTime")) { const gchar *date_string; const GError *child_error; - GTimeVal time_val; + GDateTime *time_val; date_string = json_reader_get_string_value (reader); child_error = json_reader_get_error (reader); @@ -567,13 +565,15 @@ date_object_from_json (JsonReader *reader, return TRUE; } - if (!g_time_val_from_iso8601 (date_string, &time_val)) { + time_val = g_date_time_new_from_iso8601 (date_string, NULL); + if (!time_val) { *success = gdata_parser_error_not_iso8601_format_json (reader, date_string, error); json_reader_end_member (reader); return TRUE; } - date_time = time_val.tv_sec; + date_time = g_date_time_to_unix (time_val); + g_date_time_unref (time_val); is_date = FALSE; found_member = TRUE; } diff --git a/gdata/services/calendar/gdata-calendar-query.c b/gdata/services/calendar/gdata-calendar-query.c index 37779bbe..dd019529 100644 --- a/gdata/services/calendar/gdata-calendar-query.c +++ b/gdata/services/calendar/gdata-calendar-query.c @@ -37,7 +37,7 @@ * GDataCalendarCalendar *calendar; * GDataCalendarQuery *query; * GDataFeed *feed; - * GTimeVal current_time; + * gint64 current_time; * GList *i; * GError *error = NULL; * @@ -47,8 +47,8 @@ * * /* Create the query to use. We're going to query for events within the next week which match the search term "party", * * ordered by last modification time (descending). */ - * g_get_current_time (¤t_time); - * query = gdata_calendar_query_new_with_limits ("party", current_time.tv_sec, current_time.tv_sec + 7 * 24 * 60 * 60); + * current_time = g_get_real_time () / G_USEC_PER_SEC; + * query = gdata_calendar_query_new_with_limits ("party", current_time, current_time + 7 * 24 * 60 * 60); * gdata_calendar_query_set_order_by (query, "lastmodified"); * * /* Execute the query */ diff --git a/gdata/services/contacts/gdata-contacts-contact.c b/gdata/services/contacts/gdata-contacts-contact.c index 4f511315..eb4148d0 100644 --- a/gdata/services/contacts/gdata-contacts-contact.c +++ b/gdata/services/contacts/gdata-contacts-contact.c @@ -582,12 +582,10 @@ gdata_contacts_contact_constructor (GType type, guint n_construct_params, GObjec if (_gdata_parsable_is_constructed_from_xml (GDATA_PARSABLE (object)) == FALSE) { GDataContactsContactPrivate *priv = GDATA_CONTACTS_CONTACT (object)->priv; - GTimeVal time_val; /* Set the edited property to the current time (creation time). We don't do this in *_init() since that would cause * setting it from parse_xml() to fail (duplicate element). */ - g_get_current_time (&time_val); - priv->edited = time_val.tv_sec; + priv->edited = g_get_real_time () / G_USEC_PER_SEC; } return object; diff --git a/gdata/services/contacts/gdata-contacts-group.c b/gdata/services/contacts/gdata-contacts-group.c index 055f4255..2059369a 100644 --- a/gdata/services/contacts/gdata-contacts-group.c +++ b/gdata/services/contacts/gdata-contacts-group.c @@ -266,12 +266,10 @@ gdata_contacts_group_constructor (GType type, guint n_construct_params, GObjectC if (_gdata_parsable_is_constructed_from_xml (GDATA_PARSABLE (object)) == FALSE) { GDataContactsGroupPrivate *priv = GDATA_CONTACTS_GROUP (object)->priv; - GTimeVal time_val; /* Set the edited property to the current time (creation time). We don't do this in *_init() since that would cause setting it from * parse_xml() to fail (duplicate element). */ - g_get_current_time (&time_val); - priv->edited = time_val.tv_sec; + priv->edited = g_get_real_time () / G_USEC_PER_SEC; } return object; diff --git a/gdata/services/documents/gdata-documents-query.c b/gdata/services/documents/gdata-documents-query.c index e589b524..4797718f 100644 --- a/gdata/services/documents/gdata-documents-query.c +++ b/gdata/services/documents/gdata-documents-query.c @@ -37,7 +37,7 @@ * GDataDocumentsService *service; * GDataDocumentsQuery *query; * GDataFeed *feed; - * GTimeVal current_time; + * gint64 current_time; * GList *i; * GError *error = NULL; * @@ -51,9 +51,9 @@ * gdata_documents_query_add_collaborator (query, "example@gmail.com"); * gdata_documents_query_set_show_deleted (query, TRUE); * - * g_get_current_time (¤t_time); - * gdata_query_set_updated_min (GDATA_QUERY (query), current_time.tv_sec - 7 * 24 * 60 * 60); - * gdata_query_set_updated_max (GDATA_QUERY (query), current_time.tv_sec); + * current_time = g_get_real_time () / G_USEC_PER_SEC; + * gdata_query_set_updated_min (GDATA_QUERY (query), current_time - 7 * 24 * 60 * 60); + * gdata_query_set_updated_max (GDATA_QUERY (query), current_time); * * /* Execute the query */ * feed = gdata_documents_service_query_documents (service, query, NULL, NULL, NULL, &error); diff --git a/gdata/services/picasaweb/gdata-picasaweb-album.c b/gdata/services/picasaweb/gdata-picasaweb-album.c index 40fd8cfb..fd6d0abc 100644 --- a/gdata/services/picasaweb/gdata-picasaweb-album.c +++ b/gdata/services/picasaweb/gdata-picasaweb-album.c @@ -507,13 +507,13 @@ gdata_picasaweb_album_constructor (GType type, guint n_construct_params, GObject if (_gdata_parsable_is_constructed_from_xml (GDATA_PARSABLE (object)) == FALSE) { GDataPicasaWebAlbumPrivate *priv = GDATA_PICASAWEB_ALBUM (object)->priv; - GTimeVal time_val; + gint64 time_val; /* Set the edited and timestamp properties to the current time (creation time). bgo#599140 * We don't do this in *_init() since that would cause setting it from parse_xml() to fail (duplicate element). */ - g_get_current_time (&time_val); - priv->timestamp = (gint64) time_val.tv_sec * 1000; - priv->edited = time_val.tv_sec; + time_val = g_get_real_time () / G_USEC_PER_SEC; + priv->timestamp = time_val * 1000; + priv->edited = time_val; } return object; diff --git a/gdata/services/picasaweb/gdata-picasaweb-file.c b/gdata/services/picasaweb/gdata-picasaweb-file.c index 53aab33b..96db23a6 100644 --- a/gdata/services/picasaweb/gdata-picasaweb-file.c +++ b/gdata/services/picasaweb/gdata-picasaweb-file.c @@ -690,13 +690,13 @@ gdata_picasaweb_file_constructor (GType type, guint n_construct_params, GObjectC if (_gdata_parsable_is_constructed_from_xml (GDATA_PARSABLE (object)) == FALSE) { GDataPicasaWebFilePrivate *priv = GDATA_PICASAWEB_FILE (object)->priv; - GTimeVal time_val; + gint64 time_val; /* Set the edited and timestamp properties to the current time (creation time). bgo#599140 * We don't do this in *_init() since that would cause setting it from parse_xml() to fail (duplicate element). */ - g_get_current_time (&time_val); - priv->timestamp = (gint64) time_val.tv_sec * 1000; - priv->edited = time_val.tv_sec; + time_val = g_get_real_time () / G_USEC_PER_SEC; + priv->timestamp = time_val * 1000; + priv->edited = time_val; } return object; diff --git a/gdata/services/youtube/gdata-youtube-query.c b/gdata/services/youtube/gdata-youtube-query.c index 212a0d10..bb5cff15 100644 --- a/gdata/services/youtube/gdata-youtube-query.c +++ b/gdata/services/youtube/gdata-youtube-query.c @@ -572,22 +572,20 @@ get_query_uri (GDataQuery *self, const gchar *feed_uri, GString *query_uri, gboo if (priv->age != GDATA_YOUTUBE_AGE_ALL_TIME) { gchar *after; - GTimeVal tv = { 0, }; + GDateTime *tv, *tv2; - g_get_current_time (&tv); - - /* Squash the microseconds; they’re not useful. */ - tv.tv_usec = 0; + /* don't use g_date_time_new_now_utc (squash microseconds) */ + tv2 = g_date_time_new_from_unix_utc (g_get_real_time () / G_USEC_PER_SEC); switch (priv->age) { case GDATA_YOUTUBE_AGE_TODAY: - tv.tv_sec -= 24 * 60 * 60; + tv = g_date_time_add_days (tv2, -1); break; case GDATA_YOUTUBE_AGE_THIS_WEEK: - tv.tv_sec -= 7 * 24 * 60 * 60; + tv = g_date_time_add_weeks (tv2, -1); break; case GDATA_YOUTUBE_AGE_THIS_MONTH: - tv.tv_sec -= 31 * 24 * 60 * 60; + tv = g_date_time_add_months (tv2, -1); break; case GDATA_YOUTUBE_AGE_ALL_TIME: default: @@ -596,9 +594,11 @@ get_query_uri (GDataQuery *self, const gchar *feed_uri, GString *query_uri, gboo APPEND_SEP - after = g_time_val_to_iso8601 (&tv); + after = g_date_time_format_iso8601 (tv); g_string_append_printf (query_uri, "publishedAfter=%s", after); g_free (after); + g_date_time_unref (tv); + g_date_time_unref (tv2); } /* We don’t need to use APPEND_SEP below here, as this parameter is diff --git a/gdata/services/youtube/gdata-youtube-service.c b/gdata/services/youtube/gdata-youtube-service.c index 75134e57..35994c54 100644 --- a/gdata/services/youtube/gdata-youtube-service.c +++ b/gdata/services/youtube/gdata-youtube-service.c @@ -684,14 +684,16 @@ standard_feed_type_to_feed_uri (GDataYouTubeStandardFeedType feed_type) case GDATA_YOUTUBE_RECENTLY_FEATURED_FEED: case GDATA_YOUTUBE_WATCH_ON_MOBILE_FEED: { gchar *date, *out; - GTimeVal tv; + GDateTime *tv, *tv2; /* All feed types except MOST_POPULAR have been deprecated for * a while, and fall back to MOST_POPULAR on the server anyway. * See: https://developers.google.com/youtube/2.0/developers_guide_protocol_video_feeds#Standard_feeds */ - g_get_current_time (&tv); - tv.tv_sec -= 24 * 60 * 60; /* 1 day ago */ - date = g_time_val_to_iso8601 (&tv); + tv = g_date_time_new_now_utc (); + tv2 = g_date_time_add_days (tv, -1); + g_date_time_unref (tv); + date = g_date_time_format_iso8601 (tv2); + g_date_time_unref (tv2); out = _gdata_service_build_uri ("https://www.googleapis.com/youtube/v3/videos" "?part=snippet" "&chart=mostPopular" diff --git a/gdata/tests/calendar.c b/gdata/tests/calendar.c index 4d70d1b7..87fb0b81 100644 --- a/gdata/tests/calendar.c +++ b/gdata/tests/calendar.c @@ -495,7 +495,7 @@ test_event_insert (InsertEventData *data, gconstpointer service) GDataGDWhere *where; GDataGDWho *who; GDataGDWhen *when; - GTimeVal start_time, end_time; + GDateTime *start_time, *end_time; GError *error = NULL; gdata_test_mock_server_start_trace (mock_server, "event-insert"); @@ -512,11 +512,13 @@ test_event_insert (InsertEventData *data, gconstpointer service) who = gdata_gd_who_new (GDATA_GD_WHO_EVENT_ORGANIZER, "John Smith‽", "john.smith@example.com"); gdata_calendar_event_add_person (event, who); g_object_unref (who); - g_time_val_from_iso8601 ("2009-04-17T15:00:00.000Z", &start_time); - g_time_val_from_iso8601 ("2009-04-17T17:00:00.000Z", &end_time); - when = gdata_gd_when_new (start_time.tv_sec, end_time.tv_sec, FALSE); + start_time = g_date_time_new_from_iso8601 ("2009-04-17T15:00:00.000Z", NULL); + end_time = g_date_time_new_from_iso8601 ("2009-04-17T17:00:00.000Z", NULL); + when = gdata_gd_when_new (g_date_time_to_unix (start_time), g_date_time_to_unix (end_time), FALSE); gdata_calendar_event_add_time (event, when); g_object_unref (when); + g_date_time_unref (start_time); + g_date_time_unref (end_time); /* Insert the event */ new_event = data->new_event = gdata_calendar_service_insert_calendar_event (GDATA_CALENDAR_SERVICE (service), @@ -540,8 +542,8 @@ G_STMT_START { GDataGDWhere *where; GDataGDWho *who; GDataGDWhen *when; - GTimeVal start_time; - GTimeVal end_time; + GDateTime *start_time; + GDateTime *end_time; event = gdata_calendar_event_new (NULL); @@ -555,11 +557,13 @@ G_STMT_START { who = gdata_gd_who_new (GDATA_GD_WHO_EVENT_ORGANIZER, "John Smith‽", "john.smith@example.com"); gdata_calendar_event_add_person (event, who); g_object_unref (who); - g_time_val_from_iso8601 ("2009-04-17T15:00:00.000Z", &start_time); - g_time_val_from_iso8601 ("2009-04-17T17:00:00.000Z", &end_time); - when = gdata_gd_when_new (start_time.tv_sec, end_time.tv_sec, FALSE); + start_time = g_date_time_new_from_iso8601 ("2009-04-17T15:00:00.000Z", NULL); + end_time = g_date_time_new_from_iso8601 ("2009-04-17T17:00:00.000Z", NULL); + when = gdata_gd_when_new (g_date_time_to_unix (start_time), g_date_time_to_unix (end_time), FALSE); gdata_calendar_event_add_time (event, when); g_object_unref (when); + g_date_time_unref (start_time); + g_date_time_unref (end_time); /* Insert the event */ gdata_calendar_service_insert_calendar_event_async (GDATA_CALENDAR_SERVICE (service), @@ -587,7 +591,7 @@ test_event_json (void) GDataGDWhere *where; GDataGDWho *who; GDataGDWhen *when; - GTimeVal start_time, end_time; + GDateTime *start_time, *end_time; event = gdata_calendar_event_new (NULL); @@ -601,11 +605,13 @@ test_event_json (void) who = gdata_gd_who_new (GDATA_GD_WHO_EVENT_ORGANIZER, "John Smith‽", "john.smith@example.com"); gdata_calendar_event_add_person (event, who); g_object_unref (who); - g_time_val_from_iso8601 ("2009-04-17T15:00:00.000Z", &start_time); - g_time_val_from_iso8601 ("2009-04-17T17:00:00.000Z", &end_time); - when = gdata_gd_when_new (start_time.tv_sec, end_time.tv_sec, FALSE); + start_time = g_date_time_new_from_iso8601 ("2009-04-17T15:00:00.000Z", NULL); + end_time = g_date_time_new_from_iso8601 ("2009-04-17T17:00:00.000Z", NULL); + when = gdata_gd_when_new (g_date_time_to_unix (start_time), g_date_time_to_unix (end_time), FALSE); gdata_calendar_event_add_time (event, when); g_object_unref (when); + g_date_time_unref (start_time); + g_date_time_unref (end_time); /* Check the JSON */ gdata_test_assert_json (event, "{" @@ -1099,7 +1105,7 @@ static void test_query_uri (void) { gint64 _time; - GTimeVal time_val; + GDateTime *time_val; gchar *query_uri; GDataCalendarQuery *query = gdata_calendar_query_new ("q"); @@ -1111,15 +1117,15 @@ test_query_uri (void) g_assert_cmpstr (gdata_calendar_query_get_order_by (query), ==, "starttime"); G_GNUC_BEGIN_IGNORE_DEPRECATIONS - g_time_val_from_iso8601 ("2009-04-17T15:00:00.000Z", &time_val); - gdata_calendar_query_set_recurrence_expansion_start (query, time_val.tv_sec); + time_val = g_date_time_new_from_iso8601 ("2009-04-17T15:00:00.000Z", NULL); + gdata_calendar_query_set_recurrence_expansion_start (query, g_date_time_to_unix (time_val)); _time = gdata_calendar_query_get_recurrence_expansion_start (query); - g_assert_cmpint (_time, ==, time_val.tv_sec); + g_assert_cmpint (_time, ==, g_date_time_to_unix (time_val)); - g_time_val_from_iso8601 ("2010-04-17T15:00:00.000Z", &time_val); - gdata_calendar_query_set_recurrence_expansion_end (query, time_val.tv_sec); + time_val = g_date_time_new_from_iso8601 ("2010-04-17T15:00:00.000Z", NULL); + gdata_calendar_query_set_recurrence_expansion_end (query, g_date_time_to_unix (time_val)); _time = gdata_calendar_query_get_recurrence_expansion_end (query); - g_assert_cmpint (_time, ==, time_val.tv_sec); + g_assert_cmpint (_time, ==, g_date_time_to_unix (time_val)); G_GNUC_END_IGNORE_DEPRECATIONS gdata_calendar_query_set_single_events (query, TRUE); @@ -1130,15 +1136,17 @@ G_GNUC_BEGIN_IGNORE_DEPRECATIONS g_assert_cmpstr (gdata_calendar_query_get_sort_order (query), ==, "descending"); G_GNUC_END_IGNORE_DEPRECATIONS - g_time_val_from_iso8601 ("2009-04-17T15:00:00.000Z", &time_val); - gdata_calendar_query_set_start_min (query, time_val.tv_sec); + time_val = g_date_time_new_from_iso8601 ("2009-04-17T15:00:00.000Z", NULL); + gdata_calendar_query_set_start_min (query, g_date_time_to_unix (time_val)); _time = gdata_calendar_query_get_start_min (query); - g_assert_cmpint (_time, ==, time_val.tv_sec); + g_assert_cmpint (_time, ==, g_date_time_to_unix (time_val)); + g_date_time_unref (time_val); - g_time_val_from_iso8601 ("2010-04-17T15:00:00.000Z", &time_val); - gdata_calendar_query_set_start_max (query, time_val.tv_sec); + time_val = g_date_time_new_from_iso8601 ("2010-04-17T15:00:00.000Z", NULL); + gdata_calendar_query_set_start_max (query, g_date_time_to_unix (time_val)); _time = gdata_calendar_query_get_start_max (query); - g_assert_cmpint (_time, ==, time_val.tv_sec); + g_assert_cmpint (_time, ==, g_date_time_to_unix (time_val)); + g_date_time_unref (time_val); gdata_calendar_query_set_timezone (query, "America/Los Angeles"); g_assert_cmpstr (gdata_calendar_query_get_timezone (query), ==, "America/Los_Angeles"); diff --git a/gdata/tests/contacts.c b/gdata/tests/contacts.c index e4f72deb..f70cee25 100644 --- a/gdata/tests/contacts.c +++ b/gdata/tests/contacts.c @@ -304,14 +304,12 @@ test_contact_insert (InsertData *data, gconstpointer service) GList *list; GDate date; GHashTable *properties; - GTimeVal current_time; gint64 edited, creation_time; GError *error = NULL; gdata_test_mock_server_start_trace (mock_server, "contact-insert"); contact = gdata_contacts_contact_new (NULL); - g_get_current_time (¤t_time); /* Check the kind is present and correct */ g_assert (GDATA_IS_CONTACTS_CONTACT (contact)); @@ -752,13 +750,13 @@ static void test_group_insert (InsertGroupData *data, gconstpointer service) { GDataContactsGroup *group, *new_group; - GTimeVal time_val; + gint64 time_val; GHashTable *properties; GError *error = NULL; gdata_test_mock_server_start_trace (mock_server, "group-insert"); - g_get_current_time (&time_val); + time_val = g_get_real_time () / G_USEC_PER_SEC; group = gdata_contacts_group_new (NULL); @@ -780,7 +778,7 @@ test_group_insert (InsertGroupData *data, gconstpointer service) /* Check the properties. Time-based properties can't be checked when running against a mock server, since * the trace files may be quite old. */ if (uhm_server_get_enable_online (mock_server) == TRUE) { - g_assert_cmpint (gdata_contacts_group_get_edited (new_group), >=, time_val.tv_sec); + g_assert_cmpint (gdata_contacts_group_get_edited (new_group), >=, time_val); } g_assert (gdata_contacts_group_is_deleted (new_group) == FALSE); g_assert (gdata_contacts_group_get_system_group_id (new_group) == NULL); @@ -850,12 +848,12 @@ test_contact_properties (void) gchar *nickname, *file_as, *billing_information, *directory_server, *gender, *initials, *maiden_name, *mileage, *occupation; gchar *priority, *sensitivity, *short_name, *subject, *photo_etag; GDate date, *date2; - GTimeVal current_time; + gint64 current_time; gint64 edited; gboolean deleted, birthday_has_year; contact = gdata_contacts_contact_new (NULL); - g_get_current_time (¤t_time); + current_time = g_get_real_time () / G_USEC_PER_SEC; /* Check the kind is present and correct */ g_assert (GDATA_IS_CONTACTS_CONTACT (contact)); @@ -984,7 +982,7 @@ test_contact_properties (void) "subject", &subject, NULL); - g_assert_cmpint (edited, ==, current_time.tv_sec); + g_assert_cmpint (edited, ==, current_time); g_assert (deleted == FALSE); g_assert (photo_etag == NULL); g_assert (name2 == name); @@ -1751,7 +1749,7 @@ static void test_group_properties (void) { GDataContactsGroup *group; - GTimeVal time_val; + gint64 time_val; GHashTable *properties; gint64 edited; gboolean deleted; @@ -1768,8 +1766,8 @@ test_group_properties (void) g_assert (gdata_contacts_group_set_extended_property (group, "foobar", "barfoo") == TRUE); /* Check various properties */ - g_get_current_time (&time_val); - g_assert_cmpint (gdata_contacts_group_get_edited (group), ==, time_val.tv_sec); + time_val = g_get_real_time () / G_USEC_PER_SEC; + g_assert_cmpint (gdata_contacts_group_get_edited (group), ==, time_val); g_assert (gdata_contacts_group_is_deleted (group) == FALSE); g_assert (gdata_contacts_group_get_system_group_id (group) == NULL); @@ -1785,7 +1783,7 @@ test_group_properties (void) "system-group-id", &system_group_id, NULL); - g_assert_cmpint (edited, ==, time_val.tv_sec); + g_assert_cmpint (edited, ==, time_val); g_assert (deleted == FALSE); g_assert (system_group_id == NULL); diff --git a/gdata/tests/general.c b/gdata/tests/general.c index 30604ba1..39478713 100644 --- a/gdata/tests/general.c +++ b/gdata/tests/general.c @@ -3502,11 +3502,12 @@ static void test_gd_when_escaping (void) { GDataGDWhen *when; - GTimeVal start_time; + GDateTime *start_time; - g_time_val_from_iso8601 ("2005-06-07T01:00:00Z", &start_time); - when = gdata_gd_when_new (start_time.tv_sec, -1, FALSE); + start_time = g_date_time_new_from_iso8601 ("2005-06-07T01:00:00Z", NULL); + when = gdata_gd_when_new (g_date_time_to_unix (start_time), -1, FALSE); gdata_gd_when_set_value_string (when, "Value string & stuff!"); + g_date_time_unref (start_time); /* Check the outputted XML is escaped properly */ gdata_test_assert_xml (when, diff --git a/gdata/tests/perf.c b/gdata/tests/perf.c index 2749d40d..60f3dcc1 100644 --- a/gdata/tests/perf.c +++ b/gdata/tests/perf.c @@ -78,23 +78,24 @@ test_parse_feed (void) static void test_perf_parsing (void) { - GTimeVal start_time, end_time; + GDateTime *start_time, *end_time; + GTimeSpan total_time, per_iteration_time; guint i; - guint64 total_time; /* microseconds */ - guint64 per_iteration_time; /* microseconds */ #define ITERATIONS 10000 /* Test feed parsing time */ - g_get_current_time (&start_time); + start_time = g_date_time_new_now_utc (); for (i = 0; i < ITERATIONS; i++) test_parse_feed (); - g_get_current_time (&end_time); + end_time = g_date_time_new_now_utc (); - total_time = (end_time.tv_sec - start_time.tv_sec) * G_USEC_PER_SEC + - (end_time.tv_usec - start_time.tv_usec); + total_time = g_date_time_difference (end_time, start_time); per_iteration_time = total_time / ITERATIONS; + g_date_time_unref (start_time); + g_date_time_unref (end_time); + /* Prefix with hashes to avoid the output being misinterpreted as TAP * commands. */ printf ("# Parsing a feed %u times took:\n" diff --git a/gdata/tests/picasaweb.c b/gdata/tests/picasaweb.c index eecf1b78..19978e3c 100644 --- a/gdata/tests/picasaweb.c +++ b/gdata/tests/picasaweb.c @@ -782,7 +782,7 @@ typedef struct { static void set_up_insert_album (InsertAlbumData *data, gconstpointer service) { - GTimeVal timestamp; + GDateTime *timestamp; data->album = gdata_picasaweb_album_new (NULL); g_assert (GDATA_IS_PICASAWEB_ALBUM (data->album)); @@ -791,8 +791,9 @@ set_up_insert_album (InsertAlbumData *data, gconstpointer service) gdata_entry_set_summary (GDATA_ENTRY (data->album), "Family photos of the feast!"); gdata_picasaweb_album_set_location (data->album, "Winnipeg, MN"); - g_time_val_from_iso8601 ("2002-10-14T09:58:59.643554Z", ×tamp); - gdata_picasaweb_album_set_timestamp (data->album, (gint64) timestamp.tv_sec * 1000); + timestamp = g_date_time_new_from_iso8601 ("2002-10-14T09:58:59.643554Z", NULL); + gdata_picasaweb_album_set_timestamp (data->album, g_date_time_to_unix (timestamp) * 1000); + g_date_time_unref (timestamp); } static void @@ -1757,12 +1758,12 @@ test_album_new (void) GRegex *regex; GMatchInfo *match_info; gint64 delta; - GTimeVal timeval; + GDateTime *timeval; g_test_bug ("598893"); /* Get the current time */ - g_get_current_time (&timeval); + timeval = g_date_time_new_now_utc (); /* Build a regex to match the timestamp from the XML, since we can't definitely say what it'll be. Note that we also assign any order to the * namespace definitions, since due to a change in GLib's hashing algorithm, they could be in different orders with different GLib versions. */ @@ -1795,9 +1796,10 @@ test_album_new (void) xml = gdata_parsable_get_xml (GDATA_PARSABLE (album)); g_assert (g_regex_match (regex, xml, 0, &match_info) == TRUE); parsed_time_str = g_match_info_fetch (match_info, 2); - delta = g_ascii_strtoull (parsed_time_str, NULL, 10) - (((guint64) timeval.tv_sec) * 1000 + ((guint64) timeval.tv_usec) / 1000); + delta = g_ascii_strtoull (parsed_time_str, NULL, 10) - (g_date_time_to_unix (timeval) * 1000 + ((guint64) g_date_time_get_microsecond (timeval)) / 1000); g_assert_cmpuint (ABS (delta), <, 1000); + g_date_time_unref (timeval); g_free (parsed_time_str); g_free (xml); g_regex_unref (regex); diff --git a/gdata/tests/youtube.c b/gdata/tests/youtube.c index 5fefbaf8..b2732680 100644 --- a/gdata/tests/youtube.c +++ b/gdata/tests/youtube.c @@ -1537,13 +1537,17 @@ test_comment_properties_parent_comment_uri (void) static gchar * build_this_week_date_str (void) { - GTimeVal tv; + GDateTime *tv, *tv2; + gchar *ret; - g_get_current_time (&tv); - tv.tv_sec -= 7 * 24 * 60 * 60; /* this week */ - tv.tv_usec = 0; /* pointless accuracy */ + /* don't use g_date_time_new_now_utc (squash microseconds) */ + tv = g_date_time_new_from_unix_utc (g_get_real_time () / G_USEC_PER_SEC); + tv2 = g_date_time_add_weeks (tv, -1); + g_date_time_unref (tv); - return g_time_val_to_iso8601 (&tv); + ret = g_date_time_format_iso8601 (tv2); + g_date_time_unref (tv2); + return ret; } static void -- cgit v1.2.1 From f0ef089eaa517b57f0f34731707b6d4639a9cdb6 Mon Sep 17 00:00:00 2001 From: Daniel Kolesa Date: Wed, 2 Jun 2021 16:12:36 +0200 Subject: use g_memdup2 when possible --- gdata/gdata-types.c | 4 ++++ gdata/services/contacts/gdata-contacts-contact.c | 8 ++++++++ 2 files changed, 12 insertions(+) diff --git a/gdata/gdata-types.c b/gdata/gdata-types.c index fd367052..d0a49479 100644 --- a/gdata/gdata-types.c +++ b/gdata/gdata-types.c @@ -38,7 +38,11 @@ static gpointer gdata_color_copy (gpointer color) { +#if GLIB_CHECK_VERSION (2, 68, 0) + return g_memdup2 (color, sizeof (GDataColor)); +#else return g_memdup (color, sizeof (GDataColor)); +#endif } GType diff --git a/gdata/services/contacts/gdata-contacts-contact.c b/gdata/services/contacts/gdata-contacts-contact.c index eb4148d0..bf584d48 100644 --- a/gdata/services/contacts/gdata-contacts-contact.c +++ b/gdata/services/contacts/gdata-contacts-contact.c @@ -3168,7 +3168,11 @@ gdata_contacts_contact_get_photo (GDataContactsContact *self, GDataContactsServi if (content_type != NULL) *content_type = g_strdup (soup_message_headers_get_content_type (message->response_headers, NULL)); *length = message->response_body->length; +#if GLIB_CHECK_VERSION (2, 68, 0) + data = g_memdup2 (message->response_body->data, message->response_body->length); +#else data = g_memdup (message->response_body->data, message->response_body->length); +#endif /* Update the stored photo ETag */ g_free (self->priv->photo_etag); @@ -3446,7 +3450,11 @@ gdata_contacts_contact_set_photo_async (GDataContactsContact *self, GDataContact /* Prepare the data to be passed to the thread */ photo_data = g_slice_new (PhotoData); photo_data->service = g_object_ref (service); +#if GLIB_CHECK_VERSION (2, 68, 0) + photo_data->data = g_memdup2 (data, length); +#else photo_data->data = g_memdup (data, length); +#endif photo_data->length = length; photo_data->content_type = g_strdup (content_type); -- cgit v1.2.1