diff options
author | Corentin Noël <tintou@noel.tf> | 2022-12-19 17:59:30 +0100 |
---|---|---|
committer | Milan Crha <mcrha@redhat.com> | 2023-01-03 09:29:44 +0000 |
commit | 07f367b57bb4a63fd58265d082e451e15f06d6a6 (patch) | |
tree | cc25f0ea9c59a28f9ec83a427dc9bb97884c9838 /src | |
parent | b350c54d487c11fb7940a0fb38fbb8f66998c7b3 (diff) | |
download | evolution-data-server-07f367b57bb4a63fd58265d082e451e15f06d6a6.tar.gz |
M!111 - addressbook: Add autocleanups
Add autocleanups support for libebook and libebook-contacts objects.
This allows to use them with g_autoptr(FooBar) for easier reference management.
Closes: https://gitlab.gnome.org/GNOME/evolution-data-server/-/merge_requests/111
Diffstat (limited to 'src')
-rw-r--r-- | src/addressbook/libebook-contacts/CMakeLists.txt | 1 | ||||
-rw-r--r-- | src/addressbook/libebook-contacts/e-book-contacts-autocleanups.h | 46 | ||||
-rw-r--r-- | src/addressbook/libebook-contacts/libebook-contacts.h | 2 | ||||
-rw-r--r-- | src/addressbook/libebook/CMakeLists.txt | 1 | ||||
-rw-r--r-- | src/addressbook/libebook/e-book-autocleanups.h | 35 | ||||
-rw-r--r-- | src/addressbook/libebook/libebook.h | 2 | ||||
-rw-r--r-- | src/libebackend/e-backend-autocleanups.h | 6 |
7 files changed, 90 insertions, 3 deletions
diff --git a/src/addressbook/libebook-contacts/CMakeLists.txt b/src/addressbook/libebook-contacts/CMakeLists.txt index c4fdd87cd..febbc8dec 100644 --- a/src/addressbook/libebook-contacts/CMakeLists.txt +++ b/src/addressbook/libebook-contacts/CMakeLists.txt @@ -51,6 +51,7 @@ set(SOURCES set(HEADERS libebook-contacts.h e-address-western.h + e-book-contacts-autocleanups.h e-book-contacts-enums.h e-book-contacts-utils.h e-book-query.h diff --git a/src/addressbook/libebook-contacts/e-book-contacts-autocleanups.h b/src/addressbook/libebook-contacts/e-book-contacts-autocleanups.h new file mode 100644 index 000000000..a1b398cfe --- /dev/null +++ b/src/addressbook/libebook-contacts/e-book-contacts-autocleanups.h @@ -0,0 +1,46 @@ +/* + * e-book-contacts-autocleanups.h + * + * This library is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this library. If not, see <http://www.gnu.org/licenses/>. + * + */ + +#if !defined (__LIBEBOOK_CONTACTS_H_INSIDE__) && !defined (LIBEBOOK_CONTACTS_COMPILATION) +#error "Only <libebook-contacts/libebook-contacts.h> should be included directly." +#endif + +#ifndef __E_BOOK_CONTACTS_AUTOCLEANUPS_H__ +#define __E_BOOK_CONTACTS_AUTOCLEANUPS_H__ + +#ifndef __GI_SCANNER__ +#ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC + +G_DEFINE_AUTOPTR_CLEANUP_FUNC(EAddressWestern, e_address_western_free) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(EBookQuery, e_book_query_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(EContact, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(EContactAddress, e_contact_address_free) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(EContactCert, e_contact_cert_free) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(EContactDate, e_contact_date_free) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(EContactGeo, e_contact_geo_free) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(EContactName, e_contact_name_free) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(EContactPhoto, e_contact_photo_free) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(ENameWestern, e_name_western_free) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(EPhoneNumber, e_phone_number_free) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(ESourceBackendSummarySetup, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(EVCard, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(EVCardAttribute, e_vcard_attribute_free) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(EVCardAttributeParam, e_vcard_attribute_param_free) + +#endif /* G_DEFINE_AUTOPTR_CLEANUP_FUNC */ +#endif /* !__GI_SCANNER__ */ +#endif /* __E_BOOK_CONTACTS_AUTOCLEANUPS_H__ */ diff --git a/src/addressbook/libebook-contacts/libebook-contacts.h b/src/addressbook/libebook-contacts/libebook-contacts.h index 04e1bdb5a..cbda3f95d 100644 --- a/src/addressbook/libebook-contacts/libebook-contacts.h +++ b/src/addressbook/libebook-contacts/libebook-contacts.h @@ -33,6 +33,8 @@ #include <libebook-contacts/e-source-backend-summary-setup.h> #include <libebook-contacts/e-phone-number.h> +#include <libebook-contacts/e-book-contacts-autocleanups.h> + #undef __LIBEBOOK_CONTACTS_H_INSIDE__ #endif /* LIBEBOOK_CONTACTS_H */ diff --git a/src/addressbook/libebook/CMakeLists.txt b/src/addressbook/libebook/CMakeLists.txt index dff694bff..d0bda7d5d 100644 --- a/src/addressbook/libebook/CMakeLists.txt +++ b/src/addressbook/libebook/CMakeLists.txt @@ -27,6 +27,7 @@ set(SOURCES set(HEADERS libebook.h e-book.h + e-book-autocleanups.h e-book-client.h e-book-client-cursor.h e-book-client-view.h diff --git a/src/addressbook/libebook/e-book-autocleanups.h b/src/addressbook/libebook/e-book-autocleanups.h new file mode 100644 index 000000000..6fdbe9618 --- /dev/null +++ b/src/addressbook/libebook/e-book-autocleanups.h @@ -0,0 +1,35 @@ +/* + * e-book-autocleanups.h + * + * This library is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this library. If not, see <http://www.gnu.org/licenses/>. + * + */ + +#if !defined (__LIBEBOOK_H_INSIDE__) && !defined (LIBEBOOK_COMPILATION) +#error "Only <libebook/libebook.h> should be included directly." +#endif + +#ifndef __E_BOOK_AUTOCLEANUPS_H__ +#define __E_BOOK_AUTOCLEANUPS_H__ + +#ifndef __GI_SCANNER__ +#ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC + +G_DEFINE_AUTOPTR_CLEANUP_FUNC(EBookClient, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(EBookClientCursor, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(EBookClientView, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(EDestination, g_object_unref) + +#endif /* G_DEFINE_AUTOPTR_CLEANUP_FUNC */ +#endif /* !__GI_SCANNER__ */ +#endif /* __E_BOOK_AUTOCLEANUPS_H__ */ diff --git a/src/addressbook/libebook/libebook.h b/src/addressbook/libebook/libebook.h index ab142fd70..97548ec0b 100644 --- a/src/addressbook/libebook/libebook.h +++ b/src/addressbook/libebook/libebook.h @@ -32,6 +32,8 @@ #include <libebook/e-book.h> #include <libebook/e-destination.h> +#include <libebook/e-book-autocleanups.h> + #undef __LIBEBOOK_H_INSIDE__ #endif /* LIBEBOOK_H */ diff --git a/src/libebackend/e-backend-autocleanups.h b/src/libebackend/e-backend-autocleanups.h index f0cb7922d..8a9df6196 100644 --- a/src/libebackend/e-backend-autocleanups.h +++ b/src/libebackend/e-backend-autocleanups.h @@ -25,12 +25,12 @@ #ifndef __GI_SCANNER__ #ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC -G_DEFINE_AUTOPTR_CLEANUP_FUNC(EBackendFactory, g_object_unref) G_DEFINE_AUTOPTR_CLEANUP_FUNC(EBackend, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(EBackendFactory, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(ECache, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(ECacheColumnInfo, e_cache_column_info_free) G_DEFINE_AUTOPTR_CLEANUP_FUNC(ECacheColumnValues, e_cache_column_values_free) G_DEFINE_AUTOPTR_CLEANUP_FUNC(ECacheOfflineChange, e_cache_offline_change_free) -G_DEFINE_AUTOPTR_CLEANUP_FUNC(ECacheColumnInfo, e_cache_column_info_free) -G_DEFINE_AUTOPTR_CLEANUP_FUNC(ECache, g_object_unref) G_DEFINE_AUTOPTR_CLEANUP_FUNC(ECacheReaper, g_object_unref) G_DEFINE_AUTOPTR_CLEANUP_FUNC(ECollectionBackend, g_object_unref) G_DEFINE_AUTOPTR_CLEANUP_FUNC(ECollectionBackendFactory, g_object_unref) |