Coding style and whitespace cleanup.
authorMatthew Barnes <mbarnes@redhat.com>
Wed, 7 Sep 2011 13:52:25 +0000 (09:52 -0400)
committerMatthew Barnes <mbarnes@redhat.com>
Mon, 20 Feb 2012 14:57:34 +0000 (09:57 -0500)
177 files changed:
addressbook/backends/file/e-book-backend-file.c
addressbook/backends/google/e-book-backend-google.c
addressbook/backends/ldap/e-book-backend-ldap.c
addressbook/backends/vcf/e-book-backend-vcf.c
addressbook/backends/webdav/e-book-backend-webdav.c
addressbook/libebook/e-book-client-view.c
addressbook/libebook/e-book-client.c
addressbook/libebook/e-book-view.c
addressbook/libebook/e-book.c
addressbook/libebook/e-contact.c
addressbook/libebook/e-destination.c
addressbook/libebook/e-destination.h
addressbook/libebook/e-vcard.c
addressbook/libedata-book/e-book-backend-cache.c
addressbook/libedata-book/e-book-backend-sexp.c
addressbook/libedata-book/e-book-backend-sexp.h
addressbook/libedata-book/e-book-backend-sqlitedb.c
addressbook/libedata-book/e-book-backend-summary.c
addressbook/libedata-book/e-book-backend-summary.h
addressbook/libedata-book/e-book-backend-sync.c
addressbook/libedata-book/e-book-backend.c
addressbook/libedata-book/e-data-book-types.h
addressbook/libedata-book/e-data-book-view.c
addressbook/libegdbus/e-gdbus-book-factory.c
addressbook/libegdbus/e-gdbus-book-view.c
addressbook/libegdbus/e-gdbus-book.c
calendar/backends/caldav/e-cal-backend-caldav.c
calendar/backends/contacts/e-cal-backend-contacts.c
calendar/backends/file/e-cal-backend-file-events.c
calendar/backends/file/e-cal-backend-file-journal.c
calendar/backends/file/e-cal-backend-file-todos.c
calendar/backends/file/e-cal-backend-file.c
calendar/backends/http/e-cal-backend-http.c
calendar/backends/weather/e-cal-backend-weather.c
calendar/libecal/e-cal-client-view.c
calendar/libecal/e-cal-client.c
calendar/libecal/e-cal-component.c
calendar/libecal/e-cal-system-timezone.c
calendar/libecal/e-cal-view.c
calendar/libecal/e-cal.c
calendar/libedata-cal/e-cal-backend-cache.c
calendar/libedata-cal/e-cal-backend-file-store.c
calendar/libedata-cal/e-cal-backend-intervaltree.c
calendar/libedata-cal/e-cal-backend-sexp.c
calendar/libedata-cal/e-cal-backend-store.c
calendar/libedata-cal/e-cal-backend-sync.c
calendar/libedata-cal/e-cal-backend.c
calendar/libedata-cal/e-data-cal-factory.c
calendar/libedata-cal/e-data-cal-view.c
calendar/libedata-cal/e-data-cal.c
calendar/libegdbus/e-gdbus-cal-factory.c
calendar/libegdbus/e-gdbus-cal-view.c
calendar/libegdbus/e-gdbus-cal.c
camel/camel-certdb.c
camel/camel-cipher-context.c
camel/camel-data-cache.c
camel/camel-disco-folder.c
camel/camel-filter-driver.c
camel/camel-filter-search.c
camel/camel-folder-search.c
camel/camel-folder-summary.c
camel/camel-folder.c
camel/camel-folder.h
camel/camel-gpg-context.c
camel/camel-index.c
camel/camel-medium.c
camel/camel-mime-filter-basic.c
camel/camel-mime-filter-bestenc.c
camel/camel-mime-filter-canon.c
camel/camel-mime-filter-charset.c
camel/camel-mime-filter-crlf.c
camel/camel-mime-filter-enriched.c
camel/camel-mime-filter-from.c
camel/camel-mime-filter-gzip.c
camel/camel-mime-filter-html.c
camel/camel-mime-filter-index.c
camel/camel-mime-filter-linewrap.c
camel/camel-mime-filter-pgp.c
camel/camel-mime-filter-progress.c
camel/camel-mime-filter-save.c
camel/camel-mime-filter-tohtml.c
camel/camel-mime-filter-windows.c
camel/camel-mime-filter-yenc.c
camel/camel-mime-filter.c
camel/camel-mime-parser.c
camel/camel-mime-part.c
camel/camel-mime-utils.c
camel/camel-object-bag.c
camel/camel-object.c
camel/camel-offline-folder.c
camel/camel-operation.c
camel/camel-partition-table.c
camel/camel-sasl-cram-md5.c
camel/camel-sasl-digest-md5.c
camel/camel-sasl-gssapi.c
camel/camel-sasl-login.c
camel/camel-sasl-ntlm.c
camel/camel-sasl-plain.c
camel/camel-sasl-popb4smtp.c
camel/camel-sasl.c
camel/camel-search-private.c
camel/camel-service.c
camel/camel-session.c
camel/camel-sexp.c
camel/camel-smime-context.c
camel/camel-store-summary.c
camel/camel-stream-buffer.c
camel/camel-stream-filter.c
camel/camel-stream-fs.c
camel/camel-stream-mem.c
camel/camel-tcp-stream-raw.c
camel/camel-tcp-stream-ssl.c
camel/camel-tcp-stream.c
camel/camel-text-index.c
camel/camel-transport.c
camel/camel-vee-folder.c
camel/providers/imap/camel-imap-command.c
camel/providers/imap/camel-imap-folder.c
camel/providers/imap/camel-imap-private.h
camel/providers/imap/camel-imap-wrapper.c
camel/providers/imapx/camel-imapx-folder.c
camel/providers/imapx/camel-imapx-provider.c
camel/providers/imapx/camel-imapx-server.c
camel/providers/imapx/camel-imapx-server.h
camel/providers/imapx/camel-imapx-store.c
camel/providers/imapx/camel-imapx-utils.c
camel/providers/local/camel-local-folder.c
camel/providers/local/camel-local-private.h
camel/providers/local/camel-maildir-store.c
camel/providers/local/camel-maildir-summary.c
camel/providers/local/camel-mbox-store.c
camel/providers/local/camel-mh-summary.c
camel/providers/nntp/camel-nntp-folder.c
camel/providers/nntp/camel-nntp-private.h
camel/providers/nntp/camel-nntp-store.c
camel/providers/nntp/camel-nntp-summary.c
camel/providers/pop3/camel-pop3-folder.c
camel/providers/pop3/camel-pop3-folder.h
camel/providers/pop3/camel-pop3-provider.c
camel/providers/pop3/camel-pop3-settings.c
camel/providers/pop3/camel-pop3-settings.h
libebackend/e-dbus-server.c
libebackend/e-extension.c
libebackend/e-file-cache.c
libebackend/e-module.c
libebackend/e-offline-listener.c
libedataserver/e-account-list.c
libedataserver/e-categories.c
libedataserver/e-client.c
libedataserver/e-iterator.c
libedataserver/e-list-iterator.c
libedataserver/e-list.c
libedataserver/e-proxy.c
libedataserver/e-sexp.c
libedataserver/e-source-group.c
libedataserver/e-source-list.c
libedataserver/e-source.c
libedataserverui/e-categories-dialog.c
libedataserverui/e-categories-editor.c
libedataserverui/e-categories-selector.c
libedataserverui/e-category-completion.c
libedataserverui/e-category-editor.c
libedataserverui/e-cell-renderer-color.c
libedataserverui/e-contact-store.c
libedataserverui/e-destination-store.c
libedataserverui/e-name-selector-dialog.c
libedataserverui/e-name-selector-entry.c
libedataserverui/e-name-selector-list.c
libedataserverui/e-name-selector-model.c
libedataserverui/e-name-selector.c
libedataserverui/e-source-combo-box.c
libedataserverui/e-source-selector-dialog.c
libedataserverui/e-source-selector.c
libedataserverui/e-tree-model-generator.c
tests/libebook/test-vcard-parsing.c
tests/libecal/client/test-client-get-revision.c
tests/libecal/test-ecal.c

index b73ebef..f5d3087 100644 (file)
 
 #include "e-book-backend-file.h"
 
+#define E_BOOK_BACKEND_FILE_GET_PRIVATE(obj) \
+       (G_TYPE_INSTANCE_GET_PRIVATE \
+       ((obj), E_TYPE_BOOK_BACKEND_FILE, EBookBackendFilePrivate))
+
 #define d(x)
 
 #define CHANGES_DB_SUFFIX ".changes.db"
@@ -2366,17 +2370,16 @@ e_book_backend_file_dispose (GObject *object)
 static void
 e_book_backend_file_finalize (GObject *object)
 {
-       EBookBackendFile *bf;
+       EBookBackendFilePrivate *priv;
 
-       bf = E_BOOK_BACKEND_FILE (object);
+       priv = E_BOOK_BACKEND_FILE_GET_PRIVATE (object);
 
-       g_free (bf->priv->filename);
-       g_free (bf->priv->dirname);
-       g_free (bf->priv->photo_dirname);
-       g_free (bf->priv->revision);
-
-       g_free (bf->priv);
+       g_free (priv->filename);
+       g_free (priv->dirname);
+       g_free (priv->photo_dirname);
+       g_free (priv->revision);
 
+       /* Chain up to parent's finalize() method. */
        G_OBJECT_CLASS (e_book_backend_file_parent_class)->finalize (object);
 }
 
@@ -2429,14 +2432,16 @@ my_unlink (const gchar *name)
 #endif
 
 static void
-e_book_backend_file_class_init (EBookBackendFileClass *klass)
+e_book_backend_file_class_init (EBookBackendFileClass *class)
 {
-       GObjectClass    *object_class = G_OBJECT_CLASS (klass);
+       GObjectClass    *object_class = G_OBJECT_CLASS (class);
        EBookBackendSyncClass *sync_class;
        EBookBackendClass *backend_class;
 
-       sync_class = E_BOOK_BACKEND_SYNC_CLASS (klass);
-       backend_class = E_BOOK_BACKEND_CLASS (klass);
+       g_type_class_add_private (class, sizeof (EBookBackendFilePrivate));
+
+       sync_class = E_BOOK_BACKEND_SYNC_CLASS (class);
+       backend_class = E_BOOK_BACKEND_CLASS (class);
 
        /* Set the virtual methods. */
        backend_class->start_book_view          = e_book_backend_file_start_book_view;
@@ -2473,10 +2478,7 @@ e_book_backend_file_class_init (EBookBackendFileClass *klass)
 static void
 e_book_backend_file_init (EBookBackendFile *backend)
 {
-       EBookBackendFilePrivate *priv;
-
-       priv          = g_new0 (EBookBackendFilePrivate, 1);
-       backend->priv = priv;
+       backend->priv = E_BOOK_BACKEND_FILE_GET_PRIVATE (backend);
 
        g_signal_connect (
                backend, "notify::online",
index 4626e90..bc6234d 100644 (file)
 #include "e-gdata-goa-authorizer.h"
 #endif
 
+#define E_BOOK_BACKEND_GOOGLE_GET_PRIVATE(obj) \
+       (G_TYPE_INSTANCE_GET_PRIVATE \
+       ((obj), E_TYPE_BOOK_BACKEND_GOOGLE, EBookBackendGooglePrivate))
+
 #define CLIENT_ID "evolution-client-0.1.0"
 
 #define URI_GET_CONTACTS "://www.google.com/m8/feeds/contacts/default/full"
@@ -138,9 +142,11 @@ static void
 cache_init (EBookBackend *backend,
             gboolean on_disk)
 {
-       EBookBackendGooglePrivate *priv = E_BOOK_BACKEND_GOOGLE (backend)->priv;
+       EBookBackendGooglePrivate *priv;
        const gchar *cache_dir;
 
+       priv = E_BOOK_BACKEND_GOOGLE_GET_PRIVATE (backend);
+
        cache_dir = e_book_backend_get_cache_dir (backend);
 
        if (on_disk) {
@@ -164,10 +170,12 @@ static EContact *
 cache_add_contact (EBookBackend *backend,
                    GDataEntry *entry)
 {
-       EBookBackendGooglePrivate *priv = E_BOOK_BACKEND_GOOGLE (backend)->priv;
+       EBookBackendGooglePrivate *priv;
        EContact *contact;
        const gchar *uid;
 
+       priv = E_BOOK_BACKEND_GOOGLE_GET_PRIVATE (backend);
+
        switch (priv->cache_type) {
        case ON_DISK_CACHE:
                contact = _e_contact_new_from_gdata_entry (backend, entry);
@@ -193,9 +201,11 @@ static gboolean
 cache_remove_contact (EBookBackend *backend,
                       const gchar *uid)
 {
-       EBookBackendGooglePrivate *priv = E_BOOK_BACKEND_GOOGLE (backend)->priv;
+       EBookBackendGooglePrivate *priv;
        gboolean success = TRUE;
 
+       priv = E_BOOK_BACKEND_GOOGLE_GET_PRIVATE (backend);
+
        switch (priv->cache_type) {
        case ON_DISK_CACHE:
                return e_book_backend_cache_remove_contact (priv->cache.on_disk, uid);
@@ -214,7 +224,9 @@ static gboolean
 cache_has_contact (EBookBackend *backend,
                    const gchar *uid)
 {
-       EBookBackendGooglePrivate *priv = E_BOOK_BACKEND_GOOGLE (backend)->priv;
+       EBookBackendGooglePrivate *priv;
+
+       priv = E_BOOK_BACKEND_GOOGLE_GET_PRIVATE (backend);
 
        switch (priv->cache_type) {
        case ON_DISK_CACHE:
@@ -234,9 +246,11 @@ cache_get_contact (EBookBackend *backend,
                    const gchar *uid,
                    GDataEntry **entry)
 {
-       EBookBackendGooglePrivate *priv = E_BOOK_BACKEND_GOOGLE (backend)->priv;
+       EBookBackendGooglePrivate *priv;
        EContact *contact;
 
+       priv = E_BOOK_BACKEND_GOOGLE_GET_PRIVATE (backend);
+
        switch (priv->cache_type) {
        case ON_DISK_CACHE:
                contact = e_book_backend_cache_get_contact (priv->cache.on_disk, uid);
@@ -296,9 +310,11 @@ _g_hash_table_to_list (GHashTable *ht)
 static GList *
 cache_get_contacts (EBookBackend *backend)
 {
-       EBookBackendGooglePrivate *priv = E_BOOK_BACKEND_GOOGLE (backend)->priv;
+       EBookBackendGooglePrivate *priv;
        GList *contacts, *iter;
 
+       priv = E_BOOK_BACKEND_GOOGLE_GET_PRIVATE (backend);
+
        switch (priv->cache_type) {
        case ON_DISK_CACHE:
                contacts = e_book_backend_cache_get_contacts (priv->cache.on_disk, "(contains \"x-evolution-any-field\" \"\")");
@@ -319,7 +335,9 @@ cache_get_contacts (EBookBackend *backend)
 static void
 cache_freeze (EBookBackend *backend)
 {
-       EBookBackendGooglePrivate *priv = E_BOOK_BACKEND_GOOGLE (backend)->priv;
+       EBookBackendGooglePrivate *priv;
+
+       priv = E_BOOK_BACKEND_GOOGLE_GET_PRIVATE (backend);
 
        if (priv->cache_type == ON_DISK_CACHE)
                e_file_cache_freeze_changes (E_FILE_CACHE (priv->cache.on_disk));
@@ -328,7 +346,9 @@ cache_freeze (EBookBackend *backend)
 static void
 cache_thaw (EBookBackend *backend)
 {
-       EBookBackendGooglePrivate *priv = E_BOOK_BACKEND_GOOGLE (backend)->priv;
+       EBookBackendGooglePrivate *priv;
+
+       priv = E_BOOK_BACKEND_GOOGLE_GET_PRIVATE (backend);
 
        if (priv->cache_type == ON_DISK_CACHE)
                e_file_cache_thaw_changes (E_FILE_CACHE (priv->cache.on_disk));
@@ -337,7 +357,9 @@ cache_thaw (EBookBackend *backend)
 static gchar *
 cache_get_last_update (EBookBackend *backend)
 {
-       EBookBackendGooglePrivate *priv = E_BOOK_BACKEND_GOOGLE (backend)->priv;
+       EBookBackendGooglePrivate *priv;
+
+       priv = E_BOOK_BACKEND_GOOGLE_GET_PRIVATE (backend);
 
        switch (priv->cache_type) {
        case ON_DISK_CACHE:
@@ -358,10 +380,12 @@ static gboolean
 cache_get_last_update_tv (EBookBackend *backend,
                           GTimeVal *tv)
 {
-       EBookBackendGooglePrivate *priv = E_BOOK_BACKEND_GOOGLE (backend)->priv;
+       EBookBackendGooglePrivate *priv;
        gchar *last_update;
        gint rv;
 
+       priv = E_BOOK_BACKEND_GOOGLE_GET_PRIVATE (backend);
+
        switch (priv->cache_type) {
        case ON_DISK_CACHE:
                last_update = e_book_backend_cache_get_time (priv->cache.on_disk);
@@ -383,9 +407,11 @@ static void
 cache_set_last_update (EBookBackend *backend,
                        GTimeVal *tv)
 {
-       EBookBackendGooglePrivate *priv = E_BOOK_BACKEND_GOOGLE (backend)->priv;
+       EBookBackendGooglePrivate *priv;
        gchar *_time;
 
+       priv = E_BOOK_BACKEND_GOOGLE_GET_PRIVATE (backend);
+
        switch (priv->cache_type) {
        case ON_DISK_CACHE:
                _time = g_time_val_to_iso8601 (tv);
@@ -406,11 +432,13 @@ static gboolean
 cache_needs_update (EBookBackend *backend,
                     guint *remaining_secs)
 {
-       EBookBackendGooglePrivate *priv = E_BOOK_BACKEND_GOOGLE (backend)->priv;
+       EBookBackendGooglePrivate *priv;
        GTimeVal last, current;
        guint diff;
        gboolean rv;
 
+       priv = E_BOOK_BACKEND_GOOGLE_GET_PRIVATE (backend);
+
        if (remaining_secs)
                *remaining_secs = G_MAXUINT;
 
@@ -448,7 +476,7 @@ backend_is_authorized (EBookBackend *backend)
 {
        EBookBackendGooglePrivate *priv;
 
-       priv = E_BOOK_BACKEND_GOOGLE (backend)->priv;
+       priv = E_BOOK_BACKEND_GOOGLE_GET_PRIVATE (backend);
 
        if (priv->service == NULL)
                return FALSE;
@@ -469,9 +497,11 @@ static void
 on_contact_added (EBookBackend *backend,
                   EContact *contact)
 {
-       EBookBackendGooglePrivate *priv = E_BOOK_BACKEND_GOOGLE (backend)->priv;
+       EBookBackendGooglePrivate *priv;
        GList *iter;
 
+       priv = E_BOOK_BACKEND_GOOGLE_GET_PRIVATE (backend);
+
        if (!priv->live_mode)
                return;
 
@@ -483,9 +513,11 @@ static void
 on_contact_removed (EBookBackend *backend,
                     const gchar *uid)
 {
-       EBookBackendGooglePrivate *priv = E_BOOK_BACKEND_GOOGLE (backend)->priv;
+       EBookBackendGooglePrivate *priv;
        GList *iter;
 
+       priv = E_BOOK_BACKEND_GOOGLE_GET_PRIVATE (backend);
+
        if (!priv->live_mode)
                return;
 
@@ -497,9 +529,11 @@ static void
 on_contact_changed (EBookBackend *backend,
                     EContact *contact)
 {
-       EBookBackendGooglePrivate *priv = E_BOOK_BACKEND_GOOGLE (backend)->priv;
+       EBookBackendGooglePrivate *priv;
        GList *iter;
 
+       priv = E_BOOK_BACKEND_GOOGLE_GET_PRIVATE (backend);
+
        if (!priv->live_mode)
                return;
 
@@ -513,9 +547,11 @@ start_operation (EBookBackend *backend,
                  GCancellable *cancellable,
                  const gchar *message)
 {
-       EBookBackendGooglePrivate *priv = E_BOOK_BACKEND_GOOGLE (backend)->priv;
+       EBookBackendGooglePrivate *priv;
        GList *iter;
 
+       priv = E_BOOK_BACKEND_GOOGLE_GET_PRIVATE (backend);
+
        /* Insert the operation into the set of active cancellable operations */
        if (cancellable)
                g_object_ref (cancellable);
@@ -535,9 +571,11 @@ finish_operation (EBookBackend *backend,
                   guint32 opid,
                   const GError *gdata_error)
 {
-       EBookBackendGooglePrivate *priv = E_BOOK_BACKEND_GOOGLE (backend)->priv;
+       EBookBackendGooglePrivate *priv;
        GError *book_error = NULL;
 
+       priv = E_BOOK_BACKEND_GOOGLE_GET_PRIVATE (backend);
+
        if (gdata_error != NULL) {
                data_book_error_from_gdata_error (&book_error, gdata_error);
                __debug__ ("Book view query failed: %s", book_error->message);
@@ -682,10 +720,13 @@ process_contact_cb (GDataEntry *entry,
                     guint entry_count,
                     GetContactsData *data)
 {
+       EBookBackendGooglePrivate *priv;
        EBookBackend *backend = data->backend;
        gboolean is_deleted, is_cached;
        const gchar *uid;
 
+       priv = E_BOOK_BACKEND_GOOGLE_GET_PRIVATE (backend);
+
        __debug__ (G_STRFUNC);
        uid = gdata_entry_get_id (entry);
        is_deleted = gdata_contacts_contact_is_deleted (GDATA_CONTACTS_CONTACT (entry));
@@ -747,7 +788,7 @@ process_contact_cb (GDataEntry *entry,
 
                        /* Download the photo. */
                        gdata_contacts_contact_get_photo_async (GDATA_CONTACTS_CONTACT (entry),
-                                                               GDATA_CONTACTS_SERVICE (E_BOOK_BACKEND_GOOGLE (backend)->priv->service), cancellable,
+                                                               GDATA_CONTACTS_SERVICE (priv->service), cancellable,
                                                                (GAsyncReadyCallback) process_contact_photo_cb, photo_data);
 
                        g_object_unref (cancellable);
@@ -802,13 +843,15 @@ get_new_contacts_cb (GDataService *service,
 static void
 get_new_contacts (EBookBackend *backend)
 {
-       EBookBackendGooglePrivate *priv = E_BOOK_BACKEND_GOOGLE (backend)->priv;
+       EBookBackendGooglePrivate *priv;
        gchar *last_updated;
        GTimeVal updated;
        GDataQuery *query;
        GCancellable *cancellable;
        GetContactsData *data;
 
+       priv = E_BOOK_BACKEND_GOOGLE_GET_PRIVATE (backend);
+
        __debug__ (G_STRFUNC);
        g_return_if_fail (backend_is_authorized (backend));
 
@@ -896,11 +939,13 @@ process_group (GDataEntry *entry,
                guint entry_count,
                EBookBackend *backend)
 {
-       EBookBackendGooglePrivate *priv = E_BOOK_BACKEND_GOOGLE (backend)->priv;
+       EBookBackendGooglePrivate *priv;
        const gchar *uid;
        gchar *name;
        gboolean is_deleted;
 
+       priv = E_BOOK_BACKEND_GOOGLE_GET_PRIVATE (backend);
+
        __debug__ (G_STRFUNC);
        uid = gdata_entry_get_id (entry);
        name = sanitise_group_name (entry);
@@ -925,10 +970,12 @@ get_groups_cb (GDataService *service,
                GAsyncResult *result,
                EBookBackend *backend)
 {
-       EBookBackendGooglePrivate *priv = E_BOOK_BACKEND_GOOGLE (backend)->priv;
+       EBookBackendGooglePrivate *priv;
        GDataFeed *feed;
        GError *gdata_error = NULL;
 
+       priv = E_BOOK_BACKEND_GOOGLE_GET_PRIVATE (backend);
+
        __debug__ (G_STRFUNC);
        feed = gdata_service_query_finish (service, result, &gdata_error);
        if (__e_book_backend_google_debug__ && feed) {
@@ -952,10 +999,12 @@ get_groups_cb (GDataService *service,
 static void
 get_groups (EBookBackend *backend)
 {
-       EBookBackendGooglePrivate *priv = E_BOOK_BACKEND_GOOGLE (backend)->priv;
+       EBookBackendGooglePrivate *priv;
        GDataQuery *query;
        GCancellable *cancellable;
 
+       priv = E_BOOK_BACKEND_GOOGLE_GET_PRIVATE (backend);
+
        __debug__ (G_STRFUNC);
        g_return_if_fail (backend_is_authorized (backend));
 
@@ -987,10 +1036,12 @@ create_group (EBookBackend *backend,
               const gchar *category_name,
               GError **error)
 {
-       EBookBackendGooglePrivate *priv = E_BOOK_BACKEND_GOOGLE (backend)->priv;
+       EBookBackendGooglePrivate *priv;
        GDataEntry *group, *new_group;
        gchar *uid;
 
+       priv = E_BOOK_BACKEND_GOOGLE_GET_PRIVATE (backend);
+
        group = GDATA_ENTRY (gdata_contacts_group_new (NULL));
 
        gdata_entry_set_title (group, category_name);
@@ -1020,7 +1071,9 @@ static gboolean cache_refresh_if_needed (EBookBackend *backend);
 static gboolean
 on_refresh_timeout (EBookBackend *backend)
 {
-       EBookBackendGooglePrivate *priv = E_BOOK_BACKEND_GOOGLE (backend)->priv;
+       EBookBackendGooglePrivate *priv;
+
+       priv = E_BOOK_BACKEND_GOOGLE_GET_PRIVATE (backend);
 
        __debug__ (G_STRFUNC);
 
@@ -1034,11 +1087,13 @@ on_refresh_timeout (EBookBackend *backend)
 static gboolean
 cache_refresh_if_needed (EBookBackend *backend)
 {
-       EBookBackendGooglePrivate *priv = E_BOOK_BACKEND_GOOGLE (backend)->priv;
+       EBookBackendGooglePrivate *priv;
        guint remaining_secs;
        gboolean install_timeout;
        gboolean is_online;
 
+       priv = E_BOOK_BACKEND_GOOGLE_GET_PRIVATE (backend);
+
        __debug__ (G_STRFUNC);
 
        is_online = e_backend_get_online (E_BACKEND (backend));
@@ -1068,7 +1123,9 @@ cache_refresh_if_needed (EBookBackend *backend)
 static void
 cache_destroy (EBookBackend *backend)
 {
-       EBookBackendGooglePrivate *priv = E_BOOK_BACKEND_GOOGLE (backend)->priv;
+       EBookBackendGooglePrivate *priv;
+
+       priv = E_BOOK_BACKEND_GOOGLE_GET_PRIVATE (backend);
 
        switch (priv->cache_type) {
        case ON_DISK_CACHE:
@@ -1094,7 +1151,7 @@ proxy_settings_changed (EProxy *proxy,
        SoupURI *proxy_uri = NULL;
        gchar *uri;
 
-       priv = E_BOOK_BACKEND_GOOGLE (backend)->priv;
+       priv = E_BOOK_BACKEND_GOOGLE_GET_PRIVATE (backend);
 
        if (!priv || !priv->service)
                return;
@@ -1117,7 +1174,7 @@ request_authorization (EBookBackend *backend)
 {
        EBookBackendGooglePrivate *priv;
 
-       priv = E_BOOK_BACKEND_GOOGLE (backend)->priv;
+       priv = E_BOOK_BACKEND_GOOGLE_GET_PRIVATE (backend);
 
        /* Make sure we have the GDataService configured
         * before requesting authorization. */
@@ -1264,8 +1321,11 @@ create_contact_photo_cb (GDataContactsContact *contact,
                          GAsyncResult *async_result,
                          CreateContactData *data)
 {
+       EBookBackendGooglePrivate *priv;
        GError *gdata_error = NULL;
 
+       priv = E_BOOK_BACKEND_GOOGLE_GET_PRIVATE (data->backend);
+
        __debug__ (G_STRFUNC);
 
        gdata_contacts_contact_set_photo_finish (contact, async_result, &gdata_error);
@@ -1276,7 +1336,7 @@ create_contact_photo_cb (GDataContactsContact *contact,
                data->photo = NULL;
 
                /* We now have to re-query for the contact, since setting its photo changes the contact's ETag. */
-               gdata_service_query_single_entry_async (E_BOOK_BACKEND_GOOGLE (data->backend)->priv->service,
+               gdata_service_query_single_entry_async (priv->service,
                                                        gdata_contacts_service_get_primary_authorization_domain (),
                                                        gdata_entry_get_id (GDATA_ENTRY (contact)), NULL, GDATA_TYPE_CONTACTS_CONTACT,
                                                        data->cancellable, (GAsyncReadyCallback) create_contact_photo_query_cb, data);
@@ -1347,13 +1407,15 @@ e_book_backend_google_create_contacts (EBookBackend *backend,
                                        GCancellable *cancellable,
                                        const GSList *vcards)
 {
-       EBookBackendGooglePrivate *priv = E_BOOK_BACKEND_GOOGLE (backend)->priv;
+       EBookBackendGooglePrivate *priv;
        EContact *contact;
        GDataEntry *entry;
        gchar *xml;
        CreateContactData *data;
        const gchar *vcard_str = (const gchar *) vcards->data;
 
+       priv = E_BOOK_BACKEND_GOOGLE_GET_PRIVATE (backend);
+
        /* We make the assumption that the vCard list we're passed is always exactly one element long, since we haven't specified "bulk-adds"
         * in our static capability list. This simplifies a lot of the logic, especially around asynchronous results. */
        if (vcards->next != NULL) {
@@ -1453,12 +1515,14 @@ e_book_backend_google_remove_contacts (EBookBackend *backend,
                                        GCancellable *cancellable,
                                        const GSList *id_list)
 {
-       EBookBackendGooglePrivate *priv = E_BOOK_BACKEND_GOOGLE (backend)->priv;
+       EBookBackendGooglePrivate *priv;
        const gchar *uid = id_list->data;
        GDataEntry *entry = NULL;
        EContact *cached_contact;
        RemoveContactData *data;
 
+       priv = E_BOOK_BACKEND_GOOGLE_GET_PRIVATE (backend);
+
        __debug__ (G_STRFUNC);
 
        if (!e_backend_get_online (E_BACKEND (backend))) {
@@ -1612,8 +1676,11 @@ modify_contact_photo_cb (GDataContactsContact *contact,
                          GAsyncResult *async_result,
                          ModifyContactData *data)
 {
+       EBookBackendGooglePrivate *priv;
        GError *gdata_error = NULL;
 
+       priv = E_BOOK_BACKEND_GOOGLE_GET_PRIVATE (data->backend);
+
        __debug__ (G_STRFUNC);
 
        gdata_contacts_contact_set_photo_finish (contact, async_result, &gdata_error);
@@ -1628,7 +1695,7 @@ modify_contact_photo_cb (GDataContactsContact *contact,
                }
 
                /* We now have to re-query for the contact, since setting its photo changes the contact's ETag. */
-               gdata_service_query_single_entry_async (E_BOOK_BACKEND_GOOGLE (data->backend)->priv->service,
+               gdata_service_query_single_entry_async (priv->service,
                                                        gdata_contacts_service_get_primary_authorization_domain (),
                                                        gdata_entry_get_id (GDATA_ENTRY (contact)), NULL, GDATA_TYPE_CONTACTS_CONTACT,
                                                        data->cancellable, (GAsyncReadyCallback) modify_contact_photo_query_cb, data);
@@ -1724,7 +1791,7 @@ e_book_backend_google_modify_contacts (EBookBackend *backend,
                                       GCancellable *cancellable,
                                       const GSList *vcards)
 {
-       EBookBackendGooglePrivate *priv = E_BOOK_BACKEND_GOOGLE (backend)->priv;
+       EBookBackendGooglePrivate *priv;
        EContact *contact, *cached_contact;
        EContactPhoto *old_photo, *new_photo;
        GDataEntry *entry = NULL;
@@ -1732,6 +1799,8 @@ e_book_backend_google_modify_contacts (EBookBackend *backend,
        ModifyContactData *data;
        const gchar *vcard_str = vcards->data;
 
+       priv = E_BOOK_BACKEND_GOOGLE_GET_PRIVATE (backend);
+
        __debug__ (G_STRFUNC);
 
        __debug__ ("Updating: %s", vcard_str);
@@ -1934,7 +2003,9 @@ e_book_backend_google_get_contact_list_uids (EBookBackend *backend,
 static gboolean
 on_refresh_idle (EBookBackend *backend)
 {
-       EBookBackendGooglePrivate *priv = E_BOOK_BACKEND_GOOGLE (backend)->priv;
+       EBookBackendGooglePrivate *priv;
+
+       priv = E_BOOK_BACKEND_GOOGLE_GET_PRIVATE (backend);
 
        priv->idle_id = 0;
        cache_refresh_if_needed (backend);
@@ -1946,7 +2017,9 @@ static void
 set_live_mode (EBookBackend *backend,
                gboolean live_mode)
 {
-       EBookBackendGooglePrivate *priv = E_BOOK_BACKEND_GOOGLE (backend)->priv;
+       EBookBackendGooglePrivate *priv;
+
+       priv = E_BOOK_BACKEND_GOOGLE_GET_PRIVATE (backend);
 
        __debug__ (G_STRFUNC);
 
@@ -1969,12 +2042,14 @@ static void
 e_book_backend_google_start_book_view (EBookBackend *backend,
                                        EDataBookView *bookview)
 {
-       EBookBackendGooglePrivate *priv = E_BOOK_BACKEND_GOOGLE (backend)->priv;
+       EBookBackendGooglePrivate *priv;
        GList *cached_contacts;
 
        g_return_if_fail (E_IS_BOOK_BACKEND_GOOGLE (backend));
        g_return_if_fail (E_IS_DATA_BOOK_VIEW (bookview));
 
+       priv = E_BOOK_BACKEND_GOOGLE_GET_PRIVATE (backend);
+
        __debug__ (G_STRFUNC);
 
        priv->bookviews = g_list_append (priv->bookviews, bookview);
@@ -2014,9 +2089,11 @@ static void
 e_book_backend_google_stop_book_view (EBookBackend *backend,
                                       EDataBookView *bookview)
 {
-       EBookBackendGooglePrivate *priv = E_BOOK_BACKEND_GOOGLE (backend)->priv;
+       EBookBackendGooglePrivate *priv;
        GList *view;
 
+       priv = E_BOOK_BACKEND_GOOGLE_GET_PRIVATE (backend);
+
        __debug__ (G_STRFUNC);
 
        /* Remove the view from the list of active views */
@@ -2069,10 +2146,12 @@ e_book_backend_google_authenticate_user (EBookBackend *backend,
                                          GCancellable *cancellable,
                                          ECredentials *credentials)
 {
-       EBookBackendGooglePrivate *priv = E_BOOK_BACKEND_GOOGLE (backend)->priv;
+       EBookBackendGooglePrivate *priv;
        AuthenticateUserData *data;
        guint32 opid;
 
+       priv = E_BOOK_BACKEND_GOOGLE_GET_PRIVATE (backend);
+
        __debug__ (G_STRFUNC);
 
        if (!e_backend_get_online (E_BACKEND (backend))) {
@@ -2135,13 +2214,15 @@ e_book_backend_google_open (EBookBackend *backend,
                             GCancellable *cancellable,
                             gboolean only_if_exists)
 {
-       EBookBackendGooglePrivate *priv = E_BOOK_BACKEND_GOOGLE (backend)->priv;
+       EBookBackendGooglePrivate *priv;
        const gchar *refresh_interval_str, *use_ssl_str, *use_cache_str;
        guint refresh_interval;
        gboolean use_ssl, use_cache;
        ESource *source;
        gboolean is_online;
 
+       priv = E_BOOK_BACKEND_GOOGLE_GET_PRIVATE (backend);
+
        __debug__ (G_STRFUNC);
 
        if (priv->cancellables && backend_is_authorized (backend)) {
@@ -2374,10 +2455,12 @@ e_book_backend_google_get_backend_property (EBookBackend *backend,
 static void
 google_cancel_all_operations (EBookBackend *backend)
 {
+       EBookBackendGooglePrivate *priv;
        GHashTableIter iter;
        gpointer opid_ptr;
        GCancellable *cancellable;
-       EBookBackendGooglePrivate *priv = E_BOOK_BACKEND_GOOGLE (backend)->priv;
+
+       priv = E_BOOK_BACKEND_GOOGLE_GET_PRIVATE (backend);
 
        __debug__ (G_STRFUNC);
 
@@ -2395,9 +2478,11 @@ static void
 e_book_backend_google_notify_online_cb (EBookBackend *backend,
                                         GParamSpec *pspec)
 {
-       EBookBackendGooglePrivate *priv = E_BOOK_BACKEND_GOOGLE (backend)->priv;
+       EBookBackendGooglePrivate *priv;
        gboolean is_online;
 
+       priv = E_BOOK_BACKEND_GOOGLE_GET_PRIVATE (backend);
+
        __debug__ (G_STRFUNC);
 
        is_online = e_backend_get_online (E_BACKEND (backend));
@@ -2425,7 +2510,9 @@ e_book_backend_google_notify_online_cb (EBookBackend *backend,
 static void
 e_book_backend_google_dispose (GObject *object)
 {
-       EBookBackendGooglePrivate *priv = E_BOOK_BACKEND_GOOGLE (object)->priv;
+       EBookBackendGooglePrivate *priv;
+
+       priv = E_BOOK_BACKEND_GOOGLE_GET_PRIVATE (object);
 
        __debug__ (G_STRFUNC);
 
@@ -2462,7 +2549,9 @@ e_book_backend_google_dispose (GObject *object)
 static void
 e_book_backend_google_finalize (GObject *object)
 {
-       EBookBackendGooglePrivate *priv = E_BOOK_BACKEND_GOOGLE (object)->priv;
+       EBookBackendGooglePrivate *priv;
+
+       priv = E_BOOK_BACKEND_GOOGLE_GET_PRIVATE (object);
 
        __debug__ (G_STRFUNC);
 
@@ -2476,12 +2565,12 @@ e_book_backend_google_finalize (GObject *object)
 }
 
 static void
-e_book_backend_google_class_init (EBookBackendGoogleClass *klass)
+e_book_backend_google_class_init (EBookBackendGoogleClass *class)
 {
-       GObjectClass *object_class = G_OBJECT_CLASS (klass);
-       EBookBackendClass *backend_class = E_BOOK_BACKEND_CLASS (klass);
+       GObjectClass *object_class = G_OBJECT_CLASS (class);
+       EBookBackendClass *backend_class = E_BOOK_BACKEND_CLASS (class);
 
-       g_type_class_add_private (klass, sizeof (EBookBackendGooglePrivate));
+       g_type_class_add_private (class, sizeof (EBookBackendGooglePrivate));
 
        /* Set the virtual methods. */
        backend_class->open                     = e_book_backend_google_open;
@@ -2507,9 +2596,8 @@ static void
 e_book_backend_google_init (EBookBackendGoogle *backend)
 {
        __debug__ (G_STRFUNC);
-       backend->priv = G_TYPE_INSTANCE_GET_PRIVATE (
-               backend, E_TYPE_BOOK_BACKEND_GOOGLE,
-               EBookBackendGooglePrivate);
+
+       backend->priv = E_BOOK_BACKEND_GOOGLE_GET_PRIVATE (backend);
 
        g_signal_connect (
                backend, "notify::online",
@@ -2652,7 +2740,7 @@ _gdata_entry_update_from_e_contact (EBookBackend *backend,
                                     GDataEntry *entry,
                                     EContact *contact)
 {
-       EBookBackendGooglePrivate *priv = E_BOOK_BACKEND_GOOGLE (backend)->priv;
+       EBookBackendGooglePrivate *priv;
        GList *attributes, *iter, *category_names;
        EContactName *name_struct = NULL;
        EContactPhoto *photo;
@@ -2672,6 +2760,8 @@ _gdata_entry_update_from_e_contact (EBookBackend *backend,
 #endif
 #endif
 
+       priv = E_BOOK_BACKEND_GOOGLE_GET_PRIVATE (backend);
+
        attributes = e_vcard_get_attributes (E_VCARD (contact));
 
        /* N and FN */
@@ -3009,7 +3099,7 @@ static EContact *
 _e_contact_new_from_gdata_entry (EBookBackend *backend,
                                  GDataEntry *entry)
 {
-       EBookBackendGooglePrivate *priv = E_BOOK_BACKEND_GOOGLE (backend)->priv;
+       EBookBackendGooglePrivate *priv;
        EVCard *vcard;
        EVCardAttribute *attr;
        EContactPhoto *photo;
@@ -3035,6 +3125,8 @@ _e_contact_new_from_gdata_entry (EBookBackend *backend,
 #endif
 #endif
 
+       priv = E_BOOK_BACKEND_GOOGLE_GET_PRIVATE (backend);
+
        uid = gdata_entry_get_id (entry);
        if (NULL == uid)
                return NULL;
index 58f5a45..9ac11cd 100644 (file)
 /* this is broken currently, don't enable it */
 /*#define ENABLE_SASL_BINDS*/
 
+#define E_BOOK_BACKEND_LDAP_GET_PRIVATE(obj) \
+       (G_TYPE_INSTANCE_GET_PRIVATE \
+       ((obj), E_TYPE_BOOK_BACKEND, EBookBackendLDAPPrivate))
+
 typedef enum {
        E_BOOK_BACKEND_LDAP_TLS_NO,
        E_BOOK_BACKEND_LDAP_TLS_ALWAYS,
@@ -5475,10 +5479,14 @@ e_book_backend_ldap_get_backend_property (EBookBackend *backend,
                                           GCancellable *cancellable,
                                           const gchar *prop_name)
 {
+       EBookBackendLDAPPrivate *priv;
+
        g_return_if_fail (prop_name != NULL);
 
+       priv = E_BOOK_BACKEND_LDAP_GET_PRIVATE (backend);
+
        if (g_str_equal (prop_name, CLIENT_BACKEND_PROPERTY_CAPABILITIES)) {
-               if (can_browse (backend) || E_BOOK_BACKEND_LDAP (backend)->priv->marked_for_offline)
+               if (can_browse (backend) || priv->marked_for_offline)
                        e_data_book_respond_get_backend_property (book, opid, NULL, "net,anon-access,contact-lists,do-initial-query");
                else
                        e_data_book_respond_get_backend_property (book, opid, NULL, "net,anon-access,contact-lists");
@@ -5644,75 +5652,67 @@ call_dtor (gint msgid,
 }
 
 static void
-e_book_backend_ldap_dispose (GObject *object)
+e_book_backend_ldap_finalize (GObject *object)
 {
-       EBookBackendLDAP *bl;
+       EBookBackendLDAPPrivate *priv;
 
-       bl = E_BOOK_BACKEND_LDAP (object);
+       priv = E_BOOK_BACKEND_LDAP_GET_PRIVATE (object);
 
-       if (bl->priv) {
-               g_static_rec_mutex_lock (&bl->priv->op_hash_mutex);
-               g_hash_table_foreach_remove (bl->priv->id_to_op, (GHRFunc) call_dtor, NULL);
-               g_hash_table_destroy (bl->priv->id_to_op);
-               g_static_rec_mutex_unlock (&bl->priv->op_hash_mutex);
-               g_static_rec_mutex_free (&bl->priv->op_hash_mutex);
+       g_static_rec_mutex_lock (&priv->op_hash_mutex);
+       g_hash_table_foreach_remove (priv->id_to_op, (GHRFunc) call_dtor, NULL);
+       g_hash_table_destroy (priv->id_to_op);
+       g_static_rec_mutex_unlock (&priv->op_hash_mutex);
+       g_static_rec_mutex_free (&priv->op_hash_mutex);
 
-               g_static_rec_mutex_lock (&eds_ldap_handler_lock);
-               if (bl->priv->ldap)
-                       ldap_unbind (bl->priv->ldap);
-               g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+       g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+       if (priv->ldap)
+               ldap_unbind (priv->ldap);
+       g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
 
-               if (bl->priv->poll_timeout != -1) {
-                       g_source_remove (bl->priv->poll_timeout);
-               }
+       if (priv->poll_timeout != -1)
+               g_source_remove (priv->poll_timeout);
 
-               if (bl->priv->supported_fields) {
-                       g_slist_foreach (bl->priv->supported_fields, (GFunc) g_free, NULL);
-                       g_slist_free (bl->priv->supported_fields);
-               }
+       g_slist_foreach (priv->supported_fields, (GFunc) g_free, NULL);
+       g_slist_free (priv->supported_fields);
 
-               if (bl->priv->supported_auth_methods) {
-                       g_slist_foreach (bl->priv->supported_auth_methods, (GFunc) g_free, NULL);
-                       g_slist_free (bl->priv->supported_auth_methods);
-               }
-               if (bl->priv->summary_file_name) {
-                       g_free (bl->priv->summary_file_name);
-                       bl->priv->summary_file_name = NULL;
-               }
-               if (bl->priv->summary) {
-                       e_book_backend_summary_save (bl->priv->summary);
-                       g_object_unref (bl->priv->summary);
-                       bl->priv->summary = NULL;
-               }
+       g_slist_foreach (priv->supported_auth_methods, (GFunc) g_free, NULL);
+       g_slist_free (priv->supported_auth_methods);
 
-               if (bl->priv->cache) {
-                       g_object_unref (bl->priv->cache);
-                       bl->priv->cache = NULL;
-               }
+       g_free (priv->summary_file_name);
 
-               g_free (bl->priv->ldap_host);
-               g_free (bl->priv->ldap_rootdn);
-               g_free (bl->priv->ldap_search_filter);
-               g_free (bl->priv->schema_dn);
-               g_free (bl->priv);
-               bl->priv = NULL;
+       if (priv->summary) {
+               e_book_backend_summary_save (priv->summary);
+               g_object_unref (priv->summary);
+               priv->summary = NULL;
+       }
+
+       if (priv->cache) {
+               g_object_unref (priv->cache);
+               priv->cache = NULL;
        }
 
-       /* Chain up to parent's dispose() method. */
-       G_OBJECT_CLASS (e_book_backend_ldap_parent_class)->dispose (object);
+       g_free (priv->ldap_host);
+       g_free (priv->ldap_rootdn);
+       g_free (priv->ldap_search_filter);
+       g_free (priv->schema_dn);
+
+       /* Chain up to parent's finalize() method. */
+       G_OBJECT_CLASS (e_book_backend_ldap_parent_class)->finalize (object);
 }
 
 static void
-e_book_backend_ldap_class_init (EBookBackendLDAPClass *klass)
+e_book_backend_ldap_class_init (EBookBackendLDAPClass *class)
 {
-       GObjectClass  *object_class = G_OBJECT_CLASS (klass);
+       GObjectClass  *object_class = G_OBJECT_CLASS (class);
        EBookBackendClass *parent_class;
 
+       g_type_class_add_private (class, sizeof (EBookBackendLDAPPrivate));
+
 #ifndef SUNLDAP
        /* get client side information (extensions present in the library) */
        get_ldap_library_info ();
 #endif
-       parent_class = E_BOOK_BACKEND_CLASS (klass);
+       parent_class = E_BOOK_BACKEND_CLASS (class);
 
        /* Set the virtual methods. */
        parent_class->open                      = e_book_backend_ldap_open;
@@ -5729,30 +5729,19 @@ e_book_backend_ldap_class_init (EBookBackendLDAPClass *klass)
        parent_class->stop_book_view            = e_book_backend_ldap_stop_book_view;
        parent_class->authenticate_user         = e_book_backend_ldap_authenticate_user;
 
-       object_class->dispose = e_book_backend_ldap_dispose;
+       object_class->finalize = e_book_backend_ldap_finalize;
 }
 
 static void
 e_book_backend_ldap_init (EBookBackendLDAP *backend)
 {
-       EBookBackendLDAPPrivate *priv;
+       backend->priv = E_BOOK_BACKEND_LDAP_GET_PRIVATE (backend);
+
+       backend->priv->ldap_limit = 100;
+       backend->priv->id_to_op = g_hash_table_new (g_int_hash, g_int_equal);
+       backend->priv->poll_timeout = -1;
 
-       priv                   = g_new0 (EBookBackendLDAPPrivate, 1);
-
-       priv->supported_fields       = NULL;
-       priv->supported_auth_methods = NULL;
-       priv->ldap_limit             = 100;
-       priv->id_to_op               = g_hash_table_new (g_int_hash, g_int_equal);
-       priv->poll_timeout           = -1;
-       priv->marked_for_offline     = FALSE;
-       priv->is_summary_ready       = FALSE;
-       priv->reserved1      = NULL;
-       priv->reserved2      = NULL;
-       priv->reserved3      = NULL;
-       priv->reserved4      = NULL;
-       g_static_rec_mutex_init (&priv->op_hash_mutex);
-
-       backend->priv = priv;
+       g_static_rec_mutex_init (&backend->priv->op_hash_mutex);
 
        if (g_getenv ("LDAP_DEBUG"))
                enable_debug = TRUE;
index f5dcf75..7f27d7c 100644 (file)
 
 #include "e-book-backend-vcf.h"
 
+#define E_BOOK_BACKEND_VCF_GET_PRIVATE(obj) \
+       (G_TYPE_INSTANCE_GET_PRIVATE \
+       ((obj), E_TYPE_BOOK_BACKEND_VCF, EBookBackendVCFPrivate))
+
 #define PAS_ID_PREFIX "pas-id-"
 #define FILE_FLUSH_TIMEOUT 5000
 
@@ -718,50 +722,44 @@ e_book_backend_vcf_notify_online_cb (EBookBackend *backend,
 }
 
 static void
-e_book_backend_vcf_dispose (GObject *object)
+e_book_backend_vcf_finalize (GObject *object)
 {
-       EBookBackendVCF *bvcf;
-
-       bvcf = E_BOOK_BACKEND_VCF (object);
-
-       if (bvcf->priv) {
+       EBookBackendVCFPrivate *priv;
 
-               g_mutex_lock (bvcf->priv->mutex);
+       priv = E_BOOK_BACKEND_VCF_GET_PRIVATE (object);
 
-               if (bvcf->priv->flush_timeout_tag) {
-                       g_source_remove (bvcf->priv->flush_timeout_tag);
-                       bvcf->priv->flush_timeout_tag = 0;
-               }
+       g_mutex_lock (priv->mutex);
 
-               if (bvcf->priv->dirty)
-                       save_file (bvcf);
+       if (priv->flush_timeout_tag)
+               g_source_remove (priv->flush_timeout_tag);
 
-               g_hash_table_destroy (bvcf->priv->contacts);
-               g_list_foreach (bvcf->priv->contact_list, (GFunc) g_free, NULL);
-               g_list_free (bvcf->priv->contact_list);
+       if (priv->dirty)
+               save_file (E_BOOK_BACKEND_VCF (object));
 
-               g_free (bvcf->priv->filename);
+       g_hash_table_destroy (priv->contacts);
+       g_list_free_full (priv->contact_list, (GDestroyNotify) g_free);
 
-               g_mutex_unlock (bvcf->priv->mutex);
+       g_free (priv->filename);
 
-               g_mutex_free (bvcf->priv->mutex);
+       g_mutex_unlock (priv->mutex);
 
-               g_free (bvcf->priv);
-               bvcf->priv = NULL;
-       }
+       g_mutex_free (priv->mutex);
 
-       G_OBJECT_CLASS (e_book_backend_vcf_parent_class)->dispose (object);
+       /* Chain up to parent's finalize() method. */
+       G_OBJECT_CLASS (e_book_backend_vcf_parent_class)->finalize (object);
 }
 
 static void
-e_book_backend_vcf_class_init (EBookBackendVCFClass *klass)
+e_book_backend_vcf_class_init (EBookBackendVCFClass *class)
 {
-       GObjectClass    *object_class = G_OBJECT_CLASS (klass);
+       GObjectClass    *object_class = G_OBJECT_CLASS (class);
        EBookBackendSyncClass *sync_class;
        EBookBackendClass *backend_class;
 
-       sync_class = E_BOOK_BACKEND_SYNC_CLASS (klass);
-       backend_class = E_BOOK_BACKEND_CLASS (klass);
+       g_type_class_add_private (class, sizeof (EBookBackendVCFPrivate));
+
+       sync_class = E_BOOK_BACKEND_SYNC_CLASS (class);
+       backend_class = E_BOOK_BACKEND_CLASS (class);
 
        /* Set the virtual methods. */
        backend_class->start_book_view          = e_book_backend_vcf_start_book_view;
@@ -776,18 +774,14 @@ e_book_backend_vcf_class_init (EBookBackendVCFClass *klass)
        sync_class->get_contact_list_sync       = e_book_backend_vcf_get_contact_list;
        sync_class->authenticate_user_sync      = e_book_backend_vcf_authenticate_user;
 
-       object_class->dispose = e_book_backend_vcf_dispose;
+       object_class->finalize = e_book_backend_vcf_finalize;
 }
 
 static void
 e_book_backend_vcf_init (EBookBackendVCF *backend)
 {
-       EBookBackendVCFPrivate *priv;
-
-       priv                 = g_new0 (EBookBackendVCFPrivate, 1);
-       priv->mutex = g_mutex_new ();
-
-       backend->priv = priv;
+       backend->priv = E_BOOK_BACKEND_VCF_GET_PRIVATE (backend);
+       backend->priv->mutex = g_mutex_new ();
 
        g_signal_connect (
                backend, "notify::online",
index 7a8fe24..d765f58 100644 (file)
 #include <libxml/xpath.h>
 #include <libxml/xpathInternals.h>
 
+#define E_BOOK_BACKEND_WEBDAV_GET_PRIVATE(obj) \
+       (G_TYPE_INSTANCE_GET_PRIVATE \
+       ((obj), E_TYPE_BOOK_BACKEND, EBookBackendWebdavPrivate))
+
 #define EDB_ERROR(_code) e_data_book_create_error (E_DATA_BOOK_STATUS_ ## _code, NULL)
 #define EDB_ERROR_EX(_code, _msg) e_data_book_create_error (E_DATA_BOOK_STATUS_ ## _code, _msg)
 
@@ -61,8 +65,6 @@
 
 G_DEFINE_TYPE (EBookBackendWebdav, e_book_backend_webdav, E_TYPE_BOOK_BACKEND)
 
-static EBookBackendClass *parent_class;
-
 struct _EBookBackendWebdavPrivate {
        gboolean           marked_for_offline;
        SoupSession       *session;
@@ -1461,18 +1463,16 @@ e_book_backend_webdav_dispose (GObject *object)
        #undef do_unref
        #undef do_free
 
-       G_OBJECT_CLASS (parent_class)->dispose (object);
+       G_OBJECT_CLASS (e_book_backend_webdav_parent_class)->dispose (object);
 }
 
 static void
-e_book_backend_webdav_class_init (EBookBackendWebdavClass *klass)
+e_book_backend_webdav_class_init (EBookBackendWebdavClass *class)
 {
-       GObjectClass      *object_class = G_OBJECT_CLASS (klass);
+       GObjectClass      *object_class = G_OBJECT_CLASS (class);
        EBookBackendClass *backend_class;
 
-       parent_class = g_type_class_peek_parent (klass);
-
-       backend_class = E_BOOK_BACKEND_CLASS (klass);
+       backend_class = E_BOOK_BACKEND_CLASS (class);
 
        /* Set the virtual methods. */
        backend_class->open                     = e_book_backend_webdav_open;
@@ -1497,9 +1497,7 @@ e_book_backend_webdav_class_init (EBookBackendWebdavClass *klass)
 static void
 e_book_backend_webdav_init (EBookBackendWebdav *backend)
 {
-       backend->priv = G_TYPE_INSTANCE_GET_PRIVATE (
-               backend, E_TYPE_BOOK_BACKEND_WEBDAV,
-               EBookBackendWebdavPrivate);
+       backend->priv = E_BOOK_BACKEND_WEBDAV_GET_PRIVATE (backend);
 
        g_signal_connect (
                backend, "notify::online",
index 3232f91..b4e7d34 100644 (file)
 #include "libedataserver/e-data-server-util.h"
 #include "e-gdbus-book-view.h"
 
+#define E_BOOK_CLIENT_VIEW_GET_PRIVATE(obj) \
+       (G_TYPE_INSTANCE_GET_PRIVATE \
+       ((obj), E_TYPE_BOOK_CLIENT_VIEW, EBookClientViewPrivate))
+
 G_DEFINE_TYPE (EBookClientView, e_book_client_view, G_TYPE_OBJECT);
 
 struct _EBookClientViewPrivate {
@@ -346,7 +350,7 @@ e_book_client_view_set_fields_of_interest (EBookClientView *view,
 static void
 e_book_client_view_init (EBookClientView *view)
 {
-       view->priv = G_TYPE_INSTANCE_GET_PRIVATE (view, E_TYPE_BOOK_CLIENT_VIEW, EBookClientViewPrivate);
+       view->priv = E_BOOK_CLIENT_VIEW_GET_PRIVATE (view);
        view->priv->gdbus_bookview = NULL;
 
        view->priv->client = NULL;
@@ -382,13 +386,13 @@ book_client_view_dispose (GObject *object)
 }
 
 static void
-e_book_client_view_class_init (EBookClientViewClass *klass)
+e_book_client_view_class_init (EBookClientViewClass *class)
 {
        GObjectClass *object_class;
 
-       g_type_class_add_private (klass, sizeof (EBookClientViewPrivate));
+       g_type_class_add_private (class, sizeof (EBookClientViewPrivate));
 
-       object_class = G_OBJECT_CLASS (klass);
+       object_class = G_OBJECT_CLASS (class);
        object_class->dispose = book_client_view_dispose;
 
        signals[OBJECTS_ADDED] =
index 2794e4c..329ad53 100644 (file)
 #include "e-gdbus-book-factory.h"
 #include "e-gdbus-book-view.h"
 
-struct _EBookClientPrivate
-{
+#define E_BOOK_CLIENT_GET_PRIVATE(obj) \
+       (G_TYPE_INSTANCE_GET_PRIVATE \
+       ((obj), E_TYPE_BOOK_CLIENT, EBookClientPrivate))
+
+struct _EBookClientPrivate {
        /* GDBus data */
        GDBusProxy *gdbus_book;
        guint gone_signal_id;
@@ -2757,7 +2760,7 @@ e_book_client_init (EBookClient *client)
        active_book_clients++;
        UNLOCK_FACTORY ();
 
-       client->priv = G_TYPE_INSTANCE_GET_PRIVATE (client, E_TYPE_BOOK_CLIENT, EBookClientPrivate);
+       client->priv = E_BOOK_CLIENT_GET_PRIVATE (client);
 }
 
 static void
@@ -2797,18 +2800,18 @@ book_client_finalize (GObject *object)
 }
 
 static void
-e_book_client_class_init (EBookClientClass *klass)
+e_book_client_class_init (EBookClientClass *class)
 {
        GObjectClass *object_class;
        EClientClass *client_class;
 
-       g_type_class_add_private (klass, sizeof (EBookClientPrivate));
+       g_type_class_add_private (class, sizeof (EBookClientPrivate));
 
-       object_class = G_OBJECT_CLASS (klass);
+       object_class = G_OBJECT_CLASS (class);
        object_class->dispose = book_client_dispose;
        object_class->finalize = book_client_finalize;
 
-       client_class = E_CLIENT_CLASS (klass);
+       client_class = E_CLIENT_CLASS (class);
        client_class->get_dbus_proxy                    = book_client_get_dbus_proxy;
        client_class->unwrap_dbus_error                 = book_client_unwrap_dbus_error;
        client_class->handle_authentication             = book_client_handle_authentication;
index 4305f82..2d5c0af 100644 (file)
 
 G_DEFINE_TYPE (EBookView, e_book_view, G_TYPE_OBJECT);
 
+#define E_BOOK_VIEW_GET_PRIVATE(obj) \
+       (G_TYPE_INSTANCE_GET_PRIVATE \
+       ((obj), E_TYPE_BOOK_VIEW, EBookViewPrivate))
+
 struct _EBookViewPrivate {
        EGdbusBookView *gdbus_bookview;
        EBook *book;
@@ -268,8 +272,7 @@ e_book_view_stop (EBookView *book_view)
 static void
 e_book_view_init (EBookView *book_view)
 {
-       book_view->priv = G_TYPE_INSTANCE_GET_PRIVATE (
-               book_view, E_TYPE_BOOK_VIEW, EBookViewPrivate);
+       book_view->priv = E_BOOK_VIEW_GET_PRIVATE (book_view);
        book_view->priv->gdbus_bookview = NULL;
 
        book_view->priv->book = NULL;
@@ -305,11 +308,11 @@ e_book_view_dispose (GObject *object)
 }
 
 static void
-e_book_view_class_init (EBookViewClass *klass)
+e_book_view_class_init (EBookViewClass *class)
 {
-       GObjectClass *object_class = G_OBJECT_CLASS (klass);
+       GObjectClass *object_class = G_OBJECT_CLASS (class);
 
-       g_type_class_add_private (klass, sizeof (EBookViewPrivate));
+       g_type_class_add_private (class, sizeof (EBookViewPrivate));
 
        signals [CONTACTS_CHANGED] = g_signal_new ("contacts_changed",
                                                   G_OBJECT_CLASS_TYPE (object_class),
index 98218fe..d36b394 100644 (file)
 #include "e-gdbus-book-factory.h"
 #include "e-gdbus-book-view.h"
 
+#define E_BOOK_GET_PRIVATE(obj) \
+       (G_TYPE_INSTANCE_GET_PRIVATE \
+       ((obj), E_TYPE_BOOK, EBookPrivate))
+
 #define CLIENT_BACKEND_PROPERTY_CAPABILITIES           "capabilities"
 #define BOOK_BACKEND_PROPERTY_REQUIRED_FIELDS          "required-fields"
 #define BOOK_BACKEND_PROPERTY_SUPPORTED_FIELDS         "supported-fields"
@@ -62,7 +66,6 @@ static EList *array_to_elist (gchar **list);
 static gboolean unwrap_gerror (GError *error, GError **client_error);
 
 G_DEFINE_TYPE (EBook, e_book, G_TYPE_OBJECT)
-
 enum {
        WRITABLE_STATUS,
        CONNECTION_STATUS,
@@ -264,8 +267,7 @@ e_book_class_init (EBookClass *e_book_class)
 static void
 e_book_init (EBook *book)
 {
-       book->priv = G_TYPE_INSTANCE_GET_PRIVATE (
-               book, E_TYPE_BOOK, EBookPrivate);
+       book->priv = E_BOOK_GET_PRIVATE (book);
 
        LOCK_FACTORY ();
        active_books++;
index f7acc55..296b696 100644 (file)
 
 #define d(x)
 
+#define E_CONTACT_GET_PRIVATE(obj) \
+       (G_TYPE_INSTANCE_GET_PRIVATE \
+       ((obj), E_TYPE_CONTACT, EContactPrivate))
+
 G_DEFINE_TYPE (EContact, e_contact, E_TYPE_VCARD)
 
 struct _EContactPrivate {
@@ -306,42 +310,36 @@ static const EContactFieldInfo field_info[] = {
 #undef LIST_FIELD
 #undef GETSET_FIELD
 
-static GObjectClass *parent_class;
-
 static void e_contact_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec);
 static void e_contact_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec);
 
 static void
 e_contact_finalize (GObject *object)
 {
-       EContact *ec = E_CONTACT (object);
+       EContactPrivate *priv;
        gint i;
 
-       for (i = E_CONTACT_FIELD_FIRST; i < E_CONTACT_FIELD_LAST; i++) {
-               g_free (ec->priv->cached_strings[i]);
-       }
+       priv = E_CONTACT_GET_PRIVATE (object);
 
-       if (ec->priv) {
-               g_free (ec->priv);
-               ec->priv = NULL;
-       }
+       for (i = E_CONTACT_FIELD_FIRST; i < E_CONTACT_FIELD_LAST; i++)
+               g_free (priv->cached_strings[i]);
 
-       G_OBJECT_CLASS (parent_class)->finalize (object);
+       /* Chain up to parent's finalize() method. */
+       G_OBJECT_CLASS (e_contact_parent_class)->finalize (object);
 }
 
 static void
-e_contact_class_init (EContactClass *klass)
+e_contact_class_init (EContactClass *class)
 {
        GObjectClass *object_class;
        gint i;
 
-       object_class = G_OBJECT_CLASS (klass);
+       g_type_class_add_private (class, sizeof (EContactPrivate));
 
-       parent_class = g_type_class_ref (E_TYPE_VCARD);
-
-       object_class->finalize = e_contact_finalize;
+       object_class = G_OBJECT_CLASS (class);
        object_class->set_property = e_contact_set_property;
        object_class->get_property = e_contact_get_property;
+       object_class->finalize = e_contact_finalize;
 
        for (i = E_CONTACT_FIELD_FIRST; i < E_CONTACT_FIELD_LAST; i++) {
                GParamSpec *pspec = NULL;
@@ -385,11 +383,9 @@ e_contact_class_init (EContactClass *klass)
 static void
 e_contact_init (EContact *ec)
 {
-       ec->priv = g_new0 (EContactPrivate, 1);
+       ec->priv = E_CONTACT_GET_PRIVATE (ec);
 }
 
-\f
-
 static gpointer
 geo_getter (EContact *contact,
             EVCardAttribute *attr)
index d6dedd0..28ed6a7 100644 (file)
 
 #define d(x)
 
+#define E_DESTINATION_GET_PRIVATE(obj) \
+       (G_TYPE_INSTANCE_GET_PRIVATE \
+       ((obj), E_TYPE_DESTINATION, EDestinationPrivate))
+
 G_DEFINE_TYPE (EDestination, e_destination, G_TYPE_OBJECT)
 
 struct _EDestinationPrivate {
@@ -96,8 +100,6 @@ enum CONTACT_TYPE {
 
 static guint signals[LAST_SIGNAL] = { 0 };
 
-static GObjectClass *parent_class;
-
 /* Copied from eab-book-util.c. The name selector also keeps its own copy... */
 static gint
 utf8_casefold_collate_len (const gchar *str1,
@@ -125,52 +127,44 @@ utf8_casefold_collate (const gchar *str1,
 }
 
 static void
-e_destination_dispose (GObject *object)
+destination_finalize (GObject *object)
 {
-       EDestination *dest = E_DESTINATION (object);
+       EDestinationPrivate *priv;
 
-       if (dest->priv) {
-               e_destination_clear (dest);
+       priv = E_DESTINATION_GET_PRIVATE (object);
 
-               g_free (dest->priv->source_uid);
-               dest->priv->source_uid = NULL;
+       e_destination_clear (E_DESTINATION (object));
 
-               g_free (dest->priv);
-               dest->priv = NULL;
-       }
+       g_free (priv->source_uid);
 
-       /* Chain up to parent's dispose() method. */
-       G_OBJECT_CLASS (parent_class)->dispose (object);
+       /* Chain up to parent's finalize() method. */
+       G_OBJECT_CLASS (e_destination_parent_class)->finalize (object);
 }
 
 static void
-e_destination_class_init (EDestinationClass *klass)
+e_destination_class_init (EDestinationClass *class)
 {
-       GObjectClass *object_class = G_OBJECT_CLASS (klass);
+       GObjectClass *object_class = G_OBJECT_CLASS (class);
 
-       parent_class = g_type_class_ref (G_TYPE_OBJECT);
+       g_type_class_add_private (class, sizeof (EDestinationPrivate));
 
-       signals[CHANGED] =
-               g_signal_new ("changed",
-                             G_OBJECT_CLASS_TYPE (object_class),
-                             G_SIGNAL_RUN_LAST,
-                             G_STRUCT_OFFSET (EDestinationClass, changed),
-                             NULL, NULL,
-                             g_cclosure_marshal_VOID__VOID,
-                             G_TYPE_NONE, 0);
+       object_class = G_OBJECT_CLASS (class);
+       object_class->finalize = destination_finalize;
 
-       object_class->dispose = e_destination_dispose;
+       signals[CHANGED] = g_signal_new (
+               "changed",
+               G_OBJECT_CLASS_TYPE (object_class),
+               G_SIGNAL_RUN_LAST,
+               G_STRUCT_OFFSET (EDestinationClass, changed),
+               NULL, NULL,
+               g_cclosure_marshal_VOID__VOID,
+               G_TYPE_NONE, 0);
 }
 
 static void
 e_destination_init (EDestination *dest)
 {
-       dest->priv = g_new0 (struct _EDestinationPrivate, 1);
-
-       dest->priv->auto_recipient = FALSE;
-       dest->priv->ignored = FALSE;
-       dest->priv->list_dests = NULL;
-       dest->priv->list_alldests = NULL;
+       dest->priv = E_DESTINATION_GET_PRIVATE (dest);
 }
 
 /**
@@ -291,7 +285,7 @@ gboolean
 e_destination_empty (const EDestination *dest)
 
 {
-       struct _EDestinationPrivate *p;
+       EDestinationPrivate *p;
 
        g_return_val_if_fail (E_IS_DESTINATION (dest), TRUE);
 
@@ -320,7 +314,7 @@ gboolean
 e_destination_equal (const EDestination *a,
                      const EDestination *b)
 {
-       const struct _EDestinationPrivate *pa, *pb;
+       const EDestinationPrivate *pa, *pb;
        const gchar *na, *nb;
 
        g_return_val_if_fail (E_IS_DESTINATION (a), FALSE);
@@ -863,11 +857,11 @@ e_destination_get_email_num (const EDestination *dest)
 const gchar *
 e_destination_get_name (const EDestination *dest)
 {
-       struct _EDestinationPrivate *priv;
+       EDestinationPrivate *priv;
 
        g_return_val_if_fail (dest && E_IS_DESTINATION (dest), NULL);
 
-       priv = (struct _EDestinationPrivate *) dest->priv; /* cast out const */
+       priv = (EDestinationPrivate *) dest->priv; /* cast out const */
 
        if (priv->name == NULL) {
                if (priv->contact != NULL) {
@@ -942,11 +936,11 @@ e_destination_set_ignored (EDestination *dest,
 const gchar *
 e_destination_get_email (const EDestination *dest)
 {
-       struct _EDestinationPrivate *priv;
+       EDestinationPrivate *priv;
 
        g_return_val_if_fail (dest && E_IS_DESTINATION (dest), NULL);
 
-       priv = (struct _EDestinationPrivate *) dest->priv; /* cast out const */
+       priv = (EDestinationPrivate *) dest->priv; /* cast out const */
 
        if (priv->email == NULL) {
                if (priv->contact != NULL) {
@@ -1029,12 +1023,12 @@ destination_get_address (const EDestination *dest,
 const gchar *
 e_destination_get_address (const EDestination *dest)
 {
-       struct _EDestinationPrivate *priv;
+       EDestinationPrivate *priv;
        CamelInternetAddress *addr = camel_internet_address_new ();
 
        g_return_val_if_fail (dest && E_IS_DESTINATION (dest), NULL);
 
-       priv = (struct _EDestinationPrivate *) dest->priv; /* cast out const */
+       priv = (EDestinationPrivate *) dest->priv; /* cast out const */
 
        if (priv->addr) {
                g_free (priv->addr);
index fb812b0..32df37a 100644 (file)
 #include <libebook/e-book.h>
 #endif /* E_BOOK_DISABLE_DEPRECATED */
 
-#define E_TYPE_DESTINATION           (e_destination_get_type ())
-#define E_DESTINATION(o)             (G_TYPE_CHECK_INSTANCE_CAST ((o), E_TYPE_DESTINATION, EDestination))
-#define E_DESTINATION_CLASS(k)       (G_TYPE_CHECK_CLASS_CAST ((k), E_TYPE_DESTINATION, EDestinationClass))
-#define E_IS_DESTINATION(o)          (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_TYPE_DESTINATION))
-#define E_IS_DESTINATION_CLASS(k)    (G_TYPE_CHECK_CLASS_TYPE ((k), E_TYPE_DESTINATION))
-#define E_DESTINATION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), E_TYPE_DESTINATION, EDestinationClass))
+/* Standard GObject macros */
+#define E_TYPE_DESTINATION \
+       (e_destination_get_type ())
+#define E_DESTINATION(obj) \
+       (G_TYPE_CHECK_INSTANCE_CAST \
+       ((obj), E_TYPE_DESTINATION, EDestination))
+#define E_DESTINATION_CLASS(cls) \
+       (G_TYPE_CHECK_CLASS_CAST \
+       ((cls), E_TYPE_DESTINATION, EDestinationClass))
+#define E_IS_DESTINATION(obj) \
+       (G_TYPE_CHECK_INSTANCE_TYPE \
+       ((obj), E_TYPE_DESTINATION))
+#define E_IS_DESTINATION_CLASS(cls) \
+       (G_TYPE_CHECK_CLASS_TYPE \
+       ((cls), E_TYPE_DESTINATION))
+#define E_DESTINATION_GET_CLASS(obj) \
+       (G_TYPE_INSTANCE_GET_CLASS \
+       ((obj), E_TYPE_DESTINATION, EDestinationClass))
+
+G_BEGIN_DECLS
 
 typedef struct _EDestination EDestination;
 typedef struct _EDestinationClass EDestinationClass;
+typedef struct _EDestinationPrivate EDestinationPrivate;
 
 struct _EDestinationPrivate;
 
@@ -131,4 +146,6 @@ void           e_destination_freev              (EDestination **destv);
 void           e_destination_set_book           (EDestination *dest, EBook *book);
 #endif
 
+G_END_DECLS
+
 #endif /* __E_DESTINATION_H__ */
index 0d1aade..1ff8af2 100644 (file)
 
 #define CRLF "\r\n"
 
+#define E_VCARD_GET_PRIVATE(obj) \
+       (G_TYPE_INSTANCE_GET_PRIVATE \
+       ((obj), E_TYPE_VCARD, EVCardPrivate))
+
 G_DEFINE_TYPE (EVCard, e_vcard, G_TYPE_OBJECT)
 
 /** Encoding used in v-card
@@ -64,44 +68,40 @@ struct _EVCardAttributeParam {
        GList    *values;  /* GList of gchar *'s */
 };
 
-static GObjectClass *parent_class;
-
 static void
-e_vcard_dispose (GObject *object)
+vcard_finalize (GObject *object)
 {
-       EVCard *evc = E_VCARD (object);
+       EVCardPrivate *priv;
 
-       if (evc->priv) {
-               /* Directly access priv->attributes and don't call e_vcard_ensure_attributes(),
-                * since it is pointless to start vCard parsing that late. */
-               g_list_foreach (evc->priv->attributes, (GFunc) e_vcard_attribute_free, NULL);
-               g_list_free (evc->priv->attributes);
+       priv = E_VCARD_GET_PRIVATE (object);
 
-               g_free (evc->priv->vcard);
-               g_free (evc->priv);
-               evc->priv = NULL;
-       }
+       /* Directly access priv->attributes and don't call
+        * e_vcard_ensure_attributes(), since it is pointless
+        * to start vCard parsing that late. */
+       g_list_free_full (
+               priv->attributes, (GDestroyNotify) e_vcard_attribute_free);
 
-       /* Chain up to parent's dispose() method. */
-       G_OBJECT_CLASS (parent_class)->dispose (object);
+       g_free (priv->vcard);
+
+       /* Chain up to parent's finalize() method. */
+       G_OBJECT_CLASS (e_vcard_parent_class)->finalize (object);
 }
 
 static void
-e_vcard_class_init (EVCardClass *klass)
+e_vcard_class_init (EVCardClass *class)
 {
        GObjectClass *object_class;
 
-       object_class = G_OBJECT_CLASS (klass);
-
-       parent_class = g_type_class_ref (G_TYPE_OBJECT);
+       g_type_class_add_private (class, sizeof (EVCardPrivate));
 
-       object_class->dispose = e_vcard_dispose;
+       object_class = G_OBJECT_CLASS (class);
+       object_class->finalize = vcard_finalize;
 }
 
 static void
 e_vcard_init (EVCard *evc)
 {
-       evc->priv = g_new0 (EVCardPrivate, 1);
+       evc->priv = E_VCARD_GET_PRIVATE (evc);
 }
 
 /* Case insensitive version of strstr */
index 2b4a875..31484e0 100644 (file)
 #include "e-book-backend-cache.h"
 #include "e-book-backend-sexp.h"
 
+#define E_BOOK_BACKEND_CACHE_GET_PRIVATE(obj) \
+       (G_TYPE_INSTANCE_GET_PRIVATE \
+       ((obj), E_TYPE_BOOK_BACKEND_CACHE, EBookBackendCachePrivate))
+
 struct _EBookBackendCachePrivate {
        gint placeholder;
 };
@@ -43,8 +47,7 @@ e_book_backend_cache_class_init (EBookBackendCacheClass *class)
 static void
 e_book_backend_cache_init (EBookBackendCache *cache)
 {
-       cache->priv = G_TYPE_INSTANCE_GET_PRIVATE (
-               cache, E_TYPE_BOOK_BACKEND_CACHE, EBookBackendCachePrivate);
+       cache->priv = E_BOOK_BACKEND_CACHE_GET_PRIVATE (cache);
 }
 
 /**
index 2602fbb..4964eb5 100644 (file)
 #include "libedataserver/e-data-server-util.h"
 #include "e-book-backend-sexp.h"
 
-G_DEFINE_TYPE (EBookBackendSExp, e_book_backend_sexp, G_TYPE_OBJECT)
+#define E_BOOK_BACKEND_SEXP_GET_PRIVATE(obj) \
+       (G_TYPE_INSTANCE_GET_PRIVATE \
+       ((obj), E_TYPE_BOOK_BACKEND_SEXP, EBookBackendSExpPrivate))
 
-static GObjectClass *parent_class;
+G_DEFINE_TYPE (EBookBackendSExp, e_book_backend_sexp, G_TYPE_OBJECT)
 
 typedef struct _SearchContext SearchContext;
 
@@ -1016,7 +1018,7 @@ e_book_backend_sexp_match_vcard (EBookBackendSExp *sexp,
 EBookBackendSExp *
 e_book_backend_sexp_new (const gchar *text)
 {
-       EBookBackendSExp *sexp = g_object_new (E_TYPE_BACKEND_SEXP, NULL);
+       EBookBackendSExp *sexp = g_object_new (E_TYPE_BOOK_BACKEND_SEXP, NULL);
        gint esexp_error;
        gint i;
 
@@ -1045,41 +1047,34 @@ e_book_backend_sexp_new (const gchar *text)
 }
 
 static void
-e_book_backend_sexp_dispose (GObject *object)
+e_book_backend_sexp_finalize (GObject *object)
 {
-       EBookBackendSExp *sexp = E_BOOK_BACKEND_SEXP (object);
+       EBookBackendSExpPrivate *priv;
 
-       if (sexp->priv) {
-               e_sexp_unref (sexp->priv->search_sexp);
+       priv = E_BOOK_BACKEND_SEXP_GET_PRIVATE (object);
 
-               g_free (sexp->priv->search_context);
-               g_free (sexp->priv);
-               sexp->priv = NULL;
-       }
+       e_sexp_unref (priv->search_sexp);
+
+       g_free (priv->search_context);
 
-       /* Chain up to parent's dispose() method. */
-       G_OBJECT_CLASS (parent_class)->dispose (object);
+       /* Chain up to parent's finalize() method. */
+       G_OBJECT_CLASS (e_book_backend_sexp_parent_class)->finalize (object);
 }
 
 static void
-e_book_backend_sexp_class_init (EBookBackendSExpClass *klass)
+e_book_backend_sexp_class_init (EBookBackendSExpClass *class)
 {
-       GObjectClass  *object_class = G_OBJECT_CLASS (klass);
+       GObjectClass *object_class;
 
-       parent_class = g_type_class_peek_parent (klass);
+       g_type_class_add_private (class, sizeof (EBookBackendSExpPrivate));
 
-       /* Set the virtual methods. */
-
-       object_class->dispose = e_book_backend_sexp_dispose;
+       object_class = G_OBJECT_CLASS (class);
+       object_class->finalize = e_book_backend_sexp_finalize;
 }
 
 static void
 e_book_backend_sexp_init (EBookBackendSExp *sexp)
 {
-       EBookBackendSExpPrivate *priv;
-
-       priv             = g_new0 (EBookBackendSExpPrivate, 1);
-
-       sexp->priv = priv;
-       priv->search_context = g_new (SearchContext, 1);
+       sexp->priv = E_BOOK_BACKEND_SEXP_GET_PRIVATE (sexp);
+       sexp->priv->search_context = g_new (SearchContext, 1);
 }
index f940d96..f0a2c38 100644 (file)
  * 02110-1301, USA.
  */
 
-#ifndef __E_BOOK_BACKEND_SEXP_H__
-#define __E_BOOK_BACKEND_SEXP_H__
+#ifndef E_BOOK_BACKEND_SEXP_H
+#define E_BOOK_BACKEND_SEXP_H
 
 #include <libebook/e-contact.h>
 #include <libedata-book/e-data-book-types.h>
 
-G_BEGIN_DECLS
+/* Standard GObject macros */
+#define E_TYPE_BOOK_BACKEND_SEXP \
+       (e_book_backend_sexp_get_type ())
+#define E_BOOK_BACKEND_SEXP(obj) \
+       (G_TYPE_CHECK_INSTANCE_CAST \
+       ((obj), E_TYPE_BOOK_BACKEND_SEXP, EBookBackendSExp))
+#define E_BOOK_BACKEND_SEXP_CLASS(cls) \
+       (G_TYPE_CHECK_CLASS_CAST \
+       ((cls), E_TYPE_BOOK_BACKEND_SEXP, EBookBackendSExpClass))
+#define E_IS_BOOK_BACKEND_SEXP(obj) \
+       (G_TYPE_CHECK_INSTANCE_TYPE \
+       ((obj), E_TYPE_BOOK_BACKEND_SEXP))
+#define E_IS_BOOK_BACKEND_SEXP_CLASS(cls) \
+       (G_TYPE_CHECK_CLASS_TYPE \
+       ((cls), E_TYPE_BOOK_BACKEND_SEXP))
+#define E_BOOK_BACKEND_SEXP_GET_CLASS(cls) \
+       (G_TYPE_INSTANCE_GET_CLASS \
+       ((obj), E_TYPE_BOOK_BACKEND_SEXP, EBookBackendSExpClass))
 
-#define E_TYPE_BACKEND_SEXP        (e_book_backend_sexp_get_type ())
-#define E_BOOK_BACKEND_SEXP(o)          (G_TYPE_CHECK_INSTANCE_CAST ((o), E_TYPE_BACKEND_SEXP, EBookBackendSExp))
-#define E_BOOK_BACKEND_SEXP_CLASS(k)    (G_TYPE_CHECK_CLASS_CAST((k), E_BOOK_BACKEND_TYPE, EBookBackendSExpClass))
-#define E_IS_BACKEND_SEXP(o)       (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_TYPE_BACKEND_SEXP))
-#define E_IS_BACKEND_SEXP_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_TYPE_BACKEND_SEXP))
-#define E_BOOK_BACKEND_SEXP_GET_CLASS(k) (G_TYPE_INSTANCE_GET_CLASS ((obj), E_TYPE_BACKEND_SEXP, EBookBackendSExpClass))
+G_BEGIN_DECLS
 
+typedef struct _EBookBackendSExp EBookBackendSExp;
+typedef struct _EBookBackendSExpClass EBookBackendSExpClass;
 typedef struct _EBookBackendSExpPrivate EBookBackendSExpPrivate;
 
 struct _EBookBackendSExp {
@@ -47,12 +61,15 @@ struct _EBookBackendSExpClass {
        GObjectClass parent_class;
 };
 
-EBookBackendSExp *e_book_backend_sexp_new      (const gchar *text);
-GType               e_book_backend_sexp_get_type (void);
-
-gboolean            e_book_backend_sexp_match_vcard (EBookBackendSExp *sexp, const gchar *vcard);
-gboolean            e_book_backend_sexp_match_contact (EBookBackendSExp *sexp, EContact *contact);
+GType          e_book_backend_sexp_get_type    (void) G_GNUC_CONST;
+EBookBackendSExp *
+               e_book_backend_sexp_new         (const gchar *text);
+gboolean       e_book_backend_sexp_match_vcard (EBookBackendSExp *sexp,
+                                                const gchar *vcard);
+gboolean       e_book_backend_sexp_match_contact
+                                               (EBookBackendSExp *sexp,
+                                                EContact *contact);
 
 G_END_DECLS
 
-#endif /* __E_BOOK_BACKEND_SEXP_H__ */
+#endif /* E_BOOK_BACKEND_SEXP_H */
index 7e6e82a..0fdc869 100644 (file)
 #include "libebackend/e-sqlite3-vfs.h"
 #include "e-book-backend-sqlitedb.h"
 
+#define E_BOOK_BACKEND_SQLITEDB_GET_PRIVATE(obj) \
+       (G_TYPE_INSTANCE_GET_PRIVATE \
+       ((obj), E_TYPE_BOOK_BACKEND_SQLITEDB, EBookBackendSqliteDBPrivate))
+
 #define d(x)
 
 #define DB_FILENAME "contacts.db"
@@ -120,7 +124,7 @@ e_book_backend_sqlitedb_dispose (GObject *object)
 {
        EBookBackendSqliteDBPrivate *priv;
 
-       priv = E_BOOK_BACKEND_SQLITEDB (object)->priv;
+       priv = E_BOOK_BACKEND_SQLITEDB_GET_PRIVATE (object);
 
        g_static_mutex_lock (&dbcon_lock);
        if (db_connections != NULL) {
@@ -147,21 +151,15 @@ e_book_backend_sqlitedb_finalize (GObject *object)
 {
        EBookBackendSqliteDBPrivate *priv;
 
-       priv = E_BOOK_BACKEND_SQLITEDB (object)->priv;
+       priv = E_BOOK_BACKEND_SQLITEDB_GET_PRIVATE (object);
 
        g_static_rw_lock_free (&priv->rwlock);
 
        sqlite3_close (priv->db);
-       priv->db = NULL;
 
        g_free (priv->path);
-       priv->path = NULL;
 
        g_mutex_free (priv->in_transaction_lock);
-       priv->in_transaction_lock = NULL;
-
-       g_free (priv);
-       priv = NULL;
 
        /* Chain up to parent's finalize() method. */
        G_OBJECT_CLASS (e_book_backend_sqlitedb_parent_class)->finalize (object);
@@ -182,7 +180,7 @@ e_book_backend_sqlitedb_class_init (EBookBackendSqliteDBClass *class)
 static void
 e_book_backend_sqlitedb_init (EBookBackendSqliteDB *ebsdb)
 {
-       ebsdb->priv = g_new0 (EBookBackendSqliteDBPrivate, 1);
+       ebsdb->priv = E_BOOK_BACKEND_SQLITEDB_GET_PRIVATE (ebsdb);
 
        ebsdb->priv->store_vcard = TRUE;
        g_static_rw_lock_init (&ebsdb->priv->rwlock);
@@ -314,7 +312,7 @@ book_backend_sqlitedb_start_transaction (EBookBackendSqliteDB *ebsdb,
 /* the last caller releases the writer lock too */
 static gboolean
 book_backend_sqlitedb_end_transaction (EBookBackendSqliteDB *ebsdb,
-                                      gboolean do_commit,
+                                       gboolean do_commit,
                                        GError **error)
 {
        gboolean res = TRUE;
@@ -610,7 +608,7 @@ exit:
 
 gboolean
 e_book_backend_sqlitedb_lock_updates (EBookBackendSqliteDB *ebsdb,
-                                     GError **error)
+                                      GError **error)
 {
        g_return_val_if_fail (ebsdb != NULL, FALSE);
        g_return_val_if_fail (ebsdb->priv != NULL, FALSE);
@@ -620,8 +618,8 @@ e_book_backend_sqlitedb_lock_updates (EBookBackendSqliteDB *ebsdb,
 
 gboolean
 e_book_backend_sqlitedb_unlock_updates (EBookBackendSqliteDB *ebsdb,
-                                       gboolean do_commit,
-                                       GError **error)
+                                        gboolean do_commit,
+                                        GError **error)
 {
        g_return_val_if_fail (ebsdb != NULL, FALSE);
        g_return_val_if_fail (ebsdb->priv != NULL, FALSE);
@@ -1750,7 +1748,7 @@ e_book_backend_sqlitedb_search_uids (EBookBackendSqliteDB *ebsdb,
 
 static gint
 get_uids_and_rev_cb (gpointer user_data,
-                    gint col,
+                     gint col,
                      gchar **cols,
                      gchar **name)
 {
@@ -1774,8 +1772,8 @@ get_uids_and_rev_cb (gpointer user_data,
  **/
 GHashTable *
 e_book_backend_sqlitedb_get_uids_and_rev (EBookBackendSqliteDB *ebsdb,
-                                         const gchar *folderid,
-                                         GError **error)
+                                          const gchar *folderid,
+                                          GError **error)
 {
        GHashTable *uids_and_rev = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
        gchar *stmt;
index 637286a..2553a84 100644 (file)
 
 #include "e-book-backend-summary.h"
 
-G_DEFINE_TYPE (EBookBackendSummary, e_book_backend_summary, G_TYPE_OBJECT)
+#define E_BOOK_BACKEND_SUMMARY_GET_PRIVATE(obj) \
+       (G_TYPE_INSTANCE_GET_PRIVATE \
+       ((obj), E_TYPE_BOOK_BACKEND_SUMMARY, EBookBackendSummaryPrivate))
 
-static GObjectClass *parent_class;
+G_DEFINE_TYPE (EBookBackendSummary, e_book_backend_summary, G_TYPE_OBJECT)
 
 struct _EBookBackendSummaryPrivate {
        gchar *summary_path;
@@ -161,7 +163,7 @@ EBookBackendSummary *
 e_book_backend_summary_new (const gchar *summary_path,
                             gint flush_timeout_millis)
 {
-       EBookBackendSummary *summary = g_object_new (E_TYPE_BACKEND_SUMMARY, NULL);
+       EBookBackendSummary *summary = g_object_new (E_TYPE_BOOK_BACKEND_SUMMARY, NULL);
 
        summary->priv->summary_path = g_strdup (summary_path);
        summary->priv->flush_timeout_millis = flush_timeout_millis;
@@ -171,69 +173,50 @@ e_book_backend_summary_new (const gchar *summary_path,
 }
 
 static void
-e_book_backend_summary_dispose (GObject *object)
+e_book_backend_summary_finalize (GObject *object)
 {
-       EBookBackendSummary *summary = E_BOOK_BACKEND_SUMMARY (object);
+       EBookBackendSummaryPrivate *priv;
 
-       if (summary->priv) {
-               if (summary->priv->fp)
-                       fclose (summary->priv->fp);
-               if (summary->priv->dirty)
-                       e_book_backend_summary_save (summary);
-               else
-                       utime (summary->priv->summary_path, NULL);
-
-               if (summary->priv->flush_timeout) {
-                       g_source_remove (summary->priv->flush_timeout);
-                       summary->priv->flush_timeout = 0;
-               }
+       priv = E_BOOK_BACKEND_SUMMARY_GET_PRIVATE (object);
 
-               g_free (summary->priv->summary_path);
-               clear_items (summary);
-               g_ptr_array_free (summary->priv->items, TRUE);
+       if (priv->fp)
+               fclose (priv->fp);
+       if (priv->dirty)
+               e_book_backend_summary_save (E_BOOK_BACKEND_SUMMARY (object));
+       else
+               utime (priv->summary_path, NULL);
 
-               g_hash_table_destroy (summary->priv->id_to_item);
+       if (priv->flush_timeout)
+               g_source_remove (priv->flush_timeout);
 
-               g_free (summary->priv);
-               summary->priv = NULL;
-       }
+       g_free (priv->summary_path);
+       clear_items (E_BOOK_BACKEND_SUMMARY (object));
+       g_ptr_array_free (priv->items, TRUE);
 
-       /* Chain up to parent's dispose() method. */
-       G_OBJECT_CLASS (parent_class)->dispose (object);
+       g_hash_table_destroy (priv->id_to_item);
+
+       /* Chain up to parent's finalize() method. */
+       G_OBJECT_CLASS (e_book_backend_summary_parent_class)->finalize (object);
 }
 
 static void
-e_book_backend_summary_class_init (EBookBackendSummaryClass *klass)
+e_book_backend_summary_class_init (EBookBackendSummaryClass *class)
 {
-       GObjectClass  *object_class = G_OBJECT_CLASS (klass);
-
-       parent_class = g_type_class_peek_parent (klass);
+       GObjectClass *object_class;
 
-       /* Set the virtual methods. */
+       g_type_class_add_private (class, sizeof (EBookBackendSummaryPrivate));
 
-       object_class->dispose = e_book_backend_summary_dispose;
+       object_class = G_OBJECT_CLASS (class);
+       object_class->finalize = e_book_backend_summary_finalize;
 }
 
 static void
 e_book_backend_summary_init (EBookBackendSummary *summary)
 {
-       EBookBackendSummaryPrivate *priv;
-
-       priv             = g_new (EBookBackendSummaryPrivate, 1);
+       summary->priv = E_BOOK_BACKEND_SUMMARY_GET_PRIVATE (summary);
 
-       summary->priv = priv;
-
-       priv->summary_path = NULL;
-       priv->fp = NULL;
-       priv->dirty = FALSE;
-       priv->upgraded = FALSE;
-       priv->items = g_ptr_array_new ();
-       priv->id_to_item = g_hash_table_new (g_str_hash, g_str_equal);
-       priv->flush_timeout_millis = 0;
-       priv->flush_timeout = 0;
-#ifdef SUMMARY_STATS
-       priv->size = 0;
-#endif
+       summary->priv->items = g_ptr_array_new ();
+       summary->priv->id_to_item = g_hash_table_new (g_str_hash, g_str_equal);
 }
 
 \f
index 3e2836f..a02d296 100644 (file)
  * 02110-1301, USA.
  */
 
-#ifndef __E_BOOK_BACKEND_SUMMARY_H__
-#define __E_BOOK_BACKEND_SUMMARY_H__
+#ifndef E_BOOK_BACKEND_SUMMARY_H
+#define E_BOOK_BACKEND_SUMMARY_H
 
 #include <libedata-book/e-data-book-types.h>
 #include <libebook/e-contact.h>
 
-G_BEGIN_DECLS
+/* Standard GObject macros */
+#define E_TYPE_BOOK_BACKEND_SUMMARY \
+       (e_book_backend_summary_get_type ())
+#define E_BOOK_BACKEND_SUMMARY(obj) \
+       (G_TYPE_CHECK_INSTANCE_CAST \
+       ((obj), E_TYPE_BOOK_BACKEND_SUMMARY, EBookBackendSummary))
+#define E_BOOK_BACKEND_SUMMARY_CLASS(cls) \
+       (G_TYPE_CHECK_CLASS_CAST \
+       ((cls), E_TYPE_BOOK_BACKEND_SUMMARY, EBookBackendSummaryClass))
+#define E_IS_BOOK_BACKEND_SUMMARY(obj) \
+       (G_TYPE_CHECK_INSTANCE_TYPE \
+       ((obj), E_TYPE_BOOK_BACKEND_SUMMARY))
+#define E_IS_BOOK_BACKEND_SUMMARY_CLASS(cls) \
+       (G_TYPE_CHECK_CLASS_TYPE \
+       ((cls), E_TYPE_BOOK_BACKEND_SUMMARY))
+#define E_BOOK_BACKEND_SUMMARY_GET_CLASS(cls) \
+       (G_TYPE_INSTANCE_GET_CLASS \
+       ((obj), E_TYPE_BOOK_BACKEND_SUMMARY, EBookBackendSummaryClass))
 
-#define E_TYPE_BACKEND_SUMMARY        (e_book_backend_summary_get_type ())
-#define E_BOOK_BACKEND_SUMMARY(o)          (G_TYPE_CHECK_INSTANCE_CAST ((o), E_TYPE_BACKEND_SUMMARY, EBookBackendSummary))
-#define E_BOOK_BACKEND_SUMMARY_CLASS(k)    (G_TYPE_CHECK_CLASS_CAST((k), E_BOOK_BACKEND_TYPE, EBookBackendSummaryClass))
-#define E_IS_BACKEND_SUMMARY(o)       (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_TYPE_BACKEND_SUMMARY))
-#define E_IS_BACKEND_SUMMARY_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_TYPE_BACKEND_SUMMARY))
-#define E_BOOK_BACKEND_SUMMARY_GET_CLASS(k) (G_TYPE_INSTANCE_GET_CLASS ((obj), E_TYPE_BACKEND_SUMMARY, EBookBackendSummaryClass))
+G_BEGIN_DECLS
 
+typedef struct _EBookBackendSummary EBookBackendSummary;
+typedef struct _EBookBackendSummaryClass EBookBackendSummaryClass;
 typedef struct _EBookBackendSummaryPrivate EBookBackendSummaryPrivate;
 
 struct _EBookBackendSummary{
@@ -47,29 +61,43 @@ struct _EBookBackendSummaryClass{
        GObjectClass parent_class;
 };
 
-EBookBackendSummary * e_book_backend_summary_new              (const gchar *summary_path,
-                                                        gint flush_timeout_millis);
-GType              e_book_backend_summary_get_type         (void);
+GType          e_book_backend_summary_get_type (void) G_GNUC_CONST;
+EBookBackendSummary *
+               e_book_backend_summary_new      (const gchar *summary_path,
+                                                gint flush_timeout_millis);
 
 /* returns FALSE if the load fails for any reason (including that the
  * summary is out of date), TRUE if it succeeds */
-gboolean           e_book_backend_summary_load             (EBookBackendSummary *summary);
+gboolean       e_book_backend_summary_load     (EBookBackendSummary *summary);
 /* returns FALSE if the save fails, TRUE if it succeeds (or isn't required due to no changes) */
-gboolean           e_book_backend_summary_save              (EBookBackendSummary *summary);
+gboolean       e_book_backend_summary_save     (EBookBackendSummary *summary);
 
-void               e_book_backend_summary_add_contact       (EBookBackendSummary *summary, EContact *contact);
-void               e_book_backend_summary_remove_contact    (EBookBackendSummary *summary, const gchar *id);
-gboolean           e_book_backend_summary_check_contact     (EBookBackendSummary *summary, const gchar *id);
+void           e_book_backend_summary_add_contact
+                                               (EBookBackendSummary *summary,
+                                                EContact *contact);
+void           e_book_backend_summary_remove_contact
+                                               (EBookBackendSummary *summary,
+                                                const gchar *id);
+gboolean       e_book_backend_summary_check_contact
+                                               (EBookBackendSummary *summary,
+                                                const gchar *id);
 
-void               e_book_backend_summary_touch             (EBookBackendSummary *summary);
+void           e_book_backend_summary_touch    (EBookBackendSummary *summary);
 
 /* returns TRUE if the summary's mtime is >= @t. */
-gboolean           e_book_backend_summary_is_up_to_date     (EBookBackendSummary *summary, time_t t);
+gboolean       e_book_backend_summary_is_up_to_date
+                                               (EBookBackendSummary *summary,
+                                                time_t t);
 
-gboolean           e_book_backend_summary_is_summary_query  (EBookBackendSummary *summary, const gchar *query);
-GPtrArray *         e_book_backend_summary_search            (EBookBackendSummary *summary, const gchar *query);
-gchar *              e_book_backend_summary_get_summary_vcard (EBookBackendSummary *summary, const gchar *id);
+gboolean       e_book_backend_summary_is_summary_query
+                                               (EBookBackendSummary *summary,
+                                                const gchar *query);
+GPtrArray *    e_book_backend_summary_search   (EBookBackendSummary *summary,
+                                                const gchar *query);
+gchar *                e_book_backend_summary_get_summary_vcard
+                                               (EBookBackendSummary *summary,
+                                                const gchar *id);
 
 G_END_DECLS
 
-#endif /* __E_BOOK_BACKEND_SUMMARY_H__ */
+#endif /* E_BOOK_BACKEND_SUMMARY_H */
index 04c5c0b..e18c3aa 100644 (file)
 
 G_DEFINE_TYPE (EBookBackendSync, e_book_backend_sync, E_TYPE_BOOK_BACKEND)
 
-struct _EBookBackendSyncPrivate {
-       gint mumble;
-};
-
-static GObjectClass *parent_class;
-
 /**
  * e_book_backend_sync_construct:
  * @backend: an #EBookBackendSync
@@ -632,39 +626,12 @@ book_backend_sync_set_backend_property (EBookBackendSync *backend,
 static void
 e_book_backend_sync_init (EBookBackendSync *backend)
 {
-       EBookBackendSyncPrivate *priv;
-
-       priv          = g_new0 (EBookBackendSyncPrivate, 1);
-
-       backend->priv = priv;
 }
 
 static void
-e_book_backend_sync_dispose (GObject *object)
+e_book_backend_sync_class_init (EBookBackendSyncClass *class)
 {
-       EBookBackendSync *backend;
-
-       backend = E_BOOK_BACKEND_SYNC (object);
-
-       if (backend->priv) {
-               g_free (backend->priv);
-
-               backend->priv = NULL;
-       }
-
-       G_OBJECT_CLASS (parent_class)->dispose (object);
-}
-
-static void
-e_book_backend_sync_class_init (EBookBackendSyncClass *klass)
-{
-       GObjectClass *object_class;
-       EBookBackendClass *backend_class = E_BOOK_BACKEND_CLASS (klass);
-
-       parent_class = g_type_class_peek_parent (klass);
-
-       object_class = (GObjectClass *) klass;
-       object_class->dispose = e_book_backend_sync_dispose;
+       EBookBackendClass *backend_class = E_BOOK_BACKEND_CLASS (class);
 
        backend_class->open                     = book_backend_open;
        backend_class->authenticate_user        = book_backend_authenticate_user;
@@ -679,6 +646,6 @@ e_book_backend_sync_class_init (EBookBackendSyncClass *klass)
        backend_class->get_contact_list         = book_backend_get_contact_list;
        backend_class->get_contact_list_uids    = book_backend_get_contact_list_uids;
 
-       klass->get_backend_property_sync        = book_backend_sync_get_backend_property;
-       klass->set_backend_property_sync        = book_backend_sync_set_backend_property;
+       class->get_backend_property_sync        = book_backend_sync_get_backend_property;
+       class->set_backend_property_sync        = book_backend_sync_set_backend_property;
 }
index 6e32110..8e50bb5 100644 (file)
 #define EDB_OPENING_ERROR      e_data_book_create_error (E_DATA_BOOK_STATUS_BUSY, _("Cannot process, book backend is opening"))
 #define EDB_NOT_OPENED_ERROR   e_data_book_create_error (E_DATA_BOOK_STATUS_NOT_OPENED, NULL)
 
+#define E_BOOK_BACKEND_GET_PRIVATE(obj) \
+       (G_TYPE_INSTANCE_GET_PRIVATE \
+       ((obj), E_TYPE_BOOK_BACKEND, EBookBackendPrivate))
+
 struct _EBookBackendPrivate {
        GMutex *clients_mutex;
        GSList *clients;
@@ -143,7 +147,7 @@ book_backend_dispose (GObject *object)
 {
        EBookBackendPrivate *priv;
 
-       priv = E_BOOK_BACKEND (object)->priv;
+       priv = E_BOOK_BACKEND_GET_PRIVATE (object);
 
        if (priv->views != NULL) {
                g_slist_free (priv->views);
@@ -159,7 +163,7 @@ book_backend_finalize (GObject *object)
 {
        EBookBackendPrivate *priv;
 
-       priv = E_BOOK_BACKEND (object)->priv;
+       priv = E_BOOK_BACKEND_GET_PRIVATE (object);
 
        g_slist_free (priv->clients);
 
@@ -189,21 +193,21 @@ book_backend_notify_update (EBookBackend *backend,
 }
 
 static void
-e_book_backend_class_init (EBookBackendClass *klass)
+e_book_backend_class_init (EBookBackendClass *class)
 {
        GObjectClass *object_class;
 
-       g_type_class_add_private (klass, sizeof (EBookBackendPrivate));
+       g_type_class_add_private (class, sizeof (EBookBackendPrivate));
 
-       object_class = G_OBJECT_CLASS (klass);
+       object_class = G_OBJECT_CLASS (class);
        object_class->set_property = book_backend_set_property;
        object_class->get_property = book_backend_get_property;
        object_class->dispose = book_backend_dispose;
        object_class->finalize = book_backend_finalize;
 
-       klass->get_backend_property = book_backend_get_backend_property;
-       klass->set_backend_property = book_backend_set_backend_property;
-       klass->notify_update        = book_backend_notify_update;
+       class->get_backend_property = book_backend_get_backend_property;
+       class->set_backend_property = book_backend_set_backend_property;
+       class->notify_update        = book_backend_notify_update;
 
        g_object_class_install_property (
                object_class,
@@ -219,8 +223,7 @@ e_book_backend_class_init (EBookBackendClass *klass)
 static void
 e_book_backend_init (EBookBackend *backend)
 {
-       backend->priv = G_TYPE_INSTANCE_GET_PRIVATE (
-               backend, E_TYPE_BOOK_BACKEND, EBookBackendPrivate);
+       backend->priv = E_BOOK_BACKEND_GET_PRIVATE (backend);
 
        backend->priv->clients = NULL;
        backend->priv->clients_mutex = g_mutex_new ();
index 42a1522..38dfbbd 100644 (file)
@@ -31,15 +31,9 @@ G_BEGIN_DECLS
 typedef struct _EDataBookView        EDataBookView;
 typedef struct _EDataBookViewClass   EDataBookViewClass;
 
-typedef struct _EBookBackendSExp EBookBackendSExp;
-typedef struct _EBookBackendSExpClass EBookBackendSExpClass;
-
 typedef struct _EBookBackend        EBookBackend;
 typedef struct _EBookBackendClass   EBookBackendClass;
 
-typedef struct _EBookBackendSummary EBookBackendSummary;
-typedef struct _EBookBackendSummaryClass EBookBackendSummaryClass;
-
 typedef struct _EBookBackendSync        EBookBackendSync;
 typedef struct _EBookBackendSyncClass   EBookBackendSyncClass;
 
index 3f820cd..ccbdb94 100644 (file)
 
 #include "e-gdbus-book-view.h"
 
+#define E_DATA_BOOK_VIEW_GET_PRIVATE(obj) \
+       (G_TYPE_INSTANCE_GET_PRIVATE \
+       ((obj), E_TYPE_DATA_BOOK_VIEW, EDataBookViewPrivate))
+
 static void reset_array (GArray *array);
 static void ensure_pending_flush_timeout (EDataBookView *view);
 
 G_DEFINE_TYPE (EDataBookView, e_data_book_view, G_TYPE_OBJECT);
-
 #define THRESHOLD_ITEMS   32   /* how many items can be hold in a cache, before propagated to UI */
 #define THRESHOLD_SECONDS  2   /* how long to wait until notifications are propagated to UI; in seconds */
 
@@ -70,11 +73,11 @@ static void e_data_book_view_dispose (GObject *object);
 static void e_data_book_view_finalize (GObject *object);
 
 static void
-e_data_book_view_class_init (EDataBookViewClass *klass)
+e_data_book_view_class_init (EDataBookViewClass *class)
 {
-       GObjectClass *object_class = G_OBJECT_CLASS (klass);
+       GObjectClass *object_class = G_OBJECT_CLASS (class);
 
-       g_type_class_add_private (klass, sizeof (EDataBookViewPrivate));
+       g_type_class_add_private (class, sizeof (EDataBookViewPrivate));
 
        object_class->dispose = e_data_book_view_dispose;
        object_class->finalize = e_data_book_view_finalize;
@@ -531,17 +534,15 @@ void
 e_data_book_view_notify_remove (EDataBookView *book_view,
                                 const gchar *id)
 {
-       EDataBookViewPrivate *priv = book_view->priv;
-
-       if (!priv->running)
+       if (!book_view->priv->running)
                return;
 
-       g_mutex_lock (priv->pending_mutex);
+       g_mutex_lock (book_view->priv->pending_mutex);
 
        if (id_is_in_view (book_view, id))
                notify_remove (book_view, id);
 
-       g_mutex_unlock (priv->pending_mutex);
+       g_mutex_unlock (book_view->priv->pending_mutex);
 }
 
 /**
@@ -595,13 +596,14 @@ e_data_book_view_notify_progress (EDataBookView *book_view,
                                   guint percent,
                                   const gchar *message)
 {
-       EDataBookViewPrivate *priv = book_view->priv;
        gchar *gdbus_message = NULL;
 
-       if (!priv->running)
+       if (!book_view->priv->running)
                return;
 
-       e_gdbus_book_view_emit_progress (priv->gdbus_object, percent, e_util_ensure_gdbus_string (message, &gdbus_message));
+       e_gdbus_book_view_emit_progress (
+               book_view->priv->gdbus_object, percent,
+               e_util_ensure_gdbus_string (message, &gdbus_message));
 
        g_free (gdbus_message);
 }
@@ -722,33 +724,47 @@ impl_DataBookView_dispose (EGdbusBookView *object,
 static void
 e_data_book_view_init (EDataBookView *book_view)
 {
-       EDataBookViewPrivate *priv = G_TYPE_INSTANCE_GET_PRIVATE (
-               book_view, E_TYPE_DATA_BOOK_VIEW, EDataBookViewPrivate);
-
-       book_view->priv = priv;
-
-       priv->flags = E_BOOK_CLIENT_VIEW_FLAGS_NOTIFY_INITIAL;
-
-       priv->gdbus_object = e_gdbus_book_view_stub_new ();
-       g_signal_connect (priv->gdbus_object, "handle-start", G_CALLBACK (impl_DataBookView_start), book_view);
-       g_signal_connect (priv->gdbus_object, "handle-stop", G_CALLBACK (impl_DataBookView_stop), book_view);
-       g_signal_connect (priv->gdbus_object, "handle-set-flags", G_CALLBACK (impl_DataBookView_setFlags), book_view);
-       g_signal_connect (priv->gdbus_object, "handle-dispose", G_CALLBACK (impl_DataBookView_dispose), book_view);
-       g_signal_connect (priv->gdbus_object, "handle-set-fields-of-interest", G_CALLBACK (impl_DataBookView_set_fields_of_interest), book_view);
-
-       priv->fields_of_interest = NULL;
-       priv->running = FALSE;
-       priv->complete = FALSE;
-       priv->pending_mutex = g_mutex_new ();
+       book_view->priv = E_DATA_BOOK_VIEW_GET_PRIVATE (book_view);
+
+       book_view->priv->flags = E_BOOK_CLIENT_VIEW_FLAGS_NOTIFY_INITIAL;
+
+       book_view->priv->gdbus_object = e_gdbus_book_view_stub_new ();
+       g_signal_connect (
+               book_view->priv->gdbus_object, "handle-start",
+               G_CALLBACK (impl_DataBookView_start), book_view);
+       g_signal_connect (
+               book_view->priv->gdbus_object, "handle-stop",
+               G_CALLBACK (impl_DataBookView_stop), book_view);
+       g_signal_connect (
+               book_view->priv->gdbus_object, "handle-set-flags",
+               G_CALLBACK (impl_DataBookView_setFlags), book_view);
+       g_signal_connect (
+               book_view->priv->gdbus_object, "handle-dispose",
+               G_CALLBACK (impl_DataBookView_dispose), book_view);
+       g_signal_connect (
+               book_view->priv->gdbus_object, "handle-set-fields-of-interest",
+               G_CALLBACK (impl_DataBookView_set_fields_of_interest), book_view);
+
+       book_view->priv->fields_of_interest = NULL;
+       book_view->priv->running = FALSE;
+       book_view->priv->complete = FALSE;
+       book_view->priv->pending_mutex = g_mutex_new ();
 
        /* THRESHOLD_ITEMS * 2 because we store UID and vcard */
-       priv->adds = g_array_sized_new (TRUE, TRUE, sizeof (gchar *), THRESHOLD_ITEMS * 2);
-       priv->changes = g_array_sized_new (TRUE, TRUE, sizeof (gchar *), THRESHOLD_ITEMS * 2);
-       priv->removes = g_array_sized_new (TRUE, TRUE, sizeof (gchar *), THRESHOLD_ITEMS);
-
-       priv->ids = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
-
-       priv->flush_id = 0;
+       book_view->priv->adds = g_array_sized_new (
+               TRUE, TRUE, sizeof (gchar *), THRESHOLD_ITEMS * 2);
+       book_view->priv->changes = g_array_sized_new (
+               TRUE, TRUE, sizeof (gchar *), THRESHOLD_ITEMS * 2);
+       book_view->priv->removes = g_array_sized_new (
+               TRUE, TRUE, sizeof (gchar *), THRESHOLD_ITEMS);
+
+       book_view->priv->ids = g_hash_table_new_full (
+               (GHashFunc) g_str_hash,
+               (GEqualFunc) g_str_equal,
+               (GDestroyNotify) g_free,
+               (GDestroyNotify) NULL);
+
+       book_view->priv->flush_id = 0;
 }
 
 static void
index c421c19..d567d0d 100644 (file)
@@ -352,11 +352,11 @@ g_signal (GDBusProxy *proxy,
 }
 
 static void
-e_gdbus_book_factory_proxy_class_init (EGdbusBookFactoryProxyClass *klass)
+e_gdbus_book_factory_proxy_class_init (EGdbusBookFactoryProxyClass *class)
 {
        GDBusProxyClass *proxy_class;
 
-       proxy_class = G_DBUS_PROXY_CLASS (klass);
+       proxy_class = G_DBUS_PROXY_CLASS (class);
        proxy_class->g_signal = g_signal;
 }
 
@@ -567,11 +567,6 @@ e_gdbus_book_factory_proxy_new_for_bus_sync (GBusType bus_type,
 
 /* ---------------------------------------------------------------------- */
 
-struct _EGdbusBookFactoryStubPrivate
-{
-       gint foo;
-};
-
 static void stub_iface_init (EGdbusBookFactoryIface *iface);
 
 G_DEFINE_TYPE_WITH_CODE (EGdbusBookFactoryStub, e_gdbus_book_factory_stub, G_TYPE_OBJECT,
@@ -580,13 +575,11 @@ G_DEFINE_TYPE_WITH_CODE (EGdbusBookFactoryStub, e_gdbus_book_factory_stub, G_TYP
 static void
 e_gdbus_book_factory_stub_init (EGdbusBookFactoryStub *stub)
 {
-       stub->priv = G_TYPE_INSTANCE_GET_PRIVATE (stub, E_TYPE_GDBUS_BOOK_FACTORY_STUB, EGdbusBookFactoryStubPrivate);
 }
 
 static void
-e_gdbus_book_factory_stub_class_init (EGdbusBookFactoryStubClass *klass)
+e_gdbus_book_factory_stub_class_init (EGdbusBookFactoryStubClass *class)
 {
-       g_type_class_add_private (klass, sizeof (EGdbusBookFactoryStubPrivate));
 }
 
 static void
@@ -604,5 +597,5 @@ stub_iface_init (EGdbusBookFactoryIface *iface)
 EGdbusBookFactory *
 e_gdbus_book_factory_stub_new (void)
 {
-       return E_GDBUS_BOOK_FACTORY (g_object_new (E_TYPE_GDBUS_BOOK_FACTORY_STUB, NULL));
+       return g_object_new (E_TYPE_GDBUS_BOOK_FACTORY_STUB, NULL);
 }
index a12ddf6..43d8bba 100644 (file)
@@ -551,11 +551,11 @@ g_signal (GDBusProxy *proxy,
 }
 
 static void
-e_gdbus_book_view_proxy_class_init (EGdbusBookViewProxyClass *klass)
+e_gdbus_book_view_proxy_class_init (EGdbusBookViewProxyClass *class)
 {
        GDBusProxyClass *proxy_class;
 
-       proxy_class = G_DBUS_PROXY_CLASS (klass);
+       proxy_class = G_DBUS_PROXY_CLASS (class);
        proxy_class->g_signal = g_signal;
 }
 
@@ -766,11 +766,6 @@ e_gdbus_book_view_proxy_new_for_bus_sync (GBusType bus_type,
 
 /* ---------------------------------------------------------------------- */
 
-struct _EGdbusBookViewStubPrivate
-{
-       gint foo;
-};
-
 static void stub_iface_init (EGdbusBookViewIface *iface);
 
 G_DEFINE_TYPE_WITH_CODE (EGdbusBookViewStub, e_gdbus_book_view_stub, G_TYPE_OBJECT,
@@ -779,13 +774,11 @@ G_DEFINE_TYPE_WITH_CODE (EGdbusBookViewStub, e_gdbus_book_view_stub, G_TYPE_OBJE
 static void
 e_gdbus_book_view_stub_init (EGdbusBookViewStub *stub)
 {
-       stub->priv = G_TYPE_INSTANCE_GET_PRIVATE (stub, E_TYPE_GDBUS_BOOK_VIEW_STUB, EGdbusBookViewStubPrivate);
 }
 
 static void
-e_gdbus_book_view_stub_class_init (EGdbusBookViewStubClass *klass)
+e_gdbus_book_view_stub_class_init (EGdbusBookViewStubClass *class)
 {
-       g_type_class_add_private (klass, sizeof (EGdbusBookViewStubPrivate));
 }
 
 static void
index 5dd4b37..c7431fe 100644 (file)
 
 #include "e-gdbus-book.h"
 
+#define E_GDBUS_BOOK_PROXY_GET_PRIVATE(obj) \
+       (G_TYPE_INSTANCE_GET_PRIVATE \
+       ((obj), E_TYPE_GDBUS_BOOK_PROXY, EGdbusBookProxyPrivate))
+
 #define GDBUS_BOOK_INTERFACE_NAME "org.gnome.evolution.dataserver.AddressBook"
 
 typedef EGdbusBookIface EGdbusBookInterface;
@@ -1033,7 +1037,7 @@ e_gdbus_book_proxy_init (EGdbusBookProxy *proxy)
 {
        g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), (GDBusInterfaceInfo *) &_e_gdbus_book_interface_info);
 
-       proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, E_TYPE_GDBUS_BOOK_PROXY, EGdbusBookProxyPrivate);
+       proxy->priv = E_GDBUS_BOOK_PROXY_GET_PRIVATE (proxy);
        proxy->priv->pending_ops = e_gdbus_async_op_keeper_create_pending_ops (E_GDBUS_ASYNC_OP_KEEPER (proxy));
 
        E_GDBUS_CONNECT_METHOD_DONE_SIGNAL_VOID   (open);
@@ -1084,17 +1088,17 @@ gdbus_book_proxy_finalize (GObject *object)
 }
 
 static void
-e_gdbus_book_proxy_class_init (EGdbusBookProxyClass *klass)
+e_gdbus_book_proxy_class_init (EGdbusBookProxyClass *class)
 {
        GObjectClass *object_class;
        GDBusProxyClass *proxy_class;
 
-       g_type_class_add_private (klass, sizeof (EGdbusBookProxyPrivate));
+       g_type_class_add_private (class, sizeof (EGdbusBookProxyPrivate));
 
-       object_class = G_OBJECT_CLASS (klass);
+       object_class = G_OBJECT_CLASS (class);
        object_class->finalize = gdbus_book_proxy_finalize;
 
-       proxy_class = G_DBUS_PROXY_CLASS (klass);
+       proxy_class = G_DBUS_PROXY_CLASS (class);
        proxy_class->g_signal = g_signal;
 }
 
@@ -1341,11 +1345,6 @@ e_gdbus_book_proxy_new_for_bus_sync (GBusType bus_type,
 
 /* ---------------------------------------------------------------------- */
 
-struct _EGdbusBookStubPrivate
-{
-       gint foo;
-};
-
 static void stub_iface_init (EGdbusBookIface *iface);
 
 G_DEFINE_TYPE_WITH_CODE (EGdbusBookStub, e_gdbus_book_stub, G_TYPE_OBJECT,
@@ -1354,13 +1353,11 @@ G_DEFINE_TYPE_WITH_CODE (EGdbusBookStub, e_gdbus_book_stub, G_TYPE_OBJECT,
 static void
 e_gdbus_book_stub_init (EGdbusBookStub *stub)
 {
-       stub->priv = G_TYPE_INSTANCE_GET_PRIVATE (stub, E_TYPE_GDBUS_BOOK_STUB, EGdbusBookStubPrivate);
 }
 
 static void
-e_gdbus_book_stub_class_init (EGdbusBookStubClass *klass)
+e_gdbus_book_stub_class_init (EGdbusBookStubClass *class)
 {
-       g_type_class_add_private (klass, sizeof (EGdbusBookStubPrivate));
 }
 
 static void
index 32e2d19..7ca8b8b 100644 (file)
 
 #define d(x)
 
+#define E_CAL_BACKEND_CALDAV_GET_PRIVATE(obj) \
+       (G_TYPE_INSTANCE_GET_PRIVATE \
+       ((obj), E_TYPE_CAL_BACKEND_CALDAV, ECalBackendCalDAVPrivate))
+
 #define CALDAV_CTAG_KEY "CALDAV_CTAG"
 #define CALDAV_MAX_MULTIGET_AMOUNT 100 /* what's the maximum count of items to fetch within a multiget request */
 #define LOCAL_PREFIX "file://"
@@ -286,15 +290,14 @@ put_component_to_store (ECalBackendCalDAV *cbdav,
                         ECalComponent *comp)
 {
        time_t time_start, time_end;
-       ECalBackendCalDAVPrivate *priv;
 
-       priv = cbdav->priv;
+       e_cal_util_get_component_occur_times (
+               comp, &time_start, &time_end,
+               resolve_tzid, cbdav,  icaltimezone_get_utc_timezone (),
+               e_cal_backend_get_kind (E_CAL_BACKEND (cbdav)));
 
-       e_cal_util_get_component_occur_times (comp, &time_start, &time_end,
-                                  resolve_tzid, cbdav,  icaltimezone_get_utc_timezone (),
-                                  e_cal_backend_get_kind (E_CAL_BACKEND (cbdav)));
-
-       return e_cal_backend_store_put_component_with_time_range (priv->store, comp, time_start, time_end);
+       return e_cal_backend_store_put_component_with_time_range (
+               cbdav->priv->store, comp, time_start, time_end);
 }
 
 static ECalBackendSyncClass *parent_class = NULL;
@@ -584,20 +587,16 @@ check_state (ECalBackendCalDAV *cbdav,
              gboolean *online,
              GError **perror)
 {
-       ECalBackendCalDAVPrivate *priv;
-
-       priv = cbdav->priv;
-
        *online = FALSE;
 
-       if (!priv->loaded) {
+       if (!cbdav->priv->loaded) {
                g_propagate_error (perror, EDC_ERROR_EX (OtherError, "Not loaded"));
                return FALSE;
        }
 
        if (!e_backend_get_online (E_BACKEND (cbdav))) {
 
-               if (!priv->do_offline) {
+               if (!cbdav->priv->do_offline) {
                        g_propagate_error (perror, EDC_ERROR (RepositoryOffline));
                        return FALSE;
                }
@@ -932,16 +931,14 @@ soup_authenticate (SoupSession *session,
                    gboolean retrying,
                    gpointer data)
 {
-       ECalBackendCalDAVPrivate *priv;
-       ECalBackendCalDAV        *cbdav;
+       ECalBackendCalDAV *cbdav;
 
        cbdav = E_CAL_BACKEND_CALDAV (data);
-       priv = cbdav->priv;
 
        /* do not send same password twice, but keep it for later use */
-       if (!retrying && priv->credentials && e_credentials_has_key (priv->credentials, E_CREDENTIALS_KEY_USERNAME)) {
-               soup_auth_authenticate (auth, e_credentials_peek (priv->credentials, E_CREDENTIALS_KEY_USERNAME), e_credentials_peek (priv->credentials, E_CREDENTIALS_KEY_PASSWORD));
-               e_credentials_clear_peek (priv->credentials);
+       if (!retrying && cbdav->priv->credentials && e_credentials_has_key (cbdav->priv->credentials, E_CREDENTIALS_KEY_USERNAME)) {
+               soup_auth_authenticate (auth, e_credentials_peek (cbdav->priv->credentials, E_CREDENTIALS_KEY_USERNAME), e_credentials_peek (cbdav->priv->credentials, E_CREDENTIALS_KEY_PASSWORD));
+               e_credentials_clear_peek (cbdav->priv->credentials);
        }
 }
 
@@ -1015,18 +1012,15 @@ static gchar *
 caldav_generate_uri (ECalBackendCalDAV *cbdav,
                      const gchar *target)
 {
-       ECalBackendCalDAVPrivate  *priv;
        gchar *uri;
        const gchar *slash;
 
-       priv = cbdav->priv;
-
        slash = strrchr (target, '/');
        if (slash)
                target = slash + 1;
 
-       /* priv->uri *have* trailing slash already */
-       uri = g_strconcat (priv->uri, target, NULL);
+       /* uri *have* trailing slash already */
+       uri = g_strconcat (cbdav->priv->uri, target, NULL);
 
        return uri;
 }
@@ -1036,7 +1030,6 @@ caldav_server_open_calendar (ECalBackendCalDAV *cbdav,
                              gboolean *server_unreachable,
                              GError **perror)
 {
-       ECalBackendCalDAVPrivate  *priv;
        SoupMessage               *message;
        const gchar                *header;
        gboolean                   calendar_access;
@@ -1046,11 +1039,9 @@ caldav_server_open_calendar (ECalBackendCalDAV *cbdav,
        g_return_val_if_fail (cbdav != NULL, FALSE);
        g_return_val_if_fail (server_unreachable != NULL, FALSE);
 
-       priv = cbdav->priv;
-
        /* FIXME: setup text_uri */
 
-       message = soup_message_new (SOUP_METHOD_OPTIONS, priv->uri);
+       message = soup_message_new (SOUP_METHOD_OPTIONS, cbdav->priv->uri);
        if (message == NULL) {
                g_propagate_error (perror, EDC_ERROR (NoSuchCal));
                return FALSE;
@@ -1058,7 +1049,7 @@ caldav_server_open_calendar (ECalBackendCalDAV *cbdav,
        soup_message_headers_append (message->request_headers,
                                     "User-Agent", "Evolution/" VERSION);
 
-       send_and_handle_redirection (priv->session, message, NULL);
+       send_and_handle_redirection (cbdav->priv->session, message, NULL);
 
        if (!SOUP_STATUS_IS_SUCCESSFUL (message->status_code)) {
                switch (message->status_code) {
@@ -1068,7 +1059,7 @@ caldav_server_open_calendar (ECalBackendCalDAV *cbdav,
                        break;
                }
 
-               status_code_to_result (message, priv, perror);
+               status_code_to_result (message, cbdav->priv, perror);
 
                g_object_unref (message);
                return FALSE;
@@ -1079,10 +1070,10 @@ caldav_server_open_calendar (ECalBackendCalDAV *cbdav,
        header = soup_message_headers_get (message->response_headers, "DAV");
        if (header) {
                calendar_access = soup_header_contains (header, "calendar-access");
-               priv->calendar_schedule = soup_header_contains (header, "calendar-schedule");
+               cbdav->priv->calendar_schedule = soup_header_contains (header, "calendar-schedule");
        } else {
                calendar_access = FALSE;
-               priv->calendar_schedule = FALSE;
+               cbdav->priv->calendar_schedule = FALSE;
        }
 
        /* parse the Allow header and look for PUT, DELETE at the
@@ -1097,7 +1088,7 @@ caldav_server_open_calendar (ECalBackendCalDAV *cbdav,
        g_object_unref (message);
 
        if (calendar_access) {
-               priv->read_only = !(put_allowed && delete_allowed);
+               cbdav->priv->read_only = !(put_allowed && delete_allowed);
                return TRUE;
        }
 
@@ -1144,7 +1135,6 @@ caldav_notify_auth_required (ECalBackendCalDAV *cbdav)
 static gboolean
 check_calendar_changed_on_server (ECalBackendCalDAV *cbdav)
 {
-       ECalBackendCalDAVPrivate *priv;
        xmlOutputBufferPtr        buf;
        SoupMessage              *message;
        xmlDocPtr                 doc;
@@ -1154,14 +1144,12 @@ check_calendar_changed_on_server (ECalBackendCalDAV *cbdav)
 
        g_return_val_if_fail (cbdav != NULL, TRUE);
 
-       priv   = cbdav->priv;
-
        /* no support for 'getctag', thus update cache */
-       if (!priv->ctag_supported)
+       if (!cbdav->priv->ctag_supported)
                return TRUE;
 
        /* Prepare the soup message */
-       message = soup_message_new ("PROPFIND", priv->uri);
+       message = soup_message_new ("PROPFIND", cbdav->priv->uri);
        if (message == NULL)
                return FALSE;
 
@@ -1191,7 +1179,7 @@ check_calendar_changed_on_server (ECalBackendCalDAV *cbdav)
                                  buf->buffer->use);
 
        /* Send the request now */
-       send_and_handle_redirection (priv->session, message, NULL);
+       send_and_handle_redirection (cbdav->priv->session, message, NULL);
 
        /* Clean up the memory */
        xmlOutputBufferClose (buf);
@@ -1202,28 +1190,29 @@ check_calendar_changed_on_server (ECalBackendCalDAV *cbdav)
                caldav_notify_auth_required (cbdav);
        } else if (message->status_code != 207) {
                /* does not support it, but report calendar changed to update cache */
-               priv->ctag_supported = FALSE;
+               cbdav->priv->ctag_supported = FALSE;
        } else {
                gchar *ctag = NULL;
 
                if (parse_propfind_response (message, XPATH_GETCTAG_STATUS, XPATH_GETCTAG, &ctag)) {
                        const gchar *my_ctag;
 
-                       my_ctag = e_cal_backend_store_get_key_value (priv->store, CALDAV_CTAG_KEY);
+                       my_ctag = e_cal_backend_store_get_key_value (
+                               cbdav->priv->store, CALDAV_CTAG_KEY);
 
                        if (ctag && my_ctag && g_str_equal (ctag, my_ctag)) {
                                /* ctag is same, no change in the calendar */
                                result = FALSE;
                        } else {
                                /* do not store ctag now, do it rather after complete sync */
-                               g_free (priv->ctag_to_store);
-                               priv->ctag_to_store = ctag;
+                               g_free (cbdav->priv->ctag_to_store);
+                               cbdav->priv->ctag_to_store = ctag;
                                ctag = NULL;
                        }
 
                        g_free (ctag);
                } else {
-                       priv->ctag_supported = FALSE;
+                       cbdav->priv->ctag_supported = FALSE;
                }
        }
 
@@ -1244,7 +1233,6 @@ caldav_server_list_objects (ECalBackendCalDAV *cbdav,
                             time_t start_time,
                             time_t end_time)
 {
-       ECalBackendCalDAVPrivate *priv;
        xmlOutputBufferPtr   buf;
        SoupMessage         *message;
        xmlNodePtr           node;
@@ -1255,9 +1243,8 @@ caldav_server_list_objects (ECalBackendCalDAV *cbdav,
        xmlNsPtr             nscd;
        gboolean             result;
 
-       priv = cbdav->priv;
        /* Allocate the soup message */
-       message = soup_message_new ("REPORT", priv->uri);
+       message = soup_message_new ("REPORT", cbdav->priv->uri);
        if (message == NULL)
                return FALSE;
 
@@ -1340,7 +1327,7 @@ caldav_server_list_objects (ECalBackendCalDAV *cbdav,
                                  buf->buffer->use);
 
        /* Send the request now */
-       send_and_handle_redirection (priv->session, message, NULL);
+       send_and_handle_redirection (cbdav->priv->session, message, NULL);
 
        /* Clean up the memory */
        xmlOutputBufferClose (buf);
@@ -1351,10 +1338,11 @@ caldav_server_list_objects (ECalBackendCalDAV *cbdav,
                switch (message->status_code) {
                case SOUP_STATUS_CANT_CONNECT:
                case SOUP_STATUS_CANT_CONNECT_PROXY:
-                       priv->opened = FALSE;
-                       priv->slave_cmd = SLAVE_SHOULD_SLEEP;
-                       priv->read_only = TRUE;
-                       e_cal_backend_notify_readonly (E_CAL_BACKEND (cbdav), priv->read_only);
+                       cbdav->priv->opened = FALSE;
+                       cbdav->priv->slave_cmd = SLAVE_SHOULD_SLEEP;
+                       cbdav->priv->read_only = TRUE;
+                       e_cal_backend_notify_readonly (
+                               E_CAL_BACKEND (cbdav), cbdav->priv->read_only);
                        break;
                case 401:
                        caldav_notify_auth_required (cbdav);
@@ -1422,13 +1410,10 @@ caldav_server_get_object (ECalBackendCalDAV *cbdav,
                           CalDAVObject *object,
                           GError **perror)
 {
-       ECalBackendCalDAVPrivate *priv;
        SoupMessage              *message;
        const gchar               *hdr;
        gchar                     *uri;
 
-       priv = cbdav->priv;
-
        g_assert (object != NULL && object->href != NULL);
 
        uri = caldav_generate_uri (cbdav, object->href);
@@ -1442,10 +1427,10 @@ caldav_server_get_object (ECalBackendCalDAV *cbdav,
        soup_message_headers_append (message->request_headers,
                                     "User-Agent", "Evolution/" VERSION);
 
-       send_and_handle_redirection (priv->session, message, NULL);
+       send_and_handle_redirection (cbdav->priv->session, message, NULL);
 
        if (!SOUP_STATUS_IS_SUCCESSFUL (message->status_code)) {
-               status_code_to_result (message, priv, perror);
+               status_code_to_result (message, cbdav->priv, perror);
 
                if (message->status_code == 401)
                        caldav_notify_auth_required (cbdav);
@@ -1490,7 +1475,6 @@ caldav_post_freebusy (ECalBackendCalDAV *cbdav,
                       gchar **post_fb,
                       GError **error)
 {
-       ECalBackendCalDAVPrivate *priv;
        SoupMessage *message;
 
        e_return_data_cal_error_if_fail (cbdav != NULL, InvalidArg);
@@ -1498,8 +1482,6 @@ caldav_post_freebusy (ECalBackendCalDAV *cbdav,
        e_return_data_cal_error_if_fail (post_fb != NULL, InvalidArg);
        e_return_data_cal_error_if_fail (*post_fb != NULL, InvalidArg);
 
-       priv = cbdav->priv;
-
        message = soup_message_new (SOUP_METHOD_POST, url);
        if (message == NULL) {
                g_propagate_error (error, EDC_ERROR (NoSuchCal));
@@ -1512,10 +1494,10 @@ caldav_post_freebusy (ECalBackendCalDAV *cbdav,
                                  SOUP_MEMORY_COPY,
                                  *post_fb, strlen (*post_fb));
 
-       send_and_handle_redirection (priv->session, message, NULL);
+       send_and_handle_redirection (cbdav->priv->session, message, NULL);
 
        if (!SOUP_STATUS_IS_SUCCESSFUL (message->status_code)) {
-               status_code_to_result (message, priv, error);
+               status_code_to_result (message, cbdav->priv, error);
                if (message->status_code == 401)
                        caldav_notify_auth_required (cbdav);
                else
@@ -1538,13 +1520,11 @@ caldav_server_put_object (ECalBackendCalDAV *cbdav,
                           icalcomponent *icalcomp,
                           GError **perror)
 {
-       ECalBackendCalDAVPrivate *priv;
        SoupMessage              *message;
        const gchar               *hdr;
        gchar                     *uri;
 
-       priv   = cbdav->priv;
-       hdr    = NULL;
+       hdr = NULL;
 
        g_assert (object != NULL && object->cdata != NULL);
 
@@ -1577,7 +1557,7 @@ caldav_server_put_object (ECalBackendCalDAV *cbdav,
                                  strlen (object->cdata));
 
        uri = NULL;
-       send_and_handle_redirection (priv->session, message, &uri);
+       send_and_handle_redirection (cbdav->priv->session, message, &uri);
 
        if (uri) {
                gchar *file = strrchr (uri, '/');
@@ -1597,7 +1577,7 @@ caldav_server_put_object (ECalBackendCalDAV *cbdav,
                g_free (uri);
        }
 
-       if (status_code_to_result (message, priv, perror)) {
+       if (status_code_to_result (message, cbdav->priv, perror)) {
                gboolean was_get = FALSE;
 
                hdr = soup_message_headers_get (message->response_headers, "ETag");
@@ -1656,12 +1636,9 @@ caldav_server_delete_object (ECalBackendCalDAV *cbdav,
                              CalDAVObject *object,
                              GError **perror)
 {
-       ECalBackendCalDAVPrivate *priv;
        SoupMessage              *message;
        gchar                     *uri;
 
-       priv = cbdav->priv;
-
        g_assert (object != NULL && object->href != NULL);
 
        uri = caldav_generate_uri (cbdav, object->href);
@@ -1680,9 +1657,9 @@ caldav_server_delete_object (ECalBackendCalDAV *cbdav,
                                             "If-Match", object->etag);
        }
 
-       send_and_handle_redirection (priv->session, message, NULL);
+       send_and_handle_redirection (cbdav->priv->session, message, NULL);
 
-       status_code_to_result (message, priv, perror);
+       status_code_to_result (message, cbdav->priv, perror);
 
        if (message->status_code == 401)
                caldav_notify_auth_required (cbdav);
@@ -1693,7 +1670,6 @@ caldav_server_delete_object (ECalBackendCalDAV *cbdav,
 static gboolean
 caldav_receive_schedule_outbox_url (ECalBackendCalDAV *cbdav)
 {
-       ECalBackendCalDAVPrivate *priv;
        SoupMessage *message;
        xmlOutputBufferPtr buf;
        xmlDocPtr doc;
@@ -1703,12 +1679,11 @@ caldav_receive_schedule_outbox_url (ECalBackendCalDAV *cbdav)
 
        g_return_val_if_fail (cbdav != NULL, FALSE);
 
-       priv = cbdav->priv;
-       g_return_val_if_fail (priv != NULL, FALSE);
-       g_return_val_if_fail (priv->schedule_outbox_url == NULL, TRUE);
+       g_return_val_if_fail (cbdav->priv != NULL, FALSE);
+       g_return_val_if_fail (cbdav->priv->schedule_outbox_url == NULL, TRUE);
 
        /* Prepare the soup message */
-       message = soup_message_new ("PROPFIND", priv->uri);
+       message = soup_message_new ("PROPFIND", cbdav->priv->uri);
        if (message == NULL)
                return FALSE;
 
@@ -1734,7 +1709,7 @@ caldav_receive_schedule_outbox_url (ECalBackendCalDAV *cbdav)
                                  buf->buffer->use);
 
        /* Send the request now */
-       send_and_handle_redirection (priv->session, message, NULL);
+       send_and_handle_redirection (cbdav->priv->session, message, NULL);
 
        /* Clean up the memory */
        xmlOutputBufferClose (buf);
@@ -1749,7 +1724,7 @@ caldav_receive_schedule_outbox_url (ECalBackendCalDAV *cbdav)
 
                /* owner is a full path to the user's URL, thus change it in
                 * calendar's uri when asking for schedule-outbox-URL */
-               suri = soup_uri_new (priv->uri);
+               suri = soup_uri_new (cbdav->priv->uri);
                soup_uri_set_path (suri, owner);
                g_free (owner);
                owner = soup_uri_to_string (suri, FALSE);
@@ -1784,18 +1759,18 @@ caldav_receive_schedule_outbox_url (ECalBackendCalDAV *cbdav)
                                  buf->buffer->use);
 
                /* Send the request now */
-               send_and_handle_redirection (priv->session, message, NULL);
+               send_and_handle_redirection (cbdav->priv->session, message, NULL);
 
-               if (message->status_code == 207 && parse_propfind_response (message, XPATH_SCHEDULE_OUTBOX_URL_STATUS, XPATH_SCHEDULE_OUTBOX_URL, &priv->schedule_outbox_url)) {
-                       if (!*priv->schedule_outbox_url) {
-                               g_free (priv->schedule_outbox_url);
-                               priv->schedule_outbox_url = NULL;
+               if (message->status_code == 207 && parse_propfind_response (message, XPATH_SCHEDULE_OUTBOX_URL_STATUS, XPATH_SCHEDULE_OUTBOX_URL, &cbdav->priv->schedule_outbox_url)) {
+                       if (!*cbdav->priv->schedule_outbox_url) {
+                               g_free (cbdav->priv->schedule_outbox_url);
+                               cbdav->priv->schedule_outbox_url = NULL;
                        } else {
                                /* make it a full URI */
-                               suri = soup_uri_new (priv->uri);
-                               soup_uri_set_path (suri, priv->schedule_outbox_url);
-                               g_free (priv->schedule_outbox_url);
-                               priv->schedule_outbox_url = soup_uri_to_string (suri, FALSE);
+                               suri = soup_uri_new (cbdav->priv->uri);
+                               soup_uri_set_path (suri, cbdav->priv->schedule_outbox_url);
+                               g_free (cbdav->priv->schedule_outbox_url);
+                               cbdav->priv->schedule_outbox_url = soup_uri_to_string (suri, FALSE);
                                soup_uri_free (suri);
                        }
                }
@@ -1812,7 +1787,7 @@ caldav_receive_schedule_outbox_url (ECalBackendCalDAV *cbdav)
 
        g_free (owner);
 
-       return priv->schedule_outbox_url != NULL;
+       return cbdav->priv->schedule_outbox_url != NULL;
 }
 
 /* ************************************************************************* */
@@ -1833,7 +1808,6 @@ remove_complist_from_cache_and_notify_cb (gpointer key,
        GSList *l;
        struct cache_comp_list *ccl = value;
        ECalBackendCalDAV *cbdav = data;
-       ECalBackendCalDAVPrivate *priv = cbdav->priv;
 
        for (l = ccl->slist; l; l = l->next) {
                ECalComponent *old_comp = l->data;
@@ -1844,7 +1818,7 @@ remove_complist_from_cache_and_notify_cb (gpointer key,
                        continue;
                }
 
-               if (e_cal_backend_store_remove_component (priv->store, id->uid, id->rid)) {
+               if (e_cal_backend_store_remove_component (cbdav->priv->store, id->uid, id->rid)) {
                        e_cal_backend_notify_component_removed ((ECalBackend *) cbdav, id, old_comp, NULL);
                }
 
@@ -1880,7 +1854,6 @@ synchronize_cache (ECalBackendCalDAV *cbdav,
                    time_t start_time,
                    time_t end_time)
 {
-       ECalBackendCalDAVPrivate *priv;
        ECalBackend *bkend;
        CalDAVObject *sobjs, *object;
        GSList *c_objs, *c_iter; /* list of all items known from our cache */
@@ -1894,7 +1867,6 @@ synchronize_cache (ECalBackendCalDAV *cbdav,
                return;
        }
 
-       priv   = cbdav->priv;
        bkend  = E_CAL_BACKEND (cbdav);
        len    = 0;
        sobjs  = NULL;
@@ -1903,14 +1875,14 @@ synchronize_cache (ECalBackendCalDAV *cbdav,
        if (!caldav_server_list_objects (cbdav, &sobjs, &len, NULL, start_time, end_time))
                return;
 
-       c_objs = e_cal_backend_store_get_components (priv->store);
+       c_objs = e_cal_backend_store_get_components (cbdav->priv->store);
 
        if (caldav_debug_show (DEBUG_SERVER_ITEMS)) {
                printf ("CalDAV - found %d objects on the server, locally stored %d objects\n", len, g_slist_length (c_objs)); fflush (stdout);
        }
 
        /* do not store changes in cache immediately - makes things significantly quicker */
-       e_cal_backend_store_freeze_changes (priv->store);
+       e_cal_backend_store_freeze_changes (cbdav->priv->store);
 
        c_uid2complist = g_tree_new_full ((GCompareDataFunc) g_strcmp0, NULL, g_free, free_comp_list);
        c_href2uid = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
@@ -1966,7 +1938,7 @@ synchronize_cache (ECalBackendCalDAV *cbdav,
        hrefs_to_update = NULL;
 
        /* see if we have to update or add some objects */
-       for (i = 0, object = sobjs; i < len && priv->slave_cmd == SLAVE_SHOULD_WORK; i++, object++) {
+       for (i = 0, object = sobjs; i < len && cbdav->priv->slave_cmd == SLAVE_SHOULD_WORK; i++, object++) {
                ECalComponent *ccomp = NULL;
                gchar *etag = NULL;
                const gchar *uid;
@@ -2021,7 +1993,7 @@ synchronize_cache (ECalBackendCalDAV *cbdav,
        }
 
        htu = hrefs_to_update;
-       while (htu && priv->slave_cmd == SLAVE_SHOULD_WORK) {
+       while (htu && cbdav->priv->slave_cmd == SLAVE_SHOULD_WORK) {
                gint count = 0;
                GSList *to_fetch = NULL;
 
@@ -2031,7 +2003,7 @@ synchronize_cache (ECalBackendCalDAV *cbdav,
                        count++;
                }
 
-               if (to_fetch && priv->slave_cmd == SLAVE_SHOULD_WORK) {
+               if (to_fetch && cbdav->priv->slave_cmd == SLAVE_SHOULD_WORK) {
                        CalDAVObject *up_sobjs = NULL;
 
                        if (caldav_debug_show (DEBUG_SERVER_ITEMS)) {
@@ -2050,7 +2022,7 @@ synchronize_cache (ECalBackendCalDAV *cbdav,
 
                        /* we are going to update cache */
                        /* they are downloaded, so process them */
-                       for (i = 0, object = up_sobjs; i < count /*&& priv->slave_cmd == SLAVE_SHOULD_WORK */; i++, object++) {
+                       for (i = 0, object = up_sobjs; i < count /*&& cbdav->priv->slave_cmd == SLAVE_SHOULD_WORK */; i++, object++) {
                                if (object->status == 200 && object->href && object->etag && object->cdata && *object->cdata) {
                                        icalcomponent *icomp = icalparser_parse_string (object->cdata);
 
@@ -2140,23 +2112,23 @@ synchronize_cache (ECalBackendCalDAV *cbdav,
        }
 
        /* if not interrupted and not using the time range... */
-       if (priv->slave_cmd == SLAVE_SHOULD_WORK && (!start_time || !end_time)) {
+       if (cbdav->priv->slave_cmd == SLAVE_SHOULD_WORK && (!start_time || !end_time)) {
                /* ...remove old (not on server anymore) items from our cache and notify of a removal */
                g_tree_foreach (c_uid2complist, remove_complist_from_cache_and_notify_cb, cbdav);
        }
 
-       if (priv->ctag_to_store) {
+       if (cbdav->priv->ctag_to_store) {
                /* store only when wasn't interrupted */
-               if (priv->slave_cmd == SLAVE_SHOULD_WORK && start_time == 0 && end_time == 0) {
-                       e_cal_backend_store_put_key_value (priv->store, CALDAV_CTAG_KEY, priv->ctag_to_store);
+               if (cbdav->priv->slave_cmd == SLAVE_SHOULD_WORK && start_time == 0 && end_time == 0) {
+                       e_cal_backend_store_put_key_value (cbdav->priv->store, CALDAV_CTAG_KEY, cbdav->priv->ctag_to_store);
                }
 
-               g_free (priv->ctag_to_store);
-               priv->ctag_to_store = NULL;
+               g_free (cbdav->priv->ctag_to_store);
+               cbdav->priv->ctag_to_store = NULL;
        }
 
        /* save cache changes to disk finally */
-       e_cal_backend_store_thaw_changes (priv->store);
+       e_cal_backend_store_thaw_changes (cbdav->priv->store);
 
        for (i = 0, object = sobjs; i < len; i++, object++) {
                caldav_object_free (object, FALSE);
@@ -2190,24 +2162,22 @@ is_google_uri (const gchar *uri)
 static gpointer
 caldav_synch_slave_loop (gpointer data)
 {
-       ECalBackendCalDAVPrivate *priv;
        ECalBackendCalDAV        *cbdav;
        time_t now;
        icaltimezone *utc = icaltimezone_get_utc_timezone ();
        gboolean know_unreachable;
 
        cbdav = E_CAL_BACKEND_CALDAV (data);
-       priv = cbdav->priv;
 
-       g_mutex_lock (priv->busy_lock);
+       g_mutex_lock (cbdav->priv->busy_lock);
 
-       know_unreachable = !priv->opened;
+       know_unreachable = !cbdav->priv->opened;
 
-       while (priv->slave_cmd != SLAVE_SHOULD_DIE) {
+       while (cbdav->priv->slave_cmd != SLAVE_SHOULD_DIE) {
                GTimeVal alarm_clock;
-               if (priv->slave_cmd == SLAVE_SHOULD_SLEEP) {
+               if (cbdav->priv->slave_cmd == SLAVE_SHOULD_SLEEP) {
                        /* just sleep until we get woken up again */
-                       g_cond_wait (priv->cond, priv->busy_lock);
+                       g_cond_wait (cbdav->priv->cond, cbdav->priv->busy_lock);
 
                        /* check if we should die, work or sleep again */
                        continue;
@@ -2216,23 +2186,23 @@ caldav_synch_slave_loop (gpointer data)
                /* Ok here we go, do some real work
                 * Synch it baby one more time ...
                 */
-               priv->slave_busy = TRUE;
+               cbdav->priv->slave_busy = TRUE;
 
-               if (!priv->opened) {
+               if (!cbdav->priv->opened) {
                        gboolean server_unreachable = FALSE;
                        GError *local_error = NULL;
                        gboolean online;
 
                        if (caldav_server_open_calendar (cbdav, &server_unreachable, &local_error)) {
-                               priv->opened = TRUE;
-                               priv->slave_cmd = SLAVE_SHOULD_WORK;
-                               g_cond_signal (priv->cond);
+                               cbdav->priv->opened = TRUE;
+                               cbdav->priv->slave_cmd = SLAVE_SHOULD_WORK;
+                               g_cond_signal (cbdav->priv->cond);
 
-                               priv->is_google = is_google_uri (priv->uri);
+                               cbdav->priv->is_google = is_google_uri (cbdav->priv->uri);
                                know_unreachable = FALSE;
                        } else if (local_error) {
-                               priv->opened = FALSE;
-                               priv->read_only = TRUE;
+                               cbdav->priv->opened = FALSE;
+                               cbdav->priv->read_only = TRUE;
 
                                if (!know_unreachable) {
                                        gchar *msg;
@@ -2246,24 +2216,24 @@ caldav_synch_slave_loop (gpointer data)
 
                                g_clear_error (&local_error);
                        } else {
-                               priv->opened = FALSE;
-                               priv->read_only = TRUE;
+                               cbdav->priv->opened = FALSE;
+                               cbdav->priv->read_only = TRUE;
                                know_unreachable = TRUE;
                        }
 
-                       e_cal_backend_notify_readonly (E_CAL_BACKEND (cbdav), priv->read_only);
+                       e_cal_backend_notify_readonly (E_CAL_BACKEND (cbdav), cbdav->priv->read_only);
 
                        online = e_backend_get_online (E_BACKEND (cbdav));
                        e_cal_backend_notify_online (E_CAL_BACKEND (cbdav), online);
                }
 
-               if (priv->opened) {
+               if (cbdav->priv->opened) {
                        time (&now);
                        /* check for events in the month before/after today first,
                         * to show user actual data as soon as possible */
                        synchronize_cache (cbdav, time_add_week_with_zone (now, -5, utc), time_add_week_with_zone (now, +5, utc));
 
-                       if (priv->slave_cmd != SLAVE_SHOULD_SLEEP) {
+                       if (cbdav->priv->slave_cmd != SLAVE_SHOULD_SLEEP) {
                                /* and then check for changes in a whole calendar */
                                synchronize_cache (cbdav, 0, 0);
                        }
@@ -2271,7 +2241,7 @@ caldav_synch_slave_loop (gpointer data)
                        if (caldav_debug_show (DEBUG_SERVER_ITEMS)) {
                                GSList *c_objs;
 
-                               c_objs = e_cal_backend_store_get_components (priv->store);
+                               c_objs = e_cal_backend_store_get_components (cbdav->priv->store);
 
                                printf ("CalDAV - finished syncing with %d items in a cache\n", g_slist_length (c_objs)); fflush (stdout);
 
@@ -2280,24 +2250,24 @@ caldav_synch_slave_loop (gpointer data)
                        }
                }
 
-               priv->slave_busy = FALSE;
+               cbdav->priv->slave_busy = FALSE;
 
                /* puhh that was hard, get some rest :) */
                g_get_current_time (&alarm_clock);
-               alarm_clock.tv_sec += priv->refresh_time.tv_sec;
-               g_cond_timed_wait (priv->cond,
-                                  priv->busy_lock,
+               alarm_clock.tv_sec += cbdav->priv->refresh_time.tv_sec;
+               g_cond_timed_wait (cbdav->priv->cond,
+                                  cbdav->priv->busy_lock,
                                   &alarm_clock);
 
        }
 
        /* signal we are done */
-       g_cond_signal (priv->slave_gone_cond);
+       g_cond_signal (cbdav->priv->slave_gone_cond);
 
-       priv->synch_slave = NULL;
+       cbdav->priv->synch_slave = NULL;
 
        /* we got killed ... */
-       g_mutex_unlock (priv->busy_lock);
+       g_mutex_unlock (cbdav->priv->busy_lock);
        return NULL;
 }
 
@@ -2318,7 +2288,6 @@ static gchar *
 get_usermail (ECalBackend *backend)
 {
        ECalBackendCalDAV        *cbdav;
-       ECalBackendCalDAVPrivate *priv;
        ESource *source;
        gchar *res = NULL;
 
@@ -2335,10 +2304,9 @@ get_usermail (ECalBackend *backend)
        }
 
        cbdav = E_CAL_BACKEND_CALDAV (backend);
-       priv  = cbdav->priv;
 
-       if (priv && priv->is_google && priv->credentials) {
-               res = maybe_append_email_domain (e_credentials_peek (priv->credentials, E_CREDENTIALS_KEY_USERNAME), "@gmail.com");
+       if (cbdav->priv->is_google && cbdav->priv->credentials) {
+               res = maybe_append_email_domain (e_credentials_peek (cbdav->priv->credentials, E_CREDENTIALS_KEY_USERNAME), "@gmail.com");
        }
 
        return res;
@@ -2421,7 +2389,6 @@ static gboolean
 initialize_backend (ECalBackendCalDAV *cbdav,
                     GError **perror)
 {
-       ECalBackendCalDAVPrivate *priv;
        ECalBackend              *backend;
        ESource                  *source;
        const gchar              *os_val;
@@ -2430,8 +2397,6 @@ initialize_backend (ECalBackendCalDAV *cbdav,
        const gchar              *refresh;
        const gchar              *cache_dir;
 
-       priv  = cbdav->priv;
-
        backend = E_CAL_BACKEND (cbdav);
        cache_dir = e_cal_backend_get_cache_dir (backend);
        source = e_backend_get_source (E_BACKEND (backend));
@@ -2443,16 +2408,16 @@ initialize_backend (ECalBackendCalDAV *cbdav,
        os_val = e_source_get_property (source, "offline_sync");
 
        if (!os_val || !g_str_equal (os_val, "1")) {
-               priv->do_offline = FALSE;
+               cbdav->priv->do_offline = FALSE;
        }
 
        os_val = e_source_get_property (source, "auth");
-       priv->auth_required = os_val != NULL;
+       cbdav->priv->auth_required = os_val != NULL;
 
        os_val = e_source_get_property(source, "ssl");
 
-       g_free (priv->uri);
-       priv->uri = NULL;
+       g_free (cbdav->priv->uri);
+       cbdav->priv->uri = NULL;
        if (g_str_has_prefix (uri, "caldav://")) {
                const gchar *proto;
 
@@ -2462,15 +2427,15 @@ initialize_backend (ECalBackendCalDAV *cbdav,
                        proto = "http://";
                }
 
-               priv->uri = g_strconcat (proto, uri + 9, NULL);
+               cbdav->priv->uri = g_strconcat (proto, uri + 9, NULL);
 
                g_free (uri);
        } else {
-               priv->uri = uri;
+               cbdav->priv->uri = uri;
        }
 
-       if (priv->uri) {
-               SoupURI *suri = soup_uri_new (priv->uri);
+       if (cbdav->priv->uri) {
+               SoupURI *suri = soup_uri_new (cbdav->priv->uri);
 
                /* properly encode uri */
                if (suri && suri->path) {
@@ -2493,46 +2458,46 @@ initialize_backend (ECalBackendCalDAV *cbdav,
 
                        g_free (tmp);
                        g_free (path);
-                       g_free (priv->uri);
+                       g_free (cbdav->priv->uri);
 
-                       priv->uri = soup_uri_to_string (suri, FALSE);
+                       cbdav->priv->uri = soup_uri_to_string (suri, FALSE);
                }
 
                soup_uri_free (suri);
        }
 
-       g_return_val_if_fail (priv->uri != NULL, FALSE);
+       g_return_val_if_fail (cbdav->priv->uri != NULL, FALSE);
 
        /* remove trailing slashes... */
-       len = strlen (priv->uri);
+       len = strlen (cbdav->priv->uri);
        while (len--) {
-               if (priv->uri[len] == '/') {
-                       priv->uri[len] = '\0';
+               if (cbdav->priv->uri[len] == '/') {
+                       cbdav->priv->uri[len] = '\0';
                } else {
                        break;
                }
        }
 
        /* ...and append exactly one slash */
-       if (priv->uri && *priv->uri) {
-               gchar *tmp = priv->uri;
+       if (cbdav->priv->uri && *cbdav->priv->uri) {
+               gchar *tmp = cbdav->priv->uri;
 
-               priv->uri = g_strconcat (priv->uri, "/", NULL);
+               cbdav->priv->uri = g_strconcat (cbdav->priv->uri, "/", NULL);
 
                g_free (tmp);
        }
 
-       if (priv->store == NULL) {
+       if (cbdav->priv->store == NULL) {
                /* remove the old cache while migrating to ECalBackendStore */
                e_cal_backend_cache_remove (cache_dir, "cache.xml");
-               priv->store = e_cal_backend_file_store_new (cache_dir);
+               cbdav->priv->store = e_cal_backend_file_store_new (cache_dir);
 
-               if (priv->store == NULL) {
+               if (cbdav->priv->store == NULL) {
                        g_propagate_error (perror, EDC_ERROR_EX (OtherError, "Cannot create local store"));
                        return FALSE;
                }
 
-               e_cal_backend_store_load (priv->store);
+               e_cal_backend_store_load (cbdav->priv->store);
        }
 
        /* Set the local attachment store */
@@ -2542,19 +2507,19 @@ initialize_backend (ECalBackendCalDAV *cbdav,
        }
 
        refresh = e_source_get_property (source, "refresh");
-       priv->refresh_time.tv_sec  = (refresh && atoi (refresh) > 0) ? (60 * atoi (refresh)) : (DEFAULT_REFRESH_TIME);
+       cbdav->priv->refresh_time.tv_sec  = (refresh && atoi (refresh) > 0) ? (60 * atoi (refresh)) : (DEFAULT_REFRESH_TIME);
 
-       if (!priv->synch_slave) {
+       if (!cbdav->priv->synch_slave) {
                GThread *slave;
 
-               priv->slave_cmd = SLAVE_SHOULD_SLEEP;
+               cbdav->priv->slave_cmd = SLAVE_SHOULD_SLEEP;
                slave = g_thread_create (caldav_synch_slave_loop, cbdav, FALSE, NULL);
 
                if (slave == NULL) {
                        g_propagate_error (perror, EDC_ERROR_EX (OtherError, "Could not create synch slave"));
                }
 
-               priv->synch_slave = slave;
+               cbdav->priv->synch_slave = slave;
        }
 
        return TRUE;
@@ -2583,24 +2548,21 @@ open_calendar (ECalBackendCalDAV *cbdav,
                GError **error)
 {
        gboolean server_unreachable = FALSE;
-       ECalBackendCalDAVPrivate *priv;
        GError *local_error = NULL;
 
        g_return_if_fail (cbdav != NULL);
 
-       priv  = cbdav->priv;
-
        /* set forward proxy */
-       proxy_settings_changed (priv->proxy, priv);
+       proxy_settings_changed (cbdav->priv->proxy, cbdav->priv);
 
        if (caldav_server_open_calendar (cbdav, &server_unreachable, &local_error)) {
-               priv->slave_cmd = SLAVE_SHOULD_WORK;
-               g_cond_signal (priv->cond);
+               cbdav->priv->slave_cmd = SLAVE_SHOULD_WORK;
+               g_cond_signal (cbdav->priv->cond);
 
-               priv->is_google = is_google_uri (priv->uri);
+               cbdav->priv->is_google = is_google_uri (cbdav->priv->uri);
        } else if (server_unreachable) {
-               priv->opened = FALSE;
-               priv->read_only = TRUE;
+               cbdav->priv->opened = FALSE;
+               cbdav->priv->read_only = TRUE;
                if (local_error) {
                        gchar *msg = g_strdup_printf (_("Server is unreachable, calendar is opened in read-only mode.\nError message: %s"), local_error->message);
                        e_cal_backend_notify_error (E_CAL_BACKEND (cbdav), msg);
@@ -2620,33 +2582,31 @@ caldav_do_open (ECalBackendSync *backend,
                 GError **perror)
 {
        ECalBackendCalDAV        *cbdav;
-       ECalBackendCalDAVPrivate *priv;
        gboolean online;
 
        cbdav = E_CAL_BACKEND_CALDAV (backend);
-       priv  = cbdav->priv;
 
-       g_mutex_lock (priv->busy_lock);
+       g_mutex_lock (cbdav->priv->busy_lock);
 
        /* let it decide the 'getctag' extension availability again */
-       priv->ctag_supported = TRUE;
+       cbdav->priv->ctag_supported = TRUE;
 
-       if (!priv->loaded && !initialize_backend (cbdav, perror)) {
-               g_mutex_unlock (priv->busy_lock);
+       if (!cbdav->priv->loaded && !initialize_backend (cbdav, perror)) {
+               g_mutex_unlock (cbdav->priv->busy_lock);
                return;
        }
 
        online = e_backend_get_online (E_BACKEND (backend));
 
-       if (!priv->do_offline && !online) {
-               g_mutex_unlock (priv->busy_lock);
+       if (!cbdav->priv->do_offline && !online) {
+               g_mutex_unlock (cbdav->priv->busy_lock);
                g_propagate_error (perror, EDC_ERROR (RepositoryOffline));
                return;
        }
 
-       priv->loaded = TRUE;
-       priv->opened = TRUE;
-       priv->is_google = FALSE;
+       cbdav->priv->loaded = TRUE;
+       cbdav->priv->opened = TRUE;
+       cbdav->priv->is_google = FALSE;
 
        if (online) {
                GError *local_error = NULL;
@@ -2655,7 +2615,7 @@ caldav_do_open (ECalBackendSync *backend,
 
                if (g_error_matches (local_error, E_DATA_CAL_ERROR, AuthenticationRequired) || g_error_matches (local_error, E_DATA_CAL_ERROR, AuthenticationFailed)) {
                        g_clear_error (&local_error);
-                       e_cal_backend_notify_auth_required (E_CAL_BACKEND (cbdav), TRUE, priv->credentials);
+                       e_cal_backend_notify_auth_required (E_CAL_BACKEND (cbdav), TRUE, cbdav->priv->credentials);
                } else {
                        e_cal_backend_notify_opened (E_CAL_BACKEND (backend), NULL);
                }
@@ -2663,14 +2623,14 @@ caldav_do_open (ECalBackendSync *backend,
                if (local_error)
                        g_propagate_error (perror, local_error);
        } else {
-               priv->read_only = TRUE;
+               cbdav->priv->read_only = TRUE;
                e_cal_backend_notify_opened (E_CAL_BACKEND (backend), NULL);
        }
 
-       e_cal_backend_notify_readonly (E_CAL_BACKEND (backend), priv->read_only);
+       e_cal_backend_notify_readonly (E_CAL_BACKEND (backend), cbdav->priv->read_only);
        e_cal_backend_notify_online (E_CAL_BACKEND (backend), online);
 
-       g_mutex_unlock (priv->busy_lock);
+       g_mutex_unlock (cbdav->priv->busy_lock);
 }
 
 static void
@@ -2680,27 +2640,25 @@ caldav_authenticate_user (ECalBackendSync *backend,
                           GError **error)
 {
        ECalBackendCalDAV        *cbdav;
-       ECalBackendCalDAVPrivate *priv;
 
        cbdav = E_CAL_BACKEND_CALDAV (backend);
-       priv  = cbdav->priv;
 
-       g_mutex_lock (priv->busy_lock);
+       g_mutex_lock (cbdav->priv->busy_lock);
 
-       e_credentials_free (priv->credentials);
-       priv->credentials = NULL;
+       e_credentials_free (cbdav->priv->credentials);
+       cbdav->priv->credentials = NULL;
 
        if (!credentials || !e_credentials_has_key (credentials, E_CREDENTIALS_KEY_USERNAME)) {
-               g_mutex_unlock (priv->busy_lock);
+               g_mutex_unlock (cbdav->priv->busy_lock);
                g_propagate_error (error, EDC_ERROR (AuthenticationRequired));
                return;
        }
 
-       priv->credentials = e_credentials_new_clone (credentials);
+       cbdav->priv->credentials = e_credentials_new_clone (credentials);
 
        open_calendar (cbdav, error);
 
-       g_mutex_unlock (priv->busy_lock);
+       g_mutex_unlock (cbdav->priv->busy_lock);
 }
 
 static void
@@ -2710,27 +2668,25 @@ caldav_refresh (ECalBackendSync *backend,
                 GError **perror)
 {
        ECalBackendCalDAV        *cbdav;
-       ECalBackendCalDAVPrivate *priv;
        gboolean                  online;
 
        cbdav = E_CAL_BACKEND_CALDAV (backend);
-       priv  = cbdav->priv;
 
-       g_mutex_lock (priv->busy_lock);
+       g_mutex_lock (cbdav->priv->busy_lock);
 
-       if (!priv->loaded
-           || priv->slave_cmd != SLAVE_SHOULD_SLEEP
+       if (!cbdav->priv->loaded
+           || cbdav->priv->slave_cmd != SLAVE_SHOULD_SLEEP
            || !check_state (cbdav, &online, NULL)
            || !online) {
-               g_mutex_unlock (priv->busy_lock);
+               g_mutex_unlock (cbdav->priv->busy_lock);
                return;
        }
 
-       priv->slave_cmd = SLAVE_SHOULD_WORK;
+       cbdav->priv->slave_cmd = SLAVE_SHOULD_WORK;
 
        /* wake it up */
-       g_cond_signal (priv->cond);
-       g_mutex_unlock (priv->busy_lock);
+       g_cond_signal (cbdav->priv->cond);
+       g_mutex_unlock (cbdav->priv->busy_lock);
 }
 
 static void
@@ -2740,19 +2696,17 @@ caldav_remove (ECalBackendSync *backend,
                GError **perror)
 {
        ECalBackendCalDAV        *cbdav;
-       ECalBackendCalDAVPrivate *priv;
        gboolean                  online;
 
        cbdav = E_CAL_BACKEND_CALDAV (backend);
-       priv  = cbdav->priv;
 
        /* first tell it to die, then wait for its lock */
-       priv->slave_cmd = SLAVE_SHOULD_DIE;
+       cbdav->priv->slave_cmd = SLAVE_SHOULD_DIE;
 
-       g_mutex_lock (priv->busy_lock);
+       g_mutex_lock (cbdav->priv->busy_lock);
 
-       if (!priv->loaded) {
-               g_mutex_unlock (priv->busy_lock);
+       if (!cbdav->priv->loaded) {
+               g_mutex_unlock (cbdav->priv->busy_lock);
                return;
        }
 
@@ -2761,19 +2715,19 @@ caldav_remove (ECalBackendSync *backend,
                g_print (G_STRLOC ": Failed to check state");
        }
 
-       e_cal_backend_store_remove (priv->store);
-       priv->store = NULL;
-       priv->loaded = FALSE;
-       priv->opened = FALSE;
+       e_cal_backend_store_remove (cbdav->priv->store);
+       cbdav->priv->store = NULL;
+       cbdav->priv->loaded = FALSE;
+       cbdav->priv->opened = FALSE;
 
-       if (priv->synch_slave) {
-               g_cond_signal (priv->cond);
+       if (cbdav->priv->synch_slave) {
+               g_cond_signal (cbdav->priv->cond);
 
                /* wait until the slave died */
-               g_cond_wait (priv->slave_gone_cond, priv->busy_lock);
+               g_cond_wait (cbdav->priv->slave_gone_cond, cbdav->priv->busy_lock);
        }
 
-       g_mutex_unlock (priv->busy_lock);
+       g_mutex_unlock (cbdav->priv->busy_lock);
 }
 
 static void
@@ -2799,24 +2753,21 @@ remove_comp_from_cache (ECalBackendCalDAV *cbdav,
                         const gchar *uid,
                         const gchar *rid)
 {
-       ECalBackendCalDAVPrivate *priv;
        gboolean res = FALSE;
 
-       priv  = cbdav->priv;
-
        if (!rid || !*rid) {
                /* get with detached instances */
-               GSList *objects = e_cal_backend_store_get_components_by_uid (priv->store, uid);
+               GSList *objects = e_cal_backend_store_get_components_by_uid (cbdav->priv->store, uid);
 
                if (objects) {
-                       g_slist_foreach (objects, (GFunc) remove_comp_from_cache_cb, priv->store);
+                       g_slist_foreach (objects, (GFunc) remove_comp_from_cache_cb, cbdav->priv->store);
                        g_slist_foreach (objects, (GFunc) g_object_unref, NULL);
                        g_slist_free (objects);
 
                        res = TRUE;
                }
        } else {
-               res = e_cal_backend_store_remove_component (priv->store, uid, rid);
+               res = e_cal_backend_store_remove_component (cbdav->priv->store, uid, rid);
        }
 
        return res;
@@ -2865,14 +2816,11 @@ get_comp_from_cache (ECalBackendCalDAV *cbdav,
                      gchar **href,
                      gchar **etag)
 {
-       ECalBackendCalDAVPrivate *priv;
        icalcomponent *icalcomp = NULL;
 
-       priv  = cbdav->priv;
-
        if (rid == NULL || !*rid) {
                /* get with detached instances */
-               GSList *objects = e_cal_backend_store_get_components_by_uid (priv->store, uid);
+               GSList *objects = e_cal_backend_store_get_components_by_uid (cbdav->priv->store, uid);
 
                if (!objects) {
                        return NULL;
@@ -2904,7 +2852,7 @@ get_comp_from_cache (ECalBackendCalDAV *cbdav,
                g_slist_free (objects);
        } else {
                /* get the exact object */
-               ECalComponent *comp = e_cal_backend_store_get_component (priv->store, uid, rid);
+               ECalComponent *comp = e_cal_backend_store_get_component (cbdav->priv->store, uid, rid);
 
                if (comp) {
                        icalcomp = icalcomponent_new_clone (e_cal_component_get_icalcomponent (comp));
@@ -3262,7 +3210,6 @@ static void
 remove_cached_attachment (ECalBackendCalDAV *cbdav,
                           const gchar *uid)
 {
-       ECalBackendCalDAVPrivate *priv;
        GSList *l;
        guint len;
        gchar *dir;
@@ -3271,8 +3218,7 @@ remove_cached_attachment (ECalBackendCalDAV *cbdav,
        g_return_if_fail (cbdav != NULL);
        g_return_if_fail (uid != NULL);
 
-       priv = cbdav->priv;
-       l = e_cal_backend_store_get_components_by_uid (priv->store, uid);
+       l = e_cal_backend_store_get_components_by_uid (cbdav->priv->store, uid);
        len = g_slist_length (l);
        g_slist_foreach (l, (GFunc) g_object_unref, NULL);
        g_slist_free (l);
@@ -3344,15 +3290,12 @@ add_timezones_from_component (ECalBackendCalDAV *cbdav,
                               icalcomponent *icalcomp)
 {
        ForeachTzidData f_data;
-       ECalBackendCalDAVPrivate *priv;
 
        g_return_if_fail (cbdav != NULL);
        g_return_if_fail (vcal_comp != NULL);
        g_return_if_fail (icalcomp != NULL);
 
-       priv  = cbdav->priv;
-
-       f_data.store = priv->store;
+       f_data.store = cbdav->priv->store;
        f_data.vcal_comp = vcal_comp;
        f_data.icalcomp = icalcomp;
 
@@ -3450,17 +3393,15 @@ cache_contains (ECalBackendCalDAV *cbdav,
                 const gchar *uid,
                 const gchar *rid)
 {
-       ECalBackendCalDAVPrivate *priv;
        gboolean res;
        ECalComponent *comp;
 
        g_return_val_if_fail (cbdav != NULL, FALSE);
        g_return_val_if_fail (uid != NULL, FALSE);
 
-       priv  = cbdav->priv;
-       g_return_val_if_fail (priv != NULL && priv->store != NULL, FALSE);
+       g_return_val_if_fail (cbdav->priv->store != NULL, FALSE);
 
-       comp = e_cal_backend_store_get_component (priv->store, uid, rid);
+       comp = e_cal_backend_store_get_component (cbdav->priv->store, uid, rid);
        res = comp != NULL;
 
        if (comp)
@@ -3589,12 +3530,12 @@ replace_master (ECalBackendCalDAV *cbdav,
 }
 
 /* the resulting component should be unreffed when done with it;
  the fallback_comp is cloned, if used */
* the fallback_comp is cloned, if used */
 static ECalComponent *
 get_ecalcomp_master_from_cache_or_fallback (ECalBackendCalDAV *cbdav,
-                                           const gchar *uid,
-                                           const gchar *rid,
-                                           ECalComponent *fallback_comp)
+                                            const gchar *uid,
+                                            const gchar *rid,
+                                            ECalComponent *fallback_comp)
 {
        ECalComponent *comp = NULL;
        icalcomponent *icalcomp;
@@ -3717,7 +3658,6 @@ do_modify_object (ECalBackendCalDAV *cbdav,
                   ECalComponent **new_component,
                   GError **error)
 {
-       ECalBackendCalDAVPrivate *priv;
        ECalComponent            *comp;
        icalcomponent            *cache_comp;
        gboolean                  online, did_put = FALSE;
@@ -3725,8 +3665,6 @@ do_modify_object (ECalBackendCalDAV *cbdav,
        struct icaltimetype current;
        gchar *href = NULL, *etag = NULL;
 
-       priv  = cbdav->priv;
-
        if (new_component)
                *new_component = NULL;
 
@@ -3779,7 +3717,7 @@ do_modify_object (ECalBackendCalDAV *cbdav,
 
                if (e_cal_component_is_instance (comp)) {
                        /* set detached instance as the old object, if any */
-                       ECalComponent *old_instance = e_cal_backend_store_get_component (priv->store, id->uid, id->rid);
+                       ECalComponent *old_instance = e_cal_backend_store_get_component (cbdav->priv->store, id->uid, id->rid);
 
                        /* This will give a reference to 'old_component' */
                        if (old_instance) {
@@ -3823,7 +3761,7 @@ do_modify_object (ECalBackendCalDAV *cbdav,
                                cache_comp = icomp;
                        }
 
-                       if (cache_comp && priv->is_google) {
+                       if (cache_comp && cbdav->priv->is_google) {
                                icalcomponent_set_sequence (cache_comp, icalcomponent_get_sequence (cache_comp) + 1);
                                icalcomponent_set_sequence (new_comp, icalcomponent_get_sequence (new_comp) + 1);
                        }
@@ -3885,13 +3823,10 @@ do_remove_object (ECalBackendCalDAV *cbdav,
                   ECalComponent **new_component,
                   GError **perror)
 {
-       ECalBackendCalDAVPrivate *priv;
        icalcomponent            *cache_comp;
        gboolean                  online;
        gchar *href = NULL, *etag = NULL;
 
-       priv  = cbdav->priv;
-
        if (new_component)
                *new_component = NULL;
 
@@ -3906,7 +3841,7 @@ do_remove_object (ECalBackendCalDAV *cbdav,
        }
 
        if (old_component) {
-               ECalComponent *old = e_cal_backend_store_get_component (priv->store, uid, rid);
+               ECalComponent *old = e_cal_backend_store_get_component (cbdav->priv->store, uid, rid);
 
                if (old) {
                        *old_component = e_cal_component_clone (old);
@@ -4022,7 +3957,6 @@ static gboolean
 extract_timezones (ECalBackendCalDAV *cbdav,
                    icalcomponent *icomp)
 {
-       ECalBackendCalDAVPrivate *priv;
        GSList *timezones = NULL, *iter;
        icaltimezone *zone;
        GError *err = NULL;
@@ -4036,12 +3970,10 @@ extract_timezones (ECalBackendCalDAV *cbdav,
                return FALSE;
        }
 
-       priv = cbdav->priv;
-
        zone = icaltimezone_new ();
        for (iter = timezones; iter; iter = iter->next) {
                if (icaltimezone_set_component (zone, iter->data)) {
-                       e_cal_backend_store_put_timezone (priv->store, zone);
+                       e_cal_backend_store_put_timezone (cbdav->priv->store, zone);
                } else {
                        icalcomponent_free (iter->data);
                }
@@ -4245,31 +4177,29 @@ static void                                                             \
 _func_name _params                                                     \
 {                                                                      \
        ECalBackendCalDAV        *cbdav;                                \
-       ECalBackendCalDAVPrivate *priv;                                 \
        SlaveCommand              old_slave_cmd;                        \
        gboolean                  was_slave_busy;                       \
                                                                        \
        cbdav = E_CAL_BACKEND_CALDAV (backend);                         \
-       priv  = cbdav->priv;                                            \
                                                                        \
        /* this is done before locking */                               \
-       old_slave_cmd = priv->slave_cmd;                                \
-       was_slave_busy = priv->slave_busy;                              \
+       old_slave_cmd = cbdav->priv->slave_cmd;                         \
+       was_slave_busy = cbdav->priv->slave_busy;                       \
        if (was_slave_busy) {                                           \
                /* let it pause its work and do our job */              \
-               priv->slave_cmd = SLAVE_SHOULD_SLEEP;                   \
+               cbdav->priv->slave_cmd = SLAVE_SHOULD_SLEEP;            \
        }                                                               \
                                                                        \
-       g_mutex_lock (priv->busy_lock);                                 \
+       g_mutex_lock (cbdav->priv->busy_lock);                          \
        _call_func _call_params;                                        \
                                                                        \
        /* this is done before unlocking */                             \
        if (was_slave_busy) {                                           \
-               priv->slave_cmd = old_slave_cmd;                        \
-               g_cond_signal (priv->cond);                             \
+               cbdav->priv->slave_cmd = old_slave_cmd;                 \
+               g_cond_signal (cbdav->priv->cond);                      \
        }                                                               \
                                                                        \
-       g_mutex_unlock (priv->busy_lock);                               \
+       g_mutex_unlock (cbdav->priv->busy_lock);                        \
 }
 
 caldav_busy_stub (
@@ -4388,15 +4318,12 @@ caldav_add_timezone (ECalBackendSync *backend,
 {
        icalcomponent *tz_comp;
        ECalBackendCalDAV *cbdav;
-       ECalBackendCalDAVPrivate *priv;
 
        cbdav = E_CAL_BACKEND_CALDAV (backend);
 
        e_return_data_cal_error_if_fail (E_IS_CAL_BACKEND_CALDAV (cbdav), InvalidArg);
        e_return_data_cal_error_if_fail (tzobj != NULL, InvalidArg);
 
-       priv = cbdav->priv;
-
        tz_comp = icalparser_parse_string (tzobj);
        if (!tz_comp) {
                g_propagate_error (error, EDC_ERROR (InvalidObject));
@@ -4409,7 +4336,7 @@ caldav_add_timezone (ECalBackendSync *backend,
                zone = icaltimezone_new ();
                icaltimezone_set_component (zone, tz_comp);
 
-               e_cal_backend_store_put_timezone (priv->store, zone);
+               e_cal_backend_store_put_timezone (cbdav->priv->store, zone);
 
                icaltimezone_free (zone, TRUE);
        } else {
@@ -4426,7 +4353,6 @@ caldav_get_object_list (ECalBackendSync *backend,
                         GError **perror)
 {
        ECalBackendCalDAV        *cbdav;
-       ECalBackendCalDAVPrivate *priv;
        ECalBackendSExp  *sexp;
        ECalBackend *bkend;
        gboolean                  do_search;
@@ -4435,7 +4361,6 @@ caldav_get_object_list (ECalBackendSync *backend,
        gboolean prunning_by_time;
 
        cbdav = E_CAL_BACKEND_CALDAV (backend);
-       priv  = cbdav->priv;
 
        sexp = e_cal_backend_sexp_new (sexp_string);
 
@@ -4455,8 +4380,8 @@ caldav_get_object_list (ECalBackendSync *backend,
        prunning_by_time = e_cal_backend_sexp_evaluate_occur_times (sexp, &occur_start, &occur_end);
 
        list = prunning_by_time ?
-               e_cal_backend_store_get_components_occuring_in_range (priv->store, occur_start, occur_end)
-               : e_cal_backend_store_get_components (priv->store);
+               e_cal_backend_store_get_components_occuring_in_range (cbdav->priv->store, occur_start, occur_end)
+               : e_cal_backend_store_get_components (cbdav->priv->store);
 
        bkend = E_CAL_BACKEND (backend);
 
@@ -4480,7 +4405,6 @@ caldav_start_view (ECalBackend *backend,
                    EDataCalView *query)
 {
        ECalBackendCalDAV        *cbdav;
-       ECalBackendCalDAVPrivate *priv;
        ECalBackendSExp  *sexp;
        ECalBackend              *bkend;
        gboolean                  do_search;
@@ -4489,7 +4413,6 @@ caldav_start_view (ECalBackend *backend,
        time_t occur_start = -1, occur_end = -1;
        gboolean prunning_by_time;
        cbdav = E_CAL_BACKEND_CALDAV (backend);
-       priv  = cbdav->priv;
 
        sexp_string = e_data_cal_view_get_text (query);
        sexp = e_cal_backend_sexp_new (sexp_string);
@@ -4508,8 +4431,8 @@ caldav_start_view (ECalBackend *backend,
        bkend = E_CAL_BACKEND (backend);
 
        list = prunning_by_time ?
-               e_cal_backend_store_get_components_occuring_in_range (priv->store, occur_start, occur_end)
-               : e_cal_backend_store_get_components (priv->store);
+               e_cal_backend_store_get_components_occuring_in_range (cbdav->priv->store, occur_start, occur_end)
+               : e_cal_backend_store_get_components (cbdav->priv->store);
 
        for (iter = list; iter; iter = g_slist_next (iter)) {
                ECalComponent *comp = E_CAL_COMPONENT (iter->data);
@@ -4539,7 +4462,6 @@ caldav_get_free_busy (ECalBackendSync *backend,
                       GError **error)
 {
        ECalBackendCalDAV *cbdav;
-       ECalBackendCalDAVPrivate *priv;
        icalcomponent *icalcomp;
        ECalComponent *comp;
        ECalComponentDateTime dt;
@@ -4551,22 +4473,20 @@ caldav_get_free_busy (ECalBackendSync *backend,
        GError *err = NULL;
 
        cbdav = E_CAL_BACKEND_CALDAV (backend);
-       priv  = cbdav->priv;
 
-       e_return_data_cal_error_if_fail (priv != NULL, InvalidArg);
        e_return_data_cal_error_if_fail (users != NULL, InvalidArg);
        e_return_data_cal_error_if_fail (freebusy != NULL, InvalidArg);
        e_return_data_cal_error_if_fail (start < end, InvalidArg);
 
-       if (!priv->calendar_schedule) {
+       if (!cbdav->priv->calendar_schedule) {
                g_propagate_error (error, EDC_ERROR_EX (OtherError, _("Calendar doesn't support Free/Busy")));
                return;
        }
 
-       if (!priv->schedule_outbox_url) {
+       if (!cbdav->priv->schedule_outbox_url) {
                caldav_receive_schedule_outbox_url (cbdav);
-               if (!priv->schedule_outbox_url) {
-                       priv->calendar_schedule = FALSE;
+               if (!cbdav->priv->schedule_outbox_url) {
+                       cbdav->priv->calendar_schedule = FALSE;
                        g_propagate_error (error, EDC_ERROR_EX (OtherError, "Schedule outbox url not found"));
                        return;
                }
@@ -4598,10 +4518,10 @@ caldav_get_free_busy (ECalBackendSync *backend,
                usermail = NULL;
        }
 
-       if ((priv->credentials && e_credentials_has_key (priv->credentials, E_CREDENTIALS_KEY_USERNAME)) || usermail) {
+       if ((cbdav->priv->credentials && e_credentials_has_key (cbdav->priv->credentials, E_CREDENTIALS_KEY_USERNAME)) || usermail) {
                ECalComponentOrganizer organizer = {NULL};
 
-               organizer.value = usermail ? usermail : e_credentials_peek (priv->credentials, E_CREDENTIALS_KEY_USERNAME);
+               organizer.value = usermail ? usermail : e_credentials_peek (cbdav->priv->credentials, E_CREDENTIALS_KEY_USERNAME);
                organizer.value = g_strconcat ("mailto:", organizer.value, NULL);
 
                e_cal_component_set_organizer (comp, &organizer);
@@ -4648,7 +4568,7 @@ caldav_get_free_busy (ECalBackendSync *backend,
 
        e_return_data_cal_error_if_fail (str != NULL, OtherError);
 
-       caldav_post_freebusy (cbdav, priv->schedule_outbox_url, &str, &err);
+       caldav_post_freebusy (cbdav, cbdav->priv->schedule_outbox_url, &str, &err);
 
        if (!err) {
                /* parse returned xml */
@@ -4724,34 +4644,32 @@ caldav_notify_online_cb (ECalBackend *backend,
                          GParamSpec *pspec)
 {
        ECalBackendCalDAV        *cbdav;
-       ECalBackendCalDAVPrivate *priv;
        gboolean online;
 
        cbdav = E_CAL_BACKEND_CALDAV (backend);
-       priv  = cbdav->priv;
 
-       /*g_mutex_lock (priv->busy_lock);*/
+       /*g_mutex_lock (cbdav->priv->busy_lock);*/
 
        online = e_backend_get_online (E_BACKEND (backend));
 
-       if (!priv->loaded) {
+       if (!cbdav->priv->loaded) {
                e_cal_backend_notify_online (backend, online);
-               /*g_mutex_unlock (priv->busy_lock);*/
+               /*g_mutex_unlock (cbdav->priv->busy_lock);*/
                return;
        }
 
        if (online) {
                /* Wake up the slave thread */
-               priv->slave_cmd = SLAVE_SHOULD_WORK;
-               g_cond_signal (priv->cond);
+               cbdav->priv->slave_cmd = SLAVE_SHOULD_WORK;
+               g_cond_signal (cbdav->priv->cond);
        } else {
-               soup_session_abort (priv->session);
-               priv->slave_cmd = SLAVE_SHOULD_SLEEP;
+               soup_session_abort (cbdav->priv->session);
+               cbdav->priv->slave_cmd = SLAVE_SHOULD_SLEEP;
        }
 
        e_cal_backend_notify_online (backend, online);
 
-       /*g_mutex_unlock (priv->busy_lock);*/
+       /*g_mutex_unlock (cbdav->priv->busy_lock);*/
 }
 
 static icaltimezone *
@@ -4760,14 +4678,12 @@ caldav_internal_get_timezone (ECalBackend *backend,
 {
        icaltimezone *zone;
        ECalBackendCalDAV *cbdav;
-       ECalBackendCalDAVPrivate *priv;
 
        cbdav = E_CAL_BACKEND_CALDAV (backend);
-       priv  = cbdav->priv;
        zone = NULL;
 
-       if (priv->store)
-               zone = (icaltimezone *) e_cal_backend_store_get_timezone (priv->store, tzid);
+       if (cbdav->priv->store)
+               zone = (icaltimezone *) e_cal_backend_store_get_timezone (cbdav->priv->store, tzid);
 
        if (!zone && E_CAL_BACKEND_CLASS (parent_class)->internal_get_timezone)
                zone = E_CAL_BACKEND_CLASS (parent_class)->internal_get_timezone (backend, tzid);
@@ -4779,31 +4695,27 @@ static void
 caldav_source_changed_cb (ESource *source,
                           ECalBackendCalDAV *cbdav)
 {
-       ECalBackendCalDAVPrivate *priv;
        SlaveCommand old_slave_cmd;
        gboolean old_slave_busy;
 
        g_return_if_fail (source != NULL);
        g_return_if_fail (cbdav != NULL);
 
-       priv = cbdav->priv;
-       g_return_if_fail (priv != NULL);
-
-       old_slave_cmd = priv->slave_cmd;
-       old_slave_busy = priv->slave_busy;
+       old_slave_cmd = cbdav->priv->slave_cmd;
+       old_slave_busy = cbdav->priv->slave_busy;
        if (old_slave_busy) {
-               priv->slave_cmd = SLAVE_SHOULD_SLEEP;
-               g_mutex_lock (priv->busy_lock);
+               cbdav->priv->slave_cmd = SLAVE_SHOULD_SLEEP;
+               g_mutex_lock (cbdav->priv->busy_lock);
        }
 
        initialize_backend (cbdav, NULL);
 
        /* always wakeup thread, even when it was sleeping */
-       g_cond_signal (priv->cond);
+       g_cond_signal (cbdav->priv->cond);
 
        if (old_slave_busy) {
-               priv->slave_cmd = old_slave_cmd;
-               g_mutex_unlock (priv->busy_lock);
+               cbdav->priv->slave_cmd = old_slave_cmd;
+               g_mutex_unlock (cbdav->priv->busy_lock);
        }
 }
 
@@ -4815,12 +4727,10 @@ G_DEFINE_TYPE (ECalBackendCalDAV, e_cal_backend_caldav, E_TYPE_CAL_BACKEND_SYNC)
 static void
 e_cal_backend_caldav_dispose (GObject *object)
 {
-       ECalBackendCalDAV        *cbdav;
        ECalBackendCalDAVPrivate *priv;
        ESource *source;
 
-       cbdav = E_CAL_BACKEND_CALDAV (object);
-       priv = cbdav->priv;
+       priv = E_CAL_BACKEND_CALDAV_GET_PRIVATE (object);
 
        /* tell the slave to stop before acquiring a lock,
         * as it can work at the moment, and lock can be locked */
@@ -4833,9 +4743,9 @@ e_cal_backend_caldav_dispose (GObject *object)
                return;
        }
 
-       source = e_backend_get_source (E_BACKEND (cbdav));
+       source = e_backend_get_source (E_BACKEND (object));
        if (source)
-               g_signal_handlers_disconnect_by_func (G_OBJECT (source), caldav_source_changed_cb, cbdav);
+               g_signal_handlers_disconnect_by_func (G_OBJECT (source), caldav_source_changed_cb, object);
 
        /* stop the slave  */
        if (priv->synch_slave) {
@@ -4868,11 +4778,9 @@ e_cal_backend_caldav_dispose (GObject *object)
 static void
 e_cal_backend_caldav_finalize (GObject *object)
 {
-       ECalBackendCalDAV        *cbdav;
        ECalBackendCalDAVPrivate *priv;
 
-       cbdav = E_CAL_BACKEND_CALDAV (object);
-       priv = cbdav->priv;
+       priv = E_CAL_BACKEND_CALDAV_GET_PRIVATE (object);
 
        g_mutex_free (priv->busy_lock);
        g_cond_free (priv->cond);
@@ -4885,9 +4793,7 @@ e_cal_backend_caldav_finalize (GObject *object)
 static void
 e_cal_backend_caldav_init (ECalBackendCalDAV *cbdav)
 {
-       cbdav->priv = G_TYPE_INSTANCE_GET_PRIVATE (
-               cbdav, E_TYPE_CAL_BACKEND_CALDAV, ECalBackendCalDAVPrivate);
-
+       cbdav->priv = E_CAL_BACKEND_CALDAV_GET_PRIVATE (cbdav);
        cbdav->priv->session = soup_session_sync_new ();
        g_object_set (cbdav->priv->session, SOUP_SESSION_TIMEOUT, 90, NULL);
 
index 10e0c22..f595ece 100644 (file)
 #include <libebook/e-book-query.h>
 #include <libebook/e-contact.h>
 
-#define EDC_ERROR(_code) e_data_cal_create_error (_code, NULL)
+#define E_CAL_BACKEND_CONTACTS_GET_PRIVATE(obj) \
+       (G_TYPE_INSTANCE_GET_PRIVATE \
+       ((obj), E_TYPE_CAL_BACKEND_CONTACTS, ECalBackendContactsPrivate))
 
-G_DEFINE_TYPE (ECalBackendContacts, e_cal_backend_contacts, E_TYPE_CAL_BACKEND_SYNC)
+#define EDC_ERROR(_code) e_data_cal_create_error (_code, NULL)
 
-static ECalBackendSyncClass *parent_class;
+G_DEFINE_TYPE (
+       ECalBackendContacts,
+       e_cal_backend_contacts,
+       E_TYPE_CAL_BACKEND_SYNC)
 
 typedef enum
 {
@@ -116,8 +121,8 @@ static void setup_alarm (ECalBackendContacts *cbc, ECalComponent *comp);
 
 static gboolean
 book_client_authenticate_cb (EClient *client,
-                            ECredentials *credentials,
-                            ECalBackendContacts *cbc)
+                             ECredentials *credentials,
+                             ECalBackendContacts *cbc)
 {
        ESource *source;
        const gchar *source_uid;
@@ -285,7 +290,8 @@ cbc_reopen_book_client_thread (gpointer user_data)
 }
 
 static void
-cbc_reopen_book_client (ECalBackendContacts *cbc, EBookClient *book_client)
+cbc_reopen_book_client (ECalBackendContacts *cbc,
+                        EBookClient *book_client)
 {
        GError *error = NULL;
 
@@ -310,8 +316,8 @@ cbc_reopen_book_client (ECalBackendContacts *cbc, EBookClient *book_client)
 
 static void
 book_client_opened_cb (EBookClient *book_client,
-                      const GError *error,
-                      ECalBackendContacts *cbc)
+                       const GError *error,
+                       ECalBackendContacts *cbc)
 {
        ESource *source;
        const gchar *source_uid;
@@ -382,9 +388,9 @@ book_client_opened_cb (EBookClient *book_client,
 
 static void
 e_cal_backend_contacts_authenticate_user (ECalBackendSync *backend,
-                                         GCancellable *cancellable,
-                                         ECredentials *credentials,
-                                         GError **error)
+                                          GCancellable *cancellable,
+                                          ECredentials *credentials,
+                                          GError **error)
 {
        ECalBackendContacts *cbc;
        const gchar *source_uid;
@@ -543,7 +549,7 @@ typedef struct _ContactRecordCB {
 static ContactRecordCB *
 contact_record_cb_new (ECalBackendContacts *cbc,
                        ECalBackendSExp *sexp,
-                      gboolean as_string)
+                       gboolean as_string)
 {
        ContactRecordCB *cb_data = g_new (ContactRecordCB, 1);
 
@@ -1491,14 +1497,9 @@ free_zone (gpointer data)
 static void
 e_cal_backend_contacts_finalize (GObject *object)
 {
-       ECalBackendContacts *cbc;
        ECalBackendContactsPrivate *priv;
 
-       g_return_if_fail (object != NULL);
-       g_return_if_fail (E_IS_CAL_BACKEND_CONTACTS (object));
-
-       cbc = E_CAL_BACKEND_CONTACTS (object);
-       priv = cbc->priv;
+       priv = E_CAL_BACKEND_CONTACTS_GET_PRIVATE (object);
 
        if (priv->init_done_flag) {
                e_flag_wait (priv->init_done_flag);
@@ -1526,43 +1527,52 @@ e_cal_backend_contacts_finalize (GObject *object)
 
        g_object_unref (priv->conf_client);
 
-       g_free (priv);
-       cbc->priv = NULL;
-
        /* Chain up to parent's finalize() method. */
-       G_OBJECT_CLASS (parent_class)->finalize (object);
+       G_OBJECT_CLASS (e_cal_backend_contacts_parent_class)->finalize (object);
 }
 
 /* Object initialization function for the contacts backend */
 static void
 e_cal_backend_contacts_init (ECalBackendContacts *cbc)
 {
-       ECalBackendContactsPrivate *priv;
-
-       priv = g_new0 (ECalBackendContactsPrivate, 1);
-
-       if (!e_book_client_get_sources (&priv->addressbook_sources, NULL))
-               priv->addressbook_sources = NULL;
-
-       priv->addressbooks = g_hash_table_new_full (g_str_hash, g_str_equal,
-                                                   g_free, (GDestroyNotify) book_record_free);
-       priv->credentials = g_hash_table_new_full (g_str_hash, g_str_equal,
-                                                   g_free, (GDestroyNotify) e_credentials_free);
-       priv->tracked_contacts = g_hash_table_new_full (g_str_hash, g_str_equal,
-                                                       g_free, (GDestroyNotify) contact_record_free);
-
-       priv->zones = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, free_zone);
-       priv->init_done_flag = e_flag_new ();
-       priv->conf_client = gconf_client_get_default ();
-       priv->notifyid1 = 0;
-       priv->notifyid2 = 0;
-       priv->notifyid3 = 0;
-       priv->update_alarms_id = 0;
-       priv->alarm_enabled = FALSE;
-       priv->alarm_interval = -1;
-       priv->alarm_units = CAL_MINUTES;
-
-       cbc->priv = priv;
+       cbc->priv = E_CAL_BACKEND_CONTACTS_GET_PRIVATE (cbc);
+
+       if (!e_book_client_get_sources (&cbc->priv->addressbook_sources, NULL))
+               cbc->priv->addressbook_sources = NULL;
+
+       cbc->priv->addressbooks = g_hash_table_new_full (
+               (GHashFunc) g_str_hash,
+               (GEqualFunc) g_str_equal,
+               (GDestroyNotify) g_free,
+               (GDestroyNotify) book_record_free);
+
+       cbc->priv->credentials = g_hash_table_new_full (
+               (GHashFunc) g_str_hash,
+               (GEqualFunc) g_str_equal,
+               (GDestroyNotify) g_free,
+               (GDestroyNotify) e_credentials_free);
+
+       cbc->priv->tracked_contacts = g_hash_table_new_full (
+               (GHashFunc) g_str_hash,
+               (GEqualFunc) g_str_equal,
+               (GDestroyNotify) g_free,
+               (GDestroyNotify) contact_record_free);
+
+       cbc->priv->zones = g_hash_table_new_full (
+               (GHashFunc) g_str_hash,
+               (GEqualFunc) g_str_equal,
+               (GDestroyNotify) g_free,
+               (GDestroyNotify) free_zone);
+
+       cbc->priv->init_done_flag = e_flag_new ();
+       cbc->priv->conf_client = gconf_client_get_default ();
+       cbc->priv->notifyid1 = 0;
+       cbc->priv->notifyid2 = 0;
+       cbc->priv->notifyid3 = 0;
+       cbc->priv->update_alarms_id = 0;
+       cbc->priv->alarm_enabled = FALSE;
+       cbc->priv->alarm_interval = -1;
+       cbc->priv->alarm_units = CAL_MINUTES;
 
        e_cal_backend_sync_set_lock (E_CAL_BACKEND_SYNC (cbc), TRUE);
 
@@ -1591,12 +1601,12 @@ e_cal_backend_contacts_class_init (ECalBackendContactsClass *class)
        ECalBackendClass *backend_class;
        ECalBackendSyncClass *sync_class;
 
+       g_type_class_add_private (class, sizeof (ECalBackendContactsPrivate));
+
        object_class = (GObjectClass *) class;
        backend_class = (ECalBackendClass *) class;
        sync_class = (ECalBackendSyncClass *) class;
 
-       parent_class = (ECalBackendSyncClass *) g_type_class_peek_parent (class);
-
        object_class->finalize = e_cal_backend_contacts_finalize;
 
        sync_class->get_backend_property_sync   = e_cal_backend_contacts_get_backend_property;
index 28f2b6d..f93dded 100644 (file)
@@ -31,7 +31,7 @@ G_DEFINE_TYPE (
        E_TYPE_CAL_BACKEND_FILE)
 
 static void
-e_cal_backend_file_events_class_init (ECalBackendFileEventsClass *klass)
+e_cal_backend_file_events_class_init (ECalBackendFileEventsClass *class)
 {
 }
 
index f36e172..b794bf1 100644 (file)
@@ -26,7 +26,7 @@ G_DEFINE_TYPE (
        E_TYPE_CAL_BACKEND_FILE)
 
 static void
-e_cal_backend_file_journal_class_init (ECalBackendFileJournalClass *klass)
+e_cal_backend_file_journal_class_init (ECalBackendFileJournalClass *class)
 {
 }
 
index cefca9d..536f325 100644 (file)
@@ -31,7 +31,7 @@ G_DEFINE_TYPE (
        E_TYPE_CAL_BACKEND_FILE)
 
 static void
-e_cal_backend_file_todos_class_init (ECalBackendFileTodosClass *klass)
+e_cal_backend_file_todos_class_init (ECalBackendFileTodosClass *class)
 {
 }
 
index 349f0fb..79f4c8b 100644 (file)
 #define O_BINARY 0
 #endif
 
+#define E_CAL_BACKEND_FILE_GET_PRIVATE(obj) \
+       (G_TYPE_INSTANCE_GET_PRIVATE \
+       ((obj), E_TYPE_CAL_BACKEND_FILE, ECalBackendFilePrivate))
+
 #define EDC_ERROR(_code) e_data_cal_create_error (_code, NULL)
 #define EDC_ERROR_NO_URI() e_data_cal_create_error (OtherError, "Cannot get URI")
 
@@ -126,8 +130,6 @@ struct _ECalBackendFilePrivate {
 static void e_cal_backend_file_dispose (GObject *object);
 static void e_cal_backend_file_finalize (GObject *object);
 
-static ECalBackendSyncClass *parent_class;
-
 static void free_refresh_data (ECalBackendFile *cbfile);
 
 static icaltimezone *
@@ -266,7 +268,7 @@ save_file_when_idle (gpointer user_data)
 
 static void
 save (ECalBackendFile *cbfile,
-      gboolean         do_bump_revision)
+      gboolean do_bump_revision)
 {
        ECalBackendFilePrivate *priv;
 
@@ -335,54 +337,35 @@ e_cal_backend_file_dispose (GObject *object)
                g_signal_handlers_disconnect_matched (source, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, cbfile);
 
        /* Chain up to parent's dispose() method. */
-       G_OBJECT_CLASS (parent_class)->dispose (object);
+       G_OBJECT_CLASS (e_cal_backend_file_parent_class)->dispose (object);
 }
 
 /* Finalize handler for the file backend */
 static void
 e_cal_backend_file_finalize (GObject *object)
 {
-       ECalBackendFile *cbfile;
        ECalBackendFilePrivate *priv;
 
-       g_return_if_fail (object != NULL);
-       g_return_if_fail (E_IS_CAL_BACKEND_FILE (object));
-
-       cbfile = E_CAL_BACKEND_FILE (object);
-       priv = cbfile->priv;
+       priv = E_CAL_BACKEND_FILE_GET_PRIVATE (object);
 
        /* Clean up */
 
-       if (priv->dirty_idle_id) {
+       if (priv->dirty_idle_id)
                g_source_remove (priv->dirty_idle_id);
-               priv->dirty_idle_id = 0;
-       }
 
-       free_refresh_data (cbfile);
+       free_refresh_data (E_CAL_BACKEND_FILE (object));
 
        if (priv->refresh_lock)
                g_mutex_free (priv->refresh_lock);
-       priv->refresh_lock = NULL;
 
        g_static_rec_mutex_free (&priv->idle_save_rmutex);
 
-       if (priv->path) {
-               g_free (priv->path);
-               priv->path = NULL;
-       }
-
+       g_free (priv->path);
        g_free (priv->custom_file);
-       priv->custom_file = NULL;
-
-       if (priv->file_name) {
-               g_free (priv->file_name);
-               priv->file_name = NULL;
-       }
-       g_free (priv);
-       cbfile->priv = NULL;
+       g_free (priv->file_name);
 
        /* Chain up to parent's finalize() method. */
-       G_OBJECT_CLASS (parent_class)->finalize (object);
+       G_OBJECT_CLASS (e_cal_backend_file_parent_class)->finalize (object);
 }
 
 \f
@@ -445,7 +428,7 @@ make_revision_string (ECalBackendFile *cbfile)
 static icalproperty *
 ensure_revision (ECalBackendFile *cbfile)
 {
-       icalproperty* prop;
+       icalproperty * prop;
 
        prop = get_revision_property (cbfile);
 
@@ -2204,8 +2187,8 @@ e_cal_backend_file_internal_get_timezone (ECalBackend *backend,
        else {
                zone = icalcomponent_get_timezone (priv->icalcomp, tzid);
 
-               if (!zone && E_CAL_BACKEND_CLASS (parent_class)->internal_get_timezone)
-                       zone = E_CAL_BACKEND_CLASS (parent_class)->internal_get_timezone (backend, tzid);
+               if (!zone && E_CAL_BACKEND_CLASS (e_cal_backend_file_parent_class)->internal_get_timezone)
+                       zone = E_CAL_BACKEND_CLASS (e_cal_backend_file_parent_class)->internal_get_timezone (backend, tzid);
        }
 
        g_static_rec_mutex_unlock (&priv->idle_save_rmutex);
@@ -3369,28 +3352,18 @@ e_cal_backend_file_send_objects (ECalBackendSync *backend,
 static void
 e_cal_backend_file_init (ECalBackendFile *cbfile)
 {
-       ECalBackendFilePrivate *priv;
+       cbfile->priv = E_CAL_BACKEND_FILE_GET_PRIVATE (cbfile);
 
-       priv = g_new0 (ECalBackendFilePrivate, 1);
-       cbfile->priv = priv;
+       cbfile->priv->file_name = g_strdup ("calendar.ics");
 
-       priv->path = NULL;
-       priv->file_name = g_strdup ("calendar.ics");
-       priv->read_only = FALSE;
-       priv->is_dirty = FALSE;
-       priv->dirty_idle_id = 0;
-       g_static_rec_mutex_init (&priv->idle_save_rmutex);
-       priv->icalcomp = NULL;
-       priv->comp_uid_hash = NULL;
-       priv->comp = NULL;
-       priv->interval_tree = NULL;
-       priv->custom_file = NULL;
-       priv->refresh_lock = g_mutex_new ();
+       g_static_rec_mutex_init (&cbfile->priv->idle_save_rmutex);
+
+       cbfile->priv->refresh_lock = g_mutex_new ();
 
-        /*
-         * data access is serialized via idle_save_rmutex, so locking at the
-         * backend method level is not needed
-         */
+       /*
+        * data access is serialized via idle_save_rmutex, so locking at the
+        * backend method level is not needed
+        */
        e_cal_backend_sync_set_lock (E_CAL_BACKEND_SYNC (cbfile), FALSE);
 }
 
@@ -3457,12 +3430,12 @@ e_cal_backend_file_class_init (ECalBackendFileClass *class)
        ECalBackendClass *backend_class;
        ECalBackendSyncClass *sync_class;
 
+       g_type_class_add_private (class, sizeof (ECalBackendFilePrivate));
+
        object_class = (GObjectClass *) class;
        backend_class = (ECalBackendClass *) class;
        sync_class = (ECalBackendSyncClass *) class;
 
-       parent_class = (ECalBackendSyncClass *) g_type_class_peek_parent (class);
-
        object_class->dispose = e_cal_backend_file_dispose;
        object_class->finalize = e_cal_backend_file_finalize;
        object_class->constructed = cal_backend_file_constructed;
index c81a4ed..d120ce4 100644 (file)
 #include <libsoup/soup.h>
 #include "e-cal-backend-http.h"
 
+#define E_CAL_BACKEND_HTTP_GET_PRIVATE(obj) \
+       (G_TYPE_INSTANCE_GET_PRIVATE \
+       ((obj), E_TYPE_CAL_BACKEND_HTTP, ECalBackendHttpPrivate))
+
 #define EDC_ERROR(_code) e_data_cal_create_error (_code, NULL)
 #define EDC_ERROR_EX(_code, _msg) e_data_cal_create_error (_code, _msg)
 
 G_DEFINE_TYPE (ECalBackendHttp, e_cal_backend_http, E_TYPE_CAL_BACKEND_SYNC)
 
-\f
-
 /* Private part of the ECalBackendHttp structure */
 struct _ECalBackendHttpPrivate {
        /* signal handler id for source's 'changed' signal */
@@ -79,10 +81,6 @@ static void e_cal_backend_http_finalize (GObject *object);
 static gboolean begin_retrieval_cb (ECalBackendHttp *cbhttp);
 static void e_cal_backend_http_add_timezone (ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, const gchar *tzobj, GError **perror);
 
-static ECalBackendSyncClass *parent_class;
-
-\f
-
 /* Dispose handler for the file backend */
 static void
 e_cal_backend_http_dispose (GObject *object)
@@ -113,21 +111,16 @@ e_cal_backend_http_dispose (GObject *object)
        }
 
        /* Chain up to parent's dispose() method. */
-       G_OBJECT_CLASS (parent_class)->dispose (object);
+       G_OBJECT_CLASS (e_cal_backend_http_parent_class)->dispose (object);
 }
 
 /* Finalize handler for the file backend */
 static void
 e_cal_backend_http_finalize (GObject *object)
 {
-       ECalBackendHttp *cbhttp;
        ECalBackendHttpPrivate *priv;
 
-       g_return_if_fail (object != NULL);
-       g_return_if_fail (E_IS_CAL_BACKEND_HTTP (object));
-
-       cbhttp = E_CAL_BACKEND_HTTP (object);
-       priv = cbhttp->priv;
+       priv = E_CAL_BACKEND_HTTP_GET_PRIVATE (object);
 
        /* Clean up */
 
@@ -136,16 +129,10 @@ e_cal_backend_http_finalize (GObject *object)
                priv->store = NULL;
        }
 
-       if (priv->uri) {
-               g_free (priv->uri);
-               priv->uri = NULL;
-       }
-
-       g_free (priv);
-       cbhttp->priv = NULL;
+       g_free (priv->uri);
 
        /* Chain up to parent's finalize() method. */
-       G_OBJECT_CLASS (parent_class)->finalize (object);
+       G_OBJECT_CLASS (e_cal_backend_http_parent_class)->finalize (object);
 }
 
 \f
@@ -1360,8 +1347,8 @@ e_cal_backend_http_internal_get_timezone (ECalBackend *backend,
                /* first try to get the timezone from the cache */
                zone = (icaltimezone *) e_cal_backend_store_get_timezone (priv->store, tzid);
 
-               if (!zone && E_CAL_BACKEND_CLASS (parent_class)->internal_get_timezone)
-                       zone = E_CAL_BACKEND_CLASS (parent_class)->internal_get_timezone (backend, tzid);
+               if (!zone && E_CAL_BACKEND_CLASS (e_cal_backend_http_parent_class)->internal_get_timezone)
+                       zone = E_CAL_BACKEND_CLASS (e_cal_backend_http_parent_class)->internal_get_timezone (backend, tzid);
        }
 
        return zone;
@@ -1371,14 +1358,7 @@ e_cal_backend_http_internal_get_timezone (ECalBackend *backend,
 static void
 e_cal_backend_http_init (ECalBackendHttp *cbhttp)
 {
-       ECalBackendHttpPrivate *priv;
-
-       priv = g_new0 (ECalBackendHttpPrivate, 1);
-       cbhttp->priv = priv;
-
-       priv->uri = NULL;
-       priv->reload_timeout_id = 0;
-       priv->opened = FALSE;
+       cbhttp->priv = E_CAL_BACKEND_HTTP_GET_PRIVATE (cbhttp);
 
        e_cal_backend_sync_set_lock (E_CAL_BACKEND_SYNC (cbhttp), TRUE);
 
@@ -1395,12 +1375,12 @@ e_cal_backend_http_class_init (ECalBackendHttpClass *class)
        ECalBackendClass *backend_class;
        ECalBackendSyncClass *sync_class;
 
+       g_type_class_add_private (class, sizeof (ECalBackendHttpPrivate));
+
        object_class = (GObjectClass *) class;
        backend_class = (ECalBackendClass *) class;
        sync_class = (ECalBackendSyncClass *) class;
 
-       parent_class = (ECalBackendSyncClass *) g_type_class_peek_parent (class);
-
        object_class->dispose = e_cal_backend_http_dispose;
        object_class->finalize = e_cal_backend_http_finalize;
 
index ab6b0f3..cd562fd 100644 (file)
 
 #define WEATHER_UID_EXT "-weather"
 
+#define E_CAL_BACKEND_WEATHER_GET_PRIVATE(obj) \
+       (G_TYPE_INSTANCE_GET_PRIVATE \
+       ((obj), E_TYPE_CAL_BACKEND_WEATHER, ECalBackendWeatherPrivate))
+
 #define EDC_ERROR(_code) e_data_cal_create_error (_code, NULL)
 #define EDC_ERROR_EX(_code, _msg) e_data_cal_create_error (_code, _msg)
 
@@ -71,8 +75,6 @@ struct _ECalBackendWeatherPrivate {
        guint begin_retrival_id;
 };
 
-static ECalBackendSyncClass *parent_class;
-
 static gboolean
 reload_cb (ECalBackendWeather *cbw)
 {
@@ -814,8 +816,8 @@ e_cal_backend_weather_internal_get_timezone (ECalBackend *backend,
 
                zone = g_hash_table_lookup (cbw->priv->zones, tzid);
 
-               if (!zone && E_CAL_BACKEND_CLASS (parent_class)->internal_get_timezone)
-                       zone = E_CAL_BACKEND_CLASS (parent_class)->internal_get_timezone (backend, tzid);
+               if (!zone && E_CAL_BACKEND_CLASS (e_cal_backend_weather_parent_class)->internal_get_timezone)
+                       zone = E_CAL_BACKEND_CLASS (e_cal_backend_weather_parent_class)->internal_get_timezone (backend, tzid);
        }
 
        return zone;
@@ -831,24 +833,15 @@ free_zone (gpointer data)
 static void
 e_cal_backend_weather_finalize (GObject *object)
 {
-       ECalBackendWeather *cbw;
        ECalBackendWeatherPrivate *priv;
 
-       g_return_if_fail (object != NULL);
-       g_return_if_fail (E_IS_CAL_BACKEND_WEATHER (object));
-
-       cbw = (ECalBackendWeather *) object;
-       priv = cbw->priv;
+       priv = E_CAL_BACKEND_WEATHER_GET_PRIVATE (object);
 
-       if (priv->reload_timeout_id) {
+       if (priv->reload_timeout_id)
                g_source_remove (priv->reload_timeout_id);
-               priv->reload_timeout_id = 0;
-       }
 
-       if (priv->begin_retrival_id) {
+       if (priv->begin_retrival_id)
                g_source_remove (priv->begin_retrival_id);
-               priv->begin_retrival_id = 0;
-       }
 
        if (priv->store) {
                g_object_unref (priv->store);
@@ -857,37 +850,23 @@ e_cal_backend_weather_finalize (GObject *object)
 
        g_hash_table_destroy (priv->zones);
 
-       if (priv->city) {
-               g_free (priv->city);
-               priv->city = NULL;
-       }
-
-       g_free (priv);
-       cbw->priv = NULL;
+       g_free (priv->city);
 
        /* Chain up to parent's finalize() method. */
-       G_OBJECT_CLASS (parent_class)->finalize (object);
+       G_OBJECT_CLASS (e_cal_backend_weather_parent_class)->finalize (object);
 }
 
 /* Object initialization function for the weather backend */
 static void
 e_cal_backend_weather_init (ECalBackendWeather *cbw)
 {
-       ECalBackendWeatherPrivate *priv;
-
-       priv = g_new0 (ECalBackendWeatherPrivate, 1);
+       cbw->priv = E_CAL_BACKEND_WEATHER_GET_PRIVATE (cbw);
 
-       cbw->priv = priv;
-
-       priv->reload_timeout_id = 0;
-       priv->source_changed_id = 0;
-       priv->begin_retrival_id = 0;
-       priv->opened = FALSE;
-       priv->source = NULL;
-       priv->store = NULL;
-       priv->city = NULL;
-
-       priv->zones = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, free_zone);
+       cbw->priv->zones = g_hash_table_new_full (
+               (GHashFunc) g_str_hash,
+               (GEqualFunc) g_str_equal,
+               (GDestroyNotify) g_free,
+               (GDestroyNotify) free_zone);
 
        e_cal_backend_sync_set_lock (E_CAL_BACKEND_SYNC (cbw), TRUE);
 
@@ -904,12 +883,12 @@ e_cal_backend_weather_class_init (ECalBackendWeatherClass *class)
        ECalBackendClass *backend_class;
        ECalBackendSyncClass *sync_class;
 
+       g_type_class_add_private (class, sizeof (ECalBackendWeatherPrivate));
+
        object_class = (GObjectClass *) class;
        backend_class = (ECalBackendClass *) class;
        sync_class = (ECalBackendSyncClass *) class;
 
-       parent_class = (ECalBackendSyncClass *) g_type_class_peek_parent (class);
-
        object_class->finalize = e_cal_backend_weather_finalize;
 
        sync_class->get_backend_property_sync   = e_cal_backend_weather_get_backend_property;
index ef330a7..36e5769 100644 (file)
 
 #include "e-gdbus-cal-view.h"
 
+#define E_CAL_CLIENT_VIEW_GET_PRIVATE(obj) \
+       (G_TYPE_INSTANCE_GET_PRIVATE \
+       ((obj), E_TYPE_CAL_CLIENT_VIEW, ECalClientViewPrivate))
+
 G_DEFINE_TYPE (ECalClientView, e_cal_client_view, G_TYPE_OBJECT);
 
 /* Private part of the ECalClientView structure */
@@ -222,7 +226,7 @@ complete_cb (EGdbusCalView *gdbus_calview,
 static void
 e_cal_client_view_init (ECalClientView *view)
 {
-       view->priv = G_TYPE_INSTANCE_GET_PRIVATE (view, E_TYPE_CAL_CLIENT_VIEW, ECalClientViewPrivate);
+       view->priv = E_CAL_CLIENT_VIEW_GET_PRIVATE (view);
        view->priv->running = FALSE;
 }
 
@@ -322,17 +326,17 @@ cal_client_view_finalize (GObject *object)
 
 /* Class initialization function for the calendar view */
 static void
-e_cal_client_view_class_init (ECalClientViewClass *klass)
+e_cal_client_view_class_init (ECalClientViewClass *class)
 {
        GObjectClass *object_class;
 
-       object_class = (GObjectClass *) klass;
+       object_class = (GObjectClass *) class;
 
        object_class->set_property = cal_client_view_set_property;
        object_class->get_property = cal_client_view_get_property;
        object_class->finalize = cal_client_view_finalize;
 
-       g_type_class_add_private (klass, sizeof (ECalClientViewPrivate));
+       g_type_class_add_private (class, sizeof (ECalClientViewPrivate));
 
        g_object_class_install_property (object_class, PROP_VIEW,
                g_param_spec_pointer ("view", "The GDBus view proxy", NULL,
@@ -348,7 +352,7 @@ e_cal_client_view_class_init (ECalClientViewClass *klass)
          */
        signals[OBJECTS_ADDED] =
                g_signal_new ("objects-added",
-                             G_TYPE_FROM_CLASS (klass),
+                             G_TYPE_FROM_CLASS (class),
                              G_SIGNAL_RUN_FIRST,
                              G_STRUCT_OFFSET (ECalClientViewClass, objects_added),
                              NULL, NULL,
@@ -361,7 +365,7 @@ e_cal_client_view_class_init (ECalClientViewClass *klass)
          */
        signals[OBJECTS_MODIFIED] =
                g_signal_new ("objects-modified",
-                             G_TYPE_FROM_CLASS (klass),
+                             G_TYPE_FROM_CLASS (class),
                              G_SIGNAL_RUN_FIRST,
                              G_STRUCT_OFFSET (ECalClientViewClass, objects_modified),
                              NULL, NULL,
@@ -374,7 +378,7 @@ e_cal_client_view_class_init (ECalClientViewClass *klass)
          */
        signals[OBJECTS_REMOVED] =
                g_signal_new ("objects-removed",
-                             G_TYPE_FROM_CLASS (klass),
+                             G_TYPE_FROM_CLASS (class),
                              G_SIGNAL_RUN_FIRST,
                              G_STRUCT_OFFSET (ECalClientViewClass, objects_removed),
                              NULL, NULL,
@@ -383,7 +387,7 @@ e_cal_client_view_class_init (ECalClientViewClass *klass)
 
        signals[PROGRESS] =
                g_signal_new ("progress",
-                             G_TYPE_FROM_CLASS (klass),
+                             G_TYPE_FROM_CLASS (class),
                              G_SIGNAL_RUN_FIRST,
                              G_STRUCT_OFFSET (ECalClientViewClass, progress),
                              NULL, NULL,
@@ -392,7 +396,7 @@ e_cal_client_view_class_init (ECalClientViewClass *klass)
 
        signals[COMPLETE] =
                g_signal_new ("complete",
-                             G_TYPE_FROM_CLASS (klass),
+                             G_TYPE_FROM_CLASS (class),
                              G_SIGNAL_RUN_FIRST,
                              G_STRUCT_OFFSET (ECalClientViewClass, complete),
                              NULL, NULL,
index 151ab9d..54fbdeb 100644 (file)
 #include "e-gdbus-cal-factory.h"
 #include "e-gdbus-cal-view.h"
 
-struct _ECalClientPrivate
-{
+#define E_CAL_CLIENT_GET_PRIVATE(obj) \
+       (G_TYPE_INSTANCE_GET_PRIVATE \
+       ((obj), E_TYPE_CAL_CLIENT, ECalClientPrivate))
+
+struct _ECalClientPrivate {
        /* GDBus data */
        GDBusProxy *gdbus_cal;
        guint gone_signal_id;
@@ -5057,7 +5060,7 @@ e_cal_client_init (ECalClient *client)
        active_cal_clients++;
        UNLOCK_FACTORY ();
 
-       client->priv = G_TYPE_INSTANCE_GET_PRIVATE (client, E_TYPE_CAL_CLIENT, ECalClientPrivate);
+       client->priv = E_CAL_CLIENT_GET_PRIVATE (client);
        client->priv->source_type = E_CAL_CLIENT_SOURCE_TYPE_LAST;
        client->priv->default_zone = icaltimezone_get_utc_timezone ();
        client->priv->cache_dir = NULL;
@@ -5119,18 +5122,18 @@ cal_client_finalize (GObject *object)
 }
 
 static void
-e_cal_client_class_init (ECalClientClass *klass)
+e_cal_client_class_init (ECalClientClass *class)
 {
        GObjectClass *object_class;
        EClientClass *client_class;
 
-       g_type_class_add_private (klass, sizeof (ECalClientPrivate));
+       g_type_class_add_private (class, sizeof (ECalClientPrivate));
 
-       object_class = G_OBJECT_CLASS (klass);
+       object_class = G_OBJECT_CLASS (class);
        object_class->dispose = cal_client_dispose;
        object_class->finalize = cal_client_finalize;
 
-       client_class = E_CLIENT_CLASS (klass);
+       client_class = E_CLIENT_CLASS (class);
        client_class->get_dbus_proxy                    = cal_client_get_dbus_proxy;
        client_class->unwrap_dbus_error                 = cal_client_unwrap_dbus_error;
        client_class->handle_authentication             = cal_client_handle_authentication;
@@ -5155,7 +5158,7 @@ e_cal_client_class_init (ECalClientClass *klass)
 
        signals[FREE_BUSY_DATA] = g_signal_new (
                "free-busy-data",
-               G_OBJECT_CLASS_TYPE (klass),
+               G_OBJECT_CLASS_TYPE (class),
                G_SIGNAL_RUN_FIRST,
                G_STRUCT_OFFSET (ECalClientClass, free_busy_data),
                NULL, NULL,
index c0a416c..6a79fa7 100644 (file)
 #include "e-cal-time-util.h"
 #include "libedataserver/e-data-server-util.h"
 
-\f
-
 #ifdef G_OS_WIN32
 #define getgid() 0
 #define getppid() 0
 #endif
 
+#define E_CAL_COMPONENT_GET_PRIVATE(obj) \
+       (G_TYPE_INSTANCE_GET_PRIVATE \
+       ((obj), E_TYPE_CAL_COMPONENT, ECalComponentPrivate))
+
 G_DEFINE_TYPE (ECalComponent, e_cal_component, G_TYPE_OBJECT)
 
 /* Extension property for alarm components so that we can reference them by UID */
@@ -195,51 +197,14 @@ struct _ECalComponentAlarm {
        GSList *attendee_list;
 };
 
-\f
-
-static void e_cal_component_finalize (GObject *object);
-
-static GObjectClass *parent_class;
-
-\f
-
-/* Class initialization function for the calendar component object */
-static void
-e_cal_component_class_init (ECalComponentClass *klass)
-{
-       GObjectClass *object_class;
-
-       object_class = (GObjectClass *) klass;
-
-       parent_class = g_type_class_peek_parent (klass);
-
-       object_class->finalize = e_cal_component_finalize;
-}
-
-/* Object initialization function for the calendar component object */
-static void
-e_cal_component_init (ECalComponent *comp)
-{
-       ECalComponentPrivate *priv;
-
-       priv = g_new0 (ECalComponentPrivate, 1);
-       comp->priv = priv;
-
-       priv->alarm_uid_hash = g_hash_table_new (g_str_hash, g_str_equal);
-}
-
 /* Does a simple g_free() of the elements of a GSList and then frees the list
  * itself.  Returns NULL.
  */
 static GSList *
 free_slist (GSList *slist)
 {
-       GSList *l;
+       g_slist_free_full (slist, (GDestroyNotify) g_free);
 
-       for (l = slist; l; l = l->next)
-               g_free (l->data);
-
-       g_slist_free (slist);
        return NULL;
 }
 
@@ -372,32 +337,42 @@ free_icalcomponent (ECalComponent *comp,
        priv->need_sequence_inc = FALSE;
 }
 
-/* Finalize handler for the calendar component object */
 static void
-e_cal_component_finalize (GObject *object)
+cal_component_finalize (GObject *object)
 {
-       ECalComponent *comp;
        ECalComponentPrivate *priv;
 
-       g_return_if_fail (object != NULL);
-       g_return_if_fail (E_IS_CAL_COMPONENT (object));
+       priv = E_CAL_COMPONENT_GET_PRIVATE (object);
 
-       comp = E_CAL_COMPONENT (object);
-       priv = comp->priv;
-
-       free_icalcomponent (comp, TRUE);
+       free_icalcomponent (E_CAL_COMPONENT (object), TRUE);
        g_hash_table_destroy (priv->alarm_uid_hash);
-       priv->alarm_uid_hash = NULL;
-
-       g_free (priv);
-       comp->priv = NULL;
 
        /* Chain up to parent's finalize() method. */
-       G_OBJECT_CLASS (parent_class)->finalize (object);
+       G_OBJECT_CLASS (e_cal_component_parent_class)->finalize (object);
 }
 
 \f
 
+/* Class initialization function for the calendar component object */
+static void
+e_cal_component_class_init (ECalComponentClass *class)
+{
+       GObjectClass *object_class;
+
+       g_type_class_add_private (class, sizeof (ECalComponentPrivate));
+
+       object_class = G_OBJECT_CLASS (class);
+       object_class->finalize = cal_component_finalize;
+}
+
+/* Object initialization function for the calendar component object */
+static void
+e_cal_component_init (ECalComponent *comp)
+{
+       comp->priv = E_CAL_COMPONENT_GET_PRIVATE (comp);
+       comp->priv->alarm_uid_hash = g_hash_table_new (g_str_hash, g_str_equal);
+}
+
 /**
  * e_cal_component_gen_uid:
  *
index 3f13e8d..bf7d523 100644 (file)
@@ -210,7 +210,7 @@ system_timezone_read_etc_conf_d_clock (GHashTable *ical_zones)
 static void
 update_fallback (gchar **fallback,
                  gchar *adept,
-                GHashTable *ical_zones)
+                 GHashTable *ical_zones)
 {
        g_return_if_fail (fallback != NULL);
 
@@ -251,7 +251,7 @@ recursive_compare (struct stat *localtime_stat,
                    gsize localtime_content_len,
                    const gchar *file,
                    CompareFiles compare_func,
-                  GHashTable *ical_zones,
+                   GHashTable *ical_zones,
                    gint deep_level,
                    gchar **fallback)
 {
@@ -498,7 +498,7 @@ static GetSystemTimezone get_system_timezone_methods[] = {
 
 static gboolean
 system_timezone_is_valid (const gchar *tz,
-                         GHashTable *ical_zones)
+                          GHashTable *ical_zones)
 {
        const gchar *c;
 
index 4d45dc4..fef6179 100644 (file)
@@ -32,7 +32,9 @@
 #include "e-cal-view-private.h"
 #include "e-gdbus-cal-view.h"
 
-G_DEFINE_TYPE (ECalView, e_cal_view, G_TYPE_OBJECT);
+#define E_CAL_VIEW_GET_PRIVATE(obj) \
+       (G_TYPE_INSTANCE_GET_PRIVATE \
+       ((obj), E_TYPE_CAL_VIEW, ECalViewPrivate))
 
 /* Private part of the ECalView structure */
 struct _ECalViewPrivate {
@@ -60,6 +62,8 @@ enum {
 
 static guint signals[LAST_SIGNAL];
 
+G_DEFINE_TYPE (ECalView, e_cal_view, G_TYPE_OBJECT);
+
 static GList *
 build_object_list (const gchar * const *seq)
 {
@@ -201,8 +205,7 @@ complete_cb (EGdbusCalView *gdbus_calview,
 static void
 e_cal_view_init (ECalView *view)
 {
-       view->priv = G_TYPE_INSTANCE_GET_PRIVATE (
-               view, E_TYPE_CAL_VIEW, ECalViewPrivate);
+       view->priv = E_CAL_VIEW_GET_PRIVATE (view);
 }
 
 static void
@@ -211,11 +214,9 @@ e_cal_view_set_property (GObject *object,
                          const GValue *value,
                          GParamSpec *pspec)
 {
-       ECalView *view;
        ECalViewPrivate *priv;
 
-       view = E_CAL_VIEW (object);
-       priv = view->priv;
+       priv = E_CAL_VIEW_GET_PRIVATE (object);
 
        switch (property_id) {
        case PROP_VIEW:
@@ -223,11 +224,11 @@ e_cal_view_set_property (GObject *object,
                g_return_if_fail (priv->gdbus_calview == NULL);
 
                priv->gdbus_calview = g_object_ref (g_value_get_pointer (value));
-               g_signal_connect (priv->gdbus_calview, "objects-added", G_CALLBACK (objects_added_cb), view);
-               g_signal_connect (priv->gdbus_calview, "objects-modified", G_CALLBACK (objects_modified_cb), view);
-               g_signal_connect (priv->gdbus_calview, "objects-removed", G_CALLBACK (objects_removed_cb), view);
-               g_signal_connect (priv->gdbus_calview, "progress", G_CALLBACK (progress_cb), view);
-               g_signal_connect (priv->gdbus_calview, "complete", G_CALLBACK (complete_cb), view);
+               g_signal_connect (priv->gdbus_calview, "objects-added", G_CALLBACK (objects_added_cb), object);
+               g_signal_connect (priv->gdbus_calview, "objects-modified", G_CALLBACK (objects_modified_cb), object);
+               g_signal_connect (priv->gdbus_calview, "objects-removed", G_CALLBACK (objects_removed_cb), object);
+               g_signal_connect (priv->gdbus_calview, "progress", G_CALLBACK (progress_cb), object);
+               g_signal_connect (priv->gdbus_calview, "complete", G_CALLBACK (complete_cb), object);
                break;
        case PROP_CLIENT:
                priv->client = E_CAL (g_value_dup_object (value));
@@ -244,11 +245,9 @@ e_cal_view_get_property (GObject *object,
                          GValue *value,
                          GParamSpec *pspec)
 {
-       ECalView *view;
        ECalViewPrivate *priv;
 
-       view = E_CAL_VIEW (object);
-       priv = view->priv;
+       priv = E_CAL_VIEW_GET_PRIVATE (object);
 
        switch (property_id) {
        case PROP_VIEW:
@@ -267,19 +266,14 @@ e_cal_view_get_property (GObject *object,
 static void
 e_cal_view_finalize (GObject *object)
 {
-       ECalView *view;
        ECalViewPrivate *priv;
 
-       g_return_if_fail (object != NULL);
-       g_return_if_fail (E_IS_CAL_VIEW (object));
-
-       view = E_CAL_VIEW (object);
-       priv = view->priv;
+       priv = E_CAL_VIEW_GET_PRIVATE (object);
 
        if (priv->gdbus_calview != NULL) {
                GError *error = NULL;
 
-               g_signal_handlers_disconnect_matched (priv->gdbus_calview, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, view);
+               g_signal_handlers_disconnect_matched (priv->gdbus_calview, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, object);
                e_gdbus_cal_view_call_dispose_sync (priv->gdbus_calview, NULL, &error);
                g_object_unref (priv->gdbus_calview);
                priv->gdbus_calview = NULL;
@@ -301,17 +295,17 @@ e_cal_view_finalize (GObject *object)
 
 /* Class initialization function for the calendar view */
 static void
-e_cal_view_class_init (ECalViewClass *klass)
+e_cal_view_class_init (ECalViewClass *class)
 {
        GObjectClass *object_class;
 
-       object_class = (GObjectClass *) klass;
+       object_class = (GObjectClass *) class;
 
        object_class->set_property = e_cal_view_set_property;
        object_class->get_property = e_cal_view_get_property;
        object_class->finalize = e_cal_view_finalize;
 
-       g_type_class_add_private (klass, sizeof (ECalViewPrivate));
+       g_type_class_add_private (class, sizeof (ECalViewPrivate));
 
        g_object_class_install_property (object_class, PROP_VIEW,
                g_param_spec_pointer ("view", "The GDBus view proxy", NULL,
@@ -327,7 +321,7 @@ e_cal_view_class_init (ECalViewClass *klass)
          */
        signals[OBJECTS_ADDED] =
                g_signal_new ("objects_added",
-                             G_TYPE_FROM_CLASS (klass),
+                             G_TYPE_FROM_CLASS (class),
                              G_SIGNAL_RUN_FIRST,
                              G_STRUCT_OFFSET (ECalViewClass, objects_added),
                              NULL, NULL,
@@ -340,7 +334,7 @@ e_cal_view_class_init (ECalViewClass *klass)
          */
        signals[OBJECTS_MODIFIED] =
                g_signal_new ("objects_modified",
-                             G_TYPE_FROM_CLASS (klass),
+                             G_TYPE_FROM_CLASS (class),
                              G_SIGNAL_RUN_FIRST,
                              G_STRUCT_OFFSET (ECalViewClass, objects_modified),
                              NULL, NULL,
@@ -353,7 +347,7 @@ e_cal_view_class_init (ECalViewClass *klass)
          */
        signals[OBJECTS_REMOVED] =
                g_signal_new ("objects_removed",
-                             G_TYPE_FROM_CLASS (klass),
+                             G_TYPE_FROM_CLASS (class),
                              G_SIGNAL_RUN_FIRST,
                              G_STRUCT_OFFSET (ECalViewClass, objects_removed),
                              NULL, NULL,
@@ -361,7 +355,7 @@ e_cal_view_class_init (ECalViewClass *klass)
                              G_TYPE_NONE, 1, G_TYPE_POINTER);
        signals[VIEW_PROGRESS] =
                g_signal_new ("view_progress",
-                             G_TYPE_FROM_CLASS (klass),
+                             G_TYPE_FROM_CLASS (class),
                              G_SIGNAL_RUN_FIRST,
                              G_STRUCT_OFFSET (ECalViewClass, view_progress),
                              NULL, NULL,
@@ -371,7 +365,7 @@ e_cal_view_class_init (ECalViewClass *klass)
        /* XXX The "view-done" signal is deprecated. */
        signals[VIEW_DONE] =
                g_signal_new ("view_done",
-                             G_TYPE_FROM_CLASS (klass),
+                             G_TYPE_FROM_CLASS (class),
                              G_SIGNAL_RUN_FIRST,
                              G_STRUCT_OFFSET (ECalViewClass, view_done),
                              NULL, NULL,
@@ -380,7 +374,7 @@ e_cal_view_class_init (ECalViewClass *klass)
 
        signals[VIEW_COMPLETE] =
                g_signal_new ("view_complete",
-                             G_TYPE_FROM_CLASS (klass),
+                             G_TYPE_FROM_CLASS (class),
                              G_SIGNAL_RUN_FIRST,
                              G_STRUCT_OFFSET (ECalViewClass, view_complete),
                              NULL, NULL,
@@ -448,15 +442,11 @@ void
 e_cal_view_start (ECalView *view)
 {
        GError *error = NULL;
-       ECalViewPrivate *priv;
 
-       g_return_if_fail (view != NULL);
        g_return_if_fail (E_IS_CAL_VIEW (view));
 
-       priv = view->priv;
-
-       if (priv->gdbus_calview) {
-               e_gdbus_cal_view_call_start_sync (priv->gdbus_calview, NULL, &error);
+       if (view->priv->gdbus_calview) {
+               e_gdbus_cal_view_call_start_sync (view->priv->gdbus_calview, NULL, &error);
        }
 
        if (error) {
@@ -484,15 +474,11 @@ void
 e_cal_view_stop (ECalView *view)
 {
        GError *error = NULL;
-       ECalViewPrivate *priv;
 
-       g_return_if_fail (view != NULL);
        g_return_if_fail (E_IS_CAL_VIEW (view));
 
-       priv = view->priv;
-
-       if (priv->gdbus_calview) {
-               e_gdbus_cal_view_call_stop_sync (priv->gdbus_calview, NULL, &error);
+       if (view->priv->gdbus_calview) {
+               e_gdbus_cal_view_call_stop_sync (view->priv->gdbus_calview, NULL, &error);
        }
 
        if (error) {
index 26b5066..b4f43de 100644 (file)
 #include "e-gdbus-cal-view.h"
 #include "e-gdbus-cal-factory.h"
 
+#define E_CAL_GET_PRIVATE(obj) \
+       (G_TYPE_INSTANCE_GET_PRIVATE \
+       ((obj), E_TYPE_CAL, ECalPrivate))
+
 #define CLIENT_BACKEND_PROPERTY_CACHE_DIR              "cache-dir"
 #define CLIENT_BACKEND_PROPERTY_CAPABILITIES           "capabilities"
 #define CAL_BACKEND_PROPERTY_CAL_EMAIL_ADDRESS         "cal-email-address"
@@ -144,8 +148,6 @@ enum {
 
 static guint e_cal_signals[LAST_SIGNAL];
 
-static GObjectClass *parent_class;
-
 #ifdef __PRETTY_FUNCTION__
 #define e_return_error_if_fail(expr,error_code)        G_STMT_START{           \
      if G_LIKELY (expr) { } else                                               \
@@ -419,28 +421,25 @@ convert_type (ECalSourceType type)
 static void
 e_cal_init (ECal *ecal)
 {
-       ECalPrivate *priv;
-
        LOCK_FACTORY ();
        active_cals++;
        UNLOCK_FACTORY ();
 
-       ecal->priv = priv = G_TYPE_INSTANCE_GET_PRIVATE (
-               ecal, E_TYPE_CAL, ECalPrivate);
-
-       priv->load_state = E_CAL_LOAD_NOT_LOADED;
-       priv->uri = NULL;
-       priv->local_attachment_store = NULL;
-
-       priv->cal_address = NULL;
-       priv->alarm_email_address = NULL;
-       priv->ldap_attribute = NULL;
-       priv->capabilities = NULL;
-       priv->gdbus_cal = NULL;
-       priv->timezones = g_hash_table_new (g_str_hash, g_str_equal);
-       priv->default_zone = icaltimezone_get_utc_timezone ();
-       priv->free_busy_data_lock = g_mutex_new ();
-       g_static_rec_mutex_init (&priv->cache_lock);
+       ecal->priv = E_CAL_GET_PRIVATE (ecal);
+
+       ecal->priv->load_state = E_CAL_LOAD_NOT_LOADED;
+       ecal->priv->uri = NULL;
+       ecal->priv->local_attachment_store = NULL;
+
+       ecal->priv->cal_address = NULL;
+       ecal->priv->alarm_email_address = NULL;
+       ecal->priv->ldap_attribute = NULL;
+       ecal->priv->capabilities = NULL;
+       ecal->priv->gdbus_cal = NULL;
+       ecal->priv->timezones = g_hash_table_new (g_str_hash, g_str_equal);
+       ecal->priv->default_zone = icaltimezone_get_utc_timezone ();
+       ecal->priv->free_busy_data_lock = g_mutex_new ();
+       g_static_rec_mutex_init (&ecal->priv->cache_lock);
 }
 
 static void
@@ -526,7 +525,8 @@ e_cal_dispose (GObject *object)
 
        gdbus_cal_disconnect (ecal);
 
-       (* G_OBJECT_CLASS (parent_class)->dispose) (object);
+       /* Chain up to parent's dispose() method. */
+       G_OBJECT_CLASS (e_cal_parent_class)->dispose (object);
 }
 
 static void
@@ -601,7 +601,8 @@ e_cal_finalize (GObject *object)
        g_static_rec_mutex_free (&priv->cache_lock);
        g_mutex_free (priv->free_busy_data_lock);
 
-       (* G_OBJECT_CLASS (parent_class)->finalize) (object);
+       /* Chain up to parent's finalize() method. */
+       G_OBJECT_CLASS (e_cal_parent_class)->finalize (object);
 
        LOCK_FACTORY ();
        active_cals--;
@@ -610,18 +611,16 @@ e_cal_finalize (GObject *object)
 
 /* Class initialization function for the calendar ecal */
 static void
-e_cal_class_init (ECalClass *klass)
+e_cal_class_init (ECalClass *class)
 {
        GObjectClass *object_class;
 
-       object_class = (GObjectClass *) klass;
-
-       parent_class = g_type_class_peek_parent (klass);
+       object_class = (GObjectClass *) class;
 
        /* XXX The "cal-opened" signal is deprecated. */
        e_cal_signals[CAL_OPENED] =
                g_signal_new ("cal_opened",
-                             G_TYPE_FROM_CLASS (klass),
+                             G_TYPE_FROM_CLASS (class),
                              G_SIGNAL_RUN_FIRST,
                              G_STRUCT_OFFSET (ECalClass, cal_opened),
                              NULL, NULL,
@@ -635,7 +634,7 @@ e_cal_class_init (ECalClass *klass)
          */
        e_cal_signals[CAL_OPENED_EX] =
                g_signal_new ("cal_opened_ex",
-                             G_TYPE_FROM_CLASS (klass),
+                             G_TYPE_FROM_CLASS (class),
                              G_SIGNAL_RUN_FIRST,
                              G_STRUCT_OFFSET (ECalClass, cal_opened_ex),
                              NULL, NULL,
@@ -644,7 +643,7 @@ e_cal_class_init (ECalClass *klass)
 
        e_cal_signals[CAL_SET_MODE] =
                g_signal_new ("cal_set_mode",
-                             G_TYPE_FROM_CLASS (klass),
+                             G_TYPE_FROM_CLASS (class),
                              G_SIGNAL_RUN_FIRST,
                              G_STRUCT_OFFSET (ECalClass, cal_set_mode),
                              NULL, NULL,
@@ -654,7 +653,7 @@ e_cal_class_init (ECalClass *klass)
                              CAL_MODE_ENUM_TYPE);
        e_cal_signals[BACKEND_ERROR] =
                g_signal_new ("backend_error",
-                             G_TYPE_FROM_CLASS (klass),
+                             G_TYPE_FROM_CLASS (class),
                              G_SIGNAL_RUN_FIRST,
                              G_STRUCT_OFFSET (ECalClass, backend_error),
                              NULL, NULL,
@@ -663,21 +662,21 @@ e_cal_class_init (ECalClass *klass)
                              G_TYPE_STRING);
        e_cal_signals[BACKEND_DIED] =
                g_signal_new ("backend_died",
-                             G_TYPE_FROM_CLASS (klass),
+                             G_TYPE_FROM_CLASS (class),
                              G_SIGNAL_RUN_FIRST,
                              G_STRUCT_OFFSET (ECalClass, backend_died),
                              NULL, NULL,
                              g_cclosure_marshal_VOID__VOID,
                              G_TYPE_NONE, 0);
 
-       klass->cal_opened = NULL;
-       klass->cal_opened_ex = NULL;
-       klass->backend_died = NULL;
+       class->cal_opened = NULL;
+       class->cal_opened_ex = NULL;
+       class->backend_died = NULL;
 
        object_class->dispose = e_cal_dispose;
        object_class->finalize = e_cal_finalize;
 
-       g_type_class_add_private (klass, sizeof (ECalPrivate));
+       g_type_class_add_private (class, sizeof (ECalPrivate));
 }
 
 static void
index c76a002..905024c 100644 (file)
 #include <libedataserver/e-data-server-util.h>
 #include "e-cal-backend-cache.h"
 
+#define E_CAL_BACKEND_CACHE_GET_PRIVATE(obj) \
+       (G_TYPE_INSTANCE_GET_PRIVATE \
+       ((obj), E_TYPE_CAL_BACKEND_CACHE, ECalBackendCachePrivate))
+
 struct _ECalBackendCachePrivate {
        GHashTable *timezones;
 };
@@ -40,7 +44,7 @@ e_cal_backend_cache_finalize (GObject *object)
 {
        ECalBackendCachePrivate *priv;
 
-       priv = E_CAL_BACKEND_CACHE (object)->priv;
+       priv = E_CAL_BACKEND_CACHE_GET_PRIVATE (object);
 
        g_hash_table_destroy (priv->timezones);
 
@@ -68,8 +72,7 @@ timezones_value_destroy (icaltimezone *zone)
 static void
 e_cal_backend_cache_init (ECalBackendCache *cache)
 {
-       cache->priv = G_TYPE_INSTANCE_GET_PRIVATE (
-               cache, E_TYPE_CAL_BACKEND_CACHE, ECalBackendCachePrivate);
+       cache->priv = E_CAL_BACKEND_CACHE_GET_PRIVATE (cache);
 
        cache->priv->timezones = g_hash_table_new_full (
                g_str_hash, g_str_equal,
index 8abd490..c35eb3b 100644 (file)
 #define KEY_FILE_NAME "keys.xml"
 #define IDLE_SAVE_TIMEOUT 6000
 
+#define E_CAL_BACKEND_FILE_STORE_GET_PRIVATE(obj) \
+       (G_TYPE_INSTANCE_GET_PRIVATE \
+       ((obj), E_TYPE_CAL_BACKEND_FILE_STORE, ECalBackendFileStorePrivate))
+
 typedef struct {
        ECalComponent *comp;
        GHashTable *recurrences;
@@ -102,13 +106,11 @@ static gboolean
 put_component (ECalBackendFileStore *fstore,
                ECalComponent *comp)
 {
-       ECalBackendFileStorePrivate *priv;
        FullCompObject *obj = NULL;
        const gchar *uid;
 
        g_return_val_if_fail (comp != NULL, FALSE);
 
-       priv = fstore->priv;
        e_cal_component_get_uid (comp, &uid);
 
        if (uid == NULL) {
@@ -116,11 +118,12 @@ put_component (ECalBackendFileStore *fstore,
                return FALSE;
        }
 
-       g_static_rw_lock_writer_lock (&priv->lock);
-       obj = g_hash_table_lookup (priv->comp_uid_hash, uid);
+       g_static_rw_lock_writer_lock (&fstore->priv->lock);
+       obj = g_hash_table_lookup (fstore->priv->comp_uid_hash, uid);
        if (obj == NULL) {
                obj = create_new_full_object ();
-               g_hash_table_insert (priv->comp_uid_hash, g_strdup (uid), obj);
+               g_hash_table_insert (
+                       fstore->priv->comp_uid_hash, g_strdup (uid), obj);
        }
 
        if (!e_cal_component_is_instance (comp)) {
@@ -135,7 +138,7 @@ put_component (ECalBackendFileStore *fstore,
        }
 
        g_object_ref (comp);
-       g_static_rw_lock_writer_unlock (&priv->lock);
+       g_static_rw_lock_writer_unlock (&fstore->priv->lock);
 
        return TRUE;
 }
@@ -145,16 +148,13 @@ remove_component (ECalBackendFileStore *fstore,
                   const gchar *uid,
                   const gchar *rid)
 {
-       ECalBackendFileStorePrivate *priv;
        FullCompObject *obj = NULL;
        gboolean ret_val = TRUE;
        gboolean remove_completely = FALSE;
 
-       priv = fstore->priv;
-
-       g_static_rw_lock_writer_lock (&priv->lock);
+       g_static_rw_lock_writer_lock (&fstore->priv->lock);
 
-       obj = g_hash_table_lookup (priv->comp_uid_hash, uid);
+       obj = g_hash_table_lookup (fstore->priv->comp_uid_hash, uid);
        if (obj == NULL) {
                ret_val = FALSE;
                goto end;
@@ -169,10 +169,10 @@ remove_component (ECalBackendFileStore *fstore,
                remove_completely = TRUE;
 
        if (remove_completely)
-               g_hash_table_remove (priv->comp_uid_hash, uid);
+               g_hash_table_remove (fstore->priv->comp_uid_hash, uid);
 
 end:
-       g_static_rw_lock_writer_unlock (&priv->lock);
+       g_static_rw_lock_writer_unlock (&fstore->priv->lock);
 
        return ret_val;
 
@@ -183,15 +183,12 @@ get_component (ECalBackendFileStore *fstore,
                const gchar *uid,
                const gchar *rid)
 {
-       ECalBackendFileStorePrivate *priv;
        FullCompObject *obj = NULL;
        ECalComponent *comp = NULL;
 
-       priv = fstore->priv;
-
-       g_static_rw_lock_reader_lock (&priv->lock);
+       g_static_rw_lock_reader_lock (&fstore->priv->lock);
 
-       obj = g_hash_table_lookup (priv->comp_uid_hash, uid);
+       obj = g_hash_table_lookup (fstore->priv->comp_uid_hash, uid);
        if (obj == NULL)
                goto end;
 
@@ -204,7 +201,7 @@ get_component (ECalBackendFileStore *fstore,
                g_object_ref (comp);
 
 end:
-       g_static_rw_lock_reader_unlock (&priv->lock);
+       g_static_rw_lock_reader_unlock (&fstore->priv->lock);
        return comp;
 }
 
@@ -224,15 +221,12 @@ e_cal_backend_file_store_has_component (ECalBackendStore *store,
                                         const gchar *rid)
 {
        ECalBackendFileStore *fstore = E_CAL_BACKEND_FILE_STORE (store);
-       ECalBackendFileStorePrivate *priv;
        gboolean ret_val = FALSE;
        FullCompObject *obj = NULL;
 
-       priv = fstore->priv;
-
-       g_static_rw_lock_reader_lock (&priv->lock);
+       g_static_rw_lock_reader_lock (&fstore->priv->lock);
 
-       obj = g_hash_table_lookup (priv->comp_uid_hash, uid);
+       obj = g_hash_table_lookup (fstore->priv->comp_uid_hash, uid);
        if (obj == NULL) {
                goto end;
        }
@@ -246,7 +240,7 @@ e_cal_backend_file_store_has_component (ECalBackendStore *store,
                ret_val = TRUE;
 
 end:
-       g_static_rw_lock_reader_unlock (&priv->lock);
+       g_static_rw_lock_reader_unlock (&fstore->priv->lock);
        return ret_val;
 }
 
@@ -255,17 +249,14 @@ e_cal_backend_file_store_put_component (ECalBackendStore *store,
                                         ECalComponent *comp)
 {
        ECalBackendFileStore *fstore = E_CAL_BACKEND_FILE_STORE (store);
-       ECalBackendFileStorePrivate *priv;
        gboolean ret_val = FALSE;
 
-       priv = fstore->priv;
-
        ret_val = put_component (fstore, comp);
 
        if (ret_val) {
-               priv->dirty = TRUE;
+               fstore->priv->dirty = TRUE;
 
-               if (!priv->freeze_changes)
+               if (!fstore->priv->freeze_changes)
                        save_cache (fstore);
        }
 
@@ -278,17 +269,14 @@ e_cal_backend_file_store_remove_component (ECalBackendStore *store,
                                            const gchar *rid)
 {
        ECalBackendFileStore *fstore = E_CAL_BACKEND_FILE_STORE (store);
-       ECalBackendFileStorePrivate *priv;
        gboolean ret_val = FALSE;
 
-       priv = fstore->priv;
-
        ret_val = remove_component (fstore, uid, rid);
 
        if (ret_val) {
-               priv->dirty = TRUE;
+               fstore->priv->dirty = TRUE;
 
-               if (!priv->freeze_changes)
+               if (!fstore->priv->freeze_changes)
                        save_cache (fstore);
        }
 
@@ -300,14 +288,11 @@ e_cal_backend_file_store_get_timezone (ECalBackendStore *store,
                                        const gchar *tzid)
 {
        ECalBackendFileStore *fstore = E_CAL_BACKEND_FILE_STORE (store);
-       ECalBackendFileStorePrivate *priv;
        const icaltimezone *zone = NULL;
 
-       priv = fstore->priv;
-
-       g_static_rw_lock_reader_lock (&priv->lock);
-       zone = g_hash_table_lookup (priv->timezones, tzid);
-       g_static_rw_lock_reader_unlock (&priv->lock);
+       g_static_rw_lock_reader_lock (&fstore->priv->lock);
+       zone = g_hash_table_lookup (fstore->priv->timezones, tzid);
+       g_static_rw_lock_reader_unlock (&fstore->priv->lock);
 
        return zone;
 }
@@ -317,22 +302,22 @@ e_cal_backend_file_store_put_timezone (ECalBackendStore *store,
                                        const icaltimezone *zone)
 {
        ECalBackendFileStore *fstore = E_CAL_BACKEND_FILE_STORE (store);
-       ECalBackendFileStorePrivate *priv;
        icaltimezone *copy;
 
        g_return_val_if_fail (fstore != NULL, FALSE);
        g_return_val_if_fail (zone != NULL, FALSE);
 
-       priv = fstore->priv;
-
-       g_static_rw_lock_writer_lock (&priv->lock);
+       g_static_rw_lock_writer_lock (&fstore->priv->lock);
        copy = copy_timezone ((icaltimezone *) zone);
-       g_hash_table_insert (priv->timezones, g_strdup (icaltimezone_get_tzid ((icaltimezone *) zone)), copy);
-       g_static_rw_lock_writer_unlock (&priv->lock);
+       g_hash_table_insert (
+               fstore->priv->timezones,
+               g_strdup (icaltimezone_get_tzid ((icaltimezone *) zone)),
+               copy);
+       g_static_rw_lock_writer_unlock (&fstore->priv->lock);
 
-       priv->dirty = TRUE;
+       fstore->priv->dirty = TRUE;
 
-       if (!priv->freeze_changes)
+       if (!fstore->priv->freeze_changes)
                save_cache (fstore);
 
        return TRUE;
@@ -343,19 +328,16 @@ e_cal_backend_file_store_remove_timezone (ECalBackendStore *store,
                                           const gchar *tzid)
 {
        ECalBackendFileStore *fstore = E_CAL_BACKEND_FILE_STORE (store);
-       ECalBackendFileStorePrivate *priv;
        gboolean ret_val = FALSE;
 
-       priv = fstore->priv;
-
-       g_static_rw_lock_writer_lock (&priv->lock);
-       ret_val = g_hash_table_remove (priv->timezones, tzid);
-       g_static_rw_lock_writer_unlock (&priv->lock);
+       g_static_rw_lock_writer_lock (&fstore->priv->lock);
+       ret_val = g_hash_table_remove (fstore->priv->timezones, tzid);
+       g_static_rw_lock_writer_unlock (&fstore->priv->lock);
 
        if (ret_val) {
-               priv->dirty = TRUE;
+               fstore->priv->dirty = TRUE;
 
-               if (!priv->freeze_changes)
+               if (!fstore->priv->freeze_changes)
                        save_cache (fstore);
        }
 
@@ -367,14 +349,11 @@ e_cal_backend_file_store_get_key_value (ECalBackendStore *store,
                                         const gchar *key)
 {
        ECalBackendFileStore *fstore = E_CAL_BACKEND_FILE_STORE (store);
-       ECalBackendFileStorePrivate *priv;
        const gchar *value;
 
-       priv = fstore->priv;
-
-       g_static_rw_lock_reader_lock (&priv->lock);
-       value = e_file_cache_get_object (priv->keys_cache, key);
-       g_static_rw_lock_reader_unlock (&priv->lock);
+       g_static_rw_lock_reader_lock (&fstore->priv->lock);
+       value = e_file_cache_get_object (fstore->priv->keys_cache, key);
+       g_static_rw_lock_reader_unlock (&fstore->priv->lock);
 
        return value;
 }
@@ -385,23 +364,23 @@ e_cal_backend_file_store_put_key_value (ECalBackendStore *store,
                                         const gchar *value)
 {
        ECalBackendFileStore *fstore = E_CAL_BACKEND_FILE_STORE (store);
-       ECalBackendFileStorePrivate *priv;
        gboolean ret_val = FALSE;
 
-       priv = fstore->priv;
-
-       g_static_rw_lock_writer_lock (&priv->lock);
+       g_static_rw_lock_writer_lock (&fstore->priv->lock);
 
        if (!value)
-               ret_val = e_file_cache_remove_object (priv->keys_cache, key);
+               ret_val = e_file_cache_remove_object (
+                       fstore->priv->keys_cache, key);
        else {
-               if (e_file_cache_get_object (priv->keys_cache, key))
-                       ret_val = e_file_cache_replace_object (priv->keys_cache, key, value);
+               if (e_file_cache_get_object (fstore->priv->keys_cache, key))
+                       ret_val = e_file_cache_replace_object (
+                               fstore->priv->keys_cache, key, value);
                else
-                       ret_val = e_file_cache_add_object (priv->keys_cache, key, value);
+                       ret_val = e_file_cache_add_object (
+                               fstore->priv->keys_cache, key, value);
        }
 
-       g_static_rw_lock_writer_unlock (&priv->lock);
+       g_static_rw_lock_writer_unlock (&fstore->priv->lock);
 
        return ret_val;
 }
@@ -410,19 +389,17 @@ static const icaltimezone *
 e_cal_backend_file_store_get_default_timezone (ECalBackendStore *store)
 {
        ECalBackendFileStore *fstore = E_CAL_BACKEND_FILE_STORE (store);
-       ECalBackendFileStorePrivate *priv;
        const gchar *tzid;
        const icaltimezone *zone = NULL;
 
-       priv = fstore->priv;
-
-       g_static_rw_lock_reader_lock (&priv->lock);
+       g_static_rw_lock_reader_lock (&fstore->priv->lock);
 
-       tzid = e_file_cache_get_object (priv->keys_cache, "default-zone");
+       tzid = e_file_cache_get_object (
+               fstore->priv->keys_cache, "default-zone");
        if (tzid)
-               zone = g_hash_table_lookup (priv->timezones, tzid);
+               zone = g_hash_table_lookup (fstore->priv->timezones, tzid);
 
-       g_static_rw_lock_reader_unlock (&priv->lock);
+       g_static_rw_lock_reader_unlock (&fstore->priv->lock);
 
        return zone;
 }
@@ -432,25 +409,24 @@ e_cal_backend_file_store_set_default_timezone (ECalBackendStore *store,
                                                const icaltimezone *zone)
 {
        ECalBackendFileStore *fstore = E_CAL_BACKEND_FILE_STORE (store);
-       ECalBackendFileStorePrivate *priv;
        const gchar *tzid;
        icaltimezone *copy;
        const gchar *key = "default-zone";
 
-       priv = fstore->priv;
-
-       g_static_rw_lock_writer_lock (&priv->lock);
+       g_static_rw_lock_writer_lock (&fstore->priv->lock);
 
        tzid = icaltimezone_get_tzid ((icaltimezone *) zone);
        copy = copy_timezone ((icaltimezone *) zone);
-       g_hash_table_insert (priv->timezones, g_strdup (tzid), copy);
+       g_hash_table_insert (fstore->priv->timezones, g_strdup (tzid), copy);
 
-       if (e_file_cache_get_object (priv->keys_cache, key))
-               e_file_cache_replace_object (priv->keys_cache, key, tzid);
+       if (e_file_cache_get_object (fstore->priv->keys_cache, key))
+               e_file_cache_replace_object (
+                       fstore->priv->keys_cache, key, tzid);
        else
-               e_file_cache_add_object (priv->keys_cache, key, tzid);
+               e_file_cache_add_object (
+                       fstore->priv->keys_cache, key, tzid);
 
-       g_static_rw_lock_writer_unlock (&priv->lock);
+       g_static_rw_lock_writer_unlock (&fstore->priv->lock);
 
        return TRUE;
 }
@@ -459,14 +435,11 @@ static void
 e_cal_backend_file_store_thaw_changes (ECalBackendStore *store)
 {
        ECalBackendFileStore *fstore = E_CAL_BACKEND_FILE_STORE (store);
-       ECalBackendFileStorePrivate *priv;
-
-       priv = fstore->priv;
 
-       priv->freeze_changes = FALSE;
+       fstore->priv->freeze_changes = FALSE;
 
-       e_file_cache_thaw_changes (priv->keys_cache);
-       if (priv->dirty) {
+       e_file_cache_thaw_changes (fstore->priv->keys_cache);
+       if (fstore->priv->dirty) {
                save_cache (fstore);
        }
 }
@@ -475,12 +448,9 @@ static void
 e_cal_backend_file_store_freeze_changes (ECalBackendStore *store)
 {
        ECalBackendFileStore *fstore = E_CAL_BACKEND_FILE_STORE (store);
-       ECalBackendFileStorePrivate *priv;
-
-       priv = fstore->priv;
 
-       priv->freeze_changes = TRUE;
-       e_file_cache_freeze_changes (priv->keys_cache);
+       fstore->priv->freeze_changes = TRUE;
+       e_file_cache_freeze_changes (fstore->priv->keys_cache);
 }
 
 static void
@@ -500,15 +470,12 @@ e_cal_backend_file_store_get_components_by_uid (ECalBackendStore *store,
                                                 const gchar *uid)
 {
        ECalBackendFileStore *fstore = E_CAL_BACKEND_FILE_STORE (store);
-       ECalBackendFileStorePrivate *priv;
        FullCompObject *obj = NULL;
        GSList *comps = NULL;
 
-       priv = fstore->priv;
-
-       g_static_rw_lock_reader_lock (&priv->lock);
+       g_static_rw_lock_reader_lock (&fstore->priv->lock);
 
-       obj = g_hash_table_lookup (priv->comp_uid_hash, uid);
+       obj = g_hash_table_lookup (fstore->priv->comp_uid_hash, uid);
        if (obj == NULL) {
                goto end;
        }
@@ -520,7 +487,7 @@ e_cal_backend_file_store_get_components_by_uid (ECalBackendStore *store,
 
        g_hash_table_foreach (obj->recurrences, (GHFunc) add_comp_to_slist, &comps);
 end:
-       g_static_rw_lock_reader_unlock (&priv->lock);
+       g_static_rw_lock_reader_unlock (&fstore->priv->lock);
        return comps;
 }
 
@@ -545,14 +512,13 @@ static GSList *
 e_cal_backend_file_store_get_components (ECalBackendStore *store)
 {
        ECalBackendFileStore *fstore = E_CAL_BACKEND_FILE_STORE (store);
-       ECalBackendFileStorePrivate *priv;
        GSList *comps = NULL;
 
-       priv = fstore->priv;
-
-       g_static_rw_lock_reader_lock (&priv->lock);
-       g_hash_table_foreach (priv->comp_uid_hash, (GHFunc) add_full_comp_to_slist, &comps);
-       g_static_rw_lock_reader_unlock (&priv->lock);
+       g_static_rw_lock_reader_lock (&fstore->priv->lock);
+       g_hash_table_foreach (
+               fstore->priv->comp_uid_hash,
+               (GHFunc) add_full_comp_to_slist, &comps);
+       g_static_rw_lock_reader_unlock (&fstore->priv->lock);
 
        return comps;
 }
@@ -591,14 +557,13 @@ static GSList *
 e_cal_backend_file_store_get_component_ids (ECalBackendStore *store)
 {
        ECalBackendFileStore *fstore = E_CAL_BACKEND_FILE_STORE (store);
-       ECalBackendFileStorePrivate *priv;
        GSList *comp_ids = NULL;
 
-       priv = fstore->priv;
-
-       g_static_rw_lock_reader_lock (&priv->lock);
-       g_hash_table_foreach (priv->comp_uid_hash, (GHFunc) add_comp_ids_to_slist, &comp_ids);
-       g_static_rw_lock_reader_unlock (&priv->lock);
+       g_static_rw_lock_reader_lock (&fstore->priv->lock);
+       g_hash_table_foreach (
+               fstore->priv->comp_uid_hash,
+               (GHFunc) add_comp_ids_to_slist, &comp_ids);
+       g_static_rw_lock_reader_unlock (&fstore->priv->lock);
 
        return comp_ids;
 }
@@ -607,19 +572,16 @@ static void
 add_timezone (ECalBackendFileStore *fstore,
               icalcomponent *vtzcomp)
 {
-       ECalBackendFileStorePrivate *priv;
        icalproperty *prop;
        icaltimezone *zone;
        const gchar *tzid;
 
-       priv = fstore->priv;
-
        prop = icalcomponent_get_first_property (vtzcomp, ICAL_TZID_PROPERTY);
        if (!prop)
                return;
 
        tzid = icalproperty_get_tzid (prop);
-       if (g_hash_table_lookup (priv->timezones, tzid))
+       if (g_hash_table_lookup (fstore->priv->timezones, tzid))
                return;
 
        zone = icaltimezone_new ();
@@ -628,9 +590,9 @@ add_timezone (ECalBackendFileStore *fstore,
                return;
        }
 
-       g_static_rw_lock_writer_lock (&priv->lock);
-       g_hash_table_insert (priv->timezones, g_strdup (tzid), zone);
-       g_static_rw_lock_writer_unlock (&priv->lock);
+       g_static_rw_lock_writer_lock (&fstore->priv->lock);
+       g_hash_table_insert (fstore->priv->timezones, g_strdup (tzid), zone);
+       g_static_rw_lock_writer_unlock (&fstore->priv->lock);
 }
 
 static icaltimezone *
@@ -715,19 +677,17 @@ static gboolean
 e_cal_backend_file_store_load (ECalBackendStore *store)
 {
        ECalBackendFileStore *fstore = E_CAL_BACKEND_FILE_STORE (store);
-       ECalBackendFileStorePrivate *priv;
        icalcomponent *icalcomp;
 
-       priv = fstore->priv;
-
-       if (!priv->cache_file_name || !priv->key_file_name)
+       if (!fstore->priv->cache_file_name || !fstore->priv->key_file_name)
                return FALSE;
 
        /* Parse keys */
-       priv->keys_cache = e_file_cache_new (priv->key_file_name);
+       fstore->priv->keys_cache =
+               e_file_cache_new (fstore->priv->key_file_name);
 
        /* Parse components */
-       icalcomp = e_cal_util_parse_ics_file (priv->cache_file_name);
+       icalcomp = e_cal_util_parse_ics_file (fstore->priv->cache_file_name);
        if (!icalcomp)
                return FALSE;
 
@@ -746,18 +706,15 @@ static gboolean
 e_cal_backend_file_store_remove (ECalBackendStore *store)
 {
        ECalBackendFileStore *fstore = E_CAL_BACKEND_FILE_STORE (store);
-       ECalBackendFileStorePrivate *priv;
-
-       priv = fstore->priv;
 
        /* This will remove all the contents in the directory */
-       e_file_cache_remove (priv->keys_cache);
+       e_file_cache_remove (fstore->priv->keys_cache);
 
-       g_hash_table_destroy (priv->timezones);
-       priv->timezones = NULL;
+       g_hash_table_destroy (fstore->priv->timezones);
+       fstore->priv->timezones = NULL;
 
-       g_hash_table_destroy (priv->comp_uid_hash);
-       priv->comp_uid_hash = NULL;
+       g_hash_table_destroy (fstore->priv->comp_uid_hash);
+       fstore->priv->comp_uid_hash = NULL;
 
        return TRUE;
 }
@@ -766,17 +723,14 @@ static gboolean
 e_cal_backend_file_store_clean (ECalBackendStore *store)
 {
        ECalBackendFileStore *fstore = E_CAL_BACKEND_FILE_STORE (store);
-       ECalBackendFileStorePrivate *priv;
 
-       priv = fstore->priv;
+       g_static_rw_lock_writer_lock (&fstore->priv->lock);
 
-       g_static_rw_lock_writer_lock (&priv->lock);
+       e_file_cache_clean (fstore->priv->keys_cache);
+       g_hash_table_remove_all (fstore->priv->comp_uid_hash);
+       g_hash_table_remove_all (fstore->priv->timezones);
 
-       e_file_cache_clean (priv->keys_cache);
-       g_hash_table_remove_all (priv->comp_uid_hash);
-       g_hash_table_remove_all (priv->timezones);
-
-       g_static_rw_lock_writer_unlock (&priv->lock);
+       g_static_rw_lock_writer_unlock (&fstore->priv->lock);
 
        save_cache (fstore);
        return TRUE;
@@ -826,25 +780,24 @@ static gboolean
 timeout_save_cache (gpointer user_data)
 {
        ECalBackendFileStore *fstore = user_data;
-       ECalBackendFileStorePrivate *priv;
        icalcomponent *vcalcomp;
        gchar *data = NULL, *tmpfile;
        gsize len, nwrote;
        FILE *f;
 
-       priv = fstore->priv;
+       g_static_rw_lock_reader_lock (&fstore->priv->lock);
 
-       g_static_rw_lock_reader_lock (&priv->lock);
-
-       priv->save_timeout_id = 0;
+       fstore->priv->save_timeout_id = 0;
 
        vcalcomp = e_cal_util_new_top_level ();
-       g_hash_table_foreach (priv->timezones, save_timezone, vcalcomp);
-       g_hash_table_foreach (priv->comp_uid_hash, save_object, vcalcomp);
+       g_hash_table_foreach (
+               fstore->priv->timezones, save_timezone, vcalcomp);
+       g_hash_table_foreach (
+               fstore->priv->comp_uid_hash, save_object, vcalcomp);
        data = icalcomponent_as_ical_string_r (vcalcomp);
        icalcomponent_free (vcalcomp);
 
-       tmpfile = g_strdup_printf ("%s~", priv->cache_file_name);
+       tmpfile = g_strdup_printf ("%s~", fstore->priv->cache_file_name);
        f = g_fopen (tmpfile, "wb");
        if (!f)
                goto error;
@@ -854,11 +807,11 @@ timeout_save_cache (gpointer user_data)
        if (fclose (f) != 0 || nwrote != len)
                goto error;
 
-       if (g_rename (tmpfile, priv->cache_file_name) != 0)
+       if (g_rename (tmpfile, fstore->priv->cache_file_name) != 0)
                g_unlink (tmpfile);
 
 error:
-       g_static_rw_lock_reader_unlock (&priv->lock);
+       g_static_rw_lock_reader_unlock (&fstore->priv->lock);
        g_free (tmpfile);
        g_free (data);
        return FALSE;
@@ -867,15 +820,12 @@ error:
 static void
 save_cache (ECalBackendFileStore *store)
 {
-       ECalBackendFileStorePrivate *priv;
-
-       priv = store->priv;
-
-       if (priv->save_timeout_id) {
-               g_source_remove (priv->save_timeout_id);
+       if (store->priv->save_timeout_id) {
+               g_source_remove (store->priv->save_timeout_id);
        }
 
-       priv->save_timeout_id = g_timeout_add (IDLE_SAVE_TIMEOUT, timeout_save_cache, store);
+       store->priv->save_timeout_id = g_timeout_add (
+               IDLE_SAVE_TIMEOUT, timeout_save_cache, store);
 }
 
 static void
@@ -889,14 +839,13 @@ free_timezone (gpointer data)
 static void
 cal_backend_file_store_finalize (GObject *object)
 {
-       ECalBackendFileStore *fstore = (ECalBackendFileStore *) object;
        ECalBackendFileStorePrivate *priv;
 
-       priv = fstore->priv;
+       priv = E_CAL_BACKEND_FILE_STORE_GET_PRIVATE (object);
 
        if (priv->save_timeout_id) {
                g_source_remove (priv->save_timeout_id);
-               timeout_save_cache (fstore);
+               timeout_save_cache (E_CAL_BACKEND_FILE_STORE (object));
                priv->save_timeout_id = 0;
        }
 
@@ -939,7 +888,7 @@ cal_backend_file_store_constructed (GObject *object)
        ECalBackendFileStorePrivate *priv;
        const gchar *path;
 
-       priv = E_CAL_BACKEND_FILE_STORE (object)->priv;
+       priv = E_CAL_BACKEND_FILE_STORE_GET_PRIVATE (object);
 
        path = e_cal_backend_store_get_path (E_CAL_BACKEND_STORE (object));
        priv->cache_file_name = g_build_filename (path, CACHE_FILE_NAME, NULL);
@@ -983,23 +932,25 @@ e_cal_backend_file_store_class_init (ECalBackendFileStoreClass *class)
 static void
 e_cal_backend_file_store_init (ECalBackendFileStore *store)
 {
-       ECalBackendFileStorePrivate *priv;
-
-       priv = G_TYPE_INSTANCE_GET_PRIVATE (
-               store, E_TYPE_CAL_BACKEND_FILE_STORE,
-               ECalBackendFileStorePrivate);
-
-       store->priv = priv;
-
-       priv->timezones = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, (GDestroyNotify) free_timezone);
-       priv->comp_uid_hash = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, (GDestroyNotify) destroy_full_object);
-       priv->keys_cache = NULL;
-       g_static_rw_lock_init (&priv->lock);
-       priv->cache_file_name = NULL;
-       priv->key_file_name = NULL;
-       priv->dirty = FALSE;
-       priv->freeze_changes = FALSE;
-       priv->save_timeout_id = 0;
+       store->priv = E_CAL_BACKEND_FILE_STORE_GET_PRIVATE (store);
+
+       store->priv->timezones = g_hash_table_new_full (
+               (GHashFunc) g_str_hash,
+               (GEqualFunc) g_str_equal,
+               (GDestroyNotify) g_free,
+               (GDestroyNotify) free_timezone);
+       store->priv->comp_uid_hash = g_hash_table_new_full (
+               (GHashFunc) g_str_hash,
+               (GEqualFunc) g_str_equal,
+               (GDestroyNotify) g_free,
+               (GDestroyNotify) destroy_full_object);
+       store->priv->keys_cache = NULL;
+       g_static_rw_lock_init (&store->priv->lock);
+       store->priv->cache_file_name = NULL;
+       store->priv->key_file_name = NULL;
+       store->priv->dirty = FALSE;
+       store->priv->freeze_changes = FALSE;
+       store->priv->save_timeout_id = 0;
 }
 
 /**
index c6e6527..e653bde 100644 (file)
 
 G_DEFINE_TYPE (EIntervalTree, e_intervaltree, G_TYPE_OBJECT)
 
+#define E_INTERVALTREE_GET_PRIVATE(obj) \
+       (G_TYPE_INSTANCE_GET_PRIVATE \
+       ((obj), E_TYPE_INTERVALTREE, EIntervalTreePrivate))
+
 typedef struct _EIntervalNode EIntervalNode;
 
 static EIntervalNode *
@@ -758,9 +762,9 @@ e_intervaltree_remove (EIntervalTree *tree,
 }
 
 static void
-e_intervaltree_finalize (GObject *object)
+intervaltree_finalize (GObject *object)
 {
-       EIntervalTreePrivate *priv = E_INTERVALTREE (object)->priv;
+       EIntervalTreePrivate *priv = E_INTERVALTREE_GET_PRIVATE (object);
 
        if (priv->root) {
                g_free (priv->root);
@@ -779,34 +783,35 @@ e_intervaltree_finalize (GObject *object)
 
        g_static_rec_mutex_free (&priv->mutex);
 
+       /* Chain up to parent's finalize() method. */
        G_OBJECT_CLASS (e_intervaltree_parent_class)->finalize (object);
 }
 
 static void
-e_intervaltree_class_init (EIntervalTreeClass *klass)
+e_intervaltree_class_init (EIntervalTreeClass *class)
 {
-       GObjectClass *object_class = G_OBJECT_CLASS (klass);
-       g_type_class_add_private (klass, sizeof (EIntervalTreePrivate));
-       object_class->finalize = e_intervaltree_finalize;
+       GObjectClass *object_class;
+
+       g_type_class_add_private (class, sizeof (EIntervalTreePrivate));
+
+       object_class = G_OBJECT_CLASS (class);
+       object_class->finalize = intervaltree_finalize;
 }
 
 static void
 e_intervaltree_init (EIntervalTree *tree)
 {
-       EIntervalTreePrivate *priv;
        EIntervalNode *root, *nil;
 
-       tree->priv = G_TYPE_INSTANCE_GET_PRIVATE (
-               tree, E_TYPE_INTERVALTREE, EIntervalTreePrivate);
-       priv = tree->priv;
+       tree->priv = E_INTERVALTREE_GET_PRIVATE (tree);
 
-       priv->nil = nil = g_new (EIntervalNode, 1);
+       tree->priv->nil = nil = g_new (EIntervalNode, 1);
        nil->parent = nil->left = nil->right = nil;
        nil->red = FALSE;
        nil->start = nil->end = nil->max = _TIME_MIN;
        nil->min = _TIME_MAX;
 
-       priv->root = root = g_new (EIntervalNode, 1);
+       tree->priv->root = root = g_new (EIntervalNode, 1);
        root->parent = root->left = root->right = nil;
        root->red = FALSE;
        root->start = _TIME_MAX;
@@ -814,8 +819,13 @@ e_intervaltree_init (EIntervalTree *tree)
        root->max = _TIME_MAX;
        root->min = _TIME_MIN;
 
-       g_static_rec_mutex_init (&priv->mutex);
-       priv->id_node_hash = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
+       g_static_rec_mutex_init (&tree->priv->mutex);
+
+       tree->priv->id_node_hash = g_hash_table_new_full (
+               (GHashFunc) g_str_hash,
+               (GEqualFunc) g_str_equal,
+               (GDestroyNotify) g_free,
+               (GDestroyNotify) NULL);
 }
 
 /**
index cc0b8d6..280b2d1 100644 (file)
 
 #include "e-cal-backend-sexp.h"
 
-G_DEFINE_TYPE (ECalBackendSExp, e_cal_backend_sexp, G_TYPE_OBJECT)
+#define E_CAL_BACKEND_SEXP_GET_PRIVATE(obj) \
+       (G_TYPE_INSTANCE_GET_PRIVATE \
+       ((obj), E_TYPE_CAL_BACKEND_SEXP, ECalBackendSExpPrivate))
 
-static GObjectClass *parent_class;
+G_DEFINE_TYPE (ECalBackendSExp, e_cal_backend_sexp, G_TYPE_OBJECT)
 
 typedef struct _SearchContext SearchContext;
 
@@ -1603,43 +1605,34 @@ e_cal_backend_sexp_text (ECalBackendSExp *sexp)
 }
 
 static void
-e_cal_backend_sexp_dispose (GObject *object)
+e_cal_backend_sexp_finalize (GObject *object)
 {
-       ECalBackendSExp *sexp = E_CAL_BACKEND_SEXP (object);
-
-       if (sexp->priv) {
-               e_sexp_unref (sexp->priv->search_sexp);
+       ECalBackendSExpPrivate *priv;
 
-               g_free (sexp->priv->text);
+       priv = E_CAL_BACKEND_SEXP_GET_PRIVATE (object);
 
-               g_free (sexp->priv->search_context);
-               g_free (sexp->priv);
-               sexp->priv = NULL;
-       }
+       e_sexp_unref (priv->search_sexp);
+       g_free (priv->text);
+       g_free (priv->search_context);
 
-       /* Chain up to parent's dispose() method. */
-       G_OBJECT_CLASS (parent_class)->dispose (object);
+       /* Chain up to parent's finalize() method. */
+       G_OBJECT_CLASS (e_cal_backend_sexp_parent_class)->finalize (object);
 }
 
 static void
-e_cal_backend_sexp_class_init (ECalBackendSExpClass *klass)
+e_cal_backend_sexp_class_init (ECalBackendSExpClass *class)
 {
-       GObjectClass  *object_class = G_OBJECT_CLASS (klass);
+       GObjectClass *object_class;
 
-       parent_class = g_type_class_peek_parent (klass);
+       g_type_class_add_private (class, sizeof (ECalBackendSExpPrivate));
 
-       /* Set the virtual methods. */
-
-       object_class->dispose = e_cal_backend_sexp_dispose;
+       object_class = G_OBJECT_CLASS (class);
+       object_class->finalize = e_cal_backend_sexp_finalize;
 }
 
 static void
 e_cal_backend_sexp_init (ECalBackendSExp *sexp)
 {
-       ECalBackendSExpPrivate *priv;
-
-       priv = g_new0 (ECalBackendSExpPrivate, 1);
-
-       sexp->priv = priv;
-       priv->search_context = g_new (SearchContext, 1);
+       sexp->priv = E_CAL_BACKEND_SEXP_GET_PRIVATE (sexp);
+       sexp->priv->search_context = g_new (SearchContext, 1);
 }
index 33c606a..0985ba2 100644 (file)
 #include "e-cal-backend-intervaltree.h"
 #include <libedataserver/e-data-server-util.h>
 
+#define E_CAL_BACKEND_STORE_GET_PRIVATE(obj) \
+       (G_TYPE_INSTANCE_GET_PRIVATE \
+       ((obj), E_TYPE_CAL_BACKEND_STORE, ECalBackendStorePrivate))
+
 struct _ECalBackendStorePrivate {
        gchar *path;
        EIntervalTree *intervaltree;
@@ -85,7 +89,7 @@ cal_backend_store_finalize (GObject *object)
 {
        ECalBackendStorePrivate *priv;
 
-       priv = E_CAL_BACKEND_STORE (object)->priv;
+       priv = E_CAL_BACKEND_STORE_GET_PRIVATE (object);
 
        g_free (priv->path);
        if (priv->intervaltree) {
@@ -124,8 +128,7 @@ e_cal_backend_store_class_init (ECalBackendStoreClass *class)
 static void
 e_cal_backend_store_init (ECalBackendStore *store)
 {
-       store->priv = G_TYPE_INSTANCE_GET_PRIVATE (
-               store, E_TYPE_CAL_BACKEND_STORE, ECalBackendStorePrivate);
+       store->priv = E_CAL_BACKEND_STORE_GET_PRIVATE (store);
        store->priv->intervaltree = e_intervaltree_new ();
 }
 
@@ -150,18 +153,19 @@ e_cal_backend_store_get_path (ECalBackendStore *store)
 gboolean
 e_cal_backend_store_load (ECalBackendStore *store)
 {
-       ECalBackendStorePrivate *priv;
+       ECalBackendStoreClass *class;
 
        g_return_val_if_fail (E_IS_CAL_BACKEND_STORE (store), FALSE);
 
-       priv = store->priv;
-
-       if (priv->loaded)
+       if (store->priv->loaded)
                return TRUE;
 
-       priv->loaded = (E_CAL_BACKEND_STORE_GET_CLASS (store))->load (store);
+       class = E_CAL_BACKEND_STORE_GET_CLASS (store);
+       g_return_val_if_fail (class->load != NULL, FALSE);
 
-       return priv->loaded;
+       store->priv->loaded = class->load (store);
+
+       return store->priv->loaded;
 }
 
 /**
@@ -172,16 +176,18 @@ e_cal_backend_store_load (ECalBackendStore *store)
 gboolean
 e_cal_backend_store_remove (ECalBackendStore *store)
 {
-       ECalBackendStorePrivate *priv;
+       ECalBackendStoreClass *class;
 
        g_return_val_if_fail (E_IS_CAL_BACKEND_STORE (store), FALSE);
 
-       priv = store->priv;
+       class = E_CAL_BACKEND_STORE_GET_CLASS (store);
+       g_return_val_if_fail (class->remove != NULL, FALSE);
+
        /* remove interval tree */
-       e_intervaltree_destroy (priv->intervaltree);
-       priv->intervaltree = NULL;
+       e_intervaltree_destroy (store->priv->intervaltree);
+       store->priv->intervaltree = NULL;
 
-       return (E_CAL_BACKEND_STORE_GET_CLASS (store))->remove (store);
+       return class->remove (store);
 }
 
 /**
@@ -192,18 +198,19 @@ e_cal_backend_store_remove (ECalBackendStore *store)
 gboolean
 e_cal_backend_store_clean (ECalBackendStore *store)
 {
-       ECalBackendStorePrivate *priv;
+       ECalBackendStoreClass *class;
 
        g_return_val_if_fail (E_IS_CAL_BACKEND_STORE (store), FALSE);
 
-       priv = store->priv;
+       class = E_CAL_BACKEND_STORE_GET_CLASS (store);
+       g_return_val_if_fail (class->clean != NULL, FALSE);
 
-       if (priv->intervaltree) {
-               e_intervaltree_destroy (priv->intervaltree);
-               priv->intervaltree = e_intervaltree_new ();
+       if (store->priv->intervaltree != NULL) {
+               e_intervaltree_destroy (store->priv->intervaltree);
+               store->priv->intervaltree = e_intervaltree_new ();
        }
 
-       return (E_CAL_BACKEND_STORE_GET_CLASS (store))->clean (store);
+       return class->clean (store);
 }
 
 /**
@@ -216,10 +223,15 @@ e_cal_backend_store_get_component (ECalBackendStore *store,
                                    const gchar *uid,
                                    const gchar *rid)
 {
+       ECalBackendStoreClass *class;
+
        g_return_val_if_fail (E_IS_CAL_BACKEND_STORE (store), NULL);
        g_return_val_if_fail (uid != NULL, NULL);
 
-       return (E_CAL_BACKEND_STORE_GET_CLASS (store))->get_component (store, uid, rid);
+       class = E_CAL_BACKEND_STORE_GET_CLASS (store);
+       g_return_val_if_fail (class->get_component != NULL, NULL);
+
+       return class->get_component (store, uid, rid);
 }
 
 /**
@@ -232,10 +244,15 @@ e_cal_backend_store_has_component (ECalBackendStore *store,
                                    const gchar *uid,
                                    const gchar *rid)
 {
+       ECalBackendStoreClass *class;
+
        g_return_val_if_fail (E_IS_CAL_BACKEND_STORE (store), FALSE);
        g_return_val_if_fail (uid != NULL, FALSE);
 
-       return (E_CAL_BACKEND_STORE_GET_CLASS (store))->has_component (store, uid, rid);
+       class = E_CAL_BACKEND_STORE_GET_CLASS (store);
+       g_return_val_if_fail (class->has_component != NULL, FALSE);
+
+       return class->has_component (store, uid, rid);
 }
 
 /**
@@ -249,17 +266,21 @@ e_cal_backend_store_put_component_with_time_range (ECalBackendStore *store,
                                                    time_t occurence_start,
                                                    time_t occurence_end)
 {
-       ECalBackendStorePrivate *priv;
+       ECalBackendStoreClass *class;
 
        g_return_val_if_fail (E_IS_CAL_BACKEND_STORE (store), FALSE);
        g_return_val_if_fail (E_IS_CAL_COMPONENT (comp), FALSE);
 
-       priv = store->priv;
+       class = E_CAL_BACKEND_STORE_GET_CLASS (store);
+       g_return_val_if_fail (class->put_component != NULL, FALSE);
 
-       if ((E_CAL_BACKEND_STORE_GET_CLASS (store))->put_component (store, comp)) {
-               if (e_intervaltree_insert (priv->intervaltree, occurence_start, occurence_end, comp))
+       if (class->put_component (store, comp)) {
+               if (e_intervaltree_insert (
+                       store->priv->intervaltree,
+                       occurence_start, occurence_end, comp))
                        return TRUE;
        }
+
        return FALSE;
 
 }
@@ -273,10 +294,15 @@ gboolean
 e_cal_backend_store_put_component (ECalBackendStore *store,
                                    ECalComponent *comp)
 {
+       ECalBackendStoreClass *class;
+
        g_return_val_if_fail (E_IS_CAL_BACKEND_STORE (store), FALSE);
        g_return_val_if_fail (E_IS_CAL_COMPONENT (comp), FALSE);
 
-       return (E_CAL_BACKEND_STORE_GET_CLASS (store))->put_component (store, comp);
+       class = E_CAL_BACKEND_STORE_GET_CLASS (store);
+       g_return_val_if_fail (class->put_component != NULL, FALSE);
+
+       return class->put_component (store, comp);
 }
 
 /**
@@ -289,17 +315,19 @@ e_cal_backend_store_remove_component (ECalBackendStore *store,
                                       const gchar *uid,
                                       const gchar *rid)
 {
-       ECalBackendStorePrivate *priv;
+       ECalBackendStoreClass *class;
 
        g_return_val_if_fail (E_IS_CAL_BACKEND_STORE (store), FALSE);
        g_return_val_if_fail (uid != NULL, FALSE);
 
-       priv = store->priv;
+       class = E_CAL_BACKEND_STORE_GET_CLASS (store);
+       g_return_val_if_fail (class->remove_component != NULL, FALSE);
 
-       if ((E_CAL_BACKEND_STORE_GET_CLASS (store))->remove_component (store, uid, rid)) {
-               if (e_intervaltree_remove (priv->intervaltree, uid, rid))
+       if (class->remove_component (store, uid, rid)) {
+               if (e_intervaltree_remove (store->priv->intervaltree, uid, rid))
                        return TRUE;
        }
+
        return FALSE;
 }
 
@@ -312,10 +340,15 @@ const icaltimezone *
 e_cal_backend_store_get_timezone (ECalBackendStore *store,
                                   const gchar *tzid)
 {
+       ECalBackendStoreClass *class;
+
        g_return_val_if_fail (E_IS_CAL_BACKEND_STORE (store), NULL);
        g_return_val_if_fail (tzid != NULL, NULL);
 
-       return (E_CAL_BACKEND_STORE_GET_CLASS (store))->get_timezone (store, tzid);
+       class = E_CAL_BACKEND_STORE_GET_CLASS (store);
+       g_return_val_if_fail (class->get_timezone != NULL, NULL);
+
+       return class->get_timezone (store, tzid);
 }
 
 /**
@@ -327,10 +360,15 @@ gboolean
 e_cal_backend_store_put_timezone (ECalBackendStore *store,
                                   const icaltimezone *zone)
 {
+       ECalBackendStoreClass *class;
+
        g_return_val_if_fail (E_IS_CAL_BACKEND_STORE (store), FALSE);
        g_return_val_if_fail (zone != NULL, FALSE);
 
-       return (E_CAL_BACKEND_STORE_GET_CLASS (store))->put_timezone (store, zone);
+       class = E_CAL_BACKEND_STORE_GET_CLASS (store);
+       g_return_val_if_fail (class->put_timezone != NULL, FALSE);
+
+       return class->put_timezone (store, zone);
 }
 
 /**
@@ -342,10 +380,15 @@ gboolean
 e_cal_backend_store_remove_timezone (ECalBackendStore *store,
                                      const gchar *tzid)
 {
+       ECalBackendStoreClass *class;
+
        g_return_val_if_fail (E_IS_CAL_BACKEND_STORE (store), FALSE);
        g_return_val_if_fail (tzid != NULL, FALSE);
 
-       return (E_CAL_BACKEND_STORE_GET_CLASS (store))->remove_timezone (store, tzid);
+       class = E_CAL_BACKEND_STORE_GET_CLASS (store);
+       g_return_val_if_fail (class->remove_timezone != NULL, FALSE);
+
+       return class->remove_timezone (store, tzid);
 }
 
 /**
@@ -356,9 +399,14 @@ e_cal_backend_store_remove_timezone (ECalBackendStore *store,
 const icaltimezone *
 e_cal_backend_store_get_default_timezone (ECalBackendStore *store)
 {
+       ECalBackendStoreClass *class;
+
        g_return_val_if_fail (E_IS_CAL_BACKEND_STORE (store), NULL);
 
-       return (E_CAL_BACKEND_STORE_GET_CLASS (store))->get_default_timezone (store);
+       class = E_CAL_BACKEND_STORE_GET_CLASS (store);
+       g_return_val_if_fail (class->get_default_timezone != NULL, NULL);
+
+       return class->get_default_timezone (store);
 }
 
 /**
@@ -370,10 +418,15 @@ gboolean
 e_cal_backend_store_set_default_timezone (ECalBackendStore *store,
                                           const icaltimezone *zone)
 {
+       ECalBackendStoreClass *class;
+
        g_return_val_if_fail (E_IS_CAL_BACKEND_STORE (store), FALSE);
        g_return_val_if_fail (zone != NULL, FALSE);
 
-       return (E_CAL_BACKEND_STORE_GET_CLASS (store))->set_default_timezone (store, zone);
+       class = E_CAL_BACKEND_STORE_GET_CLASS (store);
+       g_return_val_if_fail (class->set_default_timezone != NULL, FALSE);
+
+       return class->set_default_timezone (store, zone);
 }
 
 /**
@@ -385,10 +438,15 @@ GSList *
 e_cal_backend_store_get_components_by_uid (ECalBackendStore *store,
                                            const gchar *uid)
 {
+       ECalBackendStoreClass *class;
+
        g_return_val_if_fail (E_IS_CAL_BACKEND_STORE (store), NULL);
        g_return_val_if_fail (uid != NULL, NULL);
 
-       return (E_CAL_BACKEND_STORE_GET_CLASS (store))->get_components_by_uid (store, uid);
+       class = E_CAL_BACKEND_STORE_GET_CLASS (store);
+       g_return_val_if_fail (class->get_components_by_uid != NULL, NULL);
+
+       return class->get_components_by_uid (store, uid);
 }
 
 /**
@@ -399,8 +457,14 @@ e_cal_backend_store_get_components_by_uid (ECalBackendStore *store,
 GSList *
 e_cal_backend_store_get_components (ECalBackendStore *store)
 {
+       ECalBackendStoreClass *class;
+
        g_return_val_if_fail (E_IS_CAL_BACKEND_STORE (store), NULL);
-       return (E_CAL_BACKEND_STORE_GET_CLASS (store))->get_components (store);
+
+       class = E_CAL_BACKEND_STORE_GET_CLASS (store);
+       g_return_val_if_fail (class->get_components != NULL, NULL);
+
+       return class->get_components (store);
 }
 
 /**
@@ -422,7 +486,6 @@ e_cal_backend_store_get_components_occuring_in_range (ECalBackendStore *store,
                                                       time_t start,
                                                       time_t end)
 {
-       ECalBackendStorePrivate *priv;
        GList *l, *objects;
        GSList *list = NULL;
        icalcomponent *icalcomp;
@@ -430,9 +493,10 @@ e_cal_backend_store_get_components_occuring_in_range (ECalBackendStore *store,
        g_return_val_if_fail (store != NULL, NULL);
        g_return_val_if_fail (E_IS_CAL_BACKEND_STORE (store), NULL);
 
-       priv = store->priv;
+       objects = e_intervaltree_search (
+               store->priv->intervaltree, start, end);
 
-       if (!(objects = e_intervaltree_search (priv->intervaltree, start, end)))
+       if (objects == NULL)
                return NULL;
 
        for (l = objects; l != NULL; l = g_list_next (l)) {
@@ -442,7 +506,9 @@ e_cal_backend_store_get_components_occuring_in_range (ECalBackendStore *store,
                        icalcomponent_kind kind;
 
                        kind = icalcomponent_isa (icalcomp);
-                       if (kind == ICAL_VEVENT_COMPONENT || kind == ICAL_VTODO_COMPONENT || kind == ICAL_VJOURNAL_COMPONENT) {
+                       if (kind == ICAL_VEVENT_COMPONENT ||
+                           kind == ICAL_VTODO_COMPONENT ||
+                           kind == ICAL_VJOURNAL_COMPONENT) {
                                list = g_slist_prepend (list, comp);
                        } else {
                                g_object_unref (comp);
@@ -463,9 +529,14 @@ e_cal_backend_store_get_components_occuring_in_range (ECalBackendStore *store,
 GSList *
 e_cal_backend_store_get_component_ids (ECalBackendStore *store)
 {
+       ECalBackendStoreClass *class;
+
        g_return_val_if_fail (E_IS_CAL_BACKEND_STORE (store), NULL);
 
-       return (E_CAL_BACKEND_STORE_GET_CLASS (store))->get_component_ids (store);
+       class = E_CAL_BACKEND_STORE_GET_CLASS (store);
+       g_return_val_if_fail (class->get_component_ids != NULL, NULL);
+
+       return class->get_component_ids (store);
 }
 
 /**
@@ -477,10 +548,15 @@ const gchar *
 e_cal_backend_store_get_key_value (ECalBackendStore *store,
                                    const gchar *key)
 {
+       ECalBackendStoreClass *class;
+
        g_return_val_if_fail (E_IS_CAL_BACKEND_STORE (store), NULL);
        g_return_val_if_fail (key != NULL, NULL);
 
-       return (E_CAL_BACKEND_STORE_GET_CLASS (store))->get_key_value (store, key);
+       class = E_CAL_BACKEND_STORE_GET_CLASS (store);
+       g_return_val_if_fail (class->get_key_value != NULL, NULL);
+
+       return class->get_key_value (store, key);
 }
 
 /**
@@ -493,10 +569,15 @@ e_cal_backend_store_put_key_value (ECalBackendStore *store,
                                    const gchar *key,
                                    const gchar *value)
 {
+       ECalBackendStoreClass *class;
+
        g_return_val_if_fail (E_IS_CAL_BACKEND_STORE (store), FALSE);
        g_return_val_if_fail (key != NULL, FALSE);
 
-       return (E_CAL_BACKEND_STORE_GET_CLASS (store))->put_key_value (store, key, value);
+       class = E_CAL_BACKEND_STORE_GET_CLASS (store);
+       g_return_val_if_fail (class->put_key_value != NULL, FALSE);
+
+       return class->put_key_value (store, key, value);
 }
 
 /**
@@ -507,9 +588,14 @@ e_cal_backend_store_put_key_value (ECalBackendStore *store,
 void
 e_cal_backend_store_thaw_changes (ECalBackendStore *store)
 {
+       ECalBackendStoreClass *class;
+
        g_return_if_fail (E_IS_CAL_BACKEND_STORE (store));
 
-       (E_CAL_BACKEND_STORE_GET_CLASS (store))->thaw_changes (store);
+       class = E_CAL_BACKEND_STORE_GET_CLASS (store);
+       g_return_if_fail (class->thaw_changes != NULL);
+
+       class->thaw_changes (store);
 }
 
 /**
@@ -520,9 +606,14 @@ e_cal_backend_store_thaw_changes (ECalBackendStore *store)
 void
 e_cal_backend_store_freeze_changes (ECalBackendStore *store)
 {
+       ECalBackendStoreClass *class;
+
        g_return_if_fail (E_IS_CAL_BACKEND_STORE (store));
 
-       (E_CAL_BACKEND_STORE_GET_CLASS (store))->freeze_changes (store);
+       class = E_CAL_BACKEND_STORE_GET_CLASS (store);
+       g_return_if_fail (class->freeze_changes != NULL);
+
+       class->freeze_changes (store);
 }
 
 /**
@@ -536,12 +627,10 @@ e_cal_backend_store_interval_tree_add_comp (ECalBackendStore *store,
                                             time_t occurence_start,
                                             time_t occurence_end)
 {
-       ECalBackendStorePrivate *priv;
-
        g_return_if_fail (E_IS_CAL_BACKEND_STORE (store));
        g_return_if_fail (E_IS_CAL_COMPONENT (comp));
 
-       priv = store->priv;
-
-       e_intervaltree_insert (priv->intervaltree, occurence_start, occurence_end, comp);
+       e_intervaltree_insert (
+               store->priv->intervaltree,
+               occurence_start, occurence_end, comp);
 }
index e0a4b3f..34ef6a2 100644 (file)
 #include "e-cal-backend-sync.h"
 #include <libical/icaltz-util.h>
 
+#define E_CAL_BACKEND_SYNC_GET_PRIVATE(obj) \
+       (G_TYPE_INSTANCE_GET_PRIVATE \
+       ((obj), E_TYPE_CAL_BACKEND_SYNC, ECalBackendSyncPrivate))
+
 G_DEFINE_TYPE (ECalBackendSync, e_cal_backend_sync, E_TYPE_CAL_BACKEND)
 
 struct _ECalBackendSyncPrivate {
@@ -1012,43 +1016,30 @@ cal_backend_sync_set_backend_property (ECalBackendSync *backend,
 }
 
 static void
-e_cal_backend_sync_init (ECalBackendSync *backend)
+e_cal_backend_sync_finalize (GObject *object)
 {
        ECalBackendSyncPrivate *priv;
 
-       priv             = g_new0 (ECalBackendSyncPrivate, 1);
-       priv->sync_mutex = g_mutex_new ();
+       priv = E_CAL_BACKEND_SYNC_GET_PRIVATE (object);
 
-       backend->priv = priv;
-}
+       g_mutex_free (priv->sync_mutex);
 
-static void
-e_cal_backend_sync_dispose (GObject *object)
-{
-       ECalBackendSync *backend;
-
-       backend = E_CAL_BACKEND_SYNC (object);
-
-       if (backend->priv) {
-               g_mutex_free (backend->priv->sync_mutex);
-               g_free (backend->priv);
-
-               backend->priv = NULL;
-       }
-
-       G_OBJECT_CLASS (e_cal_backend_sync_parent_class)->dispose (object);
+       /* Chain up to parent's finalize() method. */
+       G_OBJECT_CLASS (e_cal_backend_sync_parent_class)->finalize (object);
 }
 
 static void
-e_cal_backend_sync_class_init (ECalBackendSyncClass *klass)
+e_cal_backend_sync_class_init (ECalBackendSyncClass *class)
 {
        GObjectClass *object_class;
        ECalBackendClass *backend_class;
 
-       object_class = G_OBJECT_CLASS (klass);
-       object_class->dispose = e_cal_backend_sync_dispose;
+       g_type_class_add_private (class, sizeof (ECalBackendSyncPrivate));
+
+       object_class = G_OBJECT_CLASS (class);
+       object_class->finalize = e_cal_backend_sync_finalize;
 
-       backend_class = E_CAL_BACKEND_CLASS (klass);
+       backend_class = E_CAL_BACKEND_CLASS (class);
        backend_class->open                     = cal_backend_open;
        backend_class->authenticate_user        = cal_backend_authenticate_user;
        backend_class->remove                   = cal_backend_remove;
@@ -1069,6 +1060,14 @@ e_cal_backend_sync_class_init (ECalBackendSyncClass *klass)
        backend_class->add_timezone             = cal_backend_add_timezone;
        backend_class->internal_get_timezone    = cal_backend_internal_get_timezone;
 
-       klass->get_backend_property_sync        = cal_backend_sync_get_backend_property;
-       klass->set_backend_property_sync        = cal_backend_sync_set_backend_property;
+       class->get_backend_property_sync        = cal_backend_sync_get_backend_property;
+       class->set_backend_property_sync        = cal_backend_sync_set_backend_property;
+}
+
+static void
+e_cal_backend_sync_init (ECalBackendSync *backend)
+{
+       backend->priv = E_CAL_BACKEND_SYNC_GET_PRIVATE (backend);
+       backend->priv->sync_mutex = g_mutex_new ();
 }
+
index 7b99118..1894690 100644 (file)
 #include "e-cal-backend.h"
 #include "e-cal-backend-cache.h"
 
+#define E_CAL_BACKEND_GET_PRIVATE(obj) \
+       (G_TYPE_INSTANCE_GET_PRIVATE \
+       ((obj), E_TYPE_CAL_BACKEND, ECalBackendPrivate))
+
 #define EDC_ERROR(_code)       e_data_cal_create_error (_code, NULL)
 #define EDC_OPENING_ERROR      e_data_cal_create_error (Busy, _("Cannot process, calendar backend is opening"))
 #define EDC_NOT_OPENED_ERROR   e_data_cal_create_error (NotOpened, NULL)
@@ -208,7 +212,7 @@ cal_backend_finalize (GObject *object)
 {
        ECalBackendPrivate *priv;
 
-       priv = E_CAL_BACKEND (object)->priv;
+       priv = E_CAL_BACKEND_GET_PRIVATE (object);
 
        g_assert (priv->clients == NULL);
 
@@ -234,20 +238,20 @@ cal_backend_constructed (GObject *object)
 }
 
 static void
-e_cal_backend_class_init (ECalBackendClass *klass)
+e_cal_backend_class_init (ECalBackendClass *class)
 {
        GObjectClass *object_class;
 
-       g_type_class_add_private (klass, sizeof (ECalBackendPrivate));
+       g_type_class_add_private (class, sizeof (ECalBackendPrivate));
 
-       object_class = G_OBJECT_CLASS (klass);
+       object_class = G_OBJECT_CLASS (class);
        object_class->set_property = cal_backend_set_property;
        object_class->get_property = cal_backend_get_property;
        object_class->finalize = cal_backend_finalize;
        object_class->constructed = cal_backend_constructed;
 
-       klass->get_backend_property = cal_backend_get_backend_property;
-       klass->set_backend_property = cal_backend_set_backend_property;
+       class->get_backend_property = cal_backend_get_backend_property;
+       class->set_backend_property = cal_backend_set_backend_property;
 
        g_object_class_install_property (
                object_class,
@@ -276,8 +280,7 @@ e_cal_backend_class_init (ECalBackendClass *klass)
 static void
 e_cal_backend_init (ECalBackend *backend)
 {
-       backend->priv = G_TYPE_INSTANCE_GET_PRIVATE (
-               backend, E_TYPE_CAL_BACKEND, ECalBackendPrivate);
+       backend->priv = E_CAL_BACKEND_GET_PRIVATE (backend);
 
        backend->priv->clients = NULL;
        backend->priv->clients_mutex = g_mutex_new ();
index d65c042..484c97c 100644 (file)
@@ -45,8 +45,6 @@
        (G_TYPE_INSTANCE_GET_PRIVATE \
        ((obj), E_TYPE_DATA_CAL_FACTORY, EDataCalFactoryPrivate))
 
-G_DEFINE_TYPE (EDataCalFactory, e_data_cal_factory, E_TYPE_DATA_FACTORY);
-
 struct _EDataCalFactoryPrivate {
        EGdbusCalFactory *gdbus_object;
 
@@ -59,6 +57,8 @@ struct _EDataCalFactoryPrivate {
        GHashTable *connections;
 };
 
+G_DEFINE_TYPE (EDataCalFactory, e_data_cal_factory, E_TYPE_DATA_FACTORY);
+
 static const gchar *
 calobjtype_to_string (const EDataCalObjType type)
 {
index f767998..6f85259 100644 (file)
 #include "e-data-cal-view.h"
 #include "e-gdbus-cal-view.h"
 
+#define E_DATA_CAL_VIEW_GET_PRIVATE(obj) \
+       (G_TYPE_INSTANCE_GET_PRIVATE \
+       ((obj), E_DATA_CAL_VIEW_TYPE, EDataCalViewPrivate))
+
 static void ensure_pending_flush_timeout (EDataCalView *view);
 
 #define THRESHOLD_ITEMS   32   /* how many items can be hold in a cache, before propagated to UI */
@@ -80,11 +84,11 @@ enum props {
 
 /* Class init */
 static void
-e_data_cal_view_class_init (EDataCalViewClass *klass)
+e_data_cal_view_class_init (EDataCalViewClass *class)
 {
-       GObjectClass *object_class = G_OBJECT_CLASS (klass);
+       GObjectClass *object_class = G_OBJECT_CLASS (class);
 
-       g_type_class_add_private (klass, sizeof (EDataCalViewPrivate));
+       g_type_class_add_private (class, sizeof (EDataCalViewPrivate));
 
        object_class->set_property = e_data_cal_view_set_property;
        object_class->get_property = e_data_cal_view_get_property;
@@ -556,32 +560,44 @@ e_data_cal_view_get_property (GObject *object,
 static void
 e_data_cal_view_init (EDataCalView *view)
 {
-       EDataCalViewPrivate *priv = G_TYPE_INSTANCE_GET_PRIVATE (
-               view, E_DATA_CAL_VIEW_TYPE, EDataCalViewPrivate);
-
-       view->priv = priv;
-
-       priv->gdbus_object = e_gdbus_cal_view_stub_new ();
-       g_signal_connect (priv->gdbus_object, "handle-start", G_CALLBACK (impl_DataCalView_start), view);
-       g_signal_connect (priv->gdbus_object, "handle-stop", G_CALLBACK (impl_DataCalView_stop), view);
-       g_signal_connect (priv->gdbus_object, "handle-dispose", G_CALLBACK (impl_DataCalView_dispose), view);
-       g_signal_connect (priv->gdbus_object, "handle-set-fields-of-interest", G_CALLBACK (impl_DataCalView_set_fields_of_interest), view);
-
-       priv->backend = NULL;
-       priv->started = FALSE;
-       priv->stopped = FALSE;
-       priv->complete = FALSE;
-       priv->sexp = NULL;
-       priv->fields_of_interest = NULL;
-
-       priv->adds = g_array_sized_new (TRUE, TRUE, sizeof (gchar *), THRESHOLD_ITEMS);
-       priv->changes = g_array_sized_new (TRUE, TRUE, sizeof (gchar *), THRESHOLD_ITEMS);
-       priv->removes = g_array_sized_new (TRUE, TRUE, sizeof (gchar *), THRESHOLD_ITEMS);
-
-       priv->ids = g_hash_table_new_full (id_hash, id_equal, (GDestroyNotify) e_cal_component_free_id, NULL);
-
-       priv->pending_mutex = g_mutex_new ();
-       priv->flush_id = 0;
+       view->priv = E_DATA_CAL_VIEW_GET_PRIVATE (view);
+
+       view->priv->gdbus_object = e_gdbus_cal_view_stub_new ();
+       g_signal_connect (
+               view->priv->gdbus_object, "handle-start",
+               G_CALLBACK (impl_DataCalView_start), view);
+       g_signal_connect (
+               view->priv->gdbus_object, "handle-stop",
+               G_CALLBACK (impl_DataCalView_stop), view);
+       g_signal_connect (
+               view->priv->gdbus_object, "handle-dispose",
+               G_CALLBACK (impl_DataCalView_dispose), view);
+       g_signal_connect (
+               view->priv->gdbus_object, "handle-set-fields-of-interest",
+               G_CALLBACK (impl_DataCalView_set_fields_of_interest), view);
+
+       view->priv->backend = NULL;
+       view->priv->started = FALSE;
+       view->priv->stopped = FALSE;
+       view->priv->complete = FALSE;
+       view->priv->sexp = NULL;
+       view->priv->fields_of_interest = NULL;
+
+       view->priv->adds = g_array_sized_new (
+               TRUE, TRUE, sizeof (gchar *), THRESHOLD_ITEMS);
+       view->priv->changes = g_array_sized_new (
+               TRUE, TRUE, sizeof (gchar *), THRESHOLD_ITEMS);
+       view->priv->removes = g_array_sized_new (
+               TRUE, TRUE, sizeof (gchar *), THRESHOLD_ITEMS);
+
+       view->priv->ids = g_hash_table_new_full (
+               (GHashFunc) id_hash,
+               (GEqualFunc) id_equal,
+               (GDestroyNotify) e_cal_component_free_id,
+               (GDestroyNotify) NULL);
+
+       view->priv->pending_mutex = g_mutex_new ();
+       view->priv->flush_id = 0;
 }
 
 static void
index 02edd41..df1f682 100644 (file)
@@ -1699,13 +1699,13 @@ data_cal_finalize (GObject *object)
 }
 
 static void
-e_data_cal_class_init (EDataCalClass *klass)
+e_data_cal_class_init (EDataCalClass *class)
 {
        GObjectClass *object_class;
 
-       g_type_class_add_private (klass, sizeof (EDataCalPrivate));
+       g_type_class_add_private (class, sizeof (EDataCalPrivate));
 
-       object_class = G_OBJECT_CLASS (klass);
+       object_class = G_OBJECT_CLASS (class);
        object_class->set_property = data_cal_set_property;
        object_class->get_property = data_cal_get_property;
        object_class->dispose = data_cal_dispose;
index aa0a5f2..9211e33 100644 (file)
@@ -408,11 +408,11 @@ g_signal (GDBusProxy *proxy,
 }
 
 static void
-e_gdbus_cal_factory_proxy_class_init (EGdbusCalFactoryProxyClass *klass)
+e_gdbus_cal_factory_proxy_class_init (EGdbusCalFactoryProxyClass *class)
 {
        GDBusProxyClass *proxy_class;
 
-       proxy_class = G_DBUS_PROXY_CLASS (klass);
+       proxy_class = G_DBUS_PROXY_CLASS (class);
        proxy_class->g_signal = g_signal;
 }
 
@@ -623,11 +623,6 @@ e_gdbus_cal_factory_proxy_new_for_bus_sync (GBusType bus_type,
 
 /* ---------------------------------------------------------------------- */
 
-struct _EGdbusCalFactoryStubPrivate
-{
-       gint foo;
-};
-
 static void stub_iface_init (EGdbusCalFactoryIface *iface);
 
 G_DEFINE_TYPE_WITH_CODE (EGdbusCalFactoryStub, e_gdbus_cal_factory_stub, G_TYPE_OBJECT,
@@ -636,13 +631,11 @@ G_DEFINE_TYPE_WITH_CODE (EGdbusCalFactoryStub, e_gdbus_cal_factory_stub, G_TYPE_
 static void
 e_gdbus_cal_factory_stub_init (EGdbusCalFactoryStub *stub)
 {
-       stub->priv = G_TYPE_INSTANCE_GET_PRIVATE (stub, E_TYPE_GDBUS_CAL_FACTORY_STUB, EGdbusCalFactoryStubPrivate);
 }
 
 static void
-e_gdbus_cal_factory_stub_class_init (EGdbusCalFactoryStubClass *klass)
+e_gdbus_cal_factory_stub_class_init (EGdbusCalFactoryStubClass *class)
 {
-       g_type_class_add_private (klass, sizeof (EGdbusCalFactoryStubPrivate));
 }
 
 static void
index ed41064..d7e0405 100644 (file)
@@ -520,11 +520,11 @@ g_signal (GDBusProxy *proxy,
 }
 
 static void
-e_gdbus_cal_view_proxy_class_init (EGdbusCalViewProxyClass *klass)
+e_gdbus_cal_view_proxy_class_init (EGdbusCalViewProxyClass *class)
 {
        GDBusProxyClass *proxy_class;
 
-       proxy_class = G_DBUS_PROXY_CLASS (klass);
+       proxy_class = G_DBUS_PROXY_CLASS (class);
        proxy_class->g_signal = g_signal;
 }
 
@@ -735,11 +735,6 @@ e_gdbus_cal_view_proxy_new_for_bus_sync (GBusType bus_type,
 
 /* ---------------------------------------------------------------------- */
 
-struct _EGdbusCalViewStubPrivate
-{
-       gint foo;
-};
-
 static void stub_iface_init (EGdbusCalViewIface *iface);
 
 G_DEFINE_TYPE_WITH_CODE (EGdbusCalViewStub, e_gdbus_cal_view_stub, G_TYPE_OBJECT,
@@ -748,13 +743,11 @@ G_DEFINE_TYPE_WITH_CODE (EGdbusCalViewStub, e_gdbus_cal_view_stub, G_TYPE_OBJECT
 static void
 e_gdbus_cal_view_stub_init (EGdbusCalViewStub *stub)
 {
-       stub->priv = G_TYPE_INSTANCE_GET_PRIVATE (stub, E_TYPE_GDBUS_CAL_VIEW_STUB, EGdbusCalViewStubPrivate);
 }
 
 static void
-e_gdbus_cal_view_stub_class_init (EGdbusCalViewStubClass *klass)
+e_gdbus_cal_view_stub_class_init (EGdbusCalViewStubClass *class)
 {
-       g_type_class_add_private (klass, sizeof (EGdbusCalViewStubPrivate));
 }
 
 static void
index 5c5af2e..8c9212a 100644 (file)
 
 #include "e-gdbus-cal.h"
 
+#define E_GDBUS_CAL_PROXY_GET_PRIVATE(obj) \
+       (G_TYPE_INSTANCE_GET_PRIVATE \
+       ((obj), E_TYPE_GDBUS_CAL_PROXY, EGdbusCalProxyPrivate))
+
 #define GDBUS_CAL_INTERFACE_NAME "org.gnome.evolution.dataserver.Calendar"
 
 typedef EGdbusCalIface EGdbusCalInterface;
@@ -1546,7 +1550,7 @@ e_gdbus_cal_proxy_init (EGdbusCalProxy *proxy)
 {
        g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), (GDBusInterfaceInfo *) &_e_gdbus_cal_interface_info);
 
-       proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, E_TYPE_GDBUS_CAL_PROXY, EGdbusCalProxyPrivate);
+       proxy->priv = E_GDBUS_CAL_PROXY_GET_PRIVATE (proxy);
        proxy->priv->pending_ops = e_gdbus_async_op_keeper_create_pending_ops (E_GDBUS_ASYNC_OP_KEEPER (proxy));
 
        E_GDBUS_CONNECT_METHOD_DONE_SIGNAL_VOID   (open);
@@ -1603,17 +1607,17 @@ gdbus_cal_proxy_finalize (GObject *object)
 }
 
 static void
-e_gdbus_cal_proxy_class_init (EGdbusCalProxyClass *klass)
+e_gdbus_cal_proxy_class_init (EGdbusCalProxyClass *class)
 {
        GObjectClass *object_class;
        GDBusProxyClass *proxy_class;
 
-       g_type_class_add_private (klass, sizeof (EGdbusCalProxyPrivate));
+       g_type_class_add_private (class, sizeof (EGdbusCalProxyPrivate));
 
-       object_class = G_OBJECT_CLASS (klass);
+       object_class = G_OBJECT_CLASS (class);
        object_class->finalize = gdbus_cal_proxy_finalize;
 
-       proxy_class = G_DBUS_PROXY_CLASS (klass);
+       proxy_class = G_DBUS_PROXY_CLASS (class);
        proxy_class->g_signal = g_signal;
 }
 
@@ -1857,11 +1861,6 @@ e_gdbus_cal_proxy_new_for_bus_sync (GBusType bus_type,
 
 /* ---------------------------------------------------------------------- */
 
-struct _EGdbusCalStubPrivate
-{
-       gint foo;
-};
-
 static void stub_iface_init (EGdbusCalIface *iface);
 
 G_DEFINE_TYPE_WITH_CODE (EGdbusCalStub, e_gdbus_cal_stub, G_TYPE_OBJECT,
@@ -1870,13 +1869,11 @@ G_DEFINE_TYPE_WITH_CODE (EGdbusCalStub, e_gdbus_cal_stub, G_TYPE_OBJECT,
 static void
 e_gdbus_cal_stub_init (EGdbusCalStub *stub)
 {
-       stub->priv = G_TYPE_INSTANCE_GET_PRIVATE (stub, E_TYPE_GDBUS_CAL_STUB, EGdbusCalStubPrivate);
 }
 
 static void
 e_gdbus_cal_stub_class_init (EGdbusCalStubClass *klass)
 {
-       g_type_class_add_private (klass, sizeof (EGdbusCalStubPrivate));
 }
 
 static void
index 68bac3f..214b0b6 100644 (file)
 
 #define CAMEL_CERTDB_VERSION  0x100
 
+#define CAMEL_CERTDB_GET_PRIVATE(obj) \
+       (G_TYPE_INSTANCE_GET_PRIVATE \
+       ((obj), CAMEL_TYPE_CERTDB, CamelCertDBPrivate))
+
 struct _CamelCertDBPrivate {
        GMutex *db_lock;        /* for the db hashtable/array */
        GMutex *io_lock;        /* load/save lock, for access to saved_count, etc */
@@ -65,7 +69,7 @@ certdb_finalize (GObject *object)
        CamelCertDB *certdb = CAMEL_CERTDB (object);
        CamelCertDBPrivate *priv;
 
-       priv = certdb->priv;
+       priv = CAMEL_CERTDB_GET_PRIVATE (object);
 
        if (certdb->flags & CAMEL_CERTDB_DIRTY)
                camel_certdb_save (certdb);
@@ -112,8 +116,8 @@ camel_certdb_class_init (CamelCertDBClass *class)
 static void
 camel_certdb_init (CamelCertDB *certdb)
 {
-       certdb->priv = G_TYPE_INSTANCE_GET_PRIVATE (
-               certdb, CAMEL_TYPE_CERTDB, CamelCertDBPrivate);
+       certdb->priv = CAMEL_CERTDB_GET_PRIVATE (certdb);
+
        certdb->filename = NULL;
        certdb->version = CAMEL_CERTDB_VERSION;
        certdb->saved_certs = 0;
index 03e5e36..72d27d8 100644 (file)
 #include "camel-mime-filter-canon.h"
 #include "camel-stream-filter.h"
 
-#define CIPHER_LOCK(ctx)   g_mutex_lock (((CamelCipherContext *) ctx)->priv->lock)
-#define CIPHER_UNLOCK(ctx) g_mutex_unlock (((CamelCipherContext *) ctx)->priv->lock);
+#define CAMEL_CIPHER_CONTEXT_GET_PRIVATE(obj) \
+       (G_TYPE_INSTANCE_GET_PRIVATE \
+       ((obj), CAMEL_TYPE_CIPHER_CONTEXT, CamelCipherContextPrivate))
+
+#define CIPHER_LOCK(ctx) \
+       g_mutex_lock (((CamelCipherContext *) ctx)->priv->lock)
+#define CIPHER_UNLOCK(ctx) \
+       g_mutex_unlock (((CamelCipherContext *) ctx)->priv->lock);
 
 #define d(x)
 
@@ -148,7 +154,7 @@ cipher_context_dispose (GObject *object)
 {
        CamelCipherContextPrivate *priv;
 
-       priv = CAMEL_CIPHER_CONTEXT (object)->priv;
+       priv = CAMEL_CIPHER_CONTEXT_GET_PRIVATE (object);
 
        if (priv->session != NULL) {
                g_object_unref (priv->session);
@@ -164,7 +170,7 @@ cipher_context_finalize (GObject *object)
 {
        CamelCipherContextPrivate *priv;
 
-       priv = CAMEL_CIPHER_CONTEXT (object)->priv;
+       priv = CAMEL_CIPHER_CONTEXT_GET_PRIVATE (object);
 
        g_mutex_free (priv->lock);
 
@@ -749,8 +755,7 @@ camel_cipher_context_class_init (CamelCipherContextClass *class)
 static void
 camel_cipher_context_init (CamelCipherContext *context)
 {
-       context->priv = G_TYPE_INSTANCE_GET_PRIVATE (
-               context, CAMEL_TYPE_CIPHER_CONTEXT, CamelCipherContextPrivate);
+       context->priv = CAMEL_CIPHER_CONTEXT_GET_PRIVATE (context);
        context->priv->lock = g_mutex_new ();
 }
 
index 48e4d32..e8395c7 100644 (file)
 
 #define d(x)
 
+#define CAMEL_DATA_CACHE_GET_PRIVATE(obj) \
+       (G_TYPE_INSTANCE_GET_PRIVATE \
+       ((obj), CAMEL_TYPE_DATA_CACHE, CamelDataCachePrivate))
+
 /* how many 'bits' of hash are used to key the toplevel directory */
 #define CAMEL_DATA_CACHE_BITS (6)
 #define CAMEL_DATA_CACHE_MASK ((1 << CAMEL_DATA_CACHE_BITS)-1)
@@ -106,7 +110,7 @@ data_cache_finalize (GObject *object)
 {
        CamelDataCachePrivate *priv;
 
-       priv = CAMEL_DATA_CACHE (object)->priv;
+       priv = CAMEL_DATA_CACHE_GET_PRIVATE (object);
 
        camel_object_bag_destroy (priv->busy_bag);
        g_free (priv->path);
@@ -149,8 +153,7 @@ camel_data_cache_init (CamelDataCache *data_cache)
                (CamelCopyFunc) g_strdup,
                (GFreeFunc) g_free);
 
-       data_cache->priv = G_TYPE_INSTANCE_GET_PRIVATE (
-               data_cache, CAMEL_TYPE_DATA_CACHE, CamelDataCachePrivate);
+       data_cache->priv = CAMEL_DATA_CACHE_GET_PRIVATE (data_cache);
        data_cache->priv->busy_bag = busy_bag;
        data_cache->priv->expire_age = -1;
        data_cache->priv->expire_access = -1;
index 6923943..aee5f13 100644 (file)
 #include "camel-offline-settings.h"
 #include "camel-session.h"
 
+#define CAMEL_DISCO_FOLDER_GET_PRIVATE(obj) \
+       (G_TYPE_INSTANCE_GET_PRIVATE \
+       ((obj), CAMEL_TYPE_DISCO_FOLDER, CamelDiscoFolderPrivate))
+
 struct _CamelDiscoFolderPrivate {
        gboolean offline_sync;
 };
@@ -484,9 +488,7 @@ camel_disco_folder_class_init (CamelDiscoFolderClass *class)
 static void
 camel_disco_folder_init (CamelDiscoFolder *disco_folder)
 {
-       disco_folder->priv = G_TYPE_INSTANCE_GET_PRIVATE (
-               disco_folder, CAMEL_TYPE_DISCO_FOLDER,
-               CamelDiscoFolderPrivate);
+       disco_folder->priv = CAMEL_DISCO_FOLDER_GET_PRIVATE (disco_folder);
 
        g_signal_connect (
                disco_folder, "changed",
index b74f277..7347adf 100644 (file)
 /* an invalid pointer */
 #define FOLDER_INVALID ((gpointer)~0)
 
+#define CAMEL_FILTER_DRIVER_GET_PRIVATE(obj) \
+       (G_TYPE_INSTANCE_GET_PRIVATE \
+       ((obj), CAMEL_TYPE_FILTER_DRIVER, CamelFilterDriverPrivate))
+
 /* type of status for a log report */
 enum filter_log_t {
        FILTER_LOG_NONE,
@@ -189,7 +193,7 @@ filter_driver_dispose (GObject *object)
 {
        CamelFilterDriverPrivate *priv;
 
-       priv = CAMEL_FILTER_DRIVER (object)->priv;
+       priv = CAMEL_FILTER_DRIVER_GET_PRIVATE (object);
 
        if (priv->defaultfolder != NULL) {
                camel_folder_thaw (priv->defaultfolder);
@@ -212,7 +216,7 @@ filter_driver_finalize (GObject *object)
        CamelFilterDriverPrivate *priv;
        struct _filter_rule *node;
 
-       priv = CAMEL_FILTER_DRIVER (object)->priv;
+       priv = CAMEL_FILTER_DRIVER_GET_PRIVATE (object);
 
        /* close all folders that were opened for appending */
        close_folders (CAMEL_FILTER_DRIVER (object));
@@ -254,9 +258,7 @@ camel_filter_driver_init (CamelFilterDriver *filter_driver)
 {
        gint ii;
 
-       filter_driver->priv = G_TYPE_INSTANCE_GET_PRIVATE (
-               filter_driver, CAMEL_TYPE_FILTER_DRIVER,
-               CamelFilterDriverPrivate);
+       filter_driver->priv = CAMEL_FILTER_DRIVER_GET_PRIVATE (filter_driver);
 
        g_queue_init (&filter_driver->priv->rules);
 
@@ -470,8 +472,6 @@ do_forward_to (struct _CamelSExp *f,
                struct _CamelSExpResult **argv,
                CamelFilterDriver *driver)
 {
-       CamelFilterDriverPrivate *p = driver->priv;
-
        d(fprintf (stderr, "marking message for forwarding\n"));
 
        /* requires one parameter, string with a destination address */
@@ -479,16 +479,27 @@ do_forward_to (struct _CamelSExp *f,
                return NULL;
 
        /* make sure we have the message... */
-       if (p->message == NULL) {
+       if (driver->priv->message == NULL) {
                /* FIXME Pass a GCancellable */
-               p->message = camel_folder_get_message_sync (
-                       p->source, p->uid, NULL, &p->error);
-               if (p->message == NULL)
+               driver->priv->message = camel_folder_get_message_sync (
+                       driver->priv->source,
+                       driver->priv->uid, NULL,
+                       &driver->priv->error);
+               if (driver->priv->message == NULL)
                        return NULL;
        }
 
-       camel_filter_driver_log (driver, FILTER_LOG_ACTION, "Forward message to '%s'", argv[0]->value.string);
-       camel_session_forward_to (p->session, p->source, p->message, argv[0]->value.string, &p->error);
+       camel_filter_driver_log (
+               driver, FILTER_LOG_ACTION,
+               "Forward message to '%s'",
+               argv[0]->value.string);
+
+       camel_session_forward_to (
+               driver->priv->session,
+               driver->priv->source,
+               driver->priv->message,
+               argv[0]->value.string,
+               &driver->priv->error);
 
        return NULL;
 }
@@ -499,7 +510,6 @@ do_copy (struct _CamelSExp *f,
          struct _CamelSExpResult **argv,
          CamelFilterDriver *driver)
 {
-       CamelFilterDriverPrivate *p = driver->priv;
        gint i;
 
        d(fprintf (stderr, "copying message...\n"));
@@ -514,39 +524,49 @@ do_copy (struct _CamelSExp *f,
                        if (!outbox)
                                break;
 
-                       if (outbox == p->source)
+                       if (outbox == driver->priv->source)
                                break;
 
-                       if (!p->modified && p->uid && p->source && camel_folder_has_summary_capability (p->source)) {
+                       if (!driver->priv->modified &&
+                           driver->priv->uid != NULL &&
+                           driver->priv->source != NULL &&
+                           camel_folder_has_summary_capability (
+                                       driver->priv->source)) {
                                GPtrArray *uids;
 
                                uids = g_ptr_array_new ();
-                               g_ptr_array_add (uids, (gchar *) p->uid);
+                               g_ptr_array_add (
+                                       uids, (gchar *) driver->priv->uid);
                                /* FIXME Pass a GCancellable */
                                camel_folder_transfer_messages_to_sync (
-                                       p->source, uids, outbox, FALSE,
-                                       NULL, NULL, &p->error);
+                                       driver->priv->source,
+                                       uids, outbox, FALSE, NULL, NULL,
+                                       &driver->priv->error);
                                g_ptr_array_free (uids, TRUE);
                        } else {
-                               if (p->message == NULL)
+                               if (driver->priv->message == NULL)
                                        /* FIXME Pass a GCancellable */
-                                       p->message = camel_folder_get_message_sync (
-                                               p->source, p->uid, NULL, &p->error);
+                                       driver->priv->message = camel_folder_get_message_sync (
+                                               driver->priv->source,
+                                               driver->priv->uid, NULL,
+                                               &driver->priv->error);
 
-                               if (!p->message)
+                               if (!driver->priv->message)
                                        continue;
 
                                /* FIXME Pass a GCancellable */
                                camel_folder_append_message_sync (
-                                       outbox, p->message, p->info,
-                                       NULL, NULL, &p->error);
+                                       outbox, driver->priv->message,
+                                       driver->priv->info, NULL, NULL,
+                                       &driver->priv->error);
                        }
 
-                       if (p->error == NULL)
-                               p->copied = TRUE;
+                       if (driver->priv->error == NULL)
+                               driver->priv->copied = TRUE;
 
-                       camel_filter_driver_log (driver, FILTER_LOG_ACTION, "Copy to folder %s",
-                                                folder);
+                       camel_filter_driver_log (
+                               driver, FILTER_LOG_ACTION,
+                               "Copy to folder %s", folder);
                }
        }
 
@@ -559,7 +579,6 @@ do_move (struct _CamelSExp *f,
          struct _CamelSExpResult **argv,
          CamelFilterDriver *driver)
 {
-       CamelFilterDriverPrivate *p = driver->priv;
        gint i;
 
        d(fprintf (stderr, "moving message...\n"));
@@ -575,45 +594,45 @@ do_move (struct _CamelSExp *f,
                        if (!outbox)
                                break;
 
-                       if (outbox == p->source)
+                       if (outbox == driver->priv->source)
                                break;
 
                        /* only delete on last folder (only 1 can ever be supplied by ui currently) */
                        last = (i == argc - 1);
 
-                       if (!p->modified && p->uid && p->source && camel_folder_has_summary_capability (p->source)) {
+                       if (!driver->priv->modified && driver->priv->uid && driver->priv->source && camel_folder_has_summary_capability (driver->priv->source)) {
                                GPtrArray *uids;
 
                                uids = g_ptr_array_new ();
-                               g_ptr_array_add (uids, (gchar *) p->uid);
+                               g_ptr_array_add (uids, (gchar *) driver->priv->uid);
                                /* FIXME Pass a GCancellable */
                                camel_folder_transfer_messages_to_sync (
-                                       p->source, uids, outbox, last,
-                                       NULL, NULL, &p->error);
+                                       driver->priv->source, uids, outbox, last,
+                                       NULL, NULL, &driver->priv->error);
                                g_ptr_array_free (uids, TRUE);
                        } else {
-                               if (p->message == NULL)
+                               if (driver->priv->message == NULL)
                                        /* FIXME Pass a GCancellable */
-                                       p->message = camel_folder_get_message_sync (
-                                               p->source, p->uid, NULL, &p->error);
+                                       driver->priv->message = camel_folder_get_message_sync (
+                                               driver->priv->source, driver->priv->uid, NULL, &driver->priv->error);
 
-                               if (!p->message)
+                               if (!driver->priv->message)
                                        continue;
 
                                /* FIXME Pass a GCancellable */
                                camel_folder_append_message_sync (
-                                       outbox, p->message, p->info,
-                                       NULL, NULL, &p->error);
+                                       outbox, driver->priv->message, driver->priv->info,
+                                       NULL, NULL, &driver->priv->error);
 
-                               if (p->error == NULL && last) {
-                                       if (p->source && p->uid && camel_folder_has_summary_capability (p->source))
+                               if (driver->priv->error == NULL && last) {
+                                       if (driver->priv->source && driver->priv->uid && camel_folder_has_summary_capability (driver->priv->source))
                                                camel_folder_set_message_flags (
-                                                       p->source, p->uid,
+                                                       driver->priv->source, driver->priv->uid,
                                                        CAMEL_MESSAGE_DELETED |
                                                        CAMEL_MESSAGE_SEEN, ~0);
                                        else
                                                camel_message_info_set_flags (
-                                                       p->info,
+                                                       driver->priv->info,
                                                        CAMEL_MESSAGE_DELETED |
                                                        CAMEL_MESSAGE_SEEN |
                                                        CAMEL_MESSAGE_FOLDER_FLAGGED,
@@ -621,8 +640,8 @@ do_move (struct _CamelSExp *f,
                                }
                        }
 
-                       if (p->error == NULL) {
-                               p->moved = TRUE;
+                       if (driver->priv->error == NULL) {
+                               driver->priv->moved = TRUE;
                                camel_filter_driver_log (driver, FILTER_LOG_ACTION, "Move to folder %s", folder);
                        }
                }
@@ -630,7 +649,7 @@ do_move (struct _CamelSExp *f,
 
        /* implicit 'stop' with 'move' */
        camel_filter_driver_log (driver, FILTER_LOG_ACTION, "Stopped processing");
-       p->terminated = TRUE;
+       driver->priv->terminated = TRUE;
 
        return NULL;
 }
@@ -641,11 +660,9 @@ do_stop (struct _CamelSExp *f,
          struct _CamelSExpResult **argv,
          CamelFilterDriver *driver)
 {
-       CamelFilterDriverPrivate *p = driver->priv;
-
        camel_filter_driver_log (driver, FILTER_LOG_ACTION, "Stopped processing");
        d(fprintf (stderr, "terminating message processing\n"));
-       p->terminated = TRUE;
+       driver->priv->terminated = TRUE;
 
        return NULL;
 }
@@ -656,8 +673,6 @@ do_label (struct _CamelSExp *f,
           struct _CamelSExpResult **argv,
           CamelFilterDriver *driver)
 {
-       CamelFilterDriverPrivate *p = driver->priv;
-
        d(fprintf (stderr, "setting label tag\n"));
        if (argc > 0 && argv[0]->type == CAMEL_SEXP_RES_STRING) {
                /* This is a list of new labels, we should used these in case of passing in old names.
@@ -675,10 +690,10 @@ do_label (struct _CamelSExp *f,
                        }
                }
 
-               if (p->source && p->uid && camel_folder_has_summary_capability (p->source))
-                       camel_folder_set_message_user_flag (p->source, p->uid, label, TRUE);
+               if (driver->priv->source && driver->priv->uid && camel_folder_has_summary_capability (driver->priv->source))
+                       camel_folder_set_message_user_flag (driver->priv->source, driver->priv->uid, label, TRUE);
                else
-                       camel_message_info_set_user_flag (p->info, label, TRUE);
+                       camel_message_info_set_user_flag (driver->priv->info, label, TRUE);
                camel_filter_driver_log (driver, FILTER_LOG_ACTION, "Set label to %s", label);
        }
 
@@ -691,8 +706,6 @@ do_color (struct _CamelSExp *f,
           struct _CamelSExpResult **argv,
           CamelFilterDriver *driver)
 {
-       CamelFilterDriverPrivate *p = driver->priv;
-
        d(fprintf (stderr, "setting color tag\n"));
        if (argc > 0 && argv[0]->type == CAMEL_SEXP_RES_STRING) {
                const gchar *color = argv[0]->value.string;
@@ -700,10 +713,10 @@ do_color (struct _CamelSExp *f,
                if (color && !*color)
                        color = NULL;
 
-               if (p->source && p->uid && camel_folder_has_summary_capability (p->source))
-                       camel_folder_set_message_user_tag (p->source, p->uid, "color", color);
+               if (driver->priv->source && driver->priv->uid && camel_folder_has_summary_capability (driver->priv->source))
+                       camel_folder_set_message_user_tag (driver->priv->source, driver->priv->uid, "color", color);
                else
-                       camel_message_info_set_user_tag(p->info, "color", color);
+                       camel_message_info_set_user_tag(driver->priv->info, "color", color);
                camel_filter_driver_log (driver, FILTER_LOG_ACTION, "Set color to %s", color ? color : "None");
        }
 
@@ -716,14 +729,12 @@ do_score (struct _CamelSExp *f,
           struct _CamelSExpResult **argv,
           CamelFilterDriver *driver)
 {
-       CamelFilterDriverPrivate *p = driver->priv;
-
        d(fprintf (stderr, "setting score tag\n"));
        if (argc > 0 && argv[0]->type == CAMEL_SEXP_RES_INT) {
                gchar *value;
 
                value = g_strdup_printf ("%d", argv[0]->value.number);
-               camel_message_info_set_user_tag(p->info, "score", value);
+               camel_message_info_set_user_tag(driver->priv->info, "score", value);
                camel_filter_driver_log (driver, FILTER_LOG_ACTION, "Set score to %d", argv[0]->value.number);
                g_free (value);
        }
@@ -737,17 +748,15 @@ do_adjust_score (struct _CamelSExp *f,
                  struct _CamelSExpResult **argv,
                  CamelFilterDriver *driver)
 {
-       CamelFilterDriverPrivate *p = driver->priv;
-
        d(fprintf (stderr, "adjusting score tag\n"));
        if (argc > 0 && argv[0]->type == CAMEL_SEXP_RES_INT) {
                gchar *value;
                gint old;
 
-               value = (gchar *)camel_message_info_user_tag(p->info, "score");
+               value = (gchar *)camel_message_info_user_tag(driver->priv->info, "score");
                old = value ? atoi (value) : 0;
                value = g_strdup_printf ("%d", old+argv[0]->value.number);
-               camel_message_info_set_user_tag(p->info, "score", value);
+               camel_message_info_set_user_tag(driver->priv->info, "score", value);
                camel_filter_driver_log (driver, FILTER_LOG_ACTION, "Adjust score (%d) to %s", argv[0]->value.number, value);
                g_free (value);
        }
@@ -761,18 +770,17 @@ set_flag (struct _CamelSExp *f,
           struct _CamelSExpResult **argv,
           CamelFilterDriver *driver)
 {
-       CamelFilterDriverPrivate *p = driver->priv;
        guint32 flags;
 
        d(fprintf (stderr, "setting flag\n"));
        if (argc == 1 && argv[0]->type == CAMEL_SEXP_RES_STRING) {
                flags = camel_system_flag (argv[0]->value.string);
-               if (p->source && p->uid && camel_folder_has_summary_capability (p->source))
+               if (driver->priv->source && driver->priv->uid && camel_folder_has_summary_capability (driver->priv->source))
                        camel_folder_set_message_flags (
-                               p->source, p->uid, flags, ~0);
+                               driver->priv->source, driver->priv->uid, flags, ~0);
                else
                        camel_message_info_set_flags (
-                               p->info, flags |
+                               driver->priv->info, flags |
                                CAMEL_MESSAGE_FOLDER_FLAGGED, ~0);
                camel_filter_driver_log (driver, FILTER_LOG_ACTION, "Set %s flag", argv[0]->value.string);
        }
@@ -786,18 +794,17 @@ unset_flag (struct _CamelSExp *f,
             struct _CamelSExpResult **argv,
             CamelFilterDriver *driver)
 {
-       CamelFilterDriverPrivate *p = driver->priv;
        guint32 flags;
 
        d(fprintf (stderr, "unsetting flag\n"));
        if (argc == 1 && argv[0]->type == CAMEL_SEXP_RES_STRING) {
                flags = camel_system_flag (argv[0]->value.string);
-               if (p->source && p->uid && camel_folder_has_summary_capability (p->source))
+               if (driver->priv->source && driver->priv->uid && camel_folder_has_summary_capability (driver->priv->source))
                        camel_folder_set_message_flags (
-                               p->source, p->uid, flags, 0);
+                               driver->priv->source, driver->priv->uid, flags, 0);
                else
                        camel_message_info_set_flags (
-                               p->info, flags |
+                               driver->priv->info, flags |
                                CAMEL_MESSAGE_FOLDER_FLAGGED, 0);
                camel_filter_driver_log (driver, FILTER_LOG_ACTION, "Unset %s flag", argv[0]->value.string);
        }
@@ -840,7 +847,6 @@ pipe_to_system (struct _CamelSExp *f,
                 struct _CamelSExpResult **argv,
                 CamelFilterDriver *driver)
 {
-       CamelFilterDriverPrivate *p = driver->priv;
        gint i, pipe_to_child, pipe_from_child;
        CamelMimeMessage *message = NULL;
        CamelMimeParser *parser;
@@ -856,11 +862,11 @@ pipe_to_system (struct _CamelSExp *f,
                return 0;
 
        /* make sure we have the message... */
-       if (p->message == NULL) {
+       if (driver->priv->message == NULL) {
                /* FIXME Pass a GCancellable */
-               p->message = camel_folder_get_message_sync (
-                       p->source, p->uid, NULL, &p->error);
-               if (p->message == NULL)
+               driver->priv->message = camel_folder_get_message_sync (
+                       driver->priv->source, driver->priv->uid, NULL, &driver->priv->error);
+               if (driver->priv->message == NULL)
                        return -1;
        }
 
@@ -885,7 +891,7 @@ pipe_to_system (struct _CamelSExp *f,
                g_ptr_array_free (args, TRUE);
 
                g_set_error (
-                       &p->error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
+                       &driver->priv->error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
                        _("Failed to create child process '%s': %s"),
                        argv[0]->value.string, error->message);
                g_error_free (error);
@@ -896,7 +902,7 @@ pipe_to_system (struct _CamelSExp *f,
 
        stream = camel_stream_fs_new_with_fd (pipe_to_child);
        if (camel_data_wrapper_write_to_stream_sync (
-               CAMEL_DATA_WRAPPER (p->message), stream, NULL, NULL) == -1) {
+               CAMEL_DATA_WRAPPER (driver->priv->message), stream, NULL, NULL) == -1) {
                g_object_unref (stream);
                close (pipe_from_child);
                goto wait;
@@ -932,16 +938,16 @@ pipe_to_system (struct _CamelSExp *f,
                (CamelMimePart *) message, parser, NULL, NULL)) {
                gint err = camel_mime_parser_errno (parser);
                g_set_error (
-                       &p->error, G_IO_ERROR,
+                       &driver->priv->error, G_IO_ERROR,
                        g_io_error_from_errno (err),
                        _("Invalid message stream received from %s: %s"),
                        argv[0]->value.string, g_strerror (err));
                g_object_unref (message);
                message = NULL;
        } else {
-               g_object_unref (p->message);
-               p->message = message;
-               p->modified = TRUE;
+               g_object_unref (driver->priv->message);
+               driver->priv->message = message;
+               driver->priv->modified = TRUE;
        }
 
        g_object_unref (parser);
@@ -995,7 +1001,6 @@ do_shell (struct _CamelSExp *f,
           struct _CamelSExpResult **argv,
           CamelFilterDriver *driver)
 {
-       CamelFilterDriverPrivate *p = driver->priv;
        GString *command;
        GPtrArray *args;
        gint i;
@@ -1019,8 +1024,8 @@ do_shell (struct _CamelSExp *f,
 
        g_string_truncate (command, command->len - 1);
 
-       if (p->shellfunc && argc >= 1) {
-               p->shellfunc (driver, argc, (gchar **) args->pdata, p->shelldata);
+       if (driver->priv->shellfunc && argc >= 1) {
+               driver->priv->shellfunc (driver, argc, (gchar **) args->pdata, driver->priv->shelldata);
                camel_filter_driver_log (driver, FILTER_LOG_ACTION, "Executing shell command: [%s]",
                                         command->str);
        }
@@ -1039,12 +1044,10 @@ do_beep (struct _CamelSExp *f,
          struct _CamelSExpResult **argv,
          CamelFilterDriver *driver)
 {
-       CamelFilterDriverPrivate *p = driver->priv;
-
        d(fprintf (stderr, "beep\n"));
 
-       if (p->beep) {
-               p->beep (driver, p->beepdata);
+       if (driver->priv->beep) {
+               driver->priv->beep (driver, driver->priv->beepdata);
                camel_filter_driver_log (driver, FILTER_LOG_ACTION, "Beep");
        }
 
@@ -1057,12 +1060,10 @@ play_sound (struct _CamelSExp *f,
             struct _CamelSExpResult **argv,
             CamelFilterDriver *driver)
 {
-       CamelFilterDriverPrivate *p = driver->priv;
-
        d(fprintf (stderr, "play sound\n"));
 
-       if (p->playfunc && argc == 1 && argv[0]->type == CAMEL_SEXP_RES_STRING) {
-               p->playfunc (driver, argv[0]->value.string, p->playdata);
+       if (driver->priv->playfunc && argc == 1 && argv[0]->type == CAMEL_SEXP_RES_STRING) {
+               driver->priv->playfunc (driver, argv[0]->value.string, driver->priv->playdata);
                camel_filter_driver_log (driver, FILTER_LOG_ACTION, "Play sound");
        }
 
@@ -1075,12 +1076,10 @@ do_only_once (struct _CamelSExp *f,
               struct _CamelSExpResult **argv,
               CamelFilterDriver *driver)
 {
-       CamelFilterDriverPrivate *p = driver->priv;
-
        d(fprintf (stderr, "only once\n"));
 
-       if (argc == 2 && !g_hash_table_lookup (p->only_once, argv[0]->value.string))
-               g_hash_table_insert (p->only_once, g_strdup (argv[0]->value.string),
+       if (argc == 2 && !g_hash_table_lookup (driver->priv->only_once, argv[0]->value.string))
+               g_hash_table_insert (driver->priv->only_once, g_strdup (argv[0]->value.string),
                                     g_strdup (argv[1]->value.string));
 
        return NULL;
@@ -1090,11 +1089,10 @@ static CamelFolder *
 open_folder (CamelFilterDriver *driver,
              const gchar *folder_url)
 {
-       CamelFilterDriverPrivate *p = driver->priv;
        CamelFolder *camelfolder;
 
        /* we have a lookup table of currently open folders */
-       camelfolder = g_hash_table_lookup (p->folders, folder_url);
+       camelfolder = g_hash_table_lookup (driver->priv->folders, folder_url);
        if (camelfolder)
                return camelfolder == FOLDER_INVALID ? NULL : camelfolder;
 
@@ -1102,17 +1100,17 @@ open_folder (CamelFilterDriver *driver,
         * a bad filter rule on pop or local delivery doesn't result
         * in duplicate mails, just mail going to inbox.  Otherwise,
         * we want to know about exceptions and abort processing */
-       if (p->defaultfolder) {
-               camelfolder = p->get_folder (driver, folder_url, p->data, NULL);
+       if (driver->priv->defaultfolder) {
+               camelfolder = driver->priv->get_folder (driver, folder_url, driver->priv->data, NULL);
        } else {
-               camelfolder = p->get_folder (driver, folder_url, p->data, &p->error);
+               camelfolder = driver->priv->get_folder (driver, folder_url, driver->priv->data, &driver->priv->error);
        }
 
        if (camelfolder) {
-               g_hash_table_insert (p->folders, g_strdup (folder_url), camelfolder);
+               g_hash_table_insert (driver->priv->folders, g_strdup (folder_url), camelfolder);
                camel_folder_freeze (camelfolder);
        } else {
-               g_hash_table_insert (p->folders, g_strdup (folder_url), FOLDER_INVALID);
+               g_hash_table_insert (driver->priv->folders, g_strdup (folder_url), FOLDER_INVALID);
        }
 
        return camelfolder;
@@ -1125,35 +1123,32 @@ close_folder (gpointer key,
 {
        CamelFolder *folder = value;
        CamelFilterDriver *driver = data;
-       CamelFilterDriverPrivate *p = driver->priv;
 
-       p->closed++;
+       driver->priv->closed++;
        g_free (key);
 
        if (folder != FOLDER_INVALID) {
                /* FIXME Pass a GCancellable */
                camel_folder_synchronize_sync (
                        folder, FALSE, NULL,
-                       (p->error != NULL) ? NULL : &p->error);
+                       (driver->priv->error != NULL) ? NULL : &driver->priv->error);
                camel_folder_thaw (folder);
                g_object_unref (folder);
        }
 
-       report_status(driver, CAMEL_FILTER_STATUS_PROGRESS, g_hash_table_size(p->folders)* 100 / p->closed, _("Syncing folders"));
+       report_status(driver, CAMEL_FILTER_STATUS_PROGRESS, g_hash_table_size(driver->priv->folders)* 100 / driver->priv->closed, _("Syncing folders"));
 }
 
 /* flush/close all folders */
 static gint
 close_folders (CamelFilterDriver *driver)
 {
-       CamelFilterDriverPrivate *p = driver->priv;
-
        report_status(driver, CAMEL_FILTER_STATUS_PROGRESS, 0, _("Syncing folders"));
 
-       p->closed = 0;
-       g_hash_table_foreach (p->folders, close_folder, driver);
-       g_hash_table_destroy (p->folders);
-       p->folders = g_hash_table_new (g_str_hash, g_str_equal);
+       driver->priv->closed = 0;
+       g_hash_table_foreach (driver->priv->folders, close_folder, driver);
+       g_hash_table_destroy (driver->priv->folders);
+       driver->priv->folders = g_hash_table_new (g_str_hash, g_str_equal);
 
        /* FIXME: status from driver */
        return 0;
@@ -1175,9 +1170,7 @@ camel_filter_driver_log (CamelFilterDriver *driver,
                          const gchar *desc,
                          ...)
 {
-       CamelFilterDriverPrivate *p = driver->priv;
-
-       if (p->logfile) {
+       if (driver->priv->logfile) {
                gchar *str = NULL;
 
                if (desc) {
@@ -1198,21 +1191,21 @@ camel_filter_driver_log (CamelFilterDriver *driver,
 
                        /* FIXME: does this need locking?  Probably */
 
-                       from = camel_message_info_from (p->info);
-                       subject = camel_message_info_subject (p->info);
+                       from = camel_message_info_from (driver->priv->info);
+                       subject = camel_message_info_subject (driver->priv->info);
 
                        time (&t);
                        strftime (date, 49, "%a, %d %b %Y %H:%M:%S", localtime (&t));
-                       fprintf (p->logfile, "Applied filter \"%s\" to message from %s - \"%s\" at %s\n",
+                       fprintf (driver->priv->logfile, "Applied filter \"%s\" to message from %s - \"%s\" at %s\n",
                                 str, from ? from : "unknown", subject ? subject : "", date);
 
                        break;
                }
                case FILTER_LOG_ACTION:
-                       fprintf (p->logfile, "Action: %s\n", str);
+                       fprintf (driver->priv->logfile, "Action: %s\n", str);
                        break;
                case FILTER_LOG_END:
-                       fprintf (p->logfile, "\n");
+                       fprintf (driver->priv->logfile, "\n");
                        break;
                default:
                        /* nothing else is loggable */
@@ -1233,34 +1226,34 @@ run_only_once (gpointer key,
                gchar *action,
                struct _run_only_once *data)
 {
-       CamelFilterDriverPrivate *p = data->driver->priv;
+       CamelFilterDriver *driver = data->driver;
        CamelSExpResult *r;
 
        d(printf ("evaluating: %s\n\n", action));
 
-       camel_sexp_input_text (p->eval, action, strlen (action));
-       if (camel_sexp_parse (p->eval) == -1) {
+       camel_sexp_input_text (driver->priv->eval, action, strlen (action));
+       if (camel_sexp_parse (driver->priv->eval) == -1) {
                if (data->error == NULL)
                        g_set_error (
                                &data->error,
                                CAMEL_ERROR, CAMEL_ERROR_GENERIC,
                                _("Error parsing filter: %s: %s"),
-                               camel_sexp_error (p->eval), action);
+                               camel_sexp_error (driver->priv->eval), action);
                goto done;
        }
 
-       r = camel_sexp_eval (p->eval);
+       r = camel_sexp_eval (driver->priv->eval);
        if (r == NULL) {
                if (data->error == NULL)
                        g_set_error (
                                &data->error,
                                CAMEL_ERROR, CAMEL_ERROR_GENERIC,
                                _("Error executing filter: %s: %s"),
-                               camel_sexp_error (p->eval), action);
+                               camel_sexp_error (driver->priv->eval), action);
                goto done;
        }
 
-       camel_sexp_result_free (p->eval, r);
+       camel_sexp_result_free (driver->priv->eval, r);
 
  done:
 
@@ -1281,16 +1274,15 @@ void
 camel_filter_driver_flush (CamelFilterDriver *driver,
                            GError **error)
 {
-       CamelFilterDriverPrivate *p = driver->priv;
        struct _run_only_once data;
 
-       if (!p->only_once)
+       if (!driver->priv->only_once)
                return;
 
        data.driver = driver;
        data.error = NULL;
 
-       g_hash_table_foreach_remove (p->only_once, (GHRFunc) run_only_once, &data);
+       g_hash_table_foreach_remove (driver->priv->only_once, (GHRFunc) run_only_once, &data);
 
        if (data.error != NULL)
                g_propagate_error (error, data.error);
@@ -1339,7 +1331,6 @@ camel_filter_driver_filter_mbox (CamelFilterDriver *driver,
                                  GCancellable *cancellable,
                                  GError **error)
 {
-       CamelFilterDriverPrivate *p = driver->priv;
        CamelMimeParser *mp = NULL;
        gchar *source_url = NULL;
        gint fd = -1;
@@ -1426,10 +1417,10 @@ camel_filter_driver_filter_mbox (CamelFilterDriver *driver,
                camel_message_info_free (info);
        }
 
-       if (p->defaultfolder) {
+       if (driver->priv->defaultfolder) {
                report_status(driver, CAMEL_FILTER_STATUS_PROGRESS, 100, _("Syncing folder"));
                camel_folder_synchronize_sync (
-                       p->defaultfolder, FALSE, cancellable, NULL);
+                       driver->priv->defaultfolder, FALSE, cancellable, NULL);
        }
 
        report_status (driver, CAMEL_FILTER_STATUS_END, 100, _("Complete"));
@@ -1472,7 +1463,6 @@ camel_filter_driver_filter_folder (CamelFilterDriver *driver,
                                    GCancellable *cancellable,
                                    GError **error)
 {
-       CamelFilterDriverPrivate *p = driver->priv;
        gboolean freeuids = FALSE;
        CamelMessageInfo *info;
        CamelStore *parent_store;
@@ -1533,10 +1523,10 @@ camel_filter_driver_filter_folder (CamelFilterDriver *driver,
        if (cache)
                camel_uid_cache_save (cache);
 
-       if (p->defaultfolder) {
+       if (driver->priv->defaultfolder) {
                report_status (driver, CAMEL_FILTER_STATUS_PROGRESS, 100, _("Syncing folder"));
                camel_folder_synchronize_sync (
-                       p->defaultfolder, FALSE, cancellable, NULL);
+                       driver->priv->defaultfolder, FALSE, cancellable, NULL);
        }
 
        if (i == uids->len)
@@ -1652,26 +1642,26 @@ camel_filter_driver_filter_message (CamelFilterDriver *driver,
                        g_object_ref (message);
        }
 
-       p->terminated = FALSE;
-       p->deleted = FALSE;
-       p->copied = FALSE;
-       p->moved = FALSE;
-       p->message = message;
-       p->info = info;
-       p->uid = uid;
-       p->source = source;
+       driver->priv->terminated = FALSE;
+       driver->priv->deleted = FALSE;
+       driver->priv->copied = FALSE;
+       driver->priv->moved = FALSE;
+       driver->priv->message = message;
+       driver->priv->info = info;
+       driver->priv->uid = uid;
+       driver->priv->source = source;
 
        if (message != NULL && camel_mime_message_get_source (message) == NULL)
                camel_mime_message_set_source (message, original_store_uid);
 
-       list = g_queue_peek_head_link (&p->rules);
+       list = g_queue_peek_head_link (&driver->priv->rules);
        result = CAMEL_SEARCH_NOMATCH;
 
        for (link = list; link != NULL; link = g_list_next (link)) {
                struct _filter_rule *rule = link->data;
                struct _get_message data;
 
-               if (p->terminated)
+               if (driver->priv->terminated)
                        break;
 
                d(printf("applying rule %s\naction %s\n", rule->match, rule->action));
@@ -1683,8 +1673,8 @@ camel_filter_driver_filter_message (CamelFilterDriver *driver,
                        original_store_uid = store_uid;
 
                result = camel_filter_search_match (
-                       p->session, get_message_cb, &data, p->info,
-                       original_store_uid, rule->match, &p->error);
+                       driver->priv->session, get_message_cb, &data, driver->priv->info,
+                       original_store_uid, rule->match, &driver->priv->error);
 
                switch (result) {
                case CAMEL_SEARCH_ERROR:
@@ -1698,36 +1688,36 @@ camel_filter_driver_filter_message (CamelFilterDriver *driver,
                                       camel_message_info_subject(info)?camel_message_info_subject(info):"?no subject?", rule->name);
 
                        /* perform necessary filtering actions */
-                       camel_sexp_input_text (p->eval, rule->action, strlen (rule->action));
-                       if (camel_sexp_parse (p->eval) == -1) {
+                       camel_sexp_input_text (driver->priv->eval, rule->action, strlen (rule->action));
+                       if (camel_sexp_parse (driver->priv->eval) == -1) {
                                g_set_error (
                                        error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
                                        _("Error parsing filter: %s: %s"),
-                                       camel_sexp_error (p->eval), rule->action);
+                                       camel_sexp_error (driver->priv->eval), rule->action);
                                goto error;
                        }
-                       r = camel_sexp_eval (p->eval);
-                       if (p->error != NULL)
+                       r = camel_sexp_eval (driver->priv->eval);
+                       if (driver->priv->error != NULL)
                                goto error;
 
                        if (r == NULL) {
                                g_set_error (
                                        error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
                                        _("Error executing filter: %s: %s"),
-                                       camel_sexp_error (p->eval), rule->action);
+                                       camel_sexp_error (driver->priv->eval), rule->action);
                                goto error;
                        }
-                       camel_sexp_result_free (p->eval, r);
+                       camel_sexp_result_free (driver->priv->eval, r);
                default:
                        break;
                }
        }
 
        /* *Now* we can set the DELETED flag... */
-       if (p->deleted) {
-               if (p->source && p->uid && camel_folder_has_summary_capability (p->source))
+       if (driver->priv->deleted) {
+               if (driver->priv->source && driver->priv->uid && camel_folder_has_summary_capability (driver->priv->source))
                        camel_folder_set_message_flags (
-                               p->source, p->uid,
+                               driver->priv->source, driver->priv->uid,
                                CAMEL_MESSAGE_DELETED |
                                CAMEL_MESSAGE_SEEN, ~0);
                else
@@ -1738,7 +1728,7 @@ camel_filter_driver_filter_message (CamelFilterDriver *driver,
        }
 
        /* Logic: if !Moved and there exists a default folder... */
-       if (!(p->copied && p->deleted) && !p->moved && p->defaultfolder) {
+       if (!(driver->priv->copied && driver->priv->deleted) && !driver->priv->moved && driver->priv->defaultfolder) {
                /* copy it to the default inbox */
                filtered = TRUE;
                camel_filter_driver_log (driver, FILTER_LOG_ACTION, "Copy to default folder");
@@ -1746,33 +1736,36 @@ camel_filter_driver_filter_message (CamelFilterDriver *driver,
                if (camel_debug(":filter"))
                        printf("filtering '%s' copy %s to default folder\n",
                               camel_message_info_subject(info)?camel_message_info_subject(info):"?no subject?",
-                              p->modified?"modified message":"");
+                              driver->priv->modified?"modified message":"");
 
-               if (!p->modified && p->uid && p->source && camel_folder_has_summary_capability (p->source)) {
+               if (!driver->priv->modified && driver->priv->uid && driver->priv->source && camel_folder_has_summary_capability (driver->priv->source)) {
                        GPtrArray *uids;
 
                        uids = g_ptr_array_new ();
-                       g_ptr_array_add (uids, (gchar *) p->uid);
+                       g_ptr_array_add (uids, (gchar *) driver->priv->uid);
                        camel_folder_transfer_messages_to_sync (
-                               p->source, uids, p->defaultfolder,
-                               FALSE, NULL, cancellable, &p->error);
+                               driver->priv->source, uids, driver->priv->defaultfolder,
+                               FALSE, NULL, cancellable, &driver->priv->error);
                        g_ptr_array_free (uids, TRUE);
                } else {
-                       if (p->message == NULL) {
-                               p->message = camel_folder_get_message_sync (
+                       if (driver->priv->message == NULL) {
+                               driver->priv->message = camel_folder_get_message_sync (
                                        source, uid, cancellable, error);
-                               if (!p->message)
+                               if (!driver->priv->message)
                                        goto error;
                        }
 
                        camel_folder_append_message_sync (
-                               p->defaultfolder, p->message,
-                               p->info, NULL, cancellable, &p->error);
+                               driver->priv->defaultfolder,
+                               driver->priv->message,
+                               driver->priv->info, NULL,
+                               cancellable,
+                               &driver->priv->error);
                }
        }
 
-       if (p->message)
-               g_object_unref (p->message);
+       if (driver->priv->message)
+               g_object_unref (driver->priv->message);
 
        if (freeinfo)
                camel_message_info_free (info);
@@ -1783,14 +1776,14 @@ camel_filter_driver_filter_message (CamelFilterDriver *driver,
        if (filtered)
                camel_filter_driver_log (driver, FILTER_LOG_END, NULL);
 
-       if (p->message)
-               g_object_unref (p->message);
+       if (driver->priv->message)
+               g_object_unref (driver->priv->message);
 
        if (freeinfo)
                camel_message_info_free (info);
 
-       g_propagate_error (error, p->error);
-       p->error = NULL;
+       g_propagate_error (error, driver->priv->error);
+       driver->priv->error = NULL;
 
        return -1;
 }
index 2ed9128..dbcc7c6 100644 (file)
@@ -142,10 +142,10 @@ camel_filter_search_get_message (FilterMessageSearch *fms,
 
 static gboolean
 check_header_in_message_info (CamelMessageInfo *info,
-                             gint argc,
-                             struct _CamelSExpResult **argv,
-                             camel_search_match_t how,
-                             gboolean *matched)
+                              gint argc,
+                              struct _CamelSExpResult **argv,
+                              camel_search_match_t how,
+                              gboolean *matched)
 {
        struct _KnownHeaders {
                const gchar *header_name;
@@ -273,9 +273,9 @@ header_contains (struct _CamelSExp *f,
 
 static CamelSExpResult *
 header_has_words (struct _CamelSExp *f,
-                 gint argc,
-                 struct _CamelSExpResult **argv,
-                 FilterMessageSearch *fms)
+                  gint argc,
+                  struct _CamelSExpResult **argv,
+                  FilterMessageSearch *fms)
 {
        return check_header (f, argc, argv, fms, CAMEL_SEARCH_MATCH_WORD);
 }
index 4fa136f..57a9dde 100644 (file)
 #define r(x)
 #define dd(x) if (camel_debug("search")) x
 
+#define CAMEL_FOLDER_SEARCH_GET_PRIVATE(obj) \
+       (G_TYPE_INSTANCE_GET_PRIVATE \
+       ((obj), CAMEL_TYPE_FOLDER_SEARCH, CamelFolderSearchPrivate))
+
 struct _CamelFolderSearchPrivate {
        GError **error;
 
@@ -159,8 +163,7 @@ camel_folder_search_class_init (CamelFolderSearchClass *class)
 static void
 camel_folder_search_init (CamelFolderSearch *search)
 {
-       search->priv = G_TYPE_INSTANCE_GET_PRIVATE (
-               search, CAMEL_TYPE_FOLDER_SEARCH, CamelFolderSearchPrivate);
+       search->priv = CAMEL_FOLDER_SEARCH_GET_PRIVATE (search);
        search->sexp = camel_sexp_new ();
 }
 
index 42e7fcf..cff451a 100644 (file)
 #include "camel-vtrash-folder.h"
 #include "camel-mime-part-utils.h"
 
+#define CAMEL_FOLDER_SUMMARY_GET_PRIVATE(obj) \
+       (G_TYPE_INSTANCE_GET_PRIVATE \
+       ((obj), CAMEL_TYPE_FOLDER_SUMMARY, CamelFolderSummaryPrivate))
+
 /* Make 5 minutes as default cache drop */
 #define SUMMARY_CACHE_DROP 300
 #define dd(x) if (camel_debug("sync")) x
@@ -177,7 +181,7 @@ folder_summary_dispose (GObject *object)
 {
        CamelFolderSummaryPrivate *priv;
 
-       priv = CAMEL_FOLDER_SUMMARY (object)->priv;
+       priv = CAMEL_FOLDER_SUMMARY_GET_PRIVATE (object);
 
        if (priv->filter_index != NULL) {
                g_object_unref (priv->filter_index);
@@ -1261,8 +1265,7 @@ camel_folder_summary_class_init (CamelFolderSummaryClass *class)
 static void
 camel_folder_summary_init (CamelFolderSummary *summary)
 {
-       summary->priv = G_TYPE_INSTANCE_GET_PRIVATE (
-               summary, CAMEL_TYPE_FOLDER_SUMMARY, CamelFolderSummaryPrivate);
+       summary->priv = CAMEL_FOLDER_SUMMARY_GET_PRIVATE (summary);
 
        summary->version = CAMEL_FOLDER_SUMMARY_VERSION;
        summary->flags = 0;
index e03f92b..fc0957b 100644 (file)
 #include "camel-vtrash-folder.h"
 #include "camel-string-utils.h"
 
+#define CAMEL_FOLDER_GET_PRIVATE(obj) \
+       (G_TYPE_INSTANCE_GET_PRIVATE \
+       ((obj), CAMEL_TYPE_FOLDER, CamelFolderPrivate))
+
 #define d(x)
 #define w(x)
 
@@ -77,7 +81,7 @@ struct _AsyncContext {
        gboolean delete_originals;
        gboolean expunge;
        CamelFetchType fetch_type;
-       int limit;
+       gint limit;
        gchar *start_uid;
        gchar *end_uid;
 
@@ -556,7 +560,7 @@ folder_finalize (GObject *object)
 {
        CamelFolderPrivate *priv;
 
-       priv = CAMEL_FOLDER (object)->priv;
+       priv = CAMEL_FOLDER_GET_PRIVATE (object);
 
        g_free (priv->full_name);
        g_free (priv->display_name);
@@ -1091,8 +1095,8 @@ fetch_messages_thread (GSimpleAsyncResult *simple,
 
 static void
 fetch_messages (CamelFolder *folder,
-               CamelFetchType type,
-               int limit,
+                CamelFetchType type,
+                gint limit,
                 gint io_priority,
                 GCancellable *cancellable,
                 GAsyncReadyCallback callback,
@@ -1302,12 +1306,12 @@ purge_message_cache_thread (GSimpleAsyncResult *simple,
 
 static void
 purge_message_cache (CamelFolder *folder,
-                    gchar *start_uid,
-                    gchar *end_uid,
-                    gint io_priority,
-                    GCancellable *cancellable,
-                    GAsyncReadyCallback callback,
-                    gpointer user_data)
+                     gchar *start_uid,
+                     gchar *end_uid,
+                     gint io_priority,
+                     GCancellable *cancellable,
+                     GAsyncReadyCallback callback,
+                     gpointer user_data)
 {
        GSimpleAsyncResult *simple;
        AsyncContext *async_context;
@@ -1330,8 +1334,8 @@ purge_message_cache (CamelFolder *folder,
 
 static gboolean
 purge_message_cache_finish (CamelFolder *folder,
-                           GAsyncResult *result,
-                           GError **error)
+                            GAsyncResult *result,
+                            GError **error)
 {
        GSimpleAsyncResult *simple;
        AsyncContext *async_context;
@@ -1746,13 +1750,13 @@ camel_folder_class_init (CamelFolderClass *class)
        class->expunge = folder_expunge;
        class->expunge_finish = folder_expunge_finish;
        class->fetch_messages= fetch_messages;
-       class->fetch_messages_finish = fetch_messages_finish;   
+       class->fetch_messages_finish = fetch_messages_finish;
        class->get_message = folder_get_message;
        class->get_message_finish = folder_get_message_finish;
        class->get_quota_info = folder_get_quota_info;
        class->get_quota_info_finish = folder_get_quota_info_finish;
        class->purge_message_cache= purge_message_cache;
-       class->purge_message_cache_finish = purge_message_cache_finish;         
+       class->purge_message_cache_finish = purge_message_cache_finish;
        class->refresh_info = folder_refresh_info;
        class->refresh_info_finish = folder_refresh_info_finish;
        class->synchronize = folder_synchronize;
@@ -1872,8 +1876,7 @@ camel_folder_class_init (CamelFolderClass *class)
 static void
 camel_folder_init (CamelFolder *folder)
 {
-       folder->priv = G_TYPE_INSTANCE_GET_PRIVATE (
-               folder, CAMEL_TYPE_FOLDER, CamelFolderPrivate);
+       folder->priv = CAMEL_FOLDER_GET_PRIVATE (folder);
        folder->priv->frozen = 0;
        folder->priv->changed_frozen = camel_folder_change_info_new ();
 
@@ -3395,18 +3398,21 @@ camel_folder_expunge_finish (CamelFolder *folder,
  * @cancellable: optional #GCancellable object, or %NULL
  * @error: return location for a #GError, or %NULL
  *
- * Downloads old or new specified number of messages from the server. It is optimized for mobile client usage. Desktop clients should keep away from this api and use @camel_folder_refresh_info.
+ * Downloads old or new specified number of messages from the server. It is
+ * optimized for mobile client usage. Desktop clients should keep away from
+ * this api and use @camel_folder_refresh_info.
  *
- * Returns: %TRUE if there are more messages to fetch, %FALSE if there are no more messages. 
+ * Returns: %TRUE if there are more messages to fetch,
+ *          %FALSE if there are no more messages
  *
  * Since: 3.4
  **/
 gboolean
 camel_folder_fetch_messages_sync (CamelFolder *folder,
-                                 CamelFetchType type,
-                                 int limit,
-                                 GCancellable *cancellable,
-                                         GError **error)
+                                  CamelFetchType type,
+                                  gint limit,
+                                  GCancellable *cancellable,
+                                  GError **error)
 {
        CamelFolderClass *class;
        gboolean success = TRUE;
@@ -3415,7 +3421,8 @@ camel_folder_fetch_messages_sync (CamelFolder *folder,
 
        class = CAMEL_FOLDER_GET_CLASS (folder);
 
-       /* Some backends that wont support mobile mode, won't have this api implemented. */
+       /* Some backends that wont support mobile
+        * mode, won't have this method implemented. */
        if (class->fetch_messages_sync == NULL)
                return FALSE;
 
@@ -3427,7 +3434,8 @@ camel_folder_fetch_messages_sync (CamelFolder *folder,
                return FALSE;
        }
 
-       success = class->fetch_messages_sync (folder, type, limit, cancellable, error);
+       success = class->fetch_messages_sync (
+               folder, type, limit, cancellable, error);
        CAMEL_CHECK_GERROR (folder, fetch_messages_sync, success, error);
 
        camel_folder_unlock (folder, CAMEL_FOLDER_REC_LOCK);
@@ -3445,11 +3453,14 @@ camel_folder_fetch_messages_sync (CamelFolder *folder,
  * @callback: a #GAsyncReadyCallback to call when the request is satisfied
  * @user_data: data to pass to the callback function
  *
- * Asynchronously download new or old messages from the server. It is assumes that the client has only a 
- * window of interested messages of what server has. And old/new type helps to expand that window.
+ * Asynchronously download new or old messages from the server. It is assumes
+ * that the client has only a window of interested messages of what server has.
+ * And old/new type helps to expand that window.
  *
- * type = CAMEL_FETCH_OLD_MESSAGES: Downloads messages older than what the client already has. 
- * type = CAMEL_FETCH_NEW_MESSAGES: Downloads messages newer than what the client already has.
+ * type = CAMEL_FETCH_OLD_MESSAGES: Downloads messages older than what the
+ * client already has.
+ * type = CAMEL_FETCH_NEW_MESSAGES: Downloads messages newer than what the
+ * client already has.
  *
  * When the operation is finished, @callback will be called.  You can then
  * call camel_folder_fetch_messages_finish() to get the result of the operation.
@@ -3458,12 +3469,12 @@ camel_folder_fetch_messages_sync (CamelFolder *folder,
  **/
 void
 camel_folder_fetch_messages (CamelFolder *folder,
-                            CamelFetchType type,
-                            int limit,
-                            gint io_priority,
-                            GCancellable *cancellable,
-                            GAsyncReadyCallback callback,
-                            gpointer user_data)
+                             CamelFetchType type,
+                             gint limit,
+                             gint io_priority,
+                             GCancellable *cancellable,
+                             GAsyncReadyCallback callback,
+                             gpointer user_data)
 {
        CamelFolderClass *class;
 
@@ -3472,7 +3483,9 @@ camel_folder_fetch_messages (CamelFolder *folder,
        class = CAMEL_FOLDER_GET_CLASS (folder);
        g_return_if_fail (class->fetch_messages != NULL);
 
-       class->fetch_messages (folder, type, limit, io_priority, cancellable, callback, user_data);
+       class->fetch_messages (
+               folder, type, limit, io_priority,
+               cancellable, callback, user_data);
 }
 
 /**
@@ -3483,14 +3496,15 @@ camel_folder_fetch_messages (CamelFolder *folder,
  *
  * Finishes the operation started with camel_folder_fetch_messages().
  *
- * Returns: %TRUE if there are more messages to fetch, %FALSE if there are no more messages.
+ * Returns: %TRUE if there are more messages to fetch,
+ *          %FALSE if there are no more messages
  *
  * Since: 3.4
  **/
 gboolean
 camel_folder_fetch_messages_finish (CamelFolder *folder,
-                                   GAsyncResult *result,
-                                   GError **error)
+                                    GAsyncResult *result,
+                                    GError **error)
 {
        CamelFolderClass *class;
 
@@ -3536,12 +3550,12 @@ camel_folder_get_message_sync (CamelFolder *folder,
                message_uid, camel_folder_get_display_name (folder));
 
        if (class->get_message_cached) {
-               /* Return cached message, if available locally; this should not do any
-                * network I/O, only check if message is already downloaded and return
-                * it quicker, not being blocked by the folder's lock.
-                * Returning NULL is not considered as an error, it just means that
-                * the message is still to-be-downloaded.
-               */
+               /* Return cached message, if available locally; this should
+                * not do any network I/O, only check if message is already
+                * downloaded and return it quicker, not being blocked by
+                * the folder's lock.  Returning NULL is not considered as
+                * an error, it just means that the message is still
+                * to-be-downloaded. */
                message = class->get_message_cached (
                        folder, message_uid, cancellable);
        }
@@ -3558,17 +3572,20 @@ camel_folder_get_message_sync (CamelFolder *folder,
 
                message = class->get_message_sync (
                        folder, message_uid, cancellable, error);
-               CAMEL_CHECK_GERROR (folder, get_message_sync, message != NULL, error);
+               CAMEL_CHECK_GERROR (
+                       folder, get_message_sync, message != NULL, error);
 
                camel_folder_unlock (folder, CAMEL_FOLDER_REC_LOCK);
        }
 
        if (message && camel_mime_message_get_source (message) == NULL) {
                CamelStore *store;
+               const gchar *uid;
 
                store = camel_folder_get_parent_store (folder);
+               uid = camel_service_get_uid (CAMEL_SERVICE (store));
 
-               camel_mime_message_set_source (message, camel_service_get_uid (CAMEL_SERVICE (store)));
+               camel_mime_message_set_source (message, uid);
        }
 
        camel_operation_pop_message (cancellable);
@@ -3773,10 +3790,10 @@ camel_folder_get_quota_info_finish (CamelFolder *folder,
  **/
 gboolean
 camel_folder_purge_message_cache_sync (CamelFolder *folder,
-                                      gchar *start_uid,
-                                      gchar *end_uid,
-                                      GCancellable *cancellable,
-                                      GError **error)
+                                       gchar *start_uid,
+                                       gchar *end_uid,
+                                       GCancellable *cancellable,
+                                       GError **error)
 {
        CamelFolderClass *class;
        gboolean success = TRUE;
@@ -3785,7 +3802,8 @@ camel_folder_purge_message_cache_sync (CamelFolder *folder,
 
        class = CAMEL_FOLDER_GET_CLASS (folder);
 
-       /* Some backends that wont support mobile mode, won't have this api implemented. */
+       /* Some backends that wont support mobile
+        * mode, won't have this api implemented. */
        if (class->purge_message_cache_sync == NULL)
                return FALSE;
 
@@ -3797,7 +3815,8 @@ camel_folder_purge_message_cache_sync (CamelFolder *folder,
                return FALSE;
        }
 
-       success = class->purge_message_cache_sync (folder, start_uid, end_uid, cancellable, error);
+       success = class->purge_message_cache_sync (
+               folder, start_uid, end_uid, cancellable, error);
        CAMEL_CHECK_GERROR (folder, purge_message_cache_sync, success, error);
 
        camel_folder_unlock (folder, CAMEL_FOLDER_REC_LOCK);
@@ -3818,18 +3837,19 @@ camel_folder_purge_message_cache_sync (CamelFolder *folder,
  * Delete the local cache of all messages between these uids.
  * 
  * When the operation is finished, @callback will be called.  You can then
- * call camel_folder_purge_message_cache_finish() to get the result of the operation.
+ * call camel_folder_purge_message_cache_finish() to get the result of the
+ * operation.
  *
  * Since: 3.4
  **/
 void
 camel_folder_purge_message_cache (CamelFolder *folder,
-                                 gchar *start_uid,
-                                 gchar *end_uid,
-                                 gint io_priority,
-                                 GCancellable *cancellable,
-                                 GAsyncReadyCallback callback,
-                                 gpointer user_data)
+                                  gchar *start_uid,
+                                  gchar *end_uid,
+                                  gint io_priority,
+                                  GCancellable *cancellable,
+                                  GAsyncReadyCallback callback,
+                                  gpointer user_data)
 {
        CamelFolderClass *class;
 
@@ -3838,7 +3858,9 @@ camel_folder_purge_message_cache (CamelFolder *folder,
        class = CAMEL_FOLDER_GET_CLASS (folder);
        g_return_if_fail (class->purge_message_cache != NULL);
 
-       class->purge_message_cache (folder, start_uid, end_uid, io_priority, cancellable, callback, user_data);
+       class->purge_message_cache (
+               folder, start_uid, end_uid, io_priority,
+               cancellable, callback, user_data);
 }
 
 /**
@@ -3849,14 +3871,14 @@ camel_folder_purge_message_cache (CamelFolder *folder,
  *
  * Finishes the operation started with camel_folder_purge_message_cache().
  *
- * Returns: %TRUE if cache is deleted, %FALSE if there are any errors.
+ * Returns: %TRUE if cache is deleted, %FALSE if there are any errors
  *
  * Since: 3.4
  **/
 gboolean
 camel_folder_purge_message_cache_finish (CamelFolder *folder,
-                                   GAsyncResult *result,
-                                   GError **error)
+                                         GAsyncResult *result,
+                                    GError **error)
 {
        CamelFolderClass *class;
 
index f226681..e249309 100644 (file)
@@ -218,7 +218,7 @@ struct _CamelFolderClass {
                        (*get_message_cached)   (CamelFolder *folder,
                                                 const gchar *message_uid,
                                                 GCancellable *cancellable);
-               
+
        /* Synchronous I/O Methods */
        gboolean        (*append_message_sync)  (CamelFolder *folder,
                                                 CamelMimeMessage *message,
@@ -229,9 +229,9 @@ struct _CamelFolderClass {
        gboolean        (*expunge_sync)         (CamelFolder *folder,
                                                 GCancellable *cancellable,
                                                 GError **error);
-       gboolean        (*fetch_messages_sync)  (CamelFolder *folder,
+       gboolean        (*fetch_messages_sync)  (CamelFolder *folder,
                                                 CamelFetchType type,
-                                                int limit,
+                                                gint limit,
                                                 GCancellable *cancellable,
                                                 GError **error);
        CamelMimeMessage *
@@ -243,12 +243,12 @@ struct _CamelFolderClass {
                        (*get_quota_info_sync)  (CamelFolder *folder,
                                                 GCancellable *cancellable,
                                                 GError **error);
-       gboolean        (*purge_message_cache_sync)     
+       gboolean        (*purge_message_cache_sync)
                                                (CamelFolder *folder,
                                                 gchar *start_uid,
                                                 gchar *end_uid,
                                                 GCancellable *cancellable,
-                                                GError **error);       
+                                                GError **error);
        gboolean        (*refresh_info_sync)    (CamelFolder *folder,
                                                 GCancellable *cancellable,
                                                 GError **error);
@@ -291,17 +291,17 @@ struct _CamelFolderClass {
        gboolean        (*expunge_finish)       (CamelFolder *folder,
                                                 GAsyncResult *result,
                                                 GError **error);
-       void            (*fetch_messages)       (CamelFolder *folder,
+       void            (*fetch_messages)       (CamelFolder *folder,
                                                 CamelFetchType type,
-                                                int limit,
+                                                gint limit,
                                                 gint io_priority,
                                                 GCancellable *cancellable,
                                                 GAsyncReadyCallback callback,
                                                 gpointer user_data);
-       gboolean        (*fetch_messages_finish)        
+       gboolean        (*fetch_messages_finish)
                                                (CamelFolder *folder,
                                                 GAsyncResult *result,
-                                                GError **error);       
+                                                GError **error);
        void            (*get_message)          (CamelFolder *folder,
                                                 const gchar *message_uid,
                                                 gint io_priority,
@@ -322,17 +322,17 @@ struct _CamelFolderClass {
                                                (CamelFolder *folder,
                                                 GAsyncResult *result,
                                                 GError **error);
-       void            (*purge_message_cache)  (CamelFolder *folder,
+       void            (*purge_message_cache)  (CamelFolder *folder,
                                                 gchar *start_uid,
                                                 gchar *end_uid,
                                                 gint io_priority,
                                                 GCancellable *cancellable,
                                                 GAsyncReadyCallback callback,
                                                 gpointer user_data);
-       gboolean        (*purge_message_cache_finish)   
+       gboolean        (*purge_message_cache_finish)
                                                (CamelFolder *folder,
                                                 GAsyncResult *result,
-                                                GError **error);       
+                                                GError **error);
 
        void            (*refresh_info)         (CamelFolder *folder,
                                                 gint io_priority,
@@ -542,20 +542,20 @@ void              camel_folder_expunge            (CamelFolder *folder,
 gboolean       camel_folder_expunge_finish     (CamelFolder *folder,
                                                 GAsyncResult *result,
                                                 GError **error);
-gboolean       camel_folder_fetch_messages_sync
+gboolean       camel_folder_fetch_messages_sync
                                                (CamelFolder *folder,
                                                 CamelFetchType type,
-                                                int limit,
+                                                gint limit,
                                                 GCancellable *cancellable,
                                                 GError **error);
-void           camel_folder_fetch_messages     (CamelFolder *folder,
+void           camel_folder_fetch_messages     (CamelFolder *folder,
                                                 CamelFetchType type,
-                                                int limit,
+                                                gint limit,
                                                 gint io_priority,
                                                 GCancellable *cancellable,
                                                 GAsyncReadyCallback callback,
                                                 gpointer user_data);
-gboolean       camel_folder_fetch_messages_finish
+gboolean       camel_folder_fetch_messages_finish
                                                (CamelFolder *folder,
                                                 GAsyncResult *result,
                                                 GError **error);
@@ -589,13 +589,13 @@ CamelFolderQuotaInfo *
                                                (CamelFolder *folder,
                                                 GAsyncResult *result,
                                                 GError **error);
-gboolean       camel_folder_purge_message_cache_sync
+gboolean       camel_folder_purge_message_cache_sync
                                                (CamelFolder *folder,
                                                 gchar *start_uid,
                                                 gchar *end_uid,
                                                 GCancellable *cancellable,
                                                 GError **error);
-void           camel_folder_purge_message_cache
+void           camel_folder_purge_message_cache
                                                (CamelFolder *folder,
                                                 gchar *start_uid,
                                                 gchar *end_uid,
@@ -603,7 +603,7 @@ void                camel_folder_purge_message_cache
                                                 GCancellable *cancellable,
                                                 GAsyncReadyCallback callback,
                                                 gpointer user_data);
-gboolean       camel_folder_purge_message_cache_finish
+gboolean       camel_folder_purge_message_cache_finish
                                                (CamelFolder *folder,
                                                 GAsyncResult *result,
                                                 GError **error);
index 477d345..72582cd 100644 (file)
 static gint logid;
 #endif
 
+#define CAMEL_GPG_CONTEXT_GET_PRIVATE(obj) \
+       (G_TYPE_INSTANCE_GET_PRIVATE \
+       ((obj), CAMEL_TYPE_GPG_CONTEXT, CamelGpgContextPrivate))
+
 struct _CamelGpgContextPrivate {
        gboolean always_trust;
 };
@@ -745,7 +749,7 @@ gpg_ctx_parse_status (struct _GpgCtx *gpg,
                        gboolean all_zero = *key == '0';
                        gint i = 0;
 
-                       while (key [i] && all_zero) {
+                       while (key[i] && all_zero) {
                                all_zero = key[i] == '0';
                                i++;
                        }
@@ -883,7 +887,7 @@ gpg_ctx_parse_status (struct _GpgCtx *gpg,
                gpg->bad_passwds = 0;
        } else if (!strncmp ((gchar *) status, "BAD_PASSPHRASE", 14)) {
                /* with anonymous recipient is user asked for his/her password for each stored key,
-                  thus here cannot be counted wrong passwords */
+                * thus here cannot be counted wrong passwords */
                if (!gpg->anonymous_recipient) {
                        gpg->bad_passwds++;
 
@@ -2259,7 +2263,7 @@ camel_gpg_context_class_init (CamelGpgContextClass *class)
        GObjectClass *object_class;
        CamelCipherContextClass *cipher_context_class;
 
-       g_type_class_add_private (class, sizeof (CamelGpgContextClass));
+       g_type_class_add_private (class, sizeof (CamelGpgContextPrivate));
 
        object_class = G_OBJECT_CLASS (class);
        object_class->set_property = gpg_context_set_property;
@@ -2293,8 +2297,7 @@ camel_gpg_context_class_init (CamelGpgContextClass *class)
 static void
 camel_gpg_context_init (CamelGpgContext *context)
 {
-       context->priv = G_TYPE_INSTANCE_GET_PRIVATE (
-               context, CAMEL_TYPE_GPG_CONTEXT, CamelGpgContextPrivate);
+       context->priv = CAMEL_GPG_CONTEXT_GET_PRIVATE (context);
 }
 
 /**
index 1546689..28e157f 100644 (file)
 
 #define CAMEL_INDEX_VERSION (0x01)
 
+#define CAMEL_INDEX_GET_PRIVATE(obj) \
+       (G_TYPE_INSTANCE_GET_PRIVATE \
+       ((obj), CAMEL_TYPE_INDEX, CamelIndexPrivate))
+
 struct _CamelIndexPrivate {
        gpointer dummy;
 };
@@ -74,8 +78,7 @@ camel_index_class_init (CamelIndexClass *class)
 static void
 camel_index_init (CamelIndex *index)
 {
-       index->priv = G_TYPE_INSTANCE_GET_PRIVATE (
-               index, CAMEL_TYPE_INDEX, CamelIndexPrivate);
+       index->priv = CAMEL_INDEX_GET_PRIVATE (index);
        index->version = CAMEL_INDEX_VERSION;
 }
 
index 5f3d46e..9d726a0 100644 (file)
 
 #define d(x)
 
+#define CAMEL_MEDIUM_GET_PRIVATE(obj) \
+       (G_TYPE_INSTANCE_GET_PRIVATE \
+       ((obj), CAMEL_TYPE_MEDIUM, CamelMediumPrivate))
+
 struct _CamelMediumPrivate {
        /* The content of the medium, as opposed to our parent
         * CamelDataWrapper, which wraps both the headers and
@@ -86,7 +90,7 @@ medium_dispose (GObject *object)
 {
        CamelMediumPrivate *priv;
 
-       priv = CAMEL_MEDIUM (object)->priv;
+       priv = CAMEL_MEDIUM_GET_PRIVATE (object);
 
        if (priv->content != NULL) {
                g_object_unref (priv->content);
@@ -162,8 +166,7 @@ camel_medium_class_init (CamelMediumClass *class)
 static void
 camel_medium_init (CamelMedium *medium)
 {
-       medium->priv = G_TYPE_INSTANCE_GET_PRIVATE (
-               medium, CAMEL_TYPE_MEDIUM, CamelMediumPrivate);
+       medium->priv = CAMEL_MEDIUM_GET_PRIVATE (medium);
 }
 
 /**
index b6d7136..0d8f441 100644 (file)
 #include "camel-mime-filter-basic.h"
 #include "camel-mime-utils.h"
 
+#define CAMEL_MIME_FILTER_BASIC_GET_PRIVATE(obj) \
+       (G_TYPE_INSTANCE_GET_PRIVATE \
+       ((obj), CAMEL_TYPE_MIME_FILTER_BASIC, CamelMimeFilterBasicPrivate))
+
 struct _CamelMimeFilterBasicPrivate {
        CamelMimeFilterBasicType type;
        guchar uubuf[60];
@@ -46,7 +50,7 @@ mime_filter_basic_filter (CamelMimeFilter *mime_filter,
        CamelMimeFilterBasicPrivate *priv;
        gsize newlen;
 
-       priv = CAMEL_MIME_FILTER_BASIC (mime_filter)->priv;
+       priv = CAMEL_MIME_FILTER_BASIC_GET_PRIVATE (mime_filter);
 
        switch (priv->type) {
        case CAMEL_MIME_FILTER_BASIC_BASE64_ENC:
@@ -151,7 +155,7 @@ mime_filter_basic_complete (CamelMimeFilter *mime_filter,
        CamelMimeFilterBasicPrivate *priv;
        gsize newlen = 0;
 
-       priv = CAMEL_MIME_FILTER_BASIC (mime_filter)->priv;
+       priv = CAMEL_MIME_FILTER_BASIC_GET_PRIVATE (mime_filter);
 
        switch (priv->type) {
        case CAMEL_MIME_FILTER_BASIC_BASE64_ENC:
@@ -217,7 +221,7 @@ mime_filter_basic_reset (CamelMimeFilter *mime_filter)
 {
        CamelMimeFilterBasicPrivate *priv;
 
-       priv = CAMEL_MIME_FILTER_BASIC (mime_filter)->priv;
+       priv = CAMEL_MIME_FILTER_BASIC_GET_PRIVATE (mime_filter);
 
        switch (priv->type) {
        case CAMEL_MIME_FILTER_BASIC_QP_ENC:
@@ -245,9 +249,7 @@ camel_mime_filter_basic_class_init (CamelMimeFilterBasicClass *class)
 static void
 camel_mime_filter_basic_init (CamelMimeFilterBasic *filter)
 {
-       filter->priv = G_TYPE_INSTANCE_GET_PRIVATE (
-               filter, CAMEL_TYPE_MIME_FILTER_BASIC,
-               CamelMimeFilterBasicPrivate);
+       filter->priv = CAMEL_MIME_FILTER_BASIC_GET_PRIVATE (filter);
 }
 
 /**
index d6c1cdf..ddcc044 100644 (file)
 
 #include "camel-mime-filter-bestenc.h"
 
+#define CAMEL_MIME_FILTER_BESTENC_GET_PRIVATE(obj) \
+       (G_TYPE_INSTANCE_GET_PRIVATE \
+       ((obj), CAMEL_TYPE_MIME_FILTER_BESTENC, CamelMimeFilterBestencPrivate))
+
 struct _CamelMimeFilterBestencPrivate {
 
        guint flags;    /* our creation flags */
@@ -64,7 +68,7 @@ mime_filter_bestenc_filter (CamelMimeFilter *mime_filter,
        CamelMimeFilterBestencPrivate *priv;
        register guchar *p, *pend;
 
-       priv = CAMEL_MIME_FILTER_BESTENC (mime_filter)->priv;
+       priv = CAMEL_MIME_FILTER_BESTENC_GET_PRIVATE (mime_filter);
 
        if (len == 0)
                goto donothing;
@@ -165,7 +169,7 @@ mime_filter_bestenc_complete (CamelMimeFilter *mime_filter,
 {
        CamelMimeFilterBestencPrivate *priv;
 
-       priv = CAMEL_MIME_FILTER_BESTENC (mime_filter)->priv;
+       priv = CAMEL_MIME_FILTER_BESTENC_GET_PRIVATE (mime_filter);
 
        mime_filter_bestenc_filter (
                mime_filter, in, len, prespace, out, outlen, outprespace);
@@ -180,7 +184,7 @@ mime_filter_bestenc_reset (CamelMimeFilter *mime_filter)
 {
        CamelMimeFilterBestencPrivate *priv;
 
-       priv = CAMEL_MIME_FILTER_BESTENC (mime_filter)->priv;
+       priv = CAMEL_MIME_FILTER_BESTENC_GET_PRIVATE (mime_filter);
 
        priv->count0 = 0;
        priv->count8 = 0;
@@ -211,9 +215,7 @@ camel_mime_filter_bestenc_class_init (CamelMimeFilterBestencClass *class)
 static void
 camel_mime_filter_bestenc_init (CamelMimeFilterBestenc *filter)
 {
-       filter->priv = G_TYPE_INSTANCE_GET_PRIVATE (
-               filter, CAMEL_TYPE_MIME_FILTER_BESTENC,
-               CamelMimeFilterBestencPrivate);
+       filter->priv = CAMEL_MIME_FILTER_BESTENC_GET_PRIVATE (filter);
 
        mime_filter_bestenc_reset (CAMEL_MIME_FILTER (filter));
 }
@@ -255,7 +257,7 @@ camel_mime_filter_bestenc_get_best_encoding (CamelMimeFilterBestenc *filter,
        CamelTransferEncoding bestenc;
        gint istext;
 
-       priv = filter->priv;
+       priv = CAMEL_MIME_FILTER_BESTENC_GET_PRIVATE (filter);
 
        istext = (required & CAMEL_BESTENC_TEXT) ? 1 : 0;
        required = required & ~CAMEL_BESTENC_TEXT;
index 8da3f5c..dfaad1b 100644 (file)
 
 #include "camel-mime-filter-canon.h"
 
+#define CAMEL_MIME_FILTER_CANON_GET_PRIVATE(obj) \
+       (G_TYPE_INSTANCE_GET_PRIVATE \
+       ((obj), CAMEL_TYPE_MIME_FILTER_CANON, CamelMimeFilterCanonPrivate))
+
 struct _CamelMimeFilterCanonPrivate {
        guint32 flags;
 };
 
-G_DEFINE_TYPE (CamelMimeFilterCanon, camel_mime_filter_canon, CAMEL_TYPE_MIME_FILTER)
+G_DEFINE_TYPE (
+       CamelMimeFilterCanon,
+       camel_mime_filter_canon,
+       CAMEL_TYPE_MIME_FILTER)
 
 static void
 mime_filter_canon_run (CamelMimeFilter *mime_filter,
@@ -54,7 +61,7 @@ mime_filter_canon_run (CamelMimeFilter *mime_filter,
        register gchar *o;
        gint lf = 0;
 
-       priv = CAMEL_MIME_FILTER_CANON (mime_filter)->priv;
+       priv = CAMEL_MIME_FILTER_CANON_GET_PRIVATE (mime_filter);
 
        /* first, work out how much space we need */
        inptr = (guchar *) in;
@@ -189,9 +196,7 @@ camel_mime_filter_canon_class_init (CamelMimeFilterCanonClass *class)
 static void
 camel_mime_filter_canon_init (CamelMimeFilterCanon *filter)
 {
-       filter->priv = G_TYPE_INSTANCE_GET_PRIVATE (
-               filter, CAMEL_TYPE_MIME_FILTER_CANON,
-               CamelMimeFilterCanonPrivate);
+       filter->priv = CAMEL_MIME_FILTER_CANON_GET_PRIVATE (filter);
 }
 
 /**
index 8dd167c..386a678 100644 (file)
 #include "camel-iconv.h"
 #include "camel-mime-filter-charset.h"
 
+#define CAMEL_MIME_FILTER_CHARSET_GET_PRIVATE(obj) \
+       (G_TYPE_INSTANCE_GET_PRIVATE \
+       ((obj), CAMEL_TYPE_MIME_FILTER_CHARSET, CamelMimeFilterCharsetPrivate))
+
 #define d(x)
 #define w(x)
 
@@ -46,7 +50,7 @@ mime_filter_charset_finalize (GObject *object)
 {
        CamelMimeFilterCharsetPrivate *priv;
 
-       priv = CAMEL_MIME_FILTER_CHARSET (object)->priv;
+       priv = CAMEL_MIME_FILTER_CHARSET_GET_PRIVATE (object);
 
        g_free (priv->from);
        g_free (priv->to);
@@ -74,7 +78,7 @@ mime_filter_charset_complete (CamelMimeFilter *mime_filter,
        const gchar *inbuf;
        gchar *outbuf;
 
-       priv = CAMEL_MIME_FILTER_CHARSET (mime_filter)->priv;
+       priv = CAMEL_MIME_FILTER_CHARSET_GET_PRIVATE (mime_filter);
 
        if (priv->ic == (iconv_t) -1)
                goto noop;
@@ -131,7 +135,7 @@ mime_filter_charset_complete (CamelMimeFilter *mime_filter,
        while (camel_iconv (priv->ic, NULL, NULL, &outbuf, &outleft) == (gsize) -1) {
                if (errno != E2BIG)
                        break;
-               
+
                converted = outbuf - mime_filter->outbuf;
                camel_mime_filter_set_size (mime_filter, mime_filter->outsize + 16, TRUE);
                outbuf = mime_filter->outbuf + converted;
@@ -165,7 +169,7 @@ mime_filter_charset_filter (CamelMimeFilter *mime_filter,
        const gchar *inbuf;
        gchar *outbuf;
 
-       priv = CAMEL_MIME_FILTER_CHARSET (mime_filter)->priv;
+       priv = CAMEL_MIME_FILTER_CHARSET_GET_PRIVATE (mime_filter);
 
        if (priv->ic == (iconv_t) -1)
                goto noop;
@@ -228,7 +232,7 @@ mime_filter_charset_reset (CamelMimeFilter *mime_filter)
        gchar *buffer;
        gsize outlen = 16;
 
-       priv = CAMEL_MIME_FILTER_CHARSET (mime_filter)->priv;
+       priv = CAMEL_MIME_FILTER_CHARSET_GET_PRIVATE (mime_filter);
 
        /* what happens with the output bytes if this resets the state? */
        if (priv->ic != (iconv_t) -1) {
@@ -257,9 +261,7 @@ camel_mime_filter_charset_class_init (CamelMimeFilterCharsetClass *class)
 static void
 camel_mime_filter_charset_init (CamelMimeFilterCharset *filter)
 {
-       filter->priv = G_TYPE_INSTANCE_GET_PRIVATE (
-               filter, CAMEL_TYPE_MIME_FILTER_CHARSET,
-               CamelMimeFilterCharsetPrivate);
+       filter->priv = CAMEL_MIME_FILTER_CHARSET_GET_PRIVATE (filter);
        filter->priv->ic = (iconv_t) -1;
 }
 
@@ -277,11 +279,11 @@ CamelMimeFilter *
 camel_mime_filter_charset_new (const gchar *from_charset,
                                const gchar *to_charset)
 {
-       CamelMimeFilter *res;
+       CamelMimeFilter *new;
        CamelMimeFilterCharsetPrivate *priv;
 
-       res = g_object_new (CAMEL_TYPE_MIME_FILTER_CHARSET, NULL);
-       priv = CAMEL_MIME_FILTER_CHARSET (res)->priv;
+       new = g_object_new (CAMEL_TYPE_MIME_FILTER_CHARSET, NULL);
+       priv = CAMEL_MIME_FILTER_CHARSET_GET_PRIVATE (new);
 
        priv->ic = camel_iconv_open (to_charset, from_charset);
        if (priv->ic == (iconv_t) -1) {
@@ -289,12 +291,12 @@ camel_mime_filter_charset_new (const gchar *from_charset,
                             from_charset ? from_charset : "(null)",
                             to_charset ? to_charset : "(null)",
                             g_strerror (errno)));
-               g_object_unref (res);
-               res = NULL;
+               g_object_unref (new);
+               new = NULL;
        } else {
                priv->from = g_strdup (from_charset);
                priv->to = g_strdup (to_charset);
        }
 
-       return res;
+       return new;
 }
index 9cf0d00..a233dcb 100644 (file)
 
 #include "camel-mime-filter-crlf.h"
 
+#define CAMEL_MIME_FILTER_CRLF_GET_PRIVATE(obj) \
+       (G_TYPE_INSTANCE_GET_PRIVATE \
+       ((obj), CAMEL_TYPE_MIME_FILTER_CRLF, CamelMimeFilterCRLFPrivate))
+
 struct _CamelMimeFilterCRLFPrivate {
        CamelMimeFilterCRLFDirection direction;
        CamelMimeFilterCRLFMode mode;
@@ -47,7 +51,7 @@ mime_filter_crlf_filter (CamelMimeFilter *mime_filter,
        gboolean do_dots;
        gchar *outptr;
 
-       priv = CAMEL_MIME_FILTER_CRLF (mime_filter)->priv;
+       priv = CAMEL_MIME_FILTER_CRLF_GET_PRIVATE (mime_filter);
 
        do_dots = priv->mode == CAMEL_MIME_FILTER_CRLF_MODE_CRLF_DOTS;
 
@@ -143,7 +147,7 @@ mime_filter_crlf_reset (CamelMimeFilter *mime_filter)
 {
        CamelMimeFilterCRLFPrivate *priv;
 
-       priv = CAMEL_MIME_FILTER_CRLF (mime_filter)->priv;
+       priv = CAMEL_MIME_FILTER_CRLF_GET_PRIVATE (mime_filter);
 
        priv->saw_cr = FALSE;
        priv->saw_lf = TRUE;
@@ -166,9 +170,7 @@ camel_mime_filter_crlf_class_init (CamelMimeFilterCRLFClass *class)
 static void
 camel_mime_filter_crlf_init (CamelMimeFilterCRLF *filter)
 {
-       filter->priv = G_TYPE_INSTANCE_GET_PRIVATE (
-               filter, CAMEL_TYPE_MIME_FILTER_CRLF,
-               CamelMimeFilterCRLFPrivate);
+       filter->priv = CAMEL_MIME_FILTER_CRLF_GET_PRIVATE (filter);
 
        filter->priv->saw_cr = FALSE;
        filter->priv->saw_lf = TRUE;
@@ -192,7 +194,7 @@ camel_mime_filter_crlf_new (CamelMimeFilterCRLFDirection direction,
        CamelMimeFilterCRLFPrivate *priv;
 
        filter = g_object_new (CAMEL_TYPE_MIME_FILTER_CRLF, NULL);
-       priv = CAMEL_MIME_FILTER_CRLF (filter)->priv;
+       priv = CAMEL_MIME_FILTER_CRLF_GET_PRIVATE (filter);
 
        priv->direction = direction;
        priv->mode = mode;
index 6edfdd0..577ff9d 100644 (file)
 #include "camel-mime-filter-enriched.h"
 #include "camel-string-utils.h"
 
+#define CAMEL_MIME_FILTER_ENRICHED_GET_PRIVATE(obj) \
+       (G_TYPE_INSTANCE_GET_PRIVATE \
+       ((obj), CAMEL_TYPE_MIME_FILTER_ENRICHED, CamelMimeFilterEnrichedPrivate))
+
 struct _CamelMimeFilterEnrichedPrivate {
        guint32 flags;
        gint nofill;
@@ -229,7 +233,7 @@ enriched_to_html (CamelMimeFilter *mime_filter,
        register const gchar *inptr;
        register gchar *outptr;
 
-       priv = CAMEL_MIME_FILTER_ENRICHED (mime_filter)->priv;
+       priv = CAMEL_MIME_FILTER_ENRICHED_GET_PRIVATE (mime_filter);
 
        camel_mime_filter_set_size (mime_filter, inlen * 2 + 6, FALSE);
 
@@ -520,7 +524,7 @@ mime_filter_enriched_reset (CamelMimeFilter *mime_filter)
 {
        CamelMimeFilterEnrichedPrivate *priv;
 
-       priv = CAMEL_MIME_FILTER_ENRICHED (mime_filter)->priv;
+       priv = CAMEL_MIME_FILTER_ENRICHED_GET_PRIVATE (mime_filter);
 
        priv->nofill = 0;
 }
@@ -550,9 +554,7 @@ camel_mime_filter_enriched_class_init (CamelMimeFilterEnrichedClass *class)
 static void
 camel_mime_filter_enriched_init (CamelMimeFilterEnriched *filter)
 {
-       filter->priv = G_TYPE_INSTANCE_GET_PRIVATE (
-               filter, CAMEL_TYPE_MIME_FILTER_ENRICHED,
-               CamelMimeFilterEnrichedPrivate);
+       filter->priv = CAMEL_MIME_FILTER_ENRICHED_GET_PRIVATE (filter);
 }
 
 /**
@@ -567,15 +569,15 @@ camel_mime_filter_enriched_init (CamelMimeFilterEnriched *filter)
 CamelMimeFilter *
 camel_mime_filter_enriched_new (guint32 flags)
 {
-       CamelMimeFilter *res;
+       CamelMimeFilter *new;
        CamelMimeFilterEnrichedPrivate *priv;
 
-       res = g_object_new (CAMEL_TYPE_MIME_FILTER_ENRICHED, NULL);
-       priv = CAMEL_MIME_FILTER_ENRICHED (res)->priv;
+       new = g_object_new (CAMEL_TYPE_MIME_FILTER_ENRICHED, NULL);
+       priv = CAMEL_MIME_FILTER_ENRICHED_GET_PRIVATE (new);
 
        priv->flags = flags;
 
-       return res;
+       return new;
 }
 
 /**
index 1b4060a..00c2fc4 100644 (file)
 
 #include "camel-mime-filter-from.h"
 
+#define CAMEL_MIME_FILTER_FROM_GET_PRIVATE(obj) \
+       (G_TYPE_INSTANCE_GET_PRIVATE \
+       ((obj), CAMEL_TYPE_MIME_FILTER_FROM, CamelMimeFilterFromPrivate))
+
 #define d(x)
 
 struct _CamelMimeFilterFromPrivate {
@@ -57,7 +61,7 @@ mime_filter_from_filter (CamelMimeFilter *mime_filter,
        struct fromnode *head = NULL, *tail = (struct fromnode *) &head, *node;
        gchar *outptr;
 
-       priv = CAMEL_MIME_FILTER_FROM (mime_filter)->priv;
+       priv = CAMEL_MIME_FILTER_FROM_GET_PRIVATE (mime_filter);
 
        inptr = in;
        inend = inptr + len;
@@ -160,9 +164,7 @@ camel_mime_filter_from_class_init (CamelMimeFilterFromClass *class)
 static void
 camel_mime_filter_from_init (CamelMimeFilterFrom *filter)
 {
-       filter->priv = G_TYPE_INSTANCE_GET_PRIVATE (
-               filter, CAMEL_TYPE_MIME_FILTER_FROM,
-               CamelMimeFilterFromPrivate);
+       filter->priv = CAMEL_MIME_FILTER_FROM_GET_PRIVATE (filter);
 }
 
 /**
index 3fb1a0b..77eac48 100644 (file)
 
 #include "camel-mime-filter-gzip.h"
 
+#define CAMEL_MIME_FILTER_GZIP_GET_PRIVATE(obj) \
+       (G_TYPE_INSTANCE_GET_PRIVATE \
+       ((obj), CAMEL_TYPE_MIME_FILTER_GZIP, CamelMimeFilterGZipPrivate))
+
 /* rfc1952 */
 
 enum {
@@ -106,7 +110,7 @@ gzip_filter (CamelMimeFilter *mime_filter,
        CamelMimeFilterGZipPrivate *priv;
        gint retval;
 
-       priv = CAMEL_MIME_FILTER_GZIP (mime_filter)->priv;
+       priv = CAMEL_MIME_FILTER_GZIP_GET_PRIVATE (mime_filter);
 
        if (!priv->state.zip.wrote_hdr) {
                priv->hdr.v.id1 = 31;
@@ -198,7 +202,7 @@ gunzip_filter (CamelMimeFilter *mime_filter,
        guint16 need, val;
        gint retval;
 
-       priv = CAMEL_MIME_FILTER_GZIP (mime_filter)->priv;
+       priv = CAMEL_MIME_FILTER_GZIP_GET_PRIVATE (mime_filter);
 
        if (!priv->state.unzip.got_hdr) {
                if (len < 10) {
@@ -343,7 +347,7 @@ mime_filter_gzip_finalize (GObject *object)
 {
        CamelMimeFilterGZipPrivate *priv;
 
-       priv = CAMEL_MIME_FILTER_GZIP (object)->priv;
+       priv = CAMEL_MIME_FILTER_GZIP_GET_PRIVATE (object);
 
        if (priv->mode == CAMEL_MIME_FILTER_GZIP_MODE_ZIP)
                deflateEnd (priv->stream);
@@ -367,7 +371,7 @@ mime_filter_gzip_filter (CamelMimeFilter *mime_filter,
 {
        CamelMimeFilterGZipPrivate *priv;
 
-       priv = CAMEL_MIME_FILTER_GZIP (mime_filter)->priv;
+       priv = CAMEL_MIME_FILTER_GZIP_GET_PRIVATE (mime_filter);
 
        if (priv->mode == CAMEL_MIME_FILTER_GZIP_MODE_ZIP)
                gzip_filter (
@@ -390,7 +394,7 @@ mime_filter_gzip_complete (CamelMimeFilter *mime_filter,
 {
        CamelMimeFilterGZipPrivate *priv;
 
-       priv = CAMEL_MIME_FILTER_GZIP (mime_filter)->priv;
+       priv = CAMEL_MIME_FILTER_GZIP_GET_PRIVATE (mime_filter);
 
        if (priv->mode == CAMEL_MIME_FILTER_GZIP_MODE_ZIP)
                gzip_filter (
@@ -408,7 +412,7 @@ mime_filter_gzip_reset (CamelMimeFilter *mime_filter)
 {
        CamelMimeFilterGZipPrivate *priv;
 
-       priv = CAMEL_MIME_FILTER_GZIP (mime_filter)->priv;
+       priv = CAMEL_MIME_FILTER_GZIP_GET_PRIVATE (mime_filter);
 
        memset (&priv->state, 0, sizeof (priv->state));
 
@@ -441,9 +445,7 @@ camel_mime_filter_gzip_class_init (CamelMimeFilterGZipClass *class)
 static void
 camel_mime_filter_gzip_init (CamelMimeFilterGZip *mime_filter)
 {
-       mime_filter->priv = G_TYPE_INSTANCE_GET_PRIVATE (
-               mime_filter, CAMEL_TYPE_MIME_FILTER_GZIP,
-               CamelMimeFilterGZipPrivate);
+       mime_filter->priv = CAMEL_MIME_FILTER_GZIP_GET_PRIVATE (mime_filter);
        mime_filter->priv->stream = g_new0 (z_stream, 1);
        mime_filter->priv->crc32 = crc32 (0, Z_NULL, 0);
 }
@@ -466,7 +468,7 @@ camel_mime_filter_gzip_new (CamelMimeFilterGZipMode mode,
        gint retval;
 
        new = g_object_new (CAMEL_TYPE_MIME_FILTER_GZIP, NULL);
-       priv = CAMEL_MIME_FILTER_GZIP (new)->priv;
+       priv = CAMEL_MIME_FILTER_GZIP_GET_PRIVATE (new);
 
        priv->mode = mode;
        priv->level = level;
index 40032a2..4c6c48f 100644 (file)
 
 #define d(x)
 
+#define CAMEL_MIME_FILTER_HTML_GET_PRIVATE(obj) \
+       (G_TYPE_INSTANCE_GET_PRIVATE \
+       ((obj), CAMEL_TYPE_MIME_FILTER_HTML, CamelMimeFilterHTMLPrivate))
+
 struct _CamelMimeFilterHTMLPrivate {
        CamelHTMLParser *ctxt;
 };
@@ -78,7 +82,7 @@ mime_filter_html_run (CamelMimeFilter *mime_filter,
        camel_html_parser_t state;
        gchar *outp;
 
-       priv = CAMEL_MIME_FILTER_HTML (mime_filter)->priv;
+       priv = CAMEL_MIME_FILTER_HTML_GET_PRIVATE (mime_filter);
 
        d(printf("converting html:\n%.*s\n", (gint)inlen, in));
 
@@ -120,7 +124,7 @@ mime_filter_html_dispose (GObject *object)
 {
        CamelMimeFilterHTMLPrivate *priv;
 
-       priv = CAMEL_MIME_FILTER_HTML (object)->priv;
+       priv = CAMEL_MIME_FILTER_HTML_GET_PRIVATE (object);
 
        if (priv->ctxt != NULL) {
                g_object_unref (priv->ctxt);
@@ -164,7 +168,7 @@ mime_filter_html_reset (CamelMimeFilter *mime_filter)
 {
        CamelMimeFilterHTMLPrivate *priv;
 
-       priv = CAMEL_MIME_FILTER_HTML (mime_filter)->priv;
+       priv = CAMEL_MIME_FILTER_HTML_GET_PRIVATE (mime_filter);
 
        g_object_unref (priv->ctxt);
        priv->ctxt = camel_html_parser_new ();
@@ -190,9 +194,7 @@ camel_mime_filter_html_class_init (CamelMimeFilterHTMLClass *class)
 static void
 camel_mime_filter_html_init (CamelMimeFilterHTML *mime_filter)
 {
-       mime_filter->priv = G_TYPE_INSTANCE_GET_PRIVATE (
-               mime_filter, CAMEL_TYPE_MIME_FILTER_HTML,
-               CamelMimeFilterHTMLPrivate);
+       mime_filter->priv = CAMEL_MIME_FILTER_HTML_GET_PRIVATE (mime_filter);
        mime_filter->priv->ctxt = camel_html_parser_new ();
 }
 
index cd5f654..fc0a29a 100644 (file)
 #include "camel-mime-filter-index.h"
 #include "camel-text-index.h"
 
+#define CAMEL_MIME_FILTER_INDEX_GET_PRIVATE(obj) \
+       (G_TYPE_INSTANCE_GET_PRIVATE \
+       ((obj), CAMEL_TYPE_MIME_FILTER_INDEX, CamelMimeFilterIndexPrivate))
+
 struct _CamelMimeFilterIndexPrivate {
        CamelIndex *index;
        CamelIndexName *name;
@@ -33,7 +37,7 @@ mime_filter_index_dispose (GObject *object)
 {
        CamelMimeFilterIndexPrivate *priv;
 
-       priv = CAMEL_MIME_FILTER_INDEX (object)->priv;
+       priv = CAMEL_MIME_FILTER_INDEX_GET_PRIVATE (object);
 
        if (priv->name != NULL) {
                g_object_unref (priv->name);
@@ -60,7 +64,7 @@ mime_filter_index_filter (CamelMimeFilter *mime_filter,
 {
        CamelMimeFilterIndexPrivate *priv;
 
-       priv = CAMEL_MIME_FILTER_INDEX (mime_filter)->priv;
+       priv = CAMEL_MIME_FILTER_INDEX_GET_PRIVATE (mime_filter);
 
        if (priv->index == NULL || priv->name == NULL) {
                goto donothing;
@@ -85,7 +89,7 @@ mime_filter_index_complete (CamelMimeFilter *mime_filter,
 {
        CamelMimeFilterIndexPrivate *priv;
 
-       priv = CAMEL_MIME_FILTER_INDEX (mime_filter)->priv;
+       priv = CAMEL_MIME_FILTER_INDEX_GET_PRIVATE (mime_filter);
 
        if (priv->index == NULL || priv->name == NULL) {
                goto donothing;
@@ -119,9 +123,7 @@ camel_mime_filter_index_class_init (CamelMimeFilterIndexClass *class)
 static void
 camel_mime_filter_index_init (CamelMimeFilterIndex *filter)
 {
-       filter->priv = G_TYPE_INSTANCE_GET_PRIVATE (
-               filter, CAMEL_TYPE_MIME_FILTER_INDEX,
-               CamelMimeFilterIndexPrivate);
+       filter->priv = CAMEL_MIME_FILTER_INDEX_GET_PRIVATE (filter);
 }
 
 /**
@@ -135,17 +137,17 @@ camel_mime_filter_index_init (CamelMimeFilterIndex *filter)
 CamelMimeFilter *
 camel_mime_filter_index_new (CamelIndex *index)
 {
-       CamelMimeFilter *res;
+       CamelMimeFilter *new;
        CamelMimeFilterIndexPrivate *priv;
 
-       res = g_object_new (CAMEL_TYPE_MIME_FILTER_INDEX, NULL);
+       new = g_object_new (CAMEL_TYPE_MIME_FILTER_INDEX, NULL);
 
-       priv = CAMEL_MIME_FILTER_INDEX (res)->priv;
-       priv->index = index;
-       if (index)
-               g_object_ref (index);
+       priv = CAMEL_MIME_FILTER_INDEX_GET_PRIVATE (new);
+
+       if (index != NULL)
+               priv->index = g_object_ref (index);
 
-       return res;
+       return new;
 }
 
 /* Set the match name for any indexed words */
index 253f4a7..0449d89 100644 (file)
 
 #include "camel-mime-filter-linewrap.h"
 
+#define CAMEL_MIME_FILTER_LINEWRAP_GET_PRIVATE(obj) \
+       (G_TYPE_INSTANCE_GET_PRIVATE \
+       ((obj), CAMEL_TYPE_MIME_FILTER_LINEWRAP, CamelMimeFilterLinewrapPrivate))
+
 struct _CamelMimeFilterLinewrapPrivate {
        guint wrap_len;
        guint max_len;
@@ -51,7 +55,7 @@ mime_filter_linewrap_filter (CamelMimeFilter *mime_filter,
        const gchar *inend, *p;
        gint nchars;
 
-       priv = CAMEL_MIME_FILTER_LINEWRAP (mime_filter)->priv;
+       priv = CAMEL_MIME_FILTER_LINEWRAP_GET_PRIVATE (mime_filter);
 
        nchars = priv->nchars;
 
@@ -154,7 +158,7 @@ mime_filter_linewrap_reset (CamelMimeFilter *mime_filter)
 {
        CamelMimeFilterLinewrapPrivate *priv;
 
-       priv = CAMEL_MIME_FILTER_LINEWRAP (mime_filter)->priv;
+       priv = CAMEL_MIME_FILTER_LINEWRAP_GET_PRIVATE (mime_filter);
 
        priv->nchars = 0;
 }
@@ -175,9 +179,7 @@ camel_mime_filter_linewrap_class_init (CamelMimeFilterLinewrapClass *class)
 static void
 camel_mime_filter_linewrap_init (CamelMimeFilterLinewrap *filter)
 {
-       filter->priv = G_TYPE_INSTANCE_GET_PRIVATE (
-               filter, CAMEL_TYPE_MIME_FILTER_LINEWRAP,
-               CamelMimeFilterLinewrapPrivate);
+       filter->priv = CAMEL_MIME_FILTER_LINEWRAP_GET_PRIVATE (filter);
 }
 
 CamelMimeFilter *
@@ -190,7 +192,7 @@ camel_mime_filter_linewrap_new (guint preferred_len,
        CamelMimeFilterLinewrapPrivate *priv;
 
        filter = g_object_new (CAMEL_TYPE_MIME_FILTER_LINEWRAP, NULL);
-       priv = CAMEL_MIME_FILTER_LINEWRAP (filter)->priv;
+       priv = CAMEL_MIME_FILTER_LINEWRAP_GET_PRIVATE (filter);
 
        priv->indent = indent_char;
        priv->wrap_len = preferred_len;
index 6468585..a85e734 100644 (file)
 
 #include "camel-mime-filter-pgp.h"
 
+#define CAMEL_MIME_FILTER_PGP_GET_PRIVATE(obj) \
+       (G_TYPE_INSTANCE_GET_PRIVATE \
+       ((obj), CAMEL_TYPE_MIME_FILTER_PGP, CamelMimeFilterPgpPrivate))
+
 #define BEGIN_PGP_SIGNED_MESSAGE "-----BEGIN PGP SIGNED MESSAGE-----"
 #define BEGIN_PGP_SIGNATURE      "-----BEGIN PGP SIGNATURE-----"
 #define END_PGP_SIGNATURE        "-----END PGP SIGNATURE-----"
@@ -70,7 +74,7 @@ mime_filter_pgp_run (CamelMimeFilter *mime_filter,
        gboolean blank;
        gsize len;
 
-       priv = CAMEL_MIME_FILTER_PGP (mime_filter)->priv;
+       priv = CAMEL_MIME_FILTER_PGP_GET_PRIVATE (mime_filter);
 
        /* only need as much space as the input, we're stripping chars */
        camel_mime_filter_set_size (mime_filter, inlen, FALSE);
@@ -179,7 +183,7 @@ mime_filter_pgp_reset (CamelMimeFilter *mime_filter)
 {
        CamelMimeFilterPgpPrivate *priv;
 
-       priv = CAMEL_MIME_FILTER_PGP (mime_filter)->priv;
+       priv = CAMEL_MIME_FILTER_PGP_GET_PRIVATE (mime_filter);
 
        priv->state = PGP_PREFACE;
 }
@@ -200,9 +204,7 @@ camel_mime_filter_pgp_class_init (CamelMimeFilterPgpClass *class)
 static void
 camel_mime_filter_pgp_init (CamelMimeFilterPgp *filter)
 {
-       filter->priv = G_TYPE_INSTANCE_GET_PRIVATE (
-               filter, CAMEL_TYPE_MIME_FILTER_PGP,
-               CamelMimeFilterPgpPrivate);
+       filter->priv = CAMEL_MIME_FILTER_PGP_GET_PRIVATE (filter);
 }
 
 CamelMimeFilter *
index e44271b..109b3bc 100644 (file)
 #include "camel-mime-filter-progress.h"
 #include "camel-operation.h"
 
+#define CAMEL_MIME_FILTER_PROGRESS_GET_PRIVATE(obj) \
+       (G_TYPE_INSTANCE_GET_PRIVATE \
+       ((obj), CAMEL_TYPE_MIME_FILTER_PROGRESS, CamelMimeFilterProgressPrivate))
+
 #define d(x)
 #define w(x)
 
@@ -46,7 +50,7 @@ mime_filter_progress_dispose (GObject *object)
 {
        CamelMimeFilterProgressPrivate *priv;
 
-       priv = CAMEL_MIME_FILTER_PROGRESS (object)->priv;
+       priv = CAMEL_MIME_FILTER_PROGRESS_GET_PRIVATE (object);
 
        if (priv->cancellable != NULL) {
                g_object_unref (priv->cancellable);
@@ -69,7 +73,7 @@ mime_filter_progress_filter (CamelMimeFilter *mime_filter,
        CamelMimeFilterProgressPrivate *priv;
        gdouble percent;
 
-       priv = CAMEL_MIME_FILTER_PROGRESS (mime_filter)->priv;
+       priv = CAMEL_MIME_FILTER_PROGRESS_GET_PRIVATE (mime_filter);
        priv->count += len;
 
        if (priv->count < priv->total)
@@ -103,7 +107,7 @@ mime_filter_progress_reset (CamelMimeFilter *mime_filter)
 {
        CamelMimeFilterProgressPrivate *priv;
 
-       priv = CAMEL_MIME_FILTER_PROGRESS (mime_filter)->priv;
+       priv = CAMEL_MIME_FILTER_PROGRESS_GET_PRIVATE (mime_filter);
 
        priv->count = 0;
 }
@@ -128,9 +132,7 @@ camel_mime_filter_progress_class_init (CamelMimeFilterProgressClass *class)
 static void
 camel_mime_filter_progress_init (CamelMimeFilterProgress *filter)
 {
-       filter->priv = G_TYPE_INSTANCE_GET_PRIVATE (
-               filter, CAMEL_TYPE_MIME_FILTER_PROGRESS,
-               CamelMimeFilterProgressPrivate);
+       filter->priv = CAMEL_MIME_FILTER_PROGRESS_GET_PRIVATE (filter);
 }
 
 /**
@@ -155,7 +157,7 @@ camel_mime_filter_progress_new (GCancellable *cancellable,
        CamelMimeFilterProgressPrivate *priv;
 
        filter = g_object_new (CAMEL_TYPE_MIME_FILTER_PROGRESS, NULL);
-       priv = CAMEL_MIME_FILTER_PROGRESS (filter)->priv;
+       priv = CAMEL_MIME_FILTER_PROGRESS_GET_PRIVATE (filter);
 
        if (CAMEL_IS_OPERATION (cancellable))
                priv->cancellable = g_object_ref (cancellable);
index 2604f39..b7092f1 100644 (file)
 #include "camel-mime-filter-save.h"
 #include "camel-stream-mem.h"
 
+#define CAMEL_MIME_FILTER_SAVE_GET_PRIVATE(obj) \
+       (G_TYPE_INSTANCE_GET_PRIVATE \
+       ((obj), CAMEL_TYPE_MIME_FILTER_SAVE, CamelMimeFilterSavePrivate))
+
 struct _CamelMimeFilterSavePrivate {
        CamelStream *stream;
 };
@@ -44,7 +48,7 @@ mime_filter_save_filter (CamelMimeFilter *mime_filter,
 {
        CamelMimeFilterSavePrivate *priv;
 
-       priv = CAMEL_MIME_FILTER_SAVE (mime_filter)->priv;
+       priv = CAMEL_MIME_FILTER_SAVE_GET_PRIVATE (mime_filter);
 
        if (priv->stream != NULL)
                camel_stream_write (priv->stream, in, len, NULL, NULL);
@@ -91,9 +95,7 @@ camel_mime_filter_save_class_init (CamelMimeFilterSaveClass *class)
 static void
 camel_mime_filter_save_init (CamelMimeFilterSave *filter)
 {
-       filter->priv = G_TYPE_INSTANCE_GET_PRIVATE (
-               filter, CAMEL_TYPE_MIME_FILTER_SAVE,
-               CamelMimeFilterSavePrivate);
+       filter->priv = CAMEL_MIME_FILTER_SAVE_GET_PRIVATE (filter);
 }
 
 /**
@@ -115,7 +117,7 @@ camel_mime_filter_save_new (CamelStream *stream)
                g_return_val_if_fail (CAMEL_IS_STREAM (stream), NULL);
 
        filter = g_object_new (CAMEL_TYPE_MIME_FILTER_SAVE, NULL);
-       priv = CAMEL_MIME_FILTER_SAVE (filter)->priv;
+       priv = CAMEL_MIME_FILTER_SAVE_GET_PRIVATE (filter);
 
        if (stream != NULL)
                priv->stream = g_object_ref (stream);
index bd38d20..3314f1a 100644 (file)
 #include "camel-url-scanner.h"
 #include "camel-utf8.h"
 
+#define CAMEL_MIME_FILTER_TOHTML_GET_PRIVATE(obj) \
+       (G_TYPE_INSTANCE_GET_PRIVATE \
+       ((obj), CAMEL_TYPE_MIME_FILTER_TOHTML, CamelMimeFilterToHTMLPrivate))
+
 struct _CamelMimeFilterToHTMLPrivate {
 
        CamelUrlScanner *scanner;
@@ -156,7 +160,7 @@ writeln (CamelMimeFilter *mime_filter,
        CamelMimeFilterToHTMLPrivate *priv;
        const guchar *inptr = in;
 
-       priv = CAMEL_MIME_FILTER_TOHTML (mime_filter)->priv;
+       priv = CAMEL_MIME_FILTER_TOHTML_GET_PRIVATE (mime_filter);
 
        while (inptr < inend) {
                guint32 u;
@@ -236,7 +240,7 @@ html_convert (CamelMimeFilter *mime_filter,
        const gchar *inend;
        gint depth;
 
-       priv = CAMEL_MIME_FILTER_TOHTML (mime_filter)->priv;
+       priv = CAMEL_MIME_FILTER_TOHTML_GET_PRIVATE (mime_filter);
 
        if (inlen == 0) {
                if (priv->pre_open) {
@@ -394,7 +398,7 @@ mime_filter_tohtml_finalize (GObject *object)
 {
        CamelMimeFilterToHTMLPrivate *priv;
 
-       priv = CAMEL_MIME_FILTER_TOHTML (object)->priv;
+       priv = CAMEL_MIME_FILTER_TOHTML_GET_PRIVATE (object);
 
        camel_url_scanner_free (priv->scanner);
 
@@ -435,7 +439,7 @@ mime_filter_tohtml_reset (CamelMimeFilter *mime_filter)
 {
        CamelMimeFilterToHTMLPrivate *priv;
 
-       priv = CAMEL_MIME_FILTER_TOHTML (mime_filter)->priv;
+       priv = CAMEL_MIME_FILTER_TOHTML_GET_PRIVATE (mime_filter);
 
        priv->column = 0;
        priv->pre_open = FALSE;
@@ -461,9 +465,7 @@ camel_mime_filter_tohtml_class_init (CamelMimeFilterToHTMLClass *class)
 static void
 camel_mime_filter_tohtml_init (CamelMimeFilterToHTML *filter)
 {
-       filter->priv = G_TYPE_INSTANCE_GET_PRIVATE (
-               filter, CAMEL_TYPE_MIME_FILTER_TOHTML,
-               CamelMimeFilterToHTMLPrivate);
+       filter->priv = CAMEL_MIME_FILTER_TOHTML_GET_PRIVATE (filter);
        filter->priv->scanner = camel_url_scanner_new ();
 }
 
@@ -486,7 +488,7 @@ camel_mime_filter_tohtml_new (guint32 flags,
        gint i;
 
        filter = g_object_new (CAMEL_TYPE_MIME_FILTER_TOHTML, NULL);
-       priv = CAMEL_MIME_FILTER_TOHTML (filter)->priv;
+       priv = CAMEL_MIME_FILTER_TOHTML_GET_PRIVATE (filter);
 
        priv->flags = flags;
        priv->color = color;
index cfaf797..0f62acf 100644 (file)
 #include "camel-charset-map.h"
 #include "camel-mime-filter-windows.h"
 
+#define CAMEL_MIME_FILTER_WINDOWS_GET_PRIVATE(obj) \
+       (G_TYPE_INSTANCE_GET_PRIVATE \
+       ((obj), CAMEL_TYPE_MIME_FILTER_WINDOWS, CamelMimeFilterWindowsPrivate))
+
 #define d(x)
 #define w(x)
 
@@ -46,7 +50,7 @@ mime_filter_windows_finalize (GObject *object)
 {
        CamelMimeFilterWindowsPrivate *priv;
 
-       priv = CAMEL_MIME_FILTER_WINDOWS (object)->priv;
+       priv = CAMEL_MIME_FILTER_WINDOWS_GET_PRIVATE (object);
 
        g_free (priv->claimed_charset);
 
@@ -67,7 +71,7 @@ mime_filter_windows_filter (CamelMimeFilter *mime_filter,
        register guchar *inptr;
        guchar *inend;
 
-       priv = CAMEL_MIME_FILTER_WINDOWS (mime_filter)->priv;
+       priv = CAMEL_MIME_FILTER_WINDOWS_GET_PRIVATE (mime_filter);
 
        if (!priv->is_windows) {
                inptr = (guchar *) in;
@@ -109,7 +113,7 @@ mime_filter_windows_reset (CamelMimeFilter *mime_filter)
 {
        CamelMimeFilterWindowsPrivate *priv;
 
-       priv = CAMEL_MIME_FILTER_WINDOWS (mime_filter)->priv;
+       priv = CAMEL_MIME_FILTER_WINDOWS_GET_PRIVATE (mime_filter);
 
        priv->is_windows = FALSE;
 }
@@ -134,9 +138,7 @@ camel_mime_filter_windows_class_init (CamelMimeFilterWindowsClass *class)
 static void
 camel_mime_filter_windows_init (CamelMimeFilterWindows *filter)
 {
-       filter->priv = G_TYPE_INSTANCE_GET_PRIVATE (
-               filter, CAMEL_TYPE_MIME_FILTER_WINDOWS,
-               CamelMimeFilterWindowsPrivate);
+       filter->priv = CAMEL_MIME_FILTER_WINDOWS_GET_PRIVATE (filter);
 }
 
 /**
@@ -157,7 +159,7 @@ camel_mime_filter_windows_new (const gchar *claimed_charset)
        g_return_val_if_fail (claimed_charset != NULL, NULL);
 
        filter = g_object_new (CAMEL_TYPE_MIME_FILTER_WINDOWS, NULL);
-       priv = CAMEL_MIME_FILTER_WINDOWS (filter)->priv;
+       priv = CAMEL_MIME_FILTER_WINDOWS_GET_PRIVATE (filter);
 
        priv->claimed_charset = g_strdup (claimed_charset);
 
index 5e2be48..89e868e 100644 (file)
 
 #include "camel-mime-filter-yenc.h"
 
+#define CAMEL_MIME_FILTER_YENC_GET_PRIVATE(obj) \
+       (G_TYPE_INSTANCE_GET_PRIVATE \
+       ((obj), CAMEL_TYPE_MIME_FILTER_YENC, CamelMimeFilterYencPrivate))
+
 struct _CamelMimeFilterYencPrivate {
 
        CamelMimeFilterYencDirection direction;
@@ -54,7 +58,7 @@ mime_filter_yenc_filter (CamelMimeFilter *mime_filter,
        CamelMimeFilterYencPrivate *priv;
        gsize newlen = 0;
 
-       priv = CAMEL_MIME_FILTER_YENC (mime_filter)->priv;
+       priv = CAMEL_MIME_FILTER_YENC_GET_PRIVATE (mime_filter);
 
        switch (priv->direction) {
                case CAMEL_MIME_FILTER_YENC_DIRECTION_ENCODE:
@@ -163,7 +167,7 @@ mime_filter_yenc_complete (CamelMimeFilter *mime_filter,
        CamelMimeFilterYencPrivate *priv;
        gsize newlen = 0;
 
-       priv = CAMEL_MIME_FILTER_YENC (mime_filter)->priv;
+       priv = CAMEL_MIME_FILTER_YENC_GET_PRIVATE (mime_filter);
 
        switch (priv->direction) {
        case CAMEL_MIME_FILTER_YENC_DIRECTION_ENCODE:
@@ -205,7 +209,7 @@ mime_filter_yenc_reset (CamelMimeFilter *mime_filter)
 {
        CamelMimeFilterYencPrivate *priv;
 
-       priv = CAMEL_MIME_FILTER_YENC (mime_filter)->priv;
+       priv = CAMEL_MIME_FILTER_YENC_GET_PRIVATE (mime_filter);
 
        switch (priv->direction) {
                case CAMEL_MIME_FILTER_YENC_DIRECTION_ENCODE:
@@ -236,9 +240,7 @@ camel_mime_filter_yenc_class_init (CamelMimeFilterYencClass *class)
 static void
 camel_mime_filter_yenc_init (CamelMimeFilterYenc *filter)
 {
-       filter->priv = G_TYPE_INSTANCE_GET_PRIVATE (
-               filter, CAMEL_TYPE_MIME_FILTER_YENC,
-               CamelMimeFilterYencPrivate);
+       filter->priv = CAMEL_MIME_FILTER_YENC_GET_PRIVATE (filter);
 
        filter->priv->part = 0;
        filter->priv->pcrc = CAMEL_MIME_YENCODE_CRC_INIT;
@@ -260,7 +262,7 @@ camel_mime_filter_yenc_new (CamelMimeFilterYencDirection direction)
        CamelMimeFilterYencPrivate *priv;
 
        filter = g_object_new (CAMEL_TYPE_MIME_FILTER_YENC, NULL);
-       priv = CAMEL_MIME_FILTER_YENC (filter)->priv;
+       priv = CAMEL_MIME_FILTER_YENC_GET_PRIVATE (filter);
 
        priv->direction = direction;
 
index 93cd464..a170518 100644 (file)
 #include <mcheck.h>
 #endif
 
+#define CAMEL_MIME_FILTER_GET_PRIVATE(obj) \
+       (G_TYPE_INSTANCE_GET_PRIVATE \
+       ((obj), CAMEL_TYPE_MIME_FILTER, CamelMimeFilterPrivate))
+
 struct _CamelMimeFilterPrivate {
        gchar *inbuf;
        gsize inlen;
@@ -82,8 +86,7 @@ camel_mime_filter_class_init (CamelMimeFilterClass *class)
 static void
 camel_mime_filter_init (CamelMimeFilter *mime_filter)
 {
-       mime_filter->priv = G_TYPE_INSTANCE_GET_PRIVATE (
-               mime_filter, CAMEL_TYPE_MIME_FILTER, CamelMimeFilterPrivate);
+       mime_filter->priv = CAMEL_MIME_FILTER_GET_PRIVATE (mime_filter);
 
        mime_filter->outreal = NULL;
        mime_filter->outbuf = NULL;
@@ -148,7 +151,7 @@ static void filter_run (CamelMimeFilter *f,
                struct _CamelMimeFilterPrivate *p;
                gint newlen;
 
-               p = f->priv;
+               p = CAMEL_MIME_FILTER_GET_PRIVATE (f);
 
                newlen = len + prespace + f->backlen;
                if (p->inlen < newlen) {
index 655c39d..f90ae6e 100644 (file)
@@ -60,7 +60,7 @@ gint inend_id = -1,
 
 /* a little hacky, but i couldn't be bothered renaming everything */
 #define _header_scan_state _CamelMimeParserPrivate
-#define _PRIVATE(o) (((CamelMimeParser *)(o))->priv)
+#define _PRIVATE(obj) (((CamelMimeParser *)(obj))->priv)
 
 struct _header_scan_state {
 
@@ -1711,7 +1711,6 @@ tail_recurse:
                                while (f) {
                                        camel_mime_filter_filter (f->filter, *databuffer, *datalength, presize,
                                                                 databuffer, datalength, &presize);
-                                       d(printf("Filtered content (%s): '", ((CamelObject *)f->filter)->klass->name));
                                        d (fwrite (*databuffer, sizeof (gchar), *datalength, stdout));
                                        d(printf("'\n"));
                                        f = f->next;
index 7091d04..1d4d2cd 100644 (file)
 
 #define d(x) /*(printf("%s(%d): ", __FILE__, __LINE__),(x))*/
 
+#define CAMEL_MIME_PART_GET_PRIVATE(obj) \
+       (G_TYPE_INSTANCE_GET_PRIVATE \
+       ((obj), CAMEL_TYPE_MIME_PART, CamelMimePartPrivate))
+
 typedef struct _AsyncContext AsyncContext;
 
 struct _CamelMimePartPrivate {
@@ -398,7 +402,7 @@ mime_part_finalize (GObject *object)
 {
        CamelMimePartPrivate *priv;
 
-       priv = CAMEL_MIME_PART (object)->priv;
+       priv = CAMEL_MIME_PART_GET_PRIVATE (object);
 
        g_free (priv->description);
        g_free (priv->content_id);
@@ -920,8 +924,7 @@ camel_mime_part_init (CamelMimePart *mime_part)
 {
        CamelDataWrapper *data_wrapper;
 
-       mime_part->priv = G_TYPE_INSTANCE_GET_PRIVATE (
-               mime_part, CAMEL_TYPE_MIME_PART, CamelMimePartPrivate);
+       mime_part->priv = CAMEL_MIME_PART_GET_PRIVATE (mime_part);
        mime_part->priv->encoding = CAMEL_TRANSFER_ENCODING_DEFAULT;
 
        data_wrapper = CAMEL_DATA_WRAPPER (mime_part);
index 1d620df..f848823 100644 (file)
@@ -881,7 +881,7 @@ camel_iconv_strndup (iconv_t cd,
        while (iconv (cd, NULL, NULL, &outbuf, &outleft) == (gsize) -1) {
                if (errno != E2BIG)
                        break;
-               
+
                outlen += 16;
                converted = outbuf - out;
                out = g_realloc (out, outlen + 4);
@@ -982,14 +982,14 @@ decode_8bit (const gchar *text,
                while ((rc = iconv (cd, NULL, NULL, &outbuf, &outleft)) == (gsize) -1) {
                        if (errno != E2BIG)
                                break;
-                       
+
                        outlen += 16;
                        rc = (gsize) (outbuf - out);
                        out = g_realloc (out, outlen + 1);
                        outleft = outlen - rc;
                        outbuf = out + rc;
                }
-               
+
                *outbuf = '\0';
 
                camel_iconv_close (cd);
@@ -1059,7 +1059,7 @@ decode_8bit (const gchar *text,
        while ((rc = iconv (cd, NULL, NULL, &outbuf, &outleft)) == (gsize) -1) {
                if (errno != E2BIG)
                        break;
-               
+
                outlen += 16;
                rc = (gsize) (outbuf - out);
                out = g_realloc (out, outlen + 1);
index b4a9da6..a904bf7 100644 (file)
@@ -88,8 +88,8 @@ key_reservation_free (CamelObjectBag *bag,
 
 static void
 object_bag_toggle_notify (gpointer user_data,
-                         GObject *object,
-                         gboolean is_last_ref)
+                          GObject *object,
+                          gboolean is_last_ref)
 {
        CamelObjectBag *bag = user_data;
        gpointer key;
@@ -113,8 +113,8 @@ object_bag_toggle_notify (gpointer user_data,
 
 static void
 object_bag_toggle_unref (gpointer key,
-                        GObject *object,
-                        CamelObjectBag *bag)
+                         GObject *object,
+                         CamelObjectBag *bag)
 {
        g_object_remove_toggle_ref (object, object_bag_toggle_notify, bag);
 }
index ede155b..d3a00c1 100644 (file)
 
 #define d(x)
 
+#define CAMEL_OBJECT_GET_PRIVATE(obj) \
+       (G_TYPE_INSTANCE_GET_PRIVATE \
+       ((obj), CAMEL_TYPE_OBJECT, CamelObjectPrivate))
+
 struct _CamelObjectPrivate {
        gchar *state_filename;
 };
@@ -127,7 +131,7 @@ object_finalize (GObject *object)
 {
        CamelObjectPrivate *priv;
 
-       priv = CAMEL_OBJECT (object)->priv;
+       priv = CAMEL_OBJECT_GET_PRIVATE (object);
 
        g_free (priv->state_filename);
 
@@ -358,8 +362,7 @@ camel_object_class_init (CamelObjectClass *class)
 static void
 camel_object_init (CamelObject *object)
 {
-       object->priv = G_TYPE_INSTANCE_GET_PRIVATE (
-               object, CAMEL_TYPE_OBJECT, CamelObjectPrivate);
+       object->priv = CAMEL_OBJECT_GET_PRIVATE (object);
 }
 
 GQuark
index 82d46f7..0f16d7b 100644 (file)
 #include "camel-operation.h"
 #include "camel-session.h"
 
+#define CAMEL_OFFLINE_FOLDER_GET_PRIVATE(obj) \
+       (G_TYPE_INSTANCE_GET_PRIVATE \
+       ((obj), CAMEL_TYPE_OFFLINE_FOLDER, CamelOfflineFolderPrivate))
+
 typedef struct _AsyncContext AsyncContext;
 typedef struct _OfflineDownsyncData OfflineDownsyncData;
 
@@ -329,8 +333,7 @@ camel_offline_folder_class_init (CamelOfflineFolderClass *class)
 static void
 camel_offline_folder_init (CamelOfflineFolder *folder)
 {
-       folder->priv = G_TYPE_INSTANCE_GET_PRIVATE (
-               folder, CAMEL_TYPE_OFFLINE_FOLDER, CamelOfflineFolderPrivate);
+       folder->priv = CAMEL_OFFLINE_FOLDER_GET_PRIVATE (folder);
 
        g_signal_connect (
                folder, "changed",
index b7a0f22..06107be 100644 (file)
 #include "camel-msgport.h"
 #include "camel-operation.h"
 
+#define CAMEL_OPERATION_GET_PRIVATE(obj) \
+       (G_TYPE_INSTANCE_GET_PRIVATE \
+       ((obj), CAMEL_TYPE_OPERATION, CamelOperationPrivate))
+
 #define PROGRESS_DELAY         250  /* milliseconds */
 #define TRANSIENT_DELAY                250  /* milliseconds */
 #define POP_MESSAGE_DELAY      999  /* milliseconds */
@@ -136,7 +140,7 @@ operation_finalize (GObject *object)
 {
        CamelOperationPrivate *priv;
 
-       priv = CAMEL_OPERATION (object)->priv;
+       priv = CAMEL_OPERATION_GET_PRIVATE (object);
 
        LOCK ();
 
@@ -178,8 +182,7 @@ camel_operation_class_init (CamelOperationClass *class)
 static void
 camel_operation_init (CamelOperation *operation)
 {
-       operation->priv = G_TYPE_INSTANCE_GET_PRIVATE (
-               operation, CAMEL_TYPE_OPERATION, CamelOperationPrivate);
+       operation->priv = CAMEL_OPERATION_GET_PRIVATE (operation);
 
        g_queue_init (&operation->priv->status_stack);
 
index c98fedf..2d1a611 100644 (file)
 /* key index debug */
 #define k(x) /*(printf ("%s (%d):%s: ",  __FILE__, __LINE__, __PRETTY_FUNCTION__),(x))*/
 
-#define CAMEL_PARTITION_TABLE_LOCK(kf, lock) (g_static_mutex_lock(&(kf)->priv->lock))
-#define CAMEL_PARTITION_TABLE_UNLOCK(kf, lock) (g_static_mutex_unlock(&(kf)->priv->lock))
+#define CAMEL_PARTITION_TABLE_LOCK(kf, lock) \
+       (g_static_mutex_lock (&(kf)->priv->lock))
+#define CAMEL_PARTITION_TABLE_UNLOCK(kf, lock) \
+       (g_static_mutex_unlock (&(kf)->priv->lock))
+
+#define CAMEL_PARTITION_TABLE_GET_PRIVATE(obj) \
+       (G_TYPE_INSTANCE_GET_PRIVATE \
+       ((obj), CAMEL_TYPE_PARTITION_TABLE, CamelPartitionTablePrivate))
 
 struct _CamelPartitionTablePrivate {
        GStaticMutex lock;      /* for locking partition */
@@ -87,8 +93,7 @@ camel_partition_table_class_init (CamelPartitionTableClass *class)
 static void
 camel_partition_table_init (CamelPartitionTable *cpi)
 {
-       cpi->priv = G_TYPE_INSTANCE_GET_PRIVATE (
-               cpi, CAMEL_TYPE_PARTITION_TABLE, CamelPartitionTablePrivate);
+       cpi->priv = CAMEL_PARTITION_TABLE_GET_PRIVATE (cpi);
 
        g_queue_init (&cpi->partition);
        g_static_mutex_init (&cpi->priv->lock);
@@ -612,8 +617,14 @@ fail:
 
 /* ********************************************************************** */
 
-#define CAMEL_KEY_TABLE_LOCK(kf, lock) (g_static_mutex_lock(&(kf)->priv->lock))
-#define CAMEL_KEY_TABLE_UNLOCK(kf, lock) (g_static_mutex_unlock(&(kf)->priv->lock))
+#define CAMEL_KEY_TABLE_GET_PRIVATE(obj) \
+       (G_TYPE_INSTANCE_GET_PRIVATE \
+       ((obj), CAMEL_TYPE_KEY_TABLE, CamelKeyTablePrivate))
+
+#define CAMEL_KEY_TABLE_LOCK(kf, lock) \
+       (g_static_mutex_lock (&(kf)->priv->lock))
+#define CAMEL_KEY_TABLE_UNLOCK(kf, lock) \
+       (g_static_mutex_unlock (&(kf)->priv->lock))
 
 struct _CamelKeyTablePrivate {
        GStaticMutex lock;      /* for locking key */
@@ -655,8 +666,7 @@ camel_key_table_class_init (CamelKeyTableClass *class)
 static void
 camel_key_table_init (CamelKeyTable *table)
 {
-       table->priv = G_TYPE_INSTANCE_GET_PRIVATE (
-               table, CAMEL_TYPE_KEY_TABLE, CamelKeyTablePrivate);
+       table->priv = CAMEL_KEY_TABLE_GET_PRIVATE (table);
        g_static_mutex_init (&table->priv->lock);
 }
 
index 505f83f..ebe4402 100644 (file)
 #include "camel-sasl-cram-md5.h"
 #include "camel-service.h"
 
+#define CAMEL_SASL_CRAM_MD5_GET_PRIVATE(obj) \
+       (G_TYPE_INSTANCE_GET_PRIVATE \
+       ((obj), CAMEL_TYPE_SASL_CRAM_MD5, CamelSaslCramMd5Private))
+
 struct _CamelSaslCramMd5Private {
        gint placeholder;  /* allow for future expansion */
 };
@@ -157,6 +161,5 @@ camel_sasl_cram_md5_class_init (CamelSaslCramMd5Class *class)
 static void
 camel_sasl_cram_md5_init (CamelSaslCramMd5 *sasl)
 {
-       sasl->priv = G_TYPE_INSTANCE_GET_PRIVATE (
-               sasl, CAMEL_TYPE_SASL_CRAM_MD5, CamelSaslCramMd5Private);
+       sasl->priv = CAMEL_SASL_CRAM_MD5_GET_PRIVATE (sasl);
 }
index f36306b..cb48b28 100644 (file)
 
 #define PARANOID(x) x
 
+#define CAMEL_SASL_DIGEST_MD5_GET_PRIVATE(obj) \
+       (G_TYPE_INSTANCE_GET_PRIVATE \
+       ((obj), CAMEL_TYPE_SASL_DIGEST_MD5, CamelSaslDigestMd5Private))
+
 /* Implements rfc2831 */
 
 static CamelServiceAuthType sasl_digest_md5_auth_type = {
@@ -973,6 +977,5 @@ camel_sasl_digest_md5_class_init (CamelSaslDigestMd5Class *class)
 static void
 camel_sasl_digest_md5_init (CamelSaslDigestMd5 *sasl)
 {
-       sasl->priv = G_TYPE_INSTANCE_GET_PRIVATE (
-               sasl, CAMEL_TYPE_SASL_DIGEST_MD5, CamelSaslDigestMd5Private);
+       sasl->priv = CAMEL_SASL_DIGEST_MD5_GET_PRIVATE (sasl);
 }
index 7f03b9c..62c8885 100644 (file)
@@ -75,6 +75,10 @@ extern gss_OID gss_nt_service_name;
 #endif /* HAVE_SUN_KRB5 */
 #endif /* HAVE_HEIMDAL_KRB5 */
 
+#define CAMEL_SASL_GSSAPI_GET_PRIVATE(obj) \
+       (G_TYPE_INSTANCE_GET_PRIVATE \
+       ((obj), CAMEL_TYPE_SASL_GSSAPI, CamelSaslGssapiPrivate))
+
 #ifndef GSS_C_OID_KRBV5_DES
 #define GSS_C_OID_KRBV5_DES GSS_C_NO_OID
 #endif
@@ -283,7 +287,7 @@ sasl_gssapi_challenge_sync (CamelSasl *sasl,
        gchar *host;
        gchar *user;
 
-       priv = CAMEL_SASL_GSSAPI (sasl)->priv;
+       priv = CAMEL_SASL_GSSAPI_GET_PRIVATE (sasl);
 
        service = camel_sasl_get_service (sasl);
        service_name = camel_sasl_get_service_name (sasl);
@@ -474,8 +478,7 @@ static void
 camel_sasl_gssapi_init (CamelSaslGssapi *sasl)
 {
 #ifdef HAVE_KRB5
-       sasl->priv = G_TYPE_INSTANCE_GET_PRIVATE (
-               sasl, CAMEL_TYPE_SASL_GSSAPI, CamelSaslGssapiPrivate);
+       sasl->priv = CAMEL_SASL_GSSAPI_GET_PRIVATE (sasl);
        sasl->priv->state = GSSAPI_STATE_INIT;
        sasl->priv->ctx = GSS_C_NO_CONTEXT;
        sasl->priv->target = GSS_C_NO_NAME;
index 6d30340..a80b302 100644 (file)
 #include "camel-sasl-login.h"
 #include "camel-service.h"
 
+#define CAMEL_SASL_LOGIN_GET_PRIVATE(obj) \
+       (G_TYPE_INSTANCE_GET_PRIVATE \
+       ((obj), CAMEL_TYPE_SASL_LOGIN, CamelSaslLoginPrivate))
+
 static CamelServiceAuthType sasl_login_auth_type = {
        N_("Login"),
 
@@ -71,7 +75,7 @@ sasl_login_challenge_sync (CamelSasl *sasl,
        if (token == NULL)
                return NULL;
 
-       priv = CAMEL_SASL_LOGIN (sasl)->priv;
+       priv = CAMEL_SASL_LOGIN_GET_PRIVATE (sasl);
 
        service = camel_sasl_get_service (sasl);
 
@@ -125,6 +129,5 @@ camel_sasl_login_class_init (CamelSaslLoginClass *class)
 static void
 camel_sasl_login_init (CamelSaslLogin *sasl)
 {
-       sasl->priv = G_TYPE_INSTANCE_GET_PRIVATE (
-               sasl, CAMEL_TYPE_SASL_LOGIN, CamelSaslLoginPrivate);
+       sasl->priv = CAMEL_SASL_LOGIN_GET_PRIVATE (sasl);
 }
index 36b6784..4012b04 100644 (file)
 #include "camel-sasl-ntlm.h"
 #include "camel-stream-process.h"
 
+#define CAMEL_SASL_NTLM_GET_PRIVATE(obj) \
+       (G_TYPE_INSTANCE_GET_PRIVATE \
+       ((obj), CAMEL_TYPE_SASL_NTLM, CamelSaslNTLMPrivate))
+
 struct _CamelSaslNTLMPrivate {
        gint placeholder;  /* allow for future expansion */
 #ifndef G_OS_WIN32
@@ -981,6 +985,5 @@ camel_sasl_ntlm_class_init (CamelSaslNTLMClass *class)
 static void
 camel_sasl_ntlm_init (CamelSaslNTLM *sasl)
 {
-       sasl->priv = G_TYPE_INSTANCE_GET_PRIVATE (
-               sasl, CAMEL_TYPE_SASL_NTLM, CamelSaslNTLMPrivate);
+       sasl->priv = CAMEL_SASL_NTLM_GET_PRIVATE (sasl);
 }
index 740629b..1f04e48 100644 (file)
 #include "camel-sasl-plain.h"
 #include "camel-service.h"
 
+#define CAMEL_SASL_PLAIN_GET_PRIVATE(obj) \
+       (G_TYPE_INSTANCE_GET_PRIVATE \
+       ((obj), CAMEL_TYPE_SASL_PLAIN, CamelSaslPlainPrivate))
+
 struct _CamelSaslPlainPrivate {
        gint placeholder;  /* allow for future expansion */
 };
@@ -102,6 +106,5 @@ camel_sasl_plain_class_init (CamelSaslPlainClass *class)
 static void
 camel_sasl_plain_init (CamelSaslPlain *sasl)
 {
-       sasl->priv = G_TYPE_INSTANCE_GET_PRIVATE (
-               sasl, CAMEL_TYPE_SASL_PLAIN, CamelSaslPlainPrivate);
+       sasl->priv = CAMEL_SASL_PLAIN_GET_PRIVATE (sasl);
 }
index 1e915c7..48c0393 100644 (file)
 #include "camel-session.h"
 #include "camel-store.h"
 
+#define CAMEL_SASL_POPB4SMTP_GET_PRIVATE(obj) \
+       (G_TYPE_INSTANCE_GET_PRIVATE \
+       ((obj), CAMEL_TYPE_SASL_POPB4SMTP, CamelSaslPOPB4SMTPPrivate))
+
 struct _CamelSaslPOPB4SMTPPrivate {
        gint placeholder;  /* allow for future expansion */
 };
@@ -169,6 +173,5 @@ camel_sasl_popb4smtp_class_init (CamelSaslPOPB4SMTPClass *class)
 static void
 camel_sasl_popb4smtp_init (CamelSaslPOPB4SMTP *sasl)
 {
-       sasl->priv = G_TYPE_INSTANCE_GET_PRIVATE (
-               sasl, CAMEL_TYPE_SASL_POPB4SMTP, CamelSaslPOPB4SMTPPrivate);
+       sasl->priv = CAMEL_SASL_POPB4SMTP_GET_PRIVATE (sasl);
 }
index c0e4170..2a397d9 100644 (file)
 
 #define w(x)
 
+#define CAMEL_SASL_GET_PRIVATE(obj) \
+       (G_TYPE_INSTANCE_GET_PRIVATE \
+       ((obj), CAMEL_TYPE_SASL, CamelSaslPrivate))
+
 typedef struct _AsyncContext AsyncContext;
 
 struct _CamelSaslPrivate {
index 0d09cc3..585e7e2 100644 (file)
@@ -314,7 +314,7 @@ depunct_string (const gchar *str)
 
 static gboolean
 camel_uwordcase (const gchar *haystack,
-                const gchar *needle)
+                 const gchar *needle)
 {
        struct _camel_search_words *hwords, *nwords;
        gchar *copy_haystack, *copy_needle;
index b5e7090..f680305 100644 (file)
 
 typedef struct _AsyncContext AsyncContext;
 
+#define CAMEL_SERVICE_GET_PRIVATE(obj) \
+       (G_TYPE_INSTANCE_GET_PRIVATE \
+       ((obj), CAMEL_TYPE_SERVICE, CamelServicePrivate))
+
 struct _CamelServicePrivate {
        gpointer session;  /* weak pointer */
 
index ace0551..91c4f51 100644 (file)
 typedef struct _AsyncContext AsyncContext;
 typedef struct _JobData JobData;
 
+#define CAMEL_SESSION_GET_PRIVATE(obj) \
+       (G_TYPE_INSTANCE_GET_PRIVATE \
+       ((obj), CAMEL_TYPE_SESSION, CamelSessionPrivate))
+
 struct _CamelSessionPrivate {
        GMutex *lock;           /* for locking everything basically */
        GMutex *thread_lock;    /* locking threads */
@@ -1577,17 +1581,17 @@ camel_session_get_socks_proxy (CamelSession *session,
                                gchar **host_ret,
                                gint *port_ret)
 {
-       CamelSessionClass *klass;
+       CamelSessionClass *class;
 
        g_return_if_fail (CAMEL_IS_SESSION (session));
        g_return_if_fail (for_host != NULL);
        g_return_if_fail (host_ret != NULL);
        g_return_if_fail (port_ret != NULL);
 
-       klass = CAMEL_SESSION_GET_CLASS (session);
-       g_return_if_fail (klass->get_socks_proxy != NULL);
+       class = CAMEL_SESSION_GET_CLASS (session);
+       g_return_if_fail (class->get_socks_proxy != NULL);
 
-       klass->get_socks_proxy (session, for_host, host_ret, port_ret);
+       class->get_socks_proxy (session, for_host, host_ret, port_ret);
 }
 
 /**
index 31c8e2d..728de7b 100644 (file)
@@ -1471,7 +1471,6 @@ camel_sexp_finalize (GObject *object)
        G_OBJECT_CLASS (camel_sexp_parent_class)->finalize (object);
 }
 
-
 static void
 camel_sexp_class_init (CamelSExpClass *class)
 {
index 772d5e9..2464de5 100644 (file)
 
 #define d(x)
 
+#define CAMEL_SMIME_CONTEXT_GET_PRIVATE(obj) \
+       (G_TYPE_INSTANCE_GET_PRIVATE \
+       ((obj), CAMEL_TYPE_SMIME_CONTEXT, CamelSMIMEContextPrivate))
+
 struct _CamelSMIMEContextPrivate {
        CERTCertDBHandle *certdb;
 
@@ -1294,9 +1298,7 @@ camel_smime_context_class_init (CamelSMIMEContextClass *class)
 static void
 camel_smime_context_init (CamelSMIMEContext *smime_context)
 {
-       smime_context->priv = G_TYPE_INSTANCE_GET_PRIVATE (
-               smime_context, CAMEL_TYPE_SMIME_CONTEXT,
-               CamelSMIMEContextPrivate);
+       smime_context->priv = CAMEL_SMIME_CONTEXT_GET_PRIVATE (smime_context);
        smime_context->priv->certdb = CERT_GetDefaultCertDB ();
        smime_context->priv->sign_mode = CAMEL_SMIME_SIGN_CLEARSIGN;
        smime_context->priv->password_tries = 0;
index a17094d..800c237 100644 (file)
 /* current version */
 #define CAMEL_STORE_SUMMARY_VERSION (2)
 
+#define CAMEL_STORE_SUMMARY_GET_PRIVATE(obj) \
+       (G_TYPE_INSTANCE_GET_PRIVATE \
+       ((obj), CAMEL_TYPE_STORE_SUMMARY, CamelStoreSummaryPrivate))
+
 struct _CamelStoreSummaryPrivate {
        GStaticRecMutex summary_lock;   /* for the summary hashtable/array */
        GStaticRecMutex io_lock;        /* load/save lock, for access to saved_count, etc */
@@ -327,8 +331,7 @@ camel_store_summary_class_init (CamelStoreSummaryClass *class)
 static void
 camel_store_summary_init (CamelStoreSummary *summary)
 {
-       summary->priv = G_TYPE_INSTANCE_GET_PRIVATE (
-               summary, CAMEL_TYPE_STORE_SUMMARY, CamelStoreSummaryPrivate);
+       summary->priv = CAMEL_STORE_SUMMARY_GET_PRIVATE (summary);
        summary->store_info_size = sizeof (CamelStoreInfo);
 
        summary->store_info_chunks = NULL;
index b082c30..a76eb64 100644 (file)
 
 #include "camel-stream-buffer.h"
 
+#define CAMEL_STREAM_BUFFER_GET_PRIVATE(obj) \
+       (G_TYPE_INSTANCE_GET_PRIVATE \
+       ((obj), CAMEL_TYPE_STREAM_BUFFER, CamelStreamBufferPrivate))
+
 struct _CamelStreamBufferPrivate {
 
        CamelStream *stream;
@@ -85,7 +89,7 @@ set_vbuf (CamelStreamBuffer *stream,
 {
        CamelStreamBufferPrivate *priv;
 
-       priv = CAMEL_STREAM_BUFFER (stream)->priv;
+       priv = CAMEL_STREAM_BUFFER_GET_PRIVATE (stream);
 
        if (priv->buf && !(priv->flags & BUF_USER))
                g_free (priv->buf);
@@ -109,7 +113,7 @@ stream_buffer_dispose (GObject *object)
 {
        CamelStreamBufferPrivate *priv;
 
-       priv = CAMEL_STREAM_BUFFER (object)->priv;
+       priv = CAMEL_STREAM_BUFFER_GET_PRIVATE (object);
 
        if (priv->stream != NULL) {
                g_object_unref (priv->stream);
@@ -125,7 +129,7 @@ stream_buffer_finalize (GObject *object)
 {
        CamelStreamBufferPrivate *priv;
 
-       priv = CAMEL_STREAM_BUFFER (object)->priv;
+       priv = CAMEL_STREAM_BUFFER_GET_PRIVATE (object);
 
        if (!(priv->flags & BUF_USER))
                g_free (priv->buf);
@@ -149,7 +153,7 @@ stream_buffer_read (CamelStream *stream,
        gchar *bptr = buffer;
        GError *local_error = NULL;
 
-       priv = CAMEL_STREAM_BUFFER (stream)->priv;
+       priv = CAMEL_STREAM_BUFFER_GET_PRIVATE (stream);
 
        g_return_val_if_fail (
                (priv->mode & CAMEL_STREAM_BUFFER_MODE) ==
@@ -221,7 +225,7 @@ stream_buffer_write (CamelStream *stream,
        gssize total = n;
        gssize left, todo;
 
-       priv = CAMEL_STREAM_BUFFER (stream)->priv;
+       priv = CAMEL_STREAM_BUFFER_GET_PRIVATE (stream);
 
        g_return_val_if_fail (
                (priv->mode & CAMEL_STREAM_BUFFER_MODE) ==
@@ -269,7 +273,7 @@ stream_buffer_flush (CamelStream *stream,
 {
        CamelStreamBufferPrivate *priv;
 
-       priv = CAMEL_STREAM_BUFFER (stream)->priv;
+       priv = CAMEL_STREAM_BUFFER_GET_PRIVATE (stream);
 
        if ((priv->mode & CAMEL_STREAM_BUFFER_MODE) == CAMEL_STREAM_BUFFER_WRITE) {
                gsize len = priv->ptr - priv->buf;
@@ -294,7 +298,7 @@ stream_buffer_close (CamelStream *stream,
 {
        CamelStreamBufferPrivate *priv;
 
-       priv = CAMEL_STREAM_BUFFER (stream)->priv;
+       priv = CAMEL_STREAM_BUFFER_GET_PRIVATE (stream);
 
        if (stream_buffer_flush (stream, cancellable, error) == -1)
                return -1;
@@ -307,7 +311,7 @@ stream_buffer_eos (CamelStream *stream)
 {
        CamelStreamBufferPrivate *priv;
 
-       priv = CAMEL_STREAM_BUFFER (stream)->priv;
+       priv = CAMEL_STREAM_BUFFER_GET_PRIVATE (stream);
 
        return camel_stream_eos (priv->stream) && priv->ptr == priv->end;
 }
@@ -321,7 +325,7 @@ stream_buffer_init_vbuf (CamelStreamBuffer *stream,
 {
        CamelStreamBufferPrivate *priv;
 
-       priv = CAMEL_STREAM_BUFFER (stream)->priv;
+       priv = CAMEL_STREAM_BUFFER_GET_PRIVATE (stream);
 
        set_vbuf (stream, buf, mode, size);
 
@@ -365,8 +369,7 @@ camel_stream_buffer_class_init (CamelStreamBufferClass *class)
 static void
 camel_stream_buffer_init (CamelStreamBuffer *stream)
 {
-       stream->priv = G_TYPE_INSTANCE_GET_PRIVATE (
-               stream, CAMEL_TYPE_STREAM_BUFFER, CamelStreamBufferPrivate);
+       stream->priv = CAMEL_STREAM_BUFFER_GET_PRIVATE (stream);
        stream->priv->flags = 0;
        stream->priv->size = BUF_SIZE;
        stream->priv->buf = g_malloc (BUF_SIZE);
index 8d380f8..f3d2775 100644 (file)
 /*extern void g_check(gpointer mp);*/
 #define g_check(x)
 
+#define CAMEL_STREAM_FILTER_GET_PRIVATE(obj) \
+       (G_TYPE_INSTANCE_GET_PRIVATE \
+       ((obj), CAMEL_TYPE_STREAM_FILTER, CamelStreamFilterPrivate))
+
 struct _filter {
        struct _filter *next;
        gint id;
@@ -100,7 +104,7 @@ stream_filter_read (CamelStream *stream,
        gssize size;
        struct _filter *f;
 
-       priv = CAMEL_STREAM_FILTER (stream)->priv;
+       priv = CAMEL_STREAM_FILTER_GET_PRIVATE (stream);
 
        priv->last_was_read = TRUE;
 
@@ -179,7 +183,7 @@ stream_filter_write (CamelStream *stream,
        gsize presize, len, left = n;
        gchar *buffer, realbuffer[READ_SIZE + READ_PAD];
 
-       priv = CAMEL_STREAM_FILTER (stream)->priv;
+       priv = CAMEL_STREAM_FILTER_GET_PRIVATE (stream);
 
        priv->last_was_read = FALSE;
 
@@ -231,7 +235,7 @@ stream_filter_flush (CamelStream *stream,
        gsize presize;
        gsize len;
 
-       priv = CAMEL_STREAM_FILTER (stream)->priv;
+       priv = CAMEL_STREAM_FILTER_GET_PRIVATE (stream);
 
        if (priv->last_was_read)
                return 0;
@@ -268,7 +272,7 @@ stream_filter_close (CamelStream *stream,
 {
        CamelStreamFilterPrivate *priv;
 
-       priv = CAMEL_STREAM_FILTER (stream)->priv;
+       priv = CAMEL_STREAM_FILTER_GET_PRIVATE (stream);
 
        /* Ignore errors while flushing. */
        if (!priv->last_was_read)
@@ -282,7 +286,7 @@ stream_filter_eos (CamelStream *stream)
 {
        CamelStreamFilterPrivate *priv;
 
-       priv = CAMEL_STREAM_FILTER (stream)->priv;
+       priv = CAMEL_STREAM_FILTER_GET_PRIVATE (stream);
 
        if (priv->filteredlen > 0)
                return FALSE;
@@ -298,9 +302,12 @@ stream_filter_tell (GSeekable *seekable)
 {
        CamelStreamFilterPrivate *priv;
 
-       priv = CAMEL_STREAM_FILTER (seekable)->priv;
+       priv = CAMEL_STREAM_FILTER_GET_PRIVATE (seekable);
+
+       if (!G_IS_SEEKABLE (priv->source))
+               return 0;
 
-       return priv->source && G_IS_SEEKABLE (priv->source) ? g_seekable_tell (G_SEEKABLE (priv->source)) : 0;
+       return g_seekable_tell (G_SEEKABLE (priv->source));
 }
 
 static gboolean
@@ -319,7 +326,7 @@ stream_filter_seek (GSeekable *seekable,
        CamelStreamFilterPrivate *priv;
        struct _filter *f;
 
-       priv = CAMEL_STREAM_FILTER (seekable)->priv;
+       priv = CAMEL_STREAM_FILTER_GET_PRIVATE (seekable);
 
        if (type != G_SEEK_SET || offset != 0) {
                g_set_error_literal (
@@ -394,8 +401,7 @@ camel_stream_filter_seekable_init (GSeekableIface *interface)
 static void
 camel_stream_filter_init (CamelStreamFilter *stream)
 {
-       stream->priv = G_TYPE_INSTANCE_GET_PRIVATE (
-               stream, CAMEL_TYPE_STREAM_FILTER, CamelStreamFilterPrivate);
+       stream->priv = CAMEL_STREAM_FILTER_GET_PRIVATE (stream);
        stream->priv->realbuffer = g_malloc (READ_SIZE + READ_PAD);
        stream->priv->buffer = stream->priv->realbuffer + READ_PAD;
        stream->priv->last_was_read = TRUE;
@@ -420,7 +426,7 @@ camel_stream_filter_new (CamelStream *source)
        g_return_val_if_fail (CAMEL_IS_STREAM (source), NULL);
 
        stream = g_object_new (CAMEL_TYPE_STREAM_FILTER, NULL);
-       priv = CAMEL_STREAM_FILTER (stream)->priv;
+       priv = CAMEL_STREAM_FILTER_GET_PRIVATE (stream);
 
        priv->source = g_object_ref (source);
 
@@ -464,7 +470,7 @@ camel_stream_filter_add (CamelStreamFilter *stream,
        g_return_val_if_fail (CAMEL_IS_STREAM_FILTER (stream), -1);
        g_return_val_if_fail (CAMEL_IS_MIME_FILTER (filter), -1);
 
-       priv = stream->priv;
+       priv = CAMEL_STREAM_FILTER_GET_PRIVATE (stream);
 
        fn = g_malloc (sizeof (*fn));
        fn->id = priv->filterid++;
@@ -495,7 +501,7 @@ camel_stream_filter_remove (CamelStreamFilter *stream,
 
        g_return_if_fail (CAMEL_IS_STREAM_FILTER (stream));
 
-       priv = stream->priv;
+       priv = CAMEL_STREAM_FILTER_GET_PRIVATE (stream);
 
        f = (struct _filter *) &priv->filters;
        while (f && f->next) {
index 907892d..67416a4 100644 (file)
 #include "camel-stream-fs.h"
 #include "camel-win32.h"
 
+#define CAMEL_STREAM_FS_GET_PRIVATE(obj) \
+       (G_TYPE_INSTANCE_GET_PRIVATE \
+       ((obj), CAMEL_TYPE_STREAM_FS, CamelStreamFsPrivate))
+
 struct _CamelStreamFsPrivate {
        gint fd;        /* file descriptor on the underlying file */
 };
@@ -55,7 +59,7 @@ stream_fs_finalize (GObject *object)
 {
        CamelStreamFsPrivate *priv;
 
-       priv = CAMEL_STREAM_FS (object)->priv;
+       priv = CAMEL_STREAM_FS_GET_PRIVATE (object);
 
        if (priv->fd != -1)
                close (priv->fd);
@@ -74,7 +78,7 @@ stream_fs_read (CamelStream *stream,
        CamelStreamFsPrivate *priv;
        gssize nread;
 
-       priv = CAMEL_STREAM_FS (stream)->priv;
+       priv = CAMEL_STREAM_FS_GET_PRIVATE (stream);
 
        nread = camel_read (priv->fd, buffer, n, cancellable, error);
 
@@ -93,7 +97,7 @@ stream_fs_write (CamelStream *stream,
 {
        CamelStreamFsPrivate *priv;
 
-       priv = CAMEL_STREAM_FS (stream)->priv;
+       priv = CAMEL_STREAM_FS_GET_PRIVATE (stream);
 
        return camel_write (priv->fd, buffer, n, cancellable, error);
 }
@@ -105,7 +109,7 @@ stream_fs_flush (CamelStream *stream,
 {
        CamelStreamFsPrivate *priv;
 
-       priv = CAMEL_STREAM_FS (stream)->priv;
+       priv = CAMEL_STREAM_FS_GET_PRIVATE (stream);
 
        if (g_cancellable_set_error_if_cancelled (cancellable, error))
                return -1;
@@ -128,7 +132,7 @@ stream_fs_close (CamelStream *stream,
 {
        CamelStreamFsPrivate *priv;
 
-       priv = CAMEL_STREAM_FS (stream)->priv;
+       priv = CAMEL_STREAM_FS_GET_PRIVATE (stream);
 
        if (g_cancellable_set_error_if_cancelled (cancellable, error))
                return -1;
@@ -151,7 +155,7 @@ stream_fs_tell (GSeekable *seekable)
 {
        CamelStreamFsPrivate *priv;
 
-       priv = CAMEL_STREAM_FS (seekable)->priv;
+       priv = CAMEL_STREAM_FS_GET_PRIVATE (seekable);
 
        return (goffset) lseek (priv->fd, 0, SEEK_CUR);
 }
@@ -172,7 +176,7 @@ stream_fs_seek (GSeekable *seekable,
        CamelStreamFsPrivate *priv;
        goffset real = 0;
 
-       priv = CAMEL_STREAM_FS (seekable)->priv;
+       priv = CAMEL_STREAM_FS_GET_PRIVATE (seekable);
 
        switch (type) {
        case G_SEEK_SET:
@@ -258,8 +262,7 @@ camel_stream_fs_seekable_init (GSeekableIface *interface)
 static void
 camel_stream_fs_init (CamelStreamFs *stream)
 {
-       stream->priv = G_TYPE_INSTANCE_GET_PRIVATE (
-               stream, CAMEL_TYPE_STREAM_FS, CamelStreamFsPrivate);
+       stream->priv = CAMEL_STREAM_FS_GET_PRIVATE (stream);
        stream->priv->fd = -1;
 }
 
@@ -283,7 +286,7 @@ camel_stream_fs_new_with_fd (gint fd)
                return NULL;
 
        stream = g_object_new (CAMEL_TYPE_STREAM_FS, NULL);
-       priv = CAMEL_STREAM_FS (stream)->priv;
+       priv = CAMEL_STREAM_FS_GET_PRIVATE (stream);
 
        priv->fd = fd;
 
index 4a1752e..293dacb 100644 (file)
 
 #include "camel-stream-mem.h"
 
+#define CAMEL_STREAM_MEM_GET_PRIVATE(obj) \
+       (G_TYPE_INSTANCE_GET_PRIVATE \
+       ((obj), CAMEL_TYPE_STREAM_MEM, CamelStreamMemPrivate))
+
 struct _CamelStreamMemPrivate {
        guint owner  : 1;       /* do we own the buffer? */
        guint secure : 1;       /* do we clear the buffer on finalize?
@@ -74,7 +78,7 @@ stream_mem_finalize (GObject *object)
 {
        CamelStreamMemPrivate *priv;
 
-       priv = CAMEL_STREAM_MEM (object)->priv;
+       priv = CAMEL_STREAM_MEM_GET_PRIVATE (object);
 
        if (priv->buffer && priv->owner) {
                /* TODO: we need our own bytearray type since we don't know
@@ -98,7 +102,7 @@ stream_mem_read (CamelStream *stream,
        CamelStreamMemPrivate *priv;
        gssize nread;
 
-       priv = CAMEL_STREAM_MEM (stream)->priv;
+       priv = CAMEL_STREAM_MEM_GET_PRIVATE (stream);
 
        nread = MIN (n, priv->buffer->len - priv->position);
        if (nread > 0) {
@@ -120,7 +124,7 @@ stream_mem_write (CamelStream *stream,
        CamelStreamMemPrivate *priv;
        gssize nwrite = n;
 
-       priv = CAMEL_STREAM_MEM (stream)->priv;
+       priv = CAMEL_STREAM_MEM_GET_PRIVATE (stream);
 
        /* FIXME: we shouldn't use g_byte_arrays or g_malloc perhaps? */
        if (priv->position == priv->buffer->len) {
@@ -139,7 +143,7 @@ stream_mem_eos (CamelStream *stream)
 {
        CamelStreamMemPrivate *priv;
 
-       priv = CAMEL_STREAM_MEM (stream)->priv;
+       priv = CAMEL_STREAM_MEM_GET_PRIVATE (stream);
 
        return priv->buffer->len <= priv->position;
 }
@@ -149,7 +153,7 @@ stream_mem_tell (GSeekable *seekable)
 {
        CamelStreamMemPrivate *priv;
 
-       priv = CAMEL_STREAM_MEM (seekable)->priv;
+       priv = CAMEL_STREAM_MEM_GET_PRIVATE (seekable);
 
        return priv->position;
 }
@@ -170,7 +174,7 @@ stream_mem_seek (GSeekable *seekable,
        CamelStreamMemPrivate *priv;
        goffset position;
 
-       priv = CAMEL_STREAM_MEM (seekable)->priv;
+       priv = CAMEL_STREAM_MEM_GET_PRIVATE (seekable);
 
        switch (type) {
        case G_SEEK_SET:
@@ -251,8 +255,7 @@ camel_stream_mem_seekable_init (GSeekableIface *interface)
 static void
 camel_stream_mem_init (CamelStreamMem *stream)
 {
-       stream->priv = G_TYPE_INSTANCE_GET_PRIVATE (
-               stream, CAMEL_TYPE_STREAM_MEM, CamelStreamMemPrivate);
+       stream->priv = CAMEL_STREAM_MEM_GET_PRIVATE (stream);
 }
 
 /**
@@ -315,7 +318,7 @@ camel_stream_mem_new_with_byte_array (GByteArray *buffer)
        g_return_val_if_fail (buffer != NULL, NULL);
 
        stream = g_object_new (CAMEL_TYPE_STREAM_MEM, NULL);
-       priv = CAMEL_STREAM_MEM (stream)->priv;
+       priv = CAMEL_STREAM_MEM_GET_PRIVATE (stream);
 
        priv->buffer = buffer;
        priv->owner = TRUE;
index af6d674..3bb8b24 100644 (file)
@@ -1174,6 +1174,10 @@ _camel_tcp_stream_raw_replace_file_desc (CamelTcpStreamRaw *raw,
        priv->sockfd = new_file_desc;
 }
 
+#define CAMEL_TCP_STREAM_RAW_GET_PRIVATE(obj) \
+       (G_TYPE_INSTANCE_GET_PRIVATE \
+       ((obj), CAMEL_TYPE_TCP_STREAM_RAW, CamelTcpStreamRawPrivate))
+
 static void
 camel_tcp_stream_raw_class_init (CamelTcpStreamRawClass *class)
 {
@@ -1204,13 +1208,7 @@ camel_tcp_stream_raw_class_init (CamelTcpStreamRawClass *class)
 static void
 camel_tcp_stream_raw_init (CamelTcpStreamRaw *stream)
 {
-       CamelTcpStreamRawPrivate *priv;
-
-       stream->priv = G_TYPE_INSTANCE_GET_PRIVATE (
-               stream, CAMEL_TYPE_TCP_STREAM_RAW, CamelTcpStreamRawPrivate);
-       priv = stream->priv;
-
-       priv->sockfd = NULL;
+       stream->priv = CAMEL_TCP_STREAM_RAW_GET_PRIVATE (stream);
 }
 
 GQuark
index 7a4bf88..db53eb1 100644 (file)
 #define IO_TIMEOUT (PR_TicksPerSecond() * 4 * 60)
 #define CONNECT_TIMEOUT (PR_TicksPerSecond () * 4 * 60)
 
+#define CAMEL_TCP_STREAM_SSL_GET_PRIVATE(obj) \
+       (G_TYPE_INSTANCE_GET_PRIVATE \
+       ((obj), CAMEL_TYPE_TCP_STREAM_SSL, CamelTcpStreamSSLPrivate))
+
 struct _CamelTcpStreamSSLPrivate {
        CamelSession *session;
        gchar *expected_host;
@@ -82,7 +86,7 @@ tcp_stream_ssl_dispose (GObject *object)
 {
        CamelTcpStreamSSLPrivate *priv;
 
-       priv = CAMEL_TCP_STREAM_SSL (object)->priv;
+       priv = CAMEL_TCP_STREAM_SSL_GET_PRIVATE (object);
 
        if (priv->session != NULL) {
                g_object_unref (priv->session);
@@ -98,7 +102,7 @@ tcp_stream_ssl_finalize (GObject *object)
 {
        CamelTcpStreamSSLPrivate *priv;
 
-       priv = CAMEL_TCP_STREAM_SSL (object)->priv;
+       priv = CAMEL_TCP_STREAM_SSL_GET_PRIVATE (object);
 
        g_free (priv->expected_host);
 
@@ -820,8 +824,7 @@ camel_tcp_stream_ssl_class_init (CamelTcpStreamSSLClass *class)
 static void
 camel_tcp_stream_ssl_init (CamelTcpStreamSSL *stream)
 {
-       stream->priv = G_TYPE_INSTANCE_GET_PRIVATE (
-               stream, CAMEL_TYPE_TCP_STREAM_SSL, CamelTcpStreamSSLPrivate);
+       stream->priv = CAMEL_TCP_STREAM_SSL_GET_PRIVATE (stream);
 }
 
 /**
index 274959c..d783e0e 100644 (file)
 
 #define w(x)
 
+#define CAMEL_TCP_STREAM_GET_PRIVATE(obj) \
+       (G_TYPE_INSTANCE_GET_PRIVATE \
+       ((obj), CAMEL_TYPE_TCP_STREAM, CamelTcpStreamPrivate))
+
 struct _CamelTcpStreamPrivate {
        gchar *socks_host;
        gint socks_port;
@@ -50,6 +54,7 @@ camel_tcp_stream_finalize (GObject *object)
 
        g_free (stream->priv->socks_host);
 
+       /* Chain up to parent's finalize() method. */
        G_OBJECT_CLASS (camel_tcp_stream_parent_class)->finalize (object);
 }
 
@@ -67,8 +72,7 @@ camel_tcp_stream_class_init (CamelTcpStreamClass *class)
 static void
 camel_tcp_stream_init (CamelTcpStream *tcp_stream)
 {
-       tcp_stream->priv = G_TYPE_INSTANCE_GET_PRIVATE (
-               tcp_stream, CAMEL_TYPE_TCP_STREAM, CamelTcpStreamPrivate);
+       tcp_stream->priv = CAMEL_TCP_STREAM_GET_PRIVATE (tcp_stream);
 }
 
 /**
index 9cca48c..906f4ca 100644 (file)
@@ -59,6 +59,10 @@ static gint text_index_compress_nosync (CamelIndex *idx);
 
 /* ********************************************************************** */
 
+#define CAMEL_TEXT_INDEX_NAME_GET_PRIVATE(obj) \
+       (G_TYPE_INSTANCE_GET_PRIVATE \
+       ((obj), CAMEL_TYPE_TEXT_INDEX_NAME, CamelTextIndexNamePrivate))
+
 struct _CamelTextIndexNamePrivate {
        GString *buffer;
        camel_key_t nameid;
@@ -69,6 +73,10 @@ CamelTextIndexName *camel_text_index_name_new (CamelTextIndex *idx, const gchar
 
 /* ****************************** */
 
+#define CAMEL_TEXT_INDEX_CURSOR_GET_PRIVATE(obj) \
+       (G_TYPE_INSTANCE_GET_PRIVATE \
+       ((obj), CAMEL_TYPE_TEXT_INDEX_CURSOR, CamelTextIndexCursorPrivate))
+
 struct _CamelTextIndexCursorPrivate {
        camel_block_t first;
        camel_block_t next;
@@ -85,6 +93,10 @@ CamelTextIndexCursor *camel_text_index_cursor_new (CamelTextIndex *idx, camel_bl
 
 /* ****************************** */
 
+#define CAMEL_TEXT_INDEX_KEY_CURSOR_GET_PRIVATE(obj) \
+       (G_TYPE_INSTANCE_GET_PRIVATE \
+       ((obj), CAMEL_TYPE_TEXT_INDEX_KEY_CURSOR, CamelTextIndexKeyCursorPrivate))
+
 struct _CamelTextIndexKeyCursorPrivate {
        CamelKeyTable *table;
 
@@ -101,6 +113,10 @@ CamelTextIndexKeyCursor *camel_text_index_key_cursor_new (CamelTextIndex *idx, C
 #define CAMEL_TEXT_INDEX_VERSION "TEXT.000"
 #define CAMEL_TEXT_INDEX_KEY_VERSION "KEYS.000"
 
+#define CAMEL_TEXT_INDEX_GET_PRIVATE(obj) \
+       (G_TYPE_INSTANCE_GET_PRIVATE \
+       ((obj), CAMEL_TYPE_TEXT_INDEX, CamelTextIndexPrivate))
+
 struct _CamelTextIndexPrivate {
        CamelBlockFile *blocks;
        CamelKeyFile *links;
@@ -154,7 +170,7 @@ text_index_dispose (GObject *object)
 {
        CamelTextIndexPrivate *priv;
 
-       priv = CAMEL_TEXT_INDEX (object)->priv;
+       priv = CAMEL_TEXT_INDEX_GET_PRIVATE (object);
 
        /* Only run this the first time. */
        if (priv->word_index != NULL)
@@ -199,7 +215,7 @@ text_index_finalize (GObject *object)
 {
        CamelTextIndexPrivate *priv;
 
-       priv = CAMEL_TEXT_INDEX (object)->priv;
+       priv = CAMEL_TEXT_INDEX_GET_PRIVATE (object);
 
        g_assert (g_queue_is_empty (&priv->word_cache));
        g_assert (g_hash_table_size (priv->words) == 0);
@@ -317,7 +333,7 @@ text_index_add_name_to_word (CamelIndex *idx,
 static gint
 text_index_sync (CamelIndex *idx)
 {
-       CamelTextIndexPrivate *p = CAMEL_TEXT_INDEX (idx)->priv;
+       CamelTextIndexPrivate *p = CAMEL_TEXT_INDEX_GET_PRIVATE (idx);
        struct _CamelTextIndexWord *ww;
        struct _CamelTextIndexRoot *rb;
        gint ret = 0, wfrag, nfrag;
@@ -450,8 +466,8 @@ text_index_compress_nosync (CamelIndex *idx)
        if (newidx == NULL)
                return -1;
 
-       newp = CAMEL_TEXT_INDEX (newidx)->priv;
-       oldp = CAMEL_TEXT_INDEX (idx)->priv;
+       newp = CAMEL_TEXT_INDEX_GET_PRIVATE (newidx);
+       oldp = CAMEL_TEXT_INDEX_GET_PRIVATE (idx);
 
        CAMEL_TEXT_INDEX_LOCK (idx, lock);
 
@@ -592,7 +608,7 @@ fail:
 static gint
 text_index_delete (CamelIndex *idx)
 {
-       CamelTextIndexPrivate *p = CAMEL_TEXT_INDEX (idx)->priv;
+       CamelTextIndexPrivate *p = CAMEL_TEXT_INDEX_GET_PRIVATE (idx);
        gint ret = 0;
 
        if (camel_block_file_delete (p->blocks) == -1)
@@ -607,7 +623,7 @@ static gint
 text_index_rename (CamelIndex *idx,
                    const gchar *path)
 {
-       CamelTextIndexPrivate *p = CAMEL_TEXT_INDEX (idx)->priv;
+       CamelTextIndexPrivate *p = CAMEL_TEXT_INDEX_GET_PRIVATE (idx);
        gchar *newlink, *newblock;
        gint err, ret;
 
@@ -644,7 +660,7 @@ static gint
 text_index_has_name (CamelIndex *idx,
                      const gchar *name)
 {
-       CamelTextIndexPrivate *p = CAMEL_TEXT_INDEX (idx)->priv;
+       CamelTextIndexPrivate *p = CAMEL_TEXT_INDEX_GET_PRIVATE (idx);
 
        return camel_partition_table_lookup (p->name_hash, name) != 0;
 }
@@ -653,7 +669,7 @@ static CamelIndexName *
 text_index_add_name (CamelIndex *idx,
                      const gchar *name)
 {
-       CamelTextIndexPrivate *p = CAMEL_TEXT_INDEX (idx)->priv;
+       CamelTextIndexPrivate *p = CAMEL_TEXT_INDEX_GET_PRIVATE (idx);
        camel_key_t keyid;
        CamelIndexName *idn;
        struct _CamelTextIndexRoot *rb = (struct _CamelTextIndexRoot *) p->blocks->root;
@@ -736,7 +752,7 @@ static void
 text_index_delete_name (CamelIndex *idx,
                         const gchar *name)
 {
-       CamelTextIndexPrivate *p = CAMEL_TEXT_INDEX (idx)->priv;
+       CamelTextIndexPrivate *p = CAMEL_TEXT_INDEX_GET_PRIVATE (idx);
        camel_key_t keyid;
        struct _CamelTextIndexRoot *rb = (struct _CamelTextIndexRoot *) p->blocks->root;
 
@@ -761,7 +777,7 @@ static CamelIndexCursor *
 text_index_find (CamelIndex *idx,
                  const gchar *word)
 {
-       CamelTextIndexPrivate *p = CAMEL_TEXT_INDEX (idx)->priv;
+       CamelTextIndexPrivate *p = CAMEL_TEXT_INDEX_GET_PRIVATE (idx);
        camel_key_t keyid;
        camel_block_t data = 0;
        guint flags;
@@ -787,7 +803,7 @@ text_index_find (CamelIndex *idx,
 static CamelIndexCursor *
 text_index_words (CamelIndex *idx)
 {
-       CamelTextIndexPrivate *p = CAMEL_TEXT_INDEX (idx)->priv;
+       CamelTextIndexPrivate *p = CAMEL_TEXT_INDEX_GET_PRIVATE (idx);
 
        return (CamelIndexCursor *) camel_text_index_key_cursor_new ((CamelTextIndex *) idx, p->word_index);
 }
@@ -795,7 +811,7 @@ text_index_words (CamelIndex *idx)
 static CamelIndexCursor *
 text_index_names (CamelIndex *idx)
 {
-       CamelTextIndexPrivate *p = CAMEL_TEXT_INDEX (idx)->priv;
+       CamelTextIndexPrivate *p = CAMEL_TEXT_INDEX_GET_PRIVATE (idx);
 
        return (CamelIndexCursor *) camel_text_index_key_cursor_new ((CamelTextIndex *) idx, p->name_index);
 }
@@ -830,8 +846,7 @@ camel_text_index_class_init (CamelTextIndexClass *class)
 static void
 camel_text_index_init (CamelTextIndex *text_index)
 {
-       text_index->priv = G_TYPE_INSTANCE_GET_PRIVATE (
-               text_index, CAMEL_TYPE_TEXT_INDEX, CamelTextIndexPrivate);
+       text_index->priv = CAMEL_TEXT_INDEX_GET_PRIVATE (text_index);
 
        g_queue_init (&text_index->priv->word_cache);
        text_index->priv->words = g_hash_table_new (g_str_hash, g_str_equal);
@@ -863,7 +878,7 @@ camel_text_index_new (const gchar *path,
                       gint flags)
 {
        CamelTextIndex *idx = g_object_new (CAMEL_TYPE_TEXT_INDEX, NULL);
-       CamelTextIndexPrivate *p = idx->priv;
+       CamelTextIndexPrivate *p = CAMEL_TEXT_INDEX_GET_PRIVATE (idx);
        struct _CamelTextIndexRoot *rb;
        gchar *link;
        CamelBlock *bl;
@@ -1243,7 +1258,7 @@ dump_raw (GHashTable *map,
 void
 camel_text_index_dump (CamelTextIndex *idx)
 {
-       CamelTextIndexPrivate *p = idx->priv;
+       CamelTextIndexPrivate *p = CAMEL_TEXT_INDEX_GET_PRIVATE (idx);
 #ifndef DUMP_RAW
        camel_key_t keyid;
        gchar *word;
@@ -1302,7 +1317,7 @@ camel_text_index_dump (CamelTextIndex *idx)
 void
 camel_text_index_validate (CamelTextIndex *idx)
 {
-       CamelTextIndexPrivate *p = idx->priv;
+       CamelTextIndexPrivate *p = CAMEL_TEXT_INDEX_GET_PRIVATE (idx);
        camel_key_t keyid;
        gchar *word;
        const gchar *name;
@@ -1433,7 +1448,7 @@ text_index_name_finalize (GObject *object)
 {
        CamelTextIndexNamePrivate *priv;
 
-       priv = CAMEL_TEXT_INDEX_NAME (object)->priv;
+       priv = CAMEL_TEXT_INDEX_NAME_GET_PRIVATE (object);
 
        g_hash_table_destroy (CAMEL_TEXT_INDEX_NAME (object)->parent.words);
 
@@ -1527,7 +1542,7 @@ text_index_name_add_buffer (CamelIndexName *idn,
                             const gchar *buffer,
                             gsize len)
 {
-       CamelTextIndexNamePrivate *p = CAMEL_TEXT_INDEX_NAME (idn)->priv;
+       CamelTextIndexNamePrivate *p = CAMEL_TEXT_INDEX_NAME_GET_PRIVATE (idn);
        const guchar *ptr, *ptrend;
        guint32 c;
        gchar utf8[8];
@@ -1581,7 +1596,8 @@ camel_text_index_name_class_init (CamelTextIndexNameClass *class)
 static void
 camel_text_index_name_init (CamelTextIndexName *text_index_name)
 {
-       text_index_name->priv = G_TYPE_INSTANCE_GET_PRIVATE (text_index_name, CAMEL_TYPE_TEXT_INDEX_NAME, CamelTextIndexNamePrivate);
+       text_index_name->priv =
+               CAMEL_TEXT_INDEX_NAME_GET_PRIVATE (text_index_name);
 
        text_index_name->parent.words = g_hash_table_new (
                g_str_hash, g_str_equal);
@@ -1598,7 +1614,7 @@ camel_text_index_name_new (CamelTextIndex *idx,
 {
        CamelTextIndexName *idn = g_object_new (CAMEL_TYPE_TEXT_INDEX_NAME, NULL);
        CamelIndexName *cin = &idn->parent;
-       CamelTextIndexNamePrivate *p = idn->priv;
+       CamelTextIndexNamePrivate *p = CAMEL_TEXT_INDEX_NAME_GET_PRIVATE (idn);
 
        cin->index = g_object_ref (idx);
        cin->name = camel_mempool_strdup (p->pool, name);
@@ -1618,7 +1634,7 @@ text_index_cursor_finalize (GObject *object)
 {
        CamelTextIndexCursorPrivate *priv;
 
-       priv = CAMEL_TEXT_INDEX_CURSOR (object)->priv;
+       priv = CAMEL_TEXT_INDEX_CURSOR_GET_PRIVATE (object);
 
        g_free (priv->records);
        g_free (priv->current);
@@ -1630,8 +1646,8 @@ text_index_cursor_finalize (GObject *object)
 static const gchar *
 text_index_cursor_next (CamelIndexCursor *idc)
 {
-       CamelTextIndexCursorPrivate *p = CAMEL_TEXT_INDEX_CURSOR (idc)->priv;
-       CamelTextIndexPrivate *tip = CAMEL_TEXT_INDEX (idc->index)->priv;
+       CamelTextIndexCursorPrivate *p = CAMEL_TEXT_INDEX_CURSOR_GET_PRIVATE (idc);
+       CamelTextIndexPrivate *tip = CAMEL_TEXT_INDEX_GET_PRIVATE (idc->index);
        guint flags;
 
        c (printf ("Going to next cursor for word with data '%08x' next %08x\n", p->first, p->next));
@@ -1665,7 +1681,7 @@ text_index_cursor_next (CamelIndexCursor *idc)
 static void
 text_index_cursor_reset (CamelIndexCursor *idc)
 {
-       CamelTextIndexCursorPrivate *p = CAMEL_TEXT_INDEX_CURSOR (idc)->priv;
+       CamelTextIndexCursorPrivate *p = CAMEL_TEXT_INDEX_CURSOR_GET_PRIVATE (idc);
 
        g_free (p->records);
        p->records = NULL;
@@ -1695,7 +1711,8 @@ camel_text_index_cursor_class_init (CamelTextIndexCursorClass *class)
 static void
 camel_text_index_cursor_init (CamelTextIndexCursor *text_index_cursor)
 {
-       text_index_cursor->priv = G_TYPE_INSTANCE_GET_PRIVATE (text_index_cursor, CAMEL_TYPE_TEXT_INDEX_CURSOR, CamelTextIndexCursorPrivate);
+       text_index_cursor->priv =
+               CAMEL_TEXT_INDEX_CURSOR_GET_PRIVATE (text_index_cursor);
 }
 
 CamelTextIndexCursor *
@@ -1704,7 +1721,7 @@ camel_text_index_cursor_new (CamelTextIndex *idx,
 {
        CamelTextIndexCursor *idc = g_object_new (CAMEL_TYPE_TEXT_INDEX_CURSOR, NULL);
        CamelIndexCursor *cic = &idc->parent;
-       CamelTextIndexCursorPrivate *p = idc->priv;
+       CamelTextIndexCursorPrivate *p = CAMEL_TEXT_INDEX_CURSOR_GET_PRIVATE (idc);
 
        cic->index = g_object_ref (idx);
        p->first = data;
@@ -1726,7 +1743,7 @@ text_index_key_cursor_dispose (GObject *object)
 {
        CamelTextIndexKeyCursorPrivate *priv;
 
-       priv = CAMEL_TEXT_INDEX_KEY_CURSOR (object)->priv;
+       priv = CAMEL_TEXT_INDEX_KEY_CURSOR_GET_PRIVATE (object);
 
        if (priv->table != NULL) {
                g_object_unref (priv->table);
@@ -1742,7 +1759,7 @@ text_index_key_cursor_finalize (GObject *object)
 {
        CamelTextIndexKeyCursorPrivate *priv;
 
-       priv = CAMEL_TEXT_INDEX_KEY_CURSOR (object)->priv;
+       priv = CAMEL_TEXT_INDEX_KEY_CURSOR_GET_PRIVATE (object);
 
        g_free (priv->current);
 
@@ -1753,7 +1770,7 @@ text_index_key_cursor_finalize (GObject *object)
 static const gchar *
 text_index_key_cursor_next (CamelIndexCursor *idc)
 {
-       CamelTextIndexKeyCursorPrivate *p = CAMEL_TEXT_INDEX_KEY_CURSOR (idc)->priv;
+       CamelTextIndexKeyCursorPrivate *p = CAMEL_TEXT_INDEX_KEY_CURSOR_GET_PRIVATE (idc);
 
        c (printf ("Going to next cursor for keyid %08x\n", p->keyid));
 
@@ -1775,7 +1792,7 @@ text_index_key_cursor_next (CamelIndexCursor *idc)
 static void
 text_index_key_cursor_reset (CamelIndexCursor *idc)
 {
-       CamelTextIndexKeyCursorPrivate *p = CAMEL_TEXT_INDEX_KEY_CURSOR (idc)->priv;
+       CamelTextIndexKeyCursorPrivate *p = CAMEL_TEXT_INDEX_KEY_CURSOR_GET_PRIVATE (idc);
 
        p->keyid = 0;
        p->flags = 0;
@@ -1804,7 +1821,9 @@ camel_text_index_key_cursor_class_init (CamelTextIndexKeyCursorClass *class)
 static void
 camel_text_index_key_cursor_init (CamelTextIndexKeyCursor *text_index_key_cursor)
 {
-       text_index_key_cursor->priv = G_TYPE_INSTANCE_GET_PRIVATE (text_index_key_cursor, CAMEL_TYPE_TEXT_INDEX_KEY_CURSOR, CamelTextIndexKeyCursorPrivate);
+       text_index_key_cursor->priv =
+               CAMEL_TEXT_INDEX_KEY_CURSOR_GET_PRIVATE (text_index_key_cursor);
+
        text_index_key_cursor->priv->keyid = 0;
        text_index_key_cursor->priv->flags = 0;
        text_index_key_cursor->priv->data = 0;
@@ -1817,7 +1836,7 @@ camel_text_index_key_cursor_new (CamelTextIndex *idx,
 {
        CamelTextIndexKeyCursor *idc = g_object_new (CAMEL_TYPE_TEXT_INDEX_KEY_CURSOR, NULL);
        CamelIndexCursor *cic = &idc->parent;
-       CamelTextIndexKeyCursorPrivate *p = idc->priv;
+       CamelTextIndexKeyCursorPrivate *p = CAMEL_TEXT_INDEX_KEY_CURSOR_GET_PRIVATE (idc);
 
        cic->index = g_object_ref (idx);
        p->table = g_object_ref (table);
index 5da6356..a46418a 100644 (file)
 #include "camel-mime-message.h"
 #include "camel-transport.h"
 
+#define CAMEL_TRANSPORT_GET_PRIVATE(obj) \
+       (G_TYPE_INSTANCE_GET_PRIVATE \
+       ((obj), CAMEL_TYPE_TRANSPORT, CamelTransportPrivate))
+
 typedef struct _AsyncContext AsyncContext;
 
 struct _CamelTransportPrivate {
@@ -67,7 +71,7 @@ transport_finalize (GObject *object)
 {
        CamelTransportPrivate *priv;
 
-       priv = CAMEL_TRANSPORT (object)->priv;
+       priv = CAMEL_TRANSPORT_GET_PRIVATE (object);
 
        g_mutex_free (priv->send_lock);
 
@@ -158,8 +162,7 @@ camel_transport_class_init (CamelTransportClass *class)
 static void
 camel_transport_init (CamelTransport *transport)
 {
-       transport->priv = G_TYPE_INSTANCE_GET_PRIVATE (
-               transport, CAMEL_TYPE_TRANSPORT, CamelTransportPrivate);
+       transport->priv = CAMEL_TRANSPORT_GET_PRIVATE (transport);
 
        transport->priv->send_lock = g_mutex_new ();
 }
index f3bd87a..4344801 100644 (file)
 
 typedef struct _FolderChangedData FolderChangedData;
 
+#define CAMEL_VEE_FOLDER_GET_PRIVATE(obj) \
+       (G_TYPE_INSTANCE_GET_PRIVATE \
+       ((obj), CAMEL_TYPE_VEE_FOLDER, CamelVeeFolderPrivate))
+
 struct _CamelVeeFolderPrivate {
        gboolean destroyed;
        GList *folders;                 /* lock using subfolder_lock before changing/accessing */
@@ -362,7 +366,7 @@ folder_changed_change (CamelVeeFolder *vf,
 
        /* Check the folder hasn't beem removed while we weren't watching */
        camel_vee_folder_lock (vf, CAMEL_VEE_FOLDER_SUBFOLDER_LOCK);
-       if (g_list_find (vf->priv->folders, sub) == NULL) {
+       if (g_list_find (CAMEL_VEE_FOLDER_GET_PRIVATE (vf)->folders, sub) == NULL) {
                camel_vee_folder_unlock (vf, CAMEL_VEE_FOLDER_SUBFOLDER_LOCK);
                return;
        }
@@ -885,7 +889,7 @@ vee_folder_stop_folder (CamelVeeFolder *vf,
                         CamelFolder *sub,
                         GCancellable *cancellable)
 {
-       CamelVeeFolderPrivate *p = vf->priv;
+       CamelVeeFolderPrivate *p = CAMEL_VEE_FOLDER_GET_PRIVATE (vf);
        gint i;
        CamelVeeFolder *folder_unmatched = vf->parent_vee_store ? vf->parent_vee_store->folder_unmatched : NULL;
 
@@ -915,7 +919,7 @@ vee_folder_stop_folder (CamelVeeFolder *vf,
        camel_vee_folder_unlock (vf, CAMEL_VEE_FOLDER_SUBFOLDER_LOCK);
 
        if (folder_unmatched != NULL) {
-               CamelVeeFolderPrivate *up = folder_unmatched->priv;
+               CamelVeeFolderPrivate *up = CAMEL_VEE_FOLDER_GET_PRIVATE (folder_unmatched);
 
                camel_vee_folder_lock (folder_unmatched, CAMEL_VEE_FOLDER_SUBFOLDER_LOCK);
                /* if folder deleted, then blow it away from unmatched always, and remove all refs to it */
@@ -1047,13 +1051,13 @@ vee_folder_finalize (GObject *object)
 static void
 vee_folder_propagate_skipped_changes (CamelVeeFolder *vf)
 {
-       CamelVeeFolderClass *klass;
+       CamelVeeFolderClass *class;
        GHashTableIter iter;
        gpointer psub, pchanges;
 
        g_return_if_fail (vf != NULL);
 
-       klass = CAMEL_VEE_FOLDER_GET_CLASS (vf);
+       class = CAMEL_VEE_FOLDER_GET_CLASS (vf);
 
        camel_vee_folder_lock (vf, CAMEL_VEE_FOLDER_CHANGED_LOCK);
 
@@ -1064,7 +1068,7 @@ vee_folder_propagate_skipped_changes (CamelVeeFolder *vf)
                        continue;
 
                if (g_list_find (vf->priv->folders, psub) != NULL)
-                       klass->folder_changed (vf, psub, pchanges);
+                       class->folder_changed (vf, psub, pchanges);
 
                camel_folder_change_info_free (pchanges);
        }
@@ -1241,7 +1245,7 @@ vee_folder_count_by_expression (CamelFolder *folder,
 static void
 vee_folder_delete (CamelFolder *folder)
 {
-       CamelVeeFolderPrivate *p = CAMEL_VEE_FOLDER (folder)->priv;
+       CamelVeeFolderPrivate *p = CAMEL_VEE_FOLDER_GET_PRIVATE (folder);
 
        /* NB: this is never called on UNMTACHED */
 
@@ -1484,7 +1488,7 @@ static void
 vee_folder_set_expression (CamelVeeFolder *vee_folder,
                            const gchar *query)
 {
-       CamelVeeFolderPrivate *p = vee_folder->priv;
+       CamelVeeFolderPrivate *p = CAMEL_VEE_FOLDER_GET_PRIVATE (vee_folder);
        GList *node;
 
        camel_vee_folder_lock (vee_folder, CAMEL_VEE_FOLDER_SUBFOLDER_LOCK);
@@ -1569,7 +1573,7 @@ vee_folder_remove_folder_helper (CamelVeeFolder *vf,
                /* check if this folder is still to be part of unmatched */
                if ((vf->flags & CAMEL_STORE_FOLDER_PRIVATE) == 0 && !killun) {
                        camel_vee_folder_lock (folder_unmatched, CAMEL_VEE_FOLDER_SUBFOLDER_LOCK);
-                       still = g_list_find (folder_unmatched->priv->folders, source) != NULL;
+                       still = g_list_find (CAMEL_VEE_FOLDER_GET_PRIVATE (folder_unmatched)->folders, source) != NULL;
                        camel_vee_folder_unlock (folder_unmatched, CAMEL_VEE_FOLDER_SUBFOLDER_LOCK);
                        camel_vee_folder_hash_folder (source, hash);
                }
@@ -2062,8 +2066,7 @@ camel_vee_folder_init (CamelVeeFolder *vee_folder)
 {
        CamelFolder *folder = CAMEL_FOLDER (vee_folder);
 
-       vee_folder->priv = G_TYPE_INSTANCE_GET_PRIVATE (
-               vee_folder, CAMEL_TYPE_VEE_FOLDER, CamelVeeFolderPrivate);
+       vee_folder->priv = CAMEL_VEE_FOLDER_GET_PRIVATE (vee_folder);
 
        folder->folder_flags |= (CAMEL_FOLDER_HAS_SUMMARY_CAPABILITY |
                                 CAMEL_FOLDER_HAS_SEARCH_CAPABILITY);
@@ -2170,7 +2173,7 @@ void
 camel_vee_folder_add_folder (CamelVeeFolder *vf,
                              CamelFolder *sub)
 {
-       CamelVeeFolderPrivate *p = vf->priv;
+       CamelVeeFolderPrivate *p = CAMEL_VEE_FOLDER_GET_PRIVATE (vf);
        gint i;
        CamelVeeFolder *folder_unmatched = vf->parent_vee_store ? vf->parent_vee_store->folder_unmatched : NULL;
 
@@ -2195,7 +2198,7 @@ camel_vee_folder_add_folder (CamelVeeFolder *vf,
                camel_folder_unlock (CAMEL_FOLDER (vf), CAMEL_FOLDER_CHANGE_LOCK);
        }
        if ((vf->flags & CAMEL_STORE_FOLDER_PRIVATE) == 0 && !CAMEL_IS_VEE_FOLDER (sub) && folder_unmatched != NULL) {
-               CamelVeeFolderPrivate *up = folder_unmatched->priv;
+               CamelVeeFolderPrivate *up = CAMEL_VEE_FOLDER_GET_PRIVATE (folder_unmatched);
                up->folders = g_list_append (
                        up->folders, g_object_ref (sub));
 
@@ -2236,7 +2239,7 @@ void
 camel_vee_folder_remove_folder (CamelVeeFolder *vf,
                                 CamelFolder *sub)
 {
-       CamelVeeFolderPrivate *p = vf->priv;
+       CamelVeeFolderPrivate *p = CAMEL_VEE_FOLDER_GET_PRIVATE (vf);
        gint i;
        CamelVeeFolder *folder_unmatched = vf->parent_vee_store ? vf->parent_vee_store->folder_unmatched : NULL;
 
@@ -2266,7 +2269,7 @@ camel_vee_folder_remove_folder (CamelVeeFolder *vf,
        camel_vee_folder_unlock (vf, CAMEL_VEE_FOLDER_SUBFOLDER_LOCK);
 
        if (folder_unmatched != NULL) {
-               CamelVeeFolderPrivate *up = folder_unmatched->priv;
+               CamelVeeFolderPrivate *up = CAMEL_VEE_FOLDER_GET_PRIVATE (folder_unmatched);
 
                camel_vee_folder_lock (folder_unmatched, CAMEL_VEE_FOLDER_SUBFOLDER_LOCK);
                /* if folder deleted, then blow it away from unmatched always, and remove all refs to it */
@@ -2342,7 +2345,7 @@ void
 camel_vee_folder_set_folders (CamelVeeFolder *vf,
                               GList *folders)
 {
-       CamelVeeFolderPrivate *p = vf->priv;
+       CamelVeeFolderPrivate *p = CAMEL_VEE_FOLDER_GET_PRIVATE (vf);
        GHashTable *remove = g_hash_table_new (NULL, NULL);
        GList *l;
        CamelFolder *folder;
index eb5f7d6..f2b3c1e 100644 (file)
@@ -281,7 +281,7 @@ imap_command_start (CamelImapStore *store,
  **/
 CamelImapResponse *
 camel_imap_command_continuation (CamelImapStore *store,
-                                CamelFolder *folder,
+                                 CamelFolder *folder,
                                  const gchar *cmd,
                                  gsize cmdlen,
                                  GCancellable *cancellable,
@@ -336,7 +336,7 @@ camel_imap_command_continuation (CamelImapStore *store,
  **/
 CamelImapResponseType
 camel_imap_command_response (CamelImapStore *store,
-                            CamelFolder *folder,
+                             CamelFolder *folder,
                              gchar **response,
                              GCancellable *cancellable,
                              GError **error)
@@ -449,7 +449,7 @@ exit:
 
 static CamelImapResponse *
 imap_read_response (CamelImapStore *store,
-                   CamelFolder *folder,
+                    CamelFolder *folder,
                     GCancellable *cancellable,
                     GError **error)
 {
index 8ecde20..657e547 100644 (file)
  * octets) */
 #define UID_SET_LIMIT  (768)
 
+#define CAMEL_IMAP_FOLDER_GET_PRIVATE(obj) \
+       (G_TYPE_INSTANCE_GET_PRIVATE \
+       ((obj), CAMEL_TYPE_IMAP_FOLDER, CamelImapFolderPrivate))
+
 /* The custom property ID is a CamelArg artifact.
  * It still identifies the property in state files. */
 enum {
@@ -149,7 +153,7 @@ imap_folder_get_apply_filters (CamelImapFolder *folder)
 
 static void
 imap_folder_set_apply_filters (CamelImapFolder *folder,
-                              gboolean apply_filters)
+                               gboolean apply_filters)
 {
        g_return_if_fail (folder != NULL);
        g_return_if_fail (CAMEL_IS_IMAP_FOLDER (folder));
@@ -363,8 +367,7 @@ camel_imap_folder_init (CamelImapFolder *imap_folder)
 {
        CamelFolder *folder = CAMEL_FOLDER (imap_folder);
 
-       imap_folder->priv = G_TYPE_INSTANCE_GET_PRIVATE (
-               imap_folder, CAMEL_TYPE_IMAP_FOLDER, CamelImapFolderPrivate);
+       imap_folder->priv = CAMEL_IMAP_FOLDER_GET_PRIVATE (imap_folder);
 
        folder->permanent_flags = CAMEL_MESSAGE_ANSWERED | CAMEL_MESSAGE_DELETED |
                CAMEL_MESSAGE_DRAFT | CAMEL_MESSAGE_FLAGGED | CAMEL_MESSAGE_SEEN;
index a9710e8..0ca3728 100644 (file)
@@ -31,8 +31,10 @@ struct _CamelImapWrapperPrivate {
        GMutex *lock;
 };
 
-#define CAMEL_IMAP_WRAPPER_LOCK(f, l) (g_mutex_lock(((CamelImapWrapper *)f)->priv->l))
-#define CAMEL_IMAP_WRAPPER_UNLOCK(f, l) (g_mutex_unlock(((CamelImapWrapper *)f)->priv->l))
+#define CAMEL_IMAP_WRAPPER_LOCK(f, l) \
+       (g_mutex_lock (((CamelImapWrapper *) f)->priv->l))
+#define CAMEL_IMAP_WRAPPER_UNLOCK(f, l) \
+       (g_mutex_unlock (((CamelImapWrapper *) f)->priv->l))
 
 G_END_DECLS
 
index 106f8ee..6e0c78b 100644 (file)
 #include "camel-imap-folder.h"
 #include "camel-imap-wrapper.h"
 
+#define CAMEL_IMAP_WRAPPER_GET_PRIVATE(obj) \
+       (G_TYPE_INSTANCE_GET_PRIVATE \
+       ((obj), CAMEL_TYPE_IMAP_WRAPPER, CamelImapWrapperPrivate))
+
 struct _CamelImapWrapperPrivate {
        GMutex *lock;
 };
 
-#define CAMEL_IMAP_WRAPPER_LOCK(f, l) (g_mutex_lock(((CamelImapWrapper *)f)->priv->l))
-#define CAMEL_IMAP_WRAPPER_UNLOCK(f, l) (g_mutex_unlock(((CamelImapWrapper *)f)->priv->l))
+#define CAMEL_IMAP_WRAPPER_LOCK(f, l) \
+       (g_mutex_lock (((CamelImapWrapper *) f)->priv->l))
+#define CAMEL_IMAP_WRAPPER_UNLOCK(f, l) \
+       (g_mutex_unlock (((CamelImapWrapper *) f)->priv->l))
 
 G_DEFINE_TYPE (CamelImapWrapper, camel_imap_wrapper, CAMEL_TYPE_DATA_WRAPPER)
 
@@ -149,9 +155,7 @@ camel_imap_wrapper_class_init (CamelImapWrapperClass *class)
 static void
 camel_imap_wrapper_init (CamelImapWrapper *imap_wrapper)
 {
-       imap_wrapper->priv = G_TYPE_INSTANCE_GET_PRIVATE (
-               imap_wrapper, CAMEL_TYPE_IMAP_WRAPPER,
-               CamelImapWrapperPrivate);
+       imap_wrapper->priv = CAMEL_IMAP_WRAPPER_GET_PRIVATE (imap_wrapper);
        imap_wrapper->priv->lock = g_mutex_new ();
 }
 
index 9505554..7122f7e 100644 (file)
@@ -156,7 +156,7 @@ imapx_folder_get_apply_filters (CamelIMAPXFolder *folder)
 
 static void
 imapx_folder_set_apply_filters (CamelIMAPXFolder *folder,
-                               gboolean apply_filters)
+                                gboolean apply_filters)
 {
        g_return_if_fail (folder != NULL);
        g_return_if_fail (CAMEL_IS_IMAPX_FOLDER (folder));
@@ -171,9 +171,9 @@ imapx_folder_set_apply_filters (CamelIMAPXFolder *folder,
 
 static void
 imapx_folder_set_property (GObject *object,
-                          guint property_id,
-                          const GValue *value,
-                          GParamSpec *pspec)
+                           guint property_id,
+                           const GValue *value,
+                           GParamSpec *pspec)
 {
        switch (property_id) {
                case PROP_APPLY_FILTERS:
@@ -188,9 +188,9 @@ imapx_folder_set_property (GObject *object,
 
 static void
 imapx_folder_get_property (GObject *object,
-                          guint property_id,
-                          GValue *value,
-                          GParamSpec *pspec)
+                           guint property_id,
+                           GValue *value,
+                           GParamSpec *pspec)
 {
        switch (property_id) {
                case PROP_APPLY_FILTERS:
@@ -454,10 +454,10 @@ imapx_expunge_sync (CamelFolder *folder,
 
 static gboolean
 imapx_fetch_messages_sync (CamelFolder *folder,
-                          CamelFetchType type,
-                          int limit,
-                          GCancellable *cancellable,
-                          GError **error)
+                           CamelFetchType type,
+                           gint limit,
+                           GCancellable *cancellable,
+                           GError **error)
 {
        CamelStore *parent_store;
        CamelIMAPXStore *istore;
@@ -558,10 +558,10 @@ imapx_get_message_sync (CamelFolder *folder,
 
 static gboolean
 imapx_purge_message_cache_sync (CamelFolder *folder,
-                               gchar *start_uid,
-                               gchar *end_uid,
-                               GCancellable *cancellable,
-                               GError **error)
+                                gchar *start_uid,
+                                gchar *end_uid,
+                                GCancellable *cancellable,
+                                GError **error)
 {
        /* Not Implemented for now. */
        return TRUE;
index 14bb8ba..aa99fd9 100644 (file)
@@ -101,7 +101,7 @@ static CamelProvider imapx_provider = {
 
        CAMEL_PROVIDER_IS_REMOTE | CAMEL_PROVIDER_IS_SOURCE |
        CAMEL_PROVIDER_IS_STORAGE | CAMEL_PROVIDER_SUPPORTS_SSL|
-       CAMEL_PROVIDER_SUPPORTS_MOBILE_DEVICES | 
+       CAMEL_PROVIDER_SUPPORTS_MOBILE_DEVICES |
        CAMEL_PROVIDER_SUPPORTS_BATCH_FETCH |
        CAMEL_PROVIDER_SUPPORTS_PURGE_MESSAGE_CACHE,
 
index 7c38064..0117b6f 100644 (file)
@@ -3648,8 +3648,8 @@ imapx_command_step_fetch_done (CamelIMAPXServer *is,
        camel_folder_change_info_clear (data->changes);
 
        if (i < data->infos->len) {
-               int total = camel_folder_summary_count (job->folder->summary);
-               int fetch_limit = data->fetch_msg_limit;
+               gint total = camel_folder_summary_count (job->folder->summary);
+               gint fetch_limit = data->fetch_msg_limit;
 
                camel_imapx_command_unref (ic);
 
@@ -4109,12 +4109,11 @@ imapx_job_fetch_new_messages_start (CamelIMAPXJob *job,
 
 static void
 imapx_job_fetch_messages_start (CamelIMAPXJob *job,
-                               CamelIMAPXServer *is)
+                                CamelIMAPXServer *is)
 {
        CamelIMAPXCommand *ic;
        CamelFolder *folder = job->folder;
-       CamelIMAPXFolder *ifolder = (CamelIMAPXFolder *) folder;
-       guint32 total, diff;
+       guint32 total;
        gchar *start_uid = NULL, *end_uid = NULL;
        CamelFetchType ftype;
        gint fetch_limit;
@@ -4122,10 +4121,10 @@ imapx_job_fetch_messages_start (CamelIMAPXJob *job,
        CamelService *service;
        CamelSettings *settings;
        guint uidset_size;
-        RefreshInfoData *data;
+       RefreshInfoData *data;
 
-        data = camel_imapx_job_get_data (job);
-        g_return_if_fail (data != NULL);
+       data = camel_imapx_job_get_data (job);
+       g_return_if_fail (data != NULL);
 
        service = CAMEL_SERVICE (is->store);
        settings = camel_service_get_settings (service);
@@ -4134,7 +4133,6 @@ imapx_job_fetch_messages_start (CamelIMAPXJob *job,
                CAMEL_IMAPX_SETTINGS (settings));
 
        total = camel_folder_summary_count (folder->summary);
-       diff = ifolder->exists_on_server - total;
 
        ftype = data->fetch_type;
        fetch_limit = data->fetch_msg_limit;
@@ -4142,10 +4140,10 @@ imapx_job_fetch_messages_start (CamelIMAPXJob *job,
        uidset_size = camel_imapx_settings_get_batch_fetch_count (
                CAMEL_IMAPX_SETTINGS (settings));
 
-       if (ftype == CAMEL_FETCH_NEW_MESSAGES || 
+       if (ftype == CAMEL_FETCH_NEW_MESSAGES ||
                (ftype ==  CAMEL_FETCH_OLD_MESSAGES && total <=0 )) {
 
-               char *uid;
+               gchar *uid;
 
                if (total > 0) {
                        /* This means that we are fetching limited number of new mails */
@@ -4181,7 +4179,7 @@ imapx_job_fetch_messages_start (CamelIMAPXJob *job,
                        job->cancellable,
                        ngettext ("Fetching summary information for %d message in %s",
                                  "Fetching summary information for %d messages in %s", data->fetch_msg_limit),
-                       data->fetch_msg_limit, camel_folder_get_full_name (folder));            
+                       data->fetch_msg_limit, camel_folder_get_full_name (folder));
                /* New account and fetching old messages, we would return just the limited number of newest messages */
                ic = camel_imapx_command_new (
                        is, "FETCH", job->folder, 
@@ -4202,16 +4200,16 @@ imapx_job_fetch_messages_start (CamelIMAPXJob *job,
 
                return;
        } else if (ftype == CAMEL_FETCH_OLD_MESSAGES && total > 0) {
-                       unsigned long long uidl;
+                       guint64 uidl;
                        start_uid = imapx_get_uid_from_index (folder->summary, 0);
-                       uidl = strtoull(start_uid, NULL, 10);
+                       uidl = strtoull (start_uid, NULL, 10);
                        end_uid = g_strdup_printf("%lld", (((int)uidl)-fetch_limit > 0) ? (uidl-fetch_limit) : 1);
 
-                       camel_operation_push_message(
+                       camel_operation_push_message (
                                job->cancellable,
                                ngettext ("Fetching summary information for %d message in %s",
                                          "Fetching summary information for %d messages in %s", data->fetch_msg_limit),
-                               data->fetch_msg_limit, camel_folder_get_full_name (folder));            
+                               data->fetch_msg_limit, camel_folder_get_full_name (folder));
 
                        ic = camel_imapx_command_new (is, "FETCH", job->folder,
                                                "UID FETCH %s:%s (RFC822.SIZE RFC822.HEADER FLAGS)", start_uid, end_uid);
@@ -6215,29 +6213,29 @@ imapx_job_fetch_messages_matches (CamelIMAPXJob *job,
                                       CamelFolder *folder,
                                       const gchar *uid)
 {
-        return (folder == job->folder);
+       return (folder == job->folder);
 }
 
-gboolean       
+gboolean
 camel_imapx_server_fetch_messages (CamelIMAPXServer *is,
-                                  CamelFolder *folder,
-                                  CamelFetchType type,
-                                  int limit,
-                                  GCancellable *cancellable,
-                                  GError **error)
+                                   CamelFolder *folder,
+                                   CamelFetchType type,
+                                   gint limit,
+                                   GCancellable *cancellable,
+                                   GError **error)
 {
        CamelIMAPXJob *job;
        RefreshInfoData *data;
        gboolean registered = TRUE;
        const gchar *full_name;
        gboolean success = TRUE;
-       unsigned long long firstuid, newfirstuid;
+       guint64 firstuid, newfirstuid;
        gchar *uid;
-       int old_len;
+       gint old_len;
 
        old_len = camel_folder_summary_count (folder->summary);
        uid = imapx_get_uid_from_index (folder->summary, 0);
-       firstuid = strtoull(uid, NULL, 10);
+       firstuid = strtoull (uid, NULL, 10);
        g_free (uid);
 
        QUEUE_LOCK (is);
@@ -6249,7 +6247,6 @@ camel_imapx_server_fetch_messages (CamelIMAPXServer *is,
                return TRUE;
        }
 
-
        data = g_slice_new0 (RefreshInfoData);
        data->changes = camel_folder_change_info_new ();
        data->fetch_msg_limit = limit;
@@ -6263,7 +6260,7 @@ camel_imapx_server_fetch_messages (CamelIMAPXServer *is,
        job->pri = IMAPX_PRIORITY_NEW_MESSAGES;
 
        full_name = camel_folder_get_full_name (folder);
-       
+
        if (g_ascii_strcasecmp(full_name, "INBOX") == 0)
                job->pri += 10;
 
@@ -6280,7 +6277,7 @@ camel_imapx_server_fetch_messages (CamelIMAPXServer *is,
                camel_folder_changed (folder, data->changes);
 
        uid = imapx_get_uid_from_index (folder->summary, 0);
-       newfirstuid = strtoull(uid, NULL, 10);
+       newfirstuid = strtoull (uid, NULL, 10);
        g_free (uid);
 
        camel_imapx_job_unref (job);
index a7ce0a3..0172228 100644 (file)
@@ -166,13 +166,13 @@ gboolean  camel_imapx_server_expunge      (CamelIMAPXServer *is,
                                                 CamelFolder *folder,
                                                 GCancellable *cancellable,
                                                 GError **error);
-gboolean       camel_imapx_server_fetch_messages               
+gboolean       camel_imapx_server_fetch_messages
                                                (CamelIMAPXServer *is,
-                                                        CamelFolder *folder,
+                                                CamelFolder *folder,
                                                 CamelFetchType type,
-                                                int limit,
+                                                gint limit,
                                                 GCancellable *cancellable,
-                                                        GError **error);
+                                                GError **error);
 gboolean       camel_imapx_server_noop         (CamelIMAPXServer *is,
                                                 CamelFolder *folder,
                                                 GCancellable *cancellable,
index 3b1d55c..2253f84 100644 (file)
@@ -392,7 +392,7 @@ fill_fi (CamelStore *store,
          guint32 flags)
 {
        CamelFolder *folder;
-       CamelService *service = (CamelService *)store;
+       CamelService *service = (CamelService *) store;
        CamelSettings *settings;
        gboolean mobile_mode;
 
index 776f615..0b50d5d 100644 (file)
@@ -333,8 +333,8 @@ imapx_update_store_summary (CamelFolder *folder)
 
                        if (!mobile_mode)
                                si->unread = unread;
-                       else 
-                               si->unread =  ((CamelIMAPXFolder *)folder)->unread_on_server;
+                       else
+                               si->unread =  ((CamelIMAPXFolder *) folder)->unread_on_server;
                        si->total = total;
 
                        camel_store_summary_touch ((CamelStoreSummary *)((CamelIMAPXStore *) parent_store)->summary);
index c62d8c8..10662aa 100644 (file)
 #define PATH_MAX _POSIX_PATH_MAX
 #endif
 
+#define CAMEL_LOCAL_FOLDER_GET_PRIVATE(obj) \
+       (G_TYPE_INSTANCE_GET_PRIVATE \
+       ((obj), CAMEL_TYPE_LOCAL_FOLDER, CamelLocalFolderPrivate))
+
 /* The custom property ID is a CamelArg artifact.
  * It still identifies the property in state files. */
 enum {
@@ -487,9 +491,7 @@ camel_local_folder_init (CamelLocalFolder *local_folder)
 {
        CamelFolder *folder = CAMEL_FOLDER (local_folder);
 
-       local_folder->priv = G_TYPE_INSTANCE_GET_PRIVATE (
-               local_folder, CAMEL_TYPE_LOCAL_FOLDER,
-               CamelLocalFolderPrivate);
+       local_folder->priv = CAMEL_LOCAL_FOLDER_GET_PRIVATE (local_folder);
        local_folder->priv->search_lock = g_mutex_new ();
 
        folder->folder_flags |= (CAMEL_FOLDER_HAS_SUMMARY_CAPABILITY |
index 5165a2b..2d3d3f2 100644 (file)
@@ -38,8 +38,10 @@ struct _CamelLocalFolderPrivate {
        GMutex *search_lock;    /* for locking the search object */
 };
 
-#define CAMEL_LOCAL_FOLDER_LOCK(f, l) (g_mutex_lock(((CamelLocalFolder *)f)->priv->l))
-#define CAMEL_LOCAL_FOLDER_UNLOCK(f, l) (g_mutex_unlock(((CamelLocalFolder *)f)->priv->l))
+#define CAMEL_LOCAL_FOLDER_LOCK(f, l) \
+       (g_mutex_lock (((CamelLocalFolder *) f)->priv->l))
+#define CAMEL_LOCAL_FOLDER_UNLOCK(f, l) \
+       (g_mutex_unlock (((CamelLocalFolder *) f)->priv->l))
 
 gint camel_local_frompos_sort (gpointer enc, gint len1, gpointer  data1, gint len2, gpointer data2);
 
index 6c0f1dd..3432f0a 100644 (file)
@@ -535,7 +535,7 @@ maildir_dir_name_to_fullname (const gchar *dir_name)
 static gint
 scan_dirs (CamelStore *store,
            guint32 flags,
-          gboolean can_inbox_sibling,
+           gboolean can_inbox_sibling,
            CamelFolderInfo **topfi,
            GCancellable *cancellable,
            GError **error)
index bc4faab..124f541 100644 (file)
 
 #include "camel-maildir-summary.h"
 
+#define CAMEL_MAILDIR_SUMMARY_GET_PRIVATE(obj) \
+       (G_TYPE_INSTANCE_GET_PRIVATE \
+       ((obj), CAMEL_TYPE_MAILDIR_SUMMARY, CamelMaildirSummaryPrivate))
+
 #define d(x) /*(printf("%s(%d): ", __FILE__, __LINE__),(x))*/
 
 #define CAMEL_MAILDIR_SUMMARY_VERSION (0x2000)
@@ -73,7 +77,7 @@ maildir_summary_finalize (GObject *object)
 {
        CamelMaildirSummaryPrivate *priv;
 
-       priv = CAMEL_MAILDIR_SUMMARY (object)->priv;
+       priv = CAMEL_MAILDIR_SUMMARY_GET_PRIVATE (object);
 
        g_free (priv->hostname);
        g_mutex_free (priv->summary_lock);
@@ -118,9 +122,8 @@ camel_maildir_summary_init (CamelMaildirSummary *maildir_summary)
 
        folder_summary = CAMEL_FOLDER_SUMMARY (maildir_summary);
 
-       maildir_summary->priv = G_TYPE_INSTANCE_GET_PRIVATE (
-               maildir_summary, CAMEL_TYPE_MAILDIR_SUMMARY,
-               CamelMaildirSummaryPrivate);
+       maildir_summary->priv =
+               CAMEL_MAILDIR_SUMMARY_GET_PRIVATE (maildir_summary);
 
        /* set unique file version */
        folder_summary->version += CAMEL_MAILDIR_SUMMARY_VERSION;
index ec797a2..0354a8b 100644 (file)
@@ -478,8 +478,8 @@ mbox_store_get_folder_info_sync (CamelStore *store,
        if (g_stat (path, &st) == -1 || !S_ISREG (st.st_mode)) {
                char *test_if_subdir = g_strdup_printf("%s.sbd", path);
 
-               if (g_stat(test_if_subdir, &st) == -1) {
-                       g_free(path);
+               if (g_stat (test_if_subdir, &st) == -1) {
+                       g_free (path);
                        g_free (test_if_subdir);
                        return NULL;
                }
index 7e9589f..8b3ce9f 100644 (file)
 
 #define CAMEL_MH_SUMMARY_VERSION (0x2000)
 
+#define CAMEL_MH_SUMMARY_GET_PRIVATE(obj) \
+       (G_TYPE_INSTANCE_GET_PRIVATE \
+       ((obj), CAMEL_TYPE_MH_SUMMARY, CamelMhSummaryPrivate))
+
 static gint mh_summary_check (CamelLocalSummary *cls, CamelFolderChangeInfo *changeinfo, GCancellable *cancellable, GError **error);
 static gint mh_summary_sync (CamelLocalSummary *cls, gboolean expunge, CamelFolderChangeInfo *changeinfo, GCancellable *cancellable, GError **error);
 /*static gint mh_summary_add(CamelLocalSummary *cls, CamelMimeMessage *msg, CamelMessageInfo *info, CamelFolderChangeInfo *, GError **error);*/
@@ -74,8 +78,7 @@ camel_mh_summary_init (CamelMhSummary *mh_summary)
 {
        CamelFolderSummary *folder_summary;
 
-       mh_summary->priv = G_TYPE_INSTANCE_GET_PRIVATE (
-               mh_summary, CAMEL_TYPE_MH_SUMMARY, CamelMhSummaryPrivate);
+       mh_summary->priv = CAMEL_MH_SUMMARY_GET_PRIVATE (mh_summary);
 
        folder_summary = CAMEL_FOLDER_SUMMARY (mh_summary);
 
index 97af26a..b557ebc 100644 (file)
@@ -44,6 +44,10 @@ enum {
        PROP_APPLY_FILTERS = 0x2501
 };
 
+#define CAMEL_NNTP_FOLDER_GET_PRIVATE(obj) \
+       (G_TYPE_INSTANCE_GET_PRIVATE \
+       ((obj), CAMEL_TYPE_NNTP_FOLDER, CamelNNTPFolderPrivate))
+
 G_DEFINE_TYPE (CamelNNTPFolder, camel_nntp_folder, CAMEL_TYPE_DISCO_FOLDER)
 
 static gboolean
@@ -57,7 +61,7 @@ nntp_folder_get_apply_filters (CamelNNTPFolder *folder)
 
 static void
 nntp_folder_set_apply_filters (CamelNNTPFolder *folder,
-                              gboolean apply_filters)
+                               gboolean apply_filters)
 {
        g_return_if_fail (folder != NULL);
        g_return_if_fail (CAMEL_IS_NNTP_FOLDER (folder));
@@ -72,9 +76,9 @@ nntp_folder_set_apply_filters (CamelNNTPFolder *folder,
 
 static void
 nntp_folder_set_property (GObject *object,
-                         guint property_id,
-                         const GValue *value,
-                         GParamSpec *pspec)
+                          guint property_id,
+                          const GValue *value,
+                          GParamSpec *pspec)
 {
        switch (property_id) {
                case PROP_APPLY_FILTERS:
@@ -89,9 +93,9 @@ nntp_folder_set_property (GObject *object,
 
 static void
 nntp_folder_get_property (GObject *object,
-                         guint property_id,
-                         GValue *value,
-                         GParamSpec *pspec)
+                          guint property_id,
+                          GValue *value,
+                          GParamSpec *pspec)
 {
        switch (property_id) {
                case PROP_APPLY_FILTERS:
@@ -762,8 +766,7 @@ camel_nntp_folder_class_init (CamelNNTPFolderClass *class)
 static void
 camel_nntp_folder_init (CamelNNTPFolder *nntp_folder)
 {
-       nntp_folder->priv = G_TYPE_INSTANCE_GET_PRIVATE (
-               nntp_folder, CAMEL_TYPE_NNTP_FOLDER, CamelNNTPFolderPrivate);
+       nntp_folder->priv = CAMEL_NNTP_FOLDER_GET_PRIVATE (nntp_folder);
 
        nntp_folder->changes = camel_folder_change_info_new ();
        nntp_folder->priv->search_lock = g_mutex_new ();
index 206adbe..6a0bd7a 100644 (file)
 
 G_BEGIN_DECLS
 
-#define CAMEL_NNTP_STORE_LOCK(f, l) (e_mutex_lock(((CamelNNTPStore *)f)->priv->l))
-#define CAMEL_NNTP_STORE_UNLOCK(f, l) (e_mutex_unlock(((CamelNNTPStore *)f)->priv->l))
+#define CAMEL_NNTP_STORE_LOCK(f, l) \
+       (e_mutex_lock (((CamelNNTPStore *) f)->priv->l))
+#define CAMEL_NNTP_STORE_UNLOCK(f, l) \
+       (e_mutex_unlock (((CamelNNTPStore *) f)->priv->l))
 
 struct _CamelNNTPFolderPrivate {
        GMutex *search_lock;    /* for locking the search object */
@@ -42,11 +44,10 @@ struct _CamelNNTPFolderPrivate {
        gboolean apply_filters;         /* persistent property */
 };
 
-#define CAMEL_NNTP_FOLDER_LOCK(f, l) (g_mutex_lock(((CamelNNTPFolder *)f)->priv->l))
-#define CAMEL_NNTP_FOLDER_UNLOCK(f, l) (g_mutex_unlock(((CamelNNTPFolder *)f)->priv->l))
-#else
-#define CAMEL_NNTP_FOLDER_LOCK(f, l)
-#define CAMEL_NNTP_FOLDER_UNLOCK(f, l)
+#define CAMEL_NNTP_FOLDER_LOCK(f, l) \
+       (g_mutex_lock (((CamelNNTPFolder *) f)->priv->l))
+#define CAMEL_NNTP_FOLDER_UNLOCK(f, l) \
+       (g_mutex_unlock (((CamelNNTPFolder *) f)->priv->l))
 
 G_END_DECLS
 
index 351eb72..8f202af 100644 (file)
@@ -917,7 +917,7 @@ nntp_store_get_cached_folder_info (CamelNNTPStore *store,
                                    si->path[strlen (last->full_name)] != '.') {
                                        gchar *dot;
                                        tmpname = g_strdup (si->path);
-                                       dot = strchr(tmpname + toplen, '.');
+                                       dot = strchr (tmpname + toplen, '.');
                                        if (dot)
                                                *dot = '\0';
                                        fi = nntp_folder_info_from_name (store, FALSE, tmpname);
index 38f8573..329c0d2 100644 (file)
 
 #define CAMEL_NNTP_SUMMARY_VERSION (1)
 
+#define CAMEL_NNTP_SUMMARY_GET_PRIVATE(obj) \
+       (G_TYPE_INSTANCE_GET_PRIVATE \
+       ((obj), CAMEL_TYPE_NNTP_SUMMARY, CamelNNTPSummaryPrivate))
+
 struct _CamelNNTPSummaryPrivate {
        gchar *uid;
 
@@ -51,8 +55,6 @@ struct _CamelNNTPSummaryPrivate {
        gint xover_setup;
 };
 
-#define _PRIVATE(o) (((CamelNNTPSummary *)(o))->priv)
-
 static CamelMessageInfo * message_info_new_from_header (CamelFolderSummary *, struct _camel_header_raw *);
 static gboolean summary_header_from_db (CamelFolderSummary *s, CamelFIRecord *mir);
 static CamelFIRecord * summary_header_to_db (CamelFolderSummary *s, GError **error);
@@ -79,9 +81,7 @@ camel_nntp_summary_init (CamelNNTPSummary *nntp_summary)
 {
        CamelFolderSummary *summary = CAMEL_FOLDER_SUMMARY (nntp_summary);
 
-       nntp_summary->priv = G_TYPE_INSTANCE_GET_PRIVATE (
-               nntp_summary, CAMEL_TYPE_NNTP_SUMMARY,
-               CamelNNTPSummaryPrivate);
+       nntp_summary->priv = CAMEL_NNTP_SUMMARY_GET_PRIVATE (nntp_summary);
 
        /* and a unique file version */
        summary->version += CAMEL_NNTP_SUMMARY_VERSION;
index dbaa785..f573f9c 100644 (file)
@@ -47,17 +47,17 @@ free_fi (CamelPOP3Folder *pop3_folder,CamelPOP3FolderInfo *fi)
        CamelPOP3Store *pop3_store;
        CamelStore *store;
 
-       store = camel_folder_get_parent_store ((CamelFolder *)pop3_folder);
-       pop3_store = CAMEL_POP3_STORE(store);
+       store = camel_folder_get_parent_store ((CamelFolder *) pop3_folder);
+       pop3_store = CAMEL_POP3_STORE (store);
 
-       g_hash_table_remove (pop3_folder->uids_id, GINT_TO_POINTER(fi->id));
+       g_hash_table_remove (pop3_folder->uids_id, GINT_TO_POINTER (fi->id));
        if (fi->cmd) {
                camel_pop3_engine_command_free (pop3_store->engine, fi->cmd);
                fi->cmd = NULL;
        }
        g_free (fi->uid);
        g_free (fi);
-       
+
 }
 static void
 cmd_uidl (CamelPOP3Engine *pe,
@@ -154,19 +154,19 @@ cmd_list (CamelPOP3Engine *pe,
        CamelStore *parent_store;
        CamelPOP3Store *pop3_store;
        CamelPOP3FolderInfo *fi;
-       int i=0, total, last_uid=-1;
+       gint i = 0, total, last_uid=-1;
        CamelPOP3Folder *pop3_folder;
        CamelService *service;
        CamelSettings *settings;
-       int batch_fetch_count;
+       gint batch_fetch_count;
 
        parent_store = camel_folder_get_parent_store (folder);
        pop3_store = CAMEL_POP3_STORE (parent_store);
-       pop3_folder = (CamelPOP3Folder *)folder;
+       pop3_folder = (CamelPOP3Folder *) folder;
        service = (CamelService *) parent_store;
        settings = camel_service_get_settings (service);
 
-       batch_fetch_count = camel_pop3_settings_get_batch_fetch_count (CAMEL_POP3_SETTINGS(settings));
+       batch_fetch_count = camel_pop3_settings_get_batch_fetch_count (CAMEL_POP3_SETTINGS (settings));
 
        do {
                ret = camel_pop3_stream_line (stream, &line, &len, cancellable, NULL);
@@ -186,14 +186,14 @@ cmd_list (CamelPOP3Engine *pe,
 
        /* Trim the list for mobile devices*/
        if (pop3_folder->mobile_mode && pop3_folder->uids->len) {
-               int y=0;
+               gint y = 0;
                gboolean save_uid = FALSE;
                CamelNetworkSettings *network_settings;
-               const gchar *host; 
+               const gchar *host;
 
                network_settings = CAMEL_NETWORK_SETTINGS (settings);
                host = camel_network_settings_get_host (network_settings);
-               
+
                d(printf("*********** Mobile mode *************\n"));
                d(printf("Total Count: %s: %d\n", host, pop3_folder->uids->len));
 
@@ -214,104 +214,103 @@ cmd_list (CamelPOP3Engine *pe,
                if (last_uid == -1)
                        save_uid = TRUE;
 
-               for (i=total-1; i >= 0; i--) {
+               for (i = total - 1; i >= 0; i--) {
                        fi = pop3_folder->uids->pdata[i];
 
-                       if ((last_uid != -1 && last_uid >= fi->id) || (last_uid == -1 && i == total-batch_fetch_count)) {
+                       if ((last_uid != -1 && last_uid >= fi->id) || (last_uid == -1 && i == total - batch_fetch_count)) {
                                if (last_uid != -1 && last_uid < fi->id)
-                                       i++; /* if the last uid was deleted on the server, then we need the last but 1*/
+                                       i++; /* if the last uid was deleted on the server, then we need the last but 1 */
                                break;
-                       } 
-                       
+                       }
+
                }
                if (i> 0 && pop3_folder->fetch_type == CAMEL_FETCH_OLD_MESSAGES && pop3_folder->fetch_more) {
-                       int k=0;
+                       gint k = 0;
                        /* Lets pull another window of old messages */
                        save_uid = TRUE;
                        /* Decrement 'i' by another batch count or till we reach the first message */
                        d(printf("Fetch more (%d): from %d", pop3_folder->fetch_more, i));
-                       for (k=0; k< pop3_folder->fetch_more && i>= 0; k++, i--);
+                       for (k = 0; k< pop3_folder->fetch_more && i>= 0; k++, i--);
                        d(printf(" to %d\n", i));
 
                        /* Don't load messages newer than the latest we already had. We had to just get old messages and not 
                         * new messages. */
-                       for (y=i; y<total; y++) {
+                       for (y = i; y < total; y++) {
                                fi = pop3_folder->uids->pdata[y];
                                if (fi->id == pop3_folder->latest_id) {
                                        /* Delete everything after this. */
 
-                                       for (y=k+1; y < total; y++) {
+                                       for (y = k + 1; y < total; y++) {
                                                fi = pop3_folder->uids->pdata[y];
                                                free_fi (pop3_folder, fi);
                                        }
-                                       g_ptr_array_remove_range (pop3_folder->uids, k+1, total-k-1);
+                                       g_ptr_array_remove_range (pop3_folder->uids, k + 1, total - k - 1);
                                        break;
                                }
                        }
-                               
+
                } else if (pop3_folder->fetch_more == CAMEL_FETCH_NEW_MESSAGES && pop3_folder->fetch_more) {
                        /* We need to download new messages. */
-                       int k=0;
+                       gint k = 0;
 
-                       for (k=i; k<total; k++) {
+                       for (k = i; k < total; k++) {
                                fi = pop3_folder->uids->pdata[k];
                                if (fi->id == pop3_folder->latest_id) {
                                        /* We need to just download the specified number of messages. */
-                                       y= (k+pop3_folder->fetch_more) < total ? (k+pop3_folder->fetch_more) : total-1;
+                                       y= (k + pop3_folder->fetch_more) < total ? (k + pop3_folder->fetch_more) : total - 1;
                                        break;
                                }
                        }
 
                }
-               
+
                /* Delete the unnecessary old messages */
                if (i > 0) {
-                       int j=0;
+                       gint j = 0;
                        /* i is the start of the last fetch UID, so remove everything else from 0 to i */
-                       for (; j<i; j++) {
+                       for (; j < i; j++) {
                                fi = pop3_folder->uids->pdata[j];
                                free_fi (pop3_folder, fi);
                        }
                        g_ptr_array_remove_range (pop3_folder->uids, 0, i);
                        d(printf("Removing %d uids that are old\n", i));
-                       
-               } 
+
+               }
 
                /* Delete the unnecessary new message references. */
-               if (y+1 < total) {
-                       int k;
+               if (y + 1 < total) {
+                       gint k;
 
-                       for (k=y+1; k < total; k++) {
+                       for (k = y + 1; k < total; k++) {
                                fi = pop3_folder->uids->pdata[k];
                                free_fi (pop3_folder, fi);
                        }
-                       g_ptr_array_remove_range (pop3_folder->uids, y+1, total-y-1);
+                       g_ptr_array_remove_range (pop3_folder->uids, y + 1, total - y - 1);
                }
 
                if (save_uid) {
-                       char *contents;
+                       gchar *contents;
                        gsize len;
-                       const char *root;
-                       char *path;
-       
+                       const gchar *root;
+                       gchar *path;
+
                        /* Save the last fetched UID */
-                       fi = pop3_folder->uids->pdata[0];                       
+                       fi = pop3_folder->uids->pdata[0];
                        g_key_file_set_integer (pop3_folder->key_file, "UIDConfig", "last-saved-uid", fi->id);
                        contents = g_key_file_to_data (pop3_folder->key_file, &len, NULL);
                        root = camel_service_get_user_cache_dir (service);
                        path = g_build_filename (root, "uidconfig", NULL);
                        g_file_set_contents (path, contents, len, NULL);
-                       g_key_file_load_from_file (pop3_folder->key_file, path, G_KEY_FILE_NONE, NULL);         
+                       g_key_file_load_from_file (pop3_folder->key_file, path, G_KEY_FILE_NONE, NULL);
                        g_free (contents);
                        g_free (path);
                        d(printf("Saving last uid %d\n", fi->id));
-                       
+
                }
 
        }
 
-}      
-
+}
 
 static void
 cmd_tocache (CamelPOP3Engine *pe,
@@ -510,7 +509,6 @@ pop3_folder_get_message_sync (CamelFolder *folder,
                "auto-fetch", &auto_fetch,
                NULL);
 
-
        fi = g_hash_table_lookup (pop3_folder->uids_fi, uid);
        if (fi == NULL) {
                g_set_error (
@@ -667,7 +665,7 @@ pop3_folder_refresh_info_sync (CamelFolder *folder,
                CamelPOP3FolderInfo *last_fi;
 
                if (pop3_folder->uids->len) {
-                       last_fi = pop3_folder->uids->pdata[pop3_folder->uids->len-1];
+                       last_fi = pop3_folder->uids->pdata[pop3_folder->uids->len - 1];
                        if (last_fi)
                                pop3_folder->latest_id = last_fi->id;
                        else
@@ -744,25 +742,25 @@ pop3_folder_refresh_info_sync (CamelFolder *folder,
 }
 
 static gboolean
-pop3_fetch_messages_sync (CamelFolder *folder, 
-                         CamelFetchType type,
-                         int limit,
-                         GCancellable *cancellable, 
-                         GError **error)
+pop3_fetch_messages_sync (CamelFolder *folder,
+                          CamelFetchType type,
+                          gint limit,
+                          GCancellable *cancellable,
+                          GError **error)
 {
        CamelPOP3FolderInfo *fi;
-       CamelPOP3Folder *pop3_folder = (CamelPOP3Folder *)folder;
-       int old_len;
+       CamelPOP3Folder *pop3_folder = (CamelPOP3Folder *) folder;
+       gint old_len;
        CamelStore *parent_store;
        CamelService *service;
        CamelSettings *settings;
-       int batch_fetch_count;
+       gint batch_fetch_count;
 
        parent_store = camel_folder_get_parent_store (folder);
        service = (CamelService *) parent_store;
        settings = camel_service_get_settings (service);
 
-       batch_fetch_count = camel_pop3_settings_get_batch_fetch_count (CAMEL_POP3_SETTINGS(settings));
+       batch_fetch_count = camel_pop3_settings_get_batch_fetch_count (CAMEL_POP3_SETTINGS (settings));
 
        old_len = pop3_folder->uids->len;
 
@@ -770,7 +768,7 @@ pop3_fetch_messages_sync (CamelFolder *folder,
        fi = pop3_folder->uids->pdata[0];
        if (type == CAMEL_FETCH_OLD_MESSAGES && fi->id == pop3_folder->first_id)
                return FALSE;
-       
+
        pop3_folder->fetch_type = type;
        pop3_folder->fetch_more = (limit > 0) ? limit : batch_fetch_count;
        pop3_folder_refresh_info_sync (folder, cancellable, error);
@@ -897,7 +895,7 @@ camel_pop3_folder_class_init (CamelPOP3FolderClass *class)
        object_class->dispose = pop3_folder_dispose;
 
        folder_class = CAMEL_FOLDER_CLASS (class);
-       folder_class->fetch_messages_sync = pop3_fetch_messages_sync;   
+       folder_class->fetch_messages_sync = pop3_fetch_messages_sync;
        folder_class->get_message_count = pop3_folder_get_message_count;
        folder_class->get_uids = pop3_folder_get_uids;
        folder_class->free_uids = camel_folder_free_shallow;
@@ -927,7 +925,7 @@ camel_pop3_folder_new (CamelStore *parent,
 
        service = CAMEL_SERVICE (parent);
        settings = camel_service_get_settings (service);
-       
+
        d(printf("opening pop3 INBOX folder\n"));
 
        folder = g_object_new (
@@ -941,10 +939,10 @@ camel_pop3_folder_new (CamelStore *parent,
        pop3_folder->fetch_more = 0;
        if (pop3_folder->mobile_mode) {
                /* Setup Keyfile */
-               char *path;
-               const char *root;
+               gchar *path;
+               const gchar *root;
 
-               pop3_folder->key_file = g_key_file_new();
+               pop3_folder->key_file = g_key_file_new ();
                root = camel_service_get_user_cache_dir (service);
                path = g_build_filename (root, "uidconfig", NULL);
                g_key_file_load_from_file (pop3_folder->key_file, path, G_KEY_FILE_NONE, NULL);
index aa39551..a3f4f5f 100644 (file)
@@ -72,10 +72,10 @@ struct _CamelPOP3Folder {
 
        GKeyFile *key_file;
        gboolean mobile_mode;
-       int fetch_more;
+       gint fetch_more;
        CamelFetchType fetch_type;
-       int first_id;
-       int latest_id;
+       gint first_id;
+       gint latest_id;
 };
 
 struct _CamelPOP3FolderClass {
index d72a14b..aeeae79 100644 (file)
@@ -66,7 +66,7 @@ static CamelProvider pop3_provider = {
        "mail",
 
        CAMEL_PROVIDER_IS_REMOTE | CAMEL_PROVIDER_IS_SOURCE |
-       CAMEL_PROVIDER_SUPPORTS_SSL | 
+       CAMEL_PROVIDER_SUPPORTS_SSL |
        CAMEL_PROVIDER_SUPPORTS_MOBILE_DEVICES,
 
        CAMEL_URL_NEED_USER | CAMEL_URL_NEED_HOST | CAMEL_URL_ALLOW_AUTH,
index 3d0dfbb..2289ef6 100644 (file)
@@ -114,7 +114,7 @@ pop3_settings_set_property (GObject *object,
                        camel_network_settings_set_user (
                                CAMEL_NETWORK_SETTINGS (object),
                                g_value_get_string (value));
-                        return;
+                       return;
                case PROP_AUTO_FETCH:
                        camel_pop3_settings_set_auto_fetch  (
                                CAMEL_POP3_SETTINGS (object),
@@ -124,12 +124,12 @@ pop3_settings_set_property (GObject *object,
                        camel_pop3_settings_set_mobile_mode (
                                CAMEL_POP3_SETTINGS (object),
                                g_value_get_boolean (value));
-                       return; 
+                       return;
                case PROP_BATCH_FETCH_COUNT:
                        camel_pop3_settings_set_batch_fetch_count (
                                CAMEL_POP3_SETTINGS (object),
                                g_value_get_int (value));
-                       return;                 
+                       return;
        }
 
        G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
@@ -209,13 +209,13 @@ pop3_settings_get_property (GObject *object,
                                value,
                                camel_pop3_settings_get_auto_fetch (
                                CAMEL_POP3_SETTINGS (object)));
-                        return;
+                       return;
                case PROP_USE_MOBILE_MODE:
                        g_value_set_boolean (
                                value,
                                camel_pop3_settings_get_mobile_mode (
                                CAMEL_POP3_SETTINGS (object)));
-                        return;
+                       return;
                case PROP_BATCH_FETCH_COUNT:
                        g_value_set_int (
                                value,
index bd2a9e6..30d5109 100644 (file)
@@ -76,12 +76,12 @@ gboolean    camel_pop3_settings_get_keep_on_server
 void           camel_pop3_settings_set_keep_on_server
                                                (CamelPOP3Settings *settings,
                                                 gboolean keep_on_server);
-gboolean       camel_pop3_settings_get_auto_fetch 
+gboolean       camel_pop3_settings_get_auto_fetch
                                                (CamelPOP3Settings *settings);
 void           camel_pop3_settings_set_auto_fetch
                                                (CamelPOP3Settings *settings,
                                                 gboolean auto_fetch);
-gboolean       camel_pop3_settings_get_mobile_mode 
+gboolean       camel_pop3_settings_get_mobile_mode
                                                (CamelPOP3Settings *settings);
 void           camel_pop3_settings_set_mobile_mode
                                                (CamelPOP3Settings *settings,
@@ -90,7 +90,7 @@ gboolean      camel_pop3_settings_get_batch_fetch_count
                                                (CamelPOP3Settings *settings);
 void           camel_pop3_settings_set_batch_fetch_count
                                                (CamelPOP3Settings *settings,
-                                                int batch_fetch_count);
+                                                gint batch_fetch_count);
 
 G_END_DECLS
 
index 3b648fd..fb7c155 100644 (file)
@@ -223,7 +223,7 @@ e_dbus_server_init (EDBusServer *server)
 
 void
 e_dbus_server_run (EDBusServer *server,
-                  gboolean wait_for_client)
+                   gboolean wait_for_client)
 {
        EDBusServerClass *class;
 
index 416ded9..5395da7 100644 (file)
 
 #include <config.h>
 
+#define E_EXTENSION_GET_PRIVATE(obj) \
+       (G_TYPE_INSTANCE_GET_PRIVATE \
+       ((obj), E_TYPE_EXTENSION, EExtensionPrivate))
+
 struct _EExtensionPrivate {
        gpointer extensible;  /* weak pointer */
 };
@@ -124,7 +128,7 @@ extension_dispose (GObject *object)
 {
        EExtensionPrivate *priv;
 
-       priv = E_EXTENSION (object)->priv;
+       priv = E_EXTENSION_GET_PRIVATE (object);
 
        if (priv->extensible != NULL) {
                g_object_remove_weak_pointer (
@@ -163,8 +167,7 @@ e_extension_class_init (EExtensionClass *class)
 static void
 e_extension_init (EExtension *extension)
 {
-       extension->priv = G_TYPE_INSTANCE_GET_PRIVATE (
-               extension, E_TYPE_EXTENSION, EExtensionPrivate);
+       extension->priv = E_EXTENSION_GET_PRIVATE (extension);
 }
 
 /**
index bdd10d3..de1dc03 100644 (file)
 #include "libedataserver/e-data-server-util.h"
 #include "libedataserver/e-xml-hash-utils.h"
 
+#define E_FILE_CACHE_GET_PRIVATE(obj) \
+       (G_TYPE_INSTANCE_GET_PRIVATE \
+       ((obj), E_TYPE_FILE_CACHE, EFileCachePrivate))
+
 struct _EFileCachePrivate {
        gchar *filename;
        EXmlHash *xml_hash;
@@ -127,27 +131,16 @@ e_file_cache_get_property (GObject *object,
 static void
 e_file_cache_finalize (GObject *object)
 {
-       EFileCache *cache;
        EFileCachePrivate *priv;
 
-       cache = E_FILE_CACHE (object);
-       priv = cache->priv;
-
-       if (priv) {
-               if (priv->filename) {
-                       g_free (priv->filename);
-                       priv->filename = NULL;
-               }
+       priv = E_FILE_CACHE_GET_PRIVATE (object);
 
-               if (priv->xml_hash) {
-                       e_xmlhash_destroy (priv->xml_hash);
-                       priv->xml_hash = NULL;
-               }
+       g_free (priv->filename);
 
-               g_free (priv);
-               cache->priv = NULL;
-       }
+       if (priv->xml_hash != NULL)
+               e_xmlhash_destroy (priv->xml_hash);
 
+       /* Chain up to parent's finalize() method. */
        G_OBJECT_CLASS (e_file_cache_parent_class)->finalize (object);
 }
 
@@ -156,10 +149,12 @@ e_file_cache_class_init (EFileCacheClass *class)
 {
        GObjectClass *object_class;
 
+       g_type_class_add_private (class, sizeof (EFileCachePrivate));
+
        object_class = G_OBJECT_CLASS (class);
-       object_class->finalize = e_file_cache_finalize;
        object_class->set_property = e_file_cache_set_property;
        object_class->get_property = e_file_cache_get_property;
+       object_class->finalize = e_file_cache_finalize;
 
        /**
         * EFileCache:filename
@@ -181,12 +176,7 @@ e_file_cache_class_init (EFileCacheClass *class)
 static void
 e_file_cache_init (EFileCache *cache)
 {
-       EFileCachePrivate *priv;
-
-       priv = g_new0 (EFileCachePrivate, 1);
-       priv->dirty = FALSE;
-       priv->frozen = 0;
-       cache->priv = priv;
+       cache->priv = E_FILE_CACHE_GET_PRIVATE (cache);
 }
 
 /**
index 6d10d9a..b264598 100644 (file)
 #include <config.h>
 #include <glib/gi18n.h>
 
+#define E_MODULE_GET_PRIVATE(obj) \
+       (G_TYPE_INSTANCE_GET_PRIVATE \
+       ((obj), E_TYPE_MODULE, EModulePrivate))
+
 /* This is the symbol we call when loading a module. */
 #define LOAD_SYMBOL    "e_module_load"
 
@@ -99,7 +103,7 @@ module_finalize (GObject *object)
 {
        EModulePrivate *priv;
 
-       priv = E_MODULE (object)->priv;
+       priv = E_MODULE_GET_PRIVATE (object);
 
        g_free (priv->filename);
 
@@ -113,7 +117,7 @@ module_load (GTypeModule *type_module)
        EModulePrivate *priv;
        gpointer symbol;
 
-       priv = E_MODULE (type_module)->priv;
+       priv = E_MODULE_GET_PRIVATE (type_module);
 
        g_return_val_if_fail (priv->filename != NULL, FALSE);
        priv->module = g_module_open (priv->filename, 0);
@@ -168,7 +172,7 @@ module_unload (GTypeModule *type_module)
 {
        EModulePrivate *priv;
 
-       priv = E_MODULE (type_module)->priv;
+       priv = E_MODULE_GET_PRIVATE (type_module);
 
        priv->unload (type_module);
 
@@ -216,8 +220,7 @@ e_module_class_init (EModuleClass *class)
 static void
 e_module_init (EModule *module)
 {
-       module->priv = G_TYPE_INSTANCE_GET_PRIVATE (
-               module, E_TYPE_MODULE, EModulePrivate);
+       module->priv = E_MODULE_GET_PRIVATE (module);
 }
 
 /**
index 26c157d..22f123f 100644 (file)
 #include "e-offline-listener.h"
 #include <gconf/gconf-client.h>
 
+#define E_OFFLINE_LISTENER_GET_PRIVATE(obj) \
+       (G_TYPE_INSTANCE_GET_PRIVATE \
+       ((obj), E_TYPE_OFFLINE_LISTENER, EOfflineListenerPrivate))
+
 G_DEFINE_TYPE (EOfflineListener, e_offline_listener, G_TYPE_OBJECT)
 
 enum {
@@ -52,8 +56,6 @@ enum {
 
 static guint signals[NUM_SIGNALS] = { 0 };
 
-static GObjectClass *parent_class = NULL;
-
 struct _EOfflineListenerPrivate {
        GConfClient *default_client;
        gboolean is_offline_now;
@@ -138,36 +140,25 @@ e_offline_listener_new (void)
 }
 
 static void
-e_offline_listener_dispose (GObject *object)
+offline_listener_dispose (GObject *object)
 {
-       EOfflineListener *eol = E_OFFLINE_LISTENER (object);
-       if (eol->priv->default_client) {
-               g_object_unref (eol->priv->default_client);
-               eol->priv->default_client = NULL;
-       }
-
-       /* Chain up to parent's dispose() method. */
-       G_OBJECT_CLASS (parent_class)->dispose (object);
-}
-
-static void
-e_offline_listener_finalize (GObject *object)
-{
-       EOfflineListener *eol;
+       EOfflineListenerPrivate *priv;
 
-       eol = E_OFFLINE_LISTENER (object);
+       priv = E_OFFLINE_LISTENER_GET_PRIVATE (object);
 
-       g_free (eol->priv);
-       eol->priv = NULL;
+       if (priv->default_client) {
+               g_object_unref (priv->default_client);
+               priv->default_client = NULL;
+       }
 
-       /* Chain up to parent's finalize() method. */
-       G_OBJECT_CLASS (parent_class)->finalize (object);
+       /* Chain up to parent's dispose() method. */
+       G_OBJECT_CLASS (e_offline_listener_parent_class)->dispose (object);
 }
 
 static void
 e_offline_listener_init (EOfflineListener *eol)
 {
-       eol->priv = g_new0 (EOfflineListenerPrivate, 1);
+       eol->priv = E_OFFLINE_LISTENER_GET_PRIVATE (eol);
 }
 
 static void
@@ -175,11 +166,10 @@ e_offline_listener_class_init (EOfflineListenerClass *class)
 {
        GObjectClass *object_class;
 
-       parent_class = g_type_class_peek_parent (class);
+       g_type_class_add_private (class, sizeof (EOfflineListenerPrivate));
 
        object_class = G_OBJECT_CLASS (class);
-       object_class->dispose = e_offline_listener_dispose;
-       object_class->finalize = e_offline_listener_finalize;
+       object_class->dispose = offline_listener_dispose;
 
        /**
         * EOfflineListener::changed:
index 1712b0b..5506425 100644 (file)
 
 #include <string.h>
 
+#define E_ACCOUNT_LIST_GET_PRIVATE(obj) \
+       (G_TYPE_INSTANCE_GET_PRIVATE \
+       ((obj), E_TYPE_ACCOUNT_LIST, EAccountListPrivate))
+
 struct _EAccountListPrivate {
        GConfClient *gconf;
        guint notify_id;
@@ -40,19 +44,36 @@ enum {
 
 static guint signals[LAST_SIGNAL] = { 0 };
 
-static void dispose (GObject *);
-static void finalize (GObject *);
-
 G_DEFINE_TYPE (EAccountList, e_account_list, E_TYPE_LIST)
 
 static void
-e_account_list_class_init (EAccountListClass *klass)
+account_list_dispose (GObject *object)
+{
+       EAccountListPrivate *priv;
+
+       priv = E_ACCOUNT_LIST_GET_PRIVATE (object);
+
+       if (priv->gconf != NULL) {
+               if (priv->notify_id > 0)
+                       gconf_client_notify_remove (
+                               priv->gconf, priv->notify_id);
+               g_object_unref (priv->gconf);
+               priv->gconf = NULL;
+       }
+
+       /* Chain up to parent's dispose() method. */
+       G_OBJECT_CLASS (e_account_list_parent_class)->dispose (object);
+}
+
+static void
+e_account_list_class_init (EAccountListClass *class)
 {
-       GObjectClass *object_class = G_OBJECT_CLASS (klass);
+       GObjectClass *object_class;
 
-       /* virtual method override */
-       object_class->dispose = dispose;
-       object_class->finalize = finalize;
+       g_type_class_add_private (class, sizeof (EAccountListPrivate));
+
+       object_class = G_OBJECT_CLASS (class);
+       object_class->dispose = account_list_dispose;
 
        /* signals */
        signals[ACCOUNT_ADDED] =
@@ -87,34 +108,7 @@ e_account_list_class_init (EAccountListClass *klass)
 static void
 e_account_list_init (EAccountList *account_list)
 {
-       account_list->priv = g_new0 (EAccountListPrivate, 1);
-}
-
-static void
-dispose (GObject *object)
-{
-       EAccountList *account_list = E_ACCOUNT_LIST (object);
-
-       if (account_list->priv->gconf) {
-               if (account_list->priv->notify_id) {
-                       gconf_client_notify_remove (account_list->priv->gconf,
-                                                   account_list->priv->notify_id);
-               }
-               g_object_unref (account_list->priv->gconf);
-               account_list->priv->gconf = NULL;
-       }
-
-       G_OBJECT_CLASS (e_account_list_parent_class)->dispose (object);
-}
-
-static void
-finalize (GObject *object)
-{
-       EAccountList *account_list = E_ACCOUNT_LIST (object);
-
-       g_free (account_list->priv);
-
-       G_OBJECT_CLASS (e_account_list_parent_class)->finalize (object);
+       account_list->priv = E_ACCOUNT_LIST_GET_PRIVATE (account_list);
 }
 
 static void
index 2aa596d..adea534 100644 (file)
@@ -95,11 +95,11 @@ enum {
 static guint changed_listener_signals[LAST_SIGNAL];
 
 static void
-e_changed_listener_class_init (EChangedListenerClass *klass)
+e_changed_listener_class_init (EChangedListenerClass *class)
 {
        changed_listener_signals[CHANGED] =
                g_signal_new ("changed",
-                             G_TYPE_FROM_CLASS (klass),
+                             G_TYPE_FROM_CLASS (class),
                              G_SIGNAL_RUN_FIRST,
                              G_STRUCT_OFFSET (EChangedListenerClass, changed),
                              NULL, NULL,
index 2fd8d7f..ce354d8 100644 (file)
 #include "e-client.h"
 #include "e-client-private.h"
 
-struct _EClientPrivate
-{
+#define E_CLIENT_GET_PRIVATE(obj) \
+       (G_TYPE_INSTANCE_GET_PRIVATE \
+       ((obj), E_TYPE_CLIENT, EClientPrivate))
+
+struct _EClientPrivate {
        GStaticRecMutex prop_mutex;
 
        ESource *source;
@@ -188,7 +191,7 @@ static void client_handle_authentication (EClient *client, const ECredentials *c
 static void
 e_client_init (EClient *client)
 {
-       client->priv = G_TYPE_INSTANCE_GET_PRIVATE (client, E_TYPE_CLIENT, EClientPrivate);
+       client->priv = E_CLIENT_GET_PRIVATE (client);
 
        client->priv->readonly = TRUE;
 
@@ -314,13 +317,13 @@ client_get_property (GObject *object,
 }
 
 static void
-e_client_class_init (EClientClass *klass)
+e_client_class_init (EClientClass *class)
 {
        GObjectClass *object_class;
 
-       g_type_class_add_private (klass, sizeof (EClientPrivate));
+       g_type_class_add_private (class, sizeof (EClientPrivate));
 
-       object_class = G_OBJECT_CLASS (klass);
+       object_class = G_OBJECT_CLASS (class);
        object_class->set_property = client_set_property;
        object_class->get_property = client_get_property;
        object_class->dispose = client_dispose;
@@ -377,7 +380,7 @@ e_client_class_init (EClientClass *klass)
 
        signals[AUTHENTICATE] = g_signal_new (
                "authenticate",
-               G_OBJECT_CLASS_TYPE (klass),
+               G_OBJECT_CLASS_TYPE (class),
                G_SIGNAL_RUN_LAST,
                G_STRUCT_OFFSET (EClientClass, authenticate),
                NULL, NULL,
@@ -387,7 +390,7 @@ e_client_class_init (EClientClass *klass)
 
        signals[OPENED] = g_signal_new (
                "opened",
-               G_OBJECT_CLASS_TYPE (klass),
+               G_OBJECT_CLASS_TYPE (class),
                G_SIGNAL_RUN_LAST,
                G_STRUCT_OFFSET (EClientClass, opened),
                NULL, NULL,
@@ -397,7 +400,7 @@ e_client_class_init (EClientClass *klass)
 
        signals[BACKEND_ERROR] = g_signal_new (
                "backend-error",
-               G_OBJECT_CLASS_TYPE (klass),
+               G_OBJECT_CLASS_TYPE (class),
                G_SIGNAL_RUN_FIRST,
                G_STRUCT_OFFSET (EClientClass, backend_error),
                NULL, NULL,
@@ -407,7 +410,7 @@ e_client_class_init (EClientClass *klass)
 
        signals[BACKEND_DIED] = g_signal_new (
                "backend-died",
-               G_OBJECT_CLASS_TYPE (klass),
+               G_OBJECT_CLASS_TYPE (class),
                G_SIGNAL_RUN_LAST,
                G_STRUCT_OFFSET (EClientClass, backend_died),
                NULL, NULL,
@@ -416,7 +419,7 @@ e_client_class_init (EClientClass *klass)
 
        signals[BACKEND_PROPERTY_CHANGED] = g_signal_new (
                "backend-property-changed",
-               G_OBJECT_CLASS_TYPE (klass),
+               G_OBJECT_CLASS_TYPE (class),
                G_SIGNAL_RUN_LAST,
                G_STRUCT_OFFSET (EClientClass, backend_property_changed),
                NULL, NULL,
@@ -854,17 +857,17 @@ static void
 client_handle_authentication (EClient *client,
                               const ECredentials *credentials)
 {
-       EClientClass *klass;
+       EClientClass *class;
 
        g_return_if_fail (client != NULL);
        g_return_if_fail (E_IS_CLIENT (client));
        g_return_if_fail (credentials != NULL);
 
-       klass = E_CLIENT_GET_CLASS (client);
-       g_return_if_fail (klass != NULL);
-       g_return_if_fail (klass->handle_authentication != NULL);
+       class = E_CLIENT_GET_CLASS (client);
+       g_return_if_fail (class != NULL);
+       g_return_if_fail (class->handle_authentication != NULL);
 
-       return klass->handle_authentication (client, credentials);
+       return class->handle_authentication (client, credentials);
 }
 
 struct EClientAuthData {
@@ -883,8 +886,8 @@ client_process_authentication_idle_cb (gpointer user_data)
                client_handle_authentication (auth_data->client, auth_data->credentials);
        } else {
                /* Always pass credentials to backend to finish opening phase.
-                  Empty username indicates that either user cancelled password prompt
-                  or there was no authentication callback set.
+                * Empty username indicates that either user cancelled password prompt
+                * or there was no authentication callback set.
                */
                e_credentials_set (auth_data->credentials, E_CREDENTIALS_KEY_USERNAME, NULL);
                client_handle_authentication (auth_data->client, auth_data->credentials);
@@ -1069,18 +1072,18 @@ e_client_retrieve_capabilities (EClient *client,
                                 GAsyncReadyCallback callback,
                                 gpointer user_data)
 {
-       EClientClass *klass;
+       EClientClass *class;
 
        g_return_if_fail (client != NULL);
        g_return_if_fail (E_IS_CLIENT (client));
        g_return_if_fail (client->priv != NULL);
        g_return_if_fail (callback != NULL);
 
-       klass = E_CLIENT_GET_CLASS (client);
-       g_return_if_fail (klass != NULL);
-       g_return_if_fail (klass->retrieve_capabilities != NULL);
+       class = E_CLIENT_GET_CLASS (client);
+       g_return_if_fail (class != NULL);
+       g_return_if_fail (class->retrieve_capabilities != NULL);
 
-       klass->retrieve_capabilities (client, cancellable, callback, user_data);
+       class->retrieve_capabilities (client, cancellable, callback, user_data);
 }
 
 /**
@@ -1104,7 +1107,7 @@ e_client_retrieve_capabilities_finish (EClient *client,
                                        gchar **capabilities,
                                        GError **error)
 {
-       EClientClass *klass;
+       EClientClass *class;
        gboolean res;
 
        g_return_val_if_fail (client != NULL, FALSE);
@@ -1112,12 +1115,12 @@ e_client_retrieve_capabilities_finish (EClient *client,
        g_return_val_if_fail (client->priv != NULL, FALSE);
        g_return_val_if_fail (capabilities != NULL, FALSE);
 
-       klass = E_CLIENT_GET_CLASS (client);
-       g_return_val_if_fail (klass != NULL, FALSE);
-       g_return_val_if_fail (klass->retrieve_capabilities_finish != NULL, FALSE);
+       class = E_CLIENT_GET_CLASS (client);
+       g_return_val_if_fail (class != NULL, FALSE);
+       g_return_val_if_fail (class->retrieve_capabilities_finish != NULL, FALSE);
 
        *capabilities = NULL;
-       res = klass->retrieve_capabilities_finish (client, result, capabilities, error);
+       res = class->retrieve_capabilities_finish (client, result, capabilities, error);
 
        e_client_set_capabilities (client, res ? *capabilities : NULL);
 
@@ -1147,18 +1150,18 @@ e_client_retrieve_capabilities_sync (EClient *client,
                                      GCancellable *cancellable,
                                      GError **error)
 {
-       EClientClass *klass;
+       EClientClass *class;
        gboolean res = FALSE;
 
        g_return_val_if_fail (client != NULL, FALSE);
        g_return_val_if_fail (capabilities != NULL, FALSE);
 
-       klass = E_CLIENT_GET_CLASS (client);
-       g_return_val_if_fail (klass != NULL, FALSE);
-       g_return_val_if_fail (klass->retrieve_capabilities_sync != NULL, FALSE);
+       class = E_CLIENT_GET_CLASS (client);
+       g_return_val_if_fail (class != NULL, FALSE);
+       g_return_val_if_fail (class->retrieve_capabilities_sync != NULL, FALSE);
 
        *capabilities = NULL;
-       res = klass->retrieve_capabilities_sync (client, capabilities, cancellable, error);
+       res = class->retrieve_capabilities_sync (client, capabilities, cancellable, error);
 
        e_client_set_capabilities (client, res ? *capabilities : NULL);
 
@@ -1186,7 +1189,7 @@ e_client_get_backend_property (EClient *client,
                                GAsyncReadyCallback callback,
                                gpointer user_data)
 {
-       EClientClass *klass;
+       EClientClass *class;
 
        g_return_if_fail (callback != NULL);
        g_return_if_fail (client != NULL);
@@ -1194,11 +1197,11 @@ e_client_get_backend_property (EClient *client,
        g_return_if_fail (client->priv != NULL);
        g_return_if_fail (prop_name != NULL);
 
-       klass = E_CLIENT_GET_CLASS (client);
-       g_return_if_fail (klass != NULL);
-       g_return_if_fail (klass->get_backend_property != NULL);
+       class = E_CLIENT_GET_CLASS (client);
+       g_return_if_fail (class != NULL);
+       g_return_if_fail (class->get_backend_property != NULL);
 
-       klass->get_backend_property (client, prop_name, cancellable, callback, user_data);
+       class->get_backend_property (client, prop_name, cancellable, callback, user_data);
 }
 
 /**
@@ -1220,18 +1223,18 @@ e_client_get_backend_property_finish (EClient *client,
                                       gchar **prop_value,
                                       GError **error)
 {
-       EClientClass *klass;
+       EClientClass *class;
 
        g_return_val_if_fail (client != NULL, FALSE);
        g_return_val_if_fail (E_IS_CLIENT (client), FALSE);
        g_return_val_if_fail (client->priv != NULL, FALSE);
        g_return_val_if_fail (prop_value != NULL, FALSE);
 
-       klass = E_CLIENT_GET_CLASS (client);
-       g_return_val_if_fail (klass != NULL, FALSE);
-       g_return_val_if_fail (klass->get_backend_property_finish != NULL, FALSE);
+       class = E_CLIENT_GET_CLASS (client);
+       g_return_val_if_fail (class != NULL, FALSE);
+       g_return_val_if_fail (class->get_backend_property_finish != NULL, FALSE);
 
-       return klass->get_backend_property_finish (client, result, prop_value, error);
+       return class->get_backend_property_finish (client, result, prop_value, error);
 }
 
 /**
@@ -1255,7 +1258,7 @@ e_client_get_backend_property_sync (EClient *client,
                                     GCancellable *cancellable,
                                     GError **error)
 {
-       EClientClass *klass;
+       EClientClass *class;
 
        g_return_val_if_fail (client != NULL, FALSE);
        g_return_val_if_fail (E_IS_CLIENT (client), FALSE);
@@ -1263,11 +1266,11 @@ e_client_get_backend_property_sync (EClient *client,
        g_return_val_if_fail (prop_name != NULL, FALSE);
        g_return_val_if_fail (prop_value != NULL, FALSE);
 
-       klass = E_CLIENT_GET_CLASS (client);
-       g_return_val_if_fail (klass != NULL, FALSE);
-       g_return_val_if_fail (klass->get_backend_property_sync != NULL, FALSE);
+       class = E_CLIENT_GET_CLASS (client);
+       g_return_val_if_fail (class != NULL, FALSE);
+       g_return_val_if_fail (class->get_backend_property_sync != NULL, FALSE);
 
-       return klass->get_backend_property_sync (client, prop_name, prop_value, cancellable, error);
+       return class->get_backend_property_sync (client, prop_name, prop_value, cancellable, error);
 }
 
 /**
@@ -1293,7 +1296,7 @@ e_client_set_backend_property (EClient *client,
                                GAsyncReadyCallback callback,
                                gpointer user_data)
 {
-       EClientClass *klass;
+       EClientClass *class;
 
        g_return_if_fail (callback != NULL);
        g_return_if_fail (client != NULL);
@@ -1302,11 +1305,11 @@ e_client_set_backend_property (EClient *client,
        g_return_if_fail (prop_name != NULL);
        g_return_if_fail (prop_value != NULL);
 
-       klass = E_CLIENT_GET_CLASS (client);
-       g_return_if_fail (klass != NULL);
-       g_return_if_fail (klass->set_backend_property != NULL);
+       class = E_CLIENT_GET_CLASS (client);
+       g_return_if_fail (class != NULL);
+       g_return_if_fail (class->set_backend_property != NULL);
 
-       klass->set_backend_property (client, prop_name, prop_value, cancellable, callback, user_data);
+       class->set_backend_property (client, prop_name, prop_value, cancellable, callback, user_data);
 }
 
 /**
@@ -1326,17 +1329,17 @@ e_client_set_backend_property_finish (EClient *client,
                                       GAsyncResult *result,
                                       GError **error)
 {
-       EClientClass *klass;
+       EClientClass *class;
 
        g_return_val_if_fail (client != NULL, FALSE);
        g_return_val_if_fail (E_IS_CLIENT (client), FALSE);
        g_return_val_if_fail (client->priv != NULL, FALSE);
 
-       klass = E_CLIENT_GET_CLASS (client);
-       g_return_val_if_fail (klass != NULL, FALSE);
-       g_return_val_if_fail (klass->set_backend_property_finish != NULL, FALSE);
+       class = E_CLIENT_GET_CLASS (client);
+       g_return_val_if_fail (class != NULL, FALSE);
+       g_return_val_if_fail (class->set_backend_property_finish != NULL, FALSE);
 
-       return klass->set_backend_property_finish (client, result, error);
+       return class->set_backend_property_finish (client, result, error);
 }
 
 /**
@@ -1361,7 +1364,7 @@ e_client_set_backend_property_sync (EClient *client,
                                     GCancellable *cancellable,
                                     GError **error)
 {
-       EClientClass *klass;
+       EClientClass *class;
 
        g_return_val_if_fail (client != NULL, FALSE);
        g_return_val_if_fail (E_IS_CLIENT (client), FALSE);
@@ -1369,11 +1372,11 @@ e_client_set_backend_property_sync (EClient *client,
        g_return_val_if_fail (prop_name != NULL, FALSE);
        g_return_val_if_fail (prop_value != NULL, FALSE);
 
-       klass = E_CLIENT_GET_CLASS (client);
-       g_return_val_if_fail (klass != NULL, FALSE);
-       g_return_val_if_fail (klass->set_backend_property_sync != NULL, FALSE);
+       class = E_CLIENT_GET_CLASS (client);
+       g_return_val_if_fail (class != NULL, FALSE);
+       g_return_val_if_fail (class->set_backend_property_sync != NULL, FALSE);
 
-       return klass->set_backend_property_sync (client, prop_name, prop_value, cancellable, error);
+       return class->set_backend_property_sync (client, prop_name, prop_value, cancellable, error);
 }
 
 /**
@@ -1396,18 +1399,18 @@ e_client_open (EClient *client,
                GAsyncReadyCallback callback,
                gpointer user_data)
 {
-       EClientClass *klass;
+       EClientClass *class;
 
        g_return_if_fail (callback != NULL);
        g_return_if_fail (client != NULL);
        g_return_if_fail (E_IS_CLIENT (client));
        g_return_if_fail (client->priv != NULL);
 
-       klass = E_CLIENT_GET_CLASS (client);
-       g_return_if_fail (klass != NULL);
-       g_return_if_fail (klass->open != NULL);
+       class = E_CLIENT_GET_CLASS (client);
+       g_return_if_fail (class != NULL);
+       g_return_if_fail (class->open != NULL);
 
-       klass->open (client, only_if_exists, cancellable, callback, user_data);
+       class->open (client, only_if_exists, cancellable, callback, user_data);
 }
 
 /**
@@ -1427,17 +1430,17 @@ e_client_open_finish (EClient *client,
                       GAsyncResult *result,
                       GError **error)
 {
-       EClientClass *klass;
+       EClientClass *class;
 
        g_return_val_if_fail (client != NULL, FALSE);
        g_return_val_if_fail (E_IS_CLIENT (client), FALSE);
        g_return_val_if_fail (client->priv != NULL, FALSE);
 
-       klass = E_CLIENT_GET_CLASS (client);
-       g_return_val_if_fail (klass != NULL, FALSE);
-       g_return_val_if_fail (klass->open_finish != NULL, FALSE);
+       class = E_CLIENT_GET_CLASS (client);
+       g_return_val_if_fail (class != NULL, FALSE);
+       g_return_val_if_fail (class->open_finish != NULL, FALSE);
 
-       return klass->open_finish (client, result, error);
+       return class->open_finish (client, result, error);
 }
 
 /**
@@ -1459,13 +1462,13 @@ e_client_open_sync (EClient *client,
                     GCancellable *cancellable,
                     GError **error)
 {
-       EClientClass *klass;
+       EClientClass *class;
 
-       klass = E_CLIENT_GET_CLASS (client);
-       g_return_val_if_fail (klass != NULL, FALSE);
-       g_return_val_if_fail (klass->open_sync != NULL, FALSE);
+       class = E_CLIENT_GET_CLASS (client);
+       g_return_val_if_fail (class != NULL, FALSE);
+       g_return_val_if_fail (class->open_sync != NULL, FALSE);
 
-       return klass->open_sync (client, only_if_exists, cancellable, error);
+       return class->open_sync (client, only_if_exists, cancellable, error);
 }
 
 /**
@@ -1487,18 +1490,18 @@ e_client_remove (EClient *client,
                  GAsyncReadyCallback callback,
                  gpointer user_data)
 {
-       EClientClass *klass;
+       EClientClass *class;
 
        g_return_if_fail (client != NULL);
        g_return_if_fail (E_IS_CLIENT (client));
        g_return_if_fail (client->priv != NULL);
        g_return_if_fail (callback != NULL);
 
-       klass = E_CLIENT_GET_CLASS (client);
-       g_return_if_fail (klass != NULL);
-       g_return_if_fail (klass->remove != NULL);
+       class = E_CLIENT_GET_CLASS (client);
+       g_return_if_fail (class != NULL);
+       g_return_if_fail (class->remove != NULL);
 
-       klass->remove (client, cancellable, callback, user_data);
+       class->remove (client, cancellable, callback, user_data);
 }
 
 /**
@@ -1518,17 +1521,17 @@ e_client_remove_finish (EClient *client,
                         GAsyncResult *result,
                         GError **error)
 {
-       EClientClass *klass;
+       EClientClass *class;
 
        g_return_val_if_fail (client != NULL, FALSE);
        g_return_val_if_fail (E_IS_CLIENT (client), FALSE);
        g_return_val_if_fail (client->priv != NULL, FALSE);
 
-       klass = E_CLIENT_GET_CLASS (client);
-       g_return_val_if_fail (klass != NULL, FALSE);
-       g_return_val_if_fail (klass->remove_finish != NULL, FALSE);
+       class = E_CLIENT_GET_CLASS (client);
+       g_return_val_if_fail (class != NULL, FALSE);
+       g_return_val_if_fail (class->remove_finish != NULL, FALSE);
 
-       return klass->remove_finish (client, result, error);
+       return class->remove_finish (client, result, error);
 }
 
 /**
@@ -1549,13 +1552,13 @@ e_client_remove_sync (EClient *client,
                       GCancellable *cancellable,
                       GError **error)
 {
-       EClientClass *klass;
+       EClientClass *class;
 
-       klass = E_CLIENT_GET_CLASS (client);
-       g_return_val_if_fail (klass != NULL, FALSE);
-       g_return_val_if_fail (klass->remove_sync != NULL, FALSE);
+       class = E_CLIENT_GET_CLASS (client);
+       g_return_val_if_fail (class != NULL, FALSE);
+       g_return_val_if_fail (class->remove_sync != NULL, FALSE);
 
-       return klass->remove_sync (client, cancellable, error);
+       return class->remove_sync (client, cancellable, error);
 }
 
 /**
@@ -1579,18 +1582,18 @@ e_client_refresh (EClient *client,
                   GAsyncReadyCallback callback,
                   gpointer user_data)
 {
-       EClientClass *klass;
+       EClientClass *class;
 
        g_return_if_fail (client != NULL);
        g_return_if_fail (E_IS_CLIENT (client));
        g_return_if_fail (client->priv != NULL);
        g_return_if_fail (callback != NULL);
 
-       klass = E_CLIENT_GET_CLASS (client);
-       g_return_if_fail (klass != NULL);
-       g_return_if_fail (klass->refresh != NULL);
+       class = E_CLIENT_GET_CLASS (client);
+       g_return_if_fail (class != NULL);
+       g_return_if_fail (class->refresh != NULL);
 
-       klass->refresh (client, cancellable, callback, user_data);
+       class->refresh (client, cancellable, callback, user_data);
 }
 
 /**
@@ -1610,17 +1613,17 @@ e_client_refresh_finish (EClient *client,
                          GAsyncResult *result,
                          GError **error)
 {
-       EClientClass *klass;
+       EClientClass *class;
 
        g_return_val_if_fail (client != NULL, FALSE);
        g_return_val_if_fail (E_IS_CLIENT (client), FALSE);
        g_return_val_if_fail (client->priv != NULL, FALSE);
 
-       klass = E_CLIENT_GET_CLASS (client);
-       g_return_val_if_fail (klass != NULL, FALSE);
-       g_return_val_if_fail (klass->refresh_finish != NULL, FALSE);
+       class = E_CLIENT_GET_CLASS (client);
+       g_return_val_if_fail (class != NULL, FALSE);
+       g_return_val_if_fail (class->refresh_finish != NULL, FALSE);
 
-       return klass->refresh_finish (client, result, error);
+       return class->refresh_finish (client, result, error);
 }
 
 /**
@@ -1643,13 +1646,13 @@ e_client_refresh_sync (EClient *client,
                        GCancellable *cancellable,
                        GError **error)
 {
-       EClientClass *klass;
+       EClientClass *class;
 
-       klass = E_CLIENT_GET_CLASS (client);
-       g_return_val_if_fail (klass != NULL, FALSE);
-       g_return_val_if_fail (klass->refresh_sync != NULL, FALSE);
+       class = E_CLIENT_GET_CLASS (client);
+       g_return_val_if_fail (class != NULL, FALSE);
+       g_return_val_if_fail (class->refresh_sync != NULL, FALSE);
 
-       return klass->refresh_sync (client, cancellable, error);
+       return class->refresh_sync (client, cancellable, error);
 }
 
 /**
@@ -2017,16 +2020,16 @@ e_client_finish_async_without_dbus (EClient *client,
 GDBusProxy *
 e_client_get_dbus_proxy (EClient *client)
 {
-       EClientClass *klass;
+       EClientClass *class;
 
        g_return_val_if_fail (client != NULL, NULL);
        g_return_val_if_fail (E_IS_CLIENT (client), NULL);
 
-       klass = E_CLIENT_GET_CLASS (client);
-       g_return_val_if_fail (klass != NULL, NULL);
-       g_return_val_if_fail (klass->get_dbus_proxy != NULL, NULL);
+       class = E_CLIENT_GET_CLASS (client);
+       g_return_val_if_fail (class != NULL, NULL);
+       g_return_val_if_fail (class->get_dbus_proxy != NULL, NULL);
 
-       return klass->get_dbus_proxy (client);
+       return class->get_dbus_proxy (client);
 }
 
 /**
@@ -2045,20 +2048,20 @@ e_client_unwrap_dbus_error (EClient *client,
                             GError *dbus_error,
                             GError **out_error)
 {
-       EClientClass *klass;
+       EClientClass *class;
 
        g_return_if_fail (client != NULL);
        g_return_if_fail (E_IS_CLIENT (client));
 
-       klass = E_CLIENT_GET_CLASS (client);
-       g_return_if_fail (klass != NULL);
-       g_return_if_fail (klass->unwrap_dbus_error != NULL);
+       class = E_CLIENT_GET_CLASS (client);
+       g_return_if_fail (class != NULL);
+       g_return_if_fail (class->unwrap_dbus_error != NULL);
 
        if (!dbus_error || !out_error) {
                if (dbus_error)
                        g_error_free (dbus_error);
        } else {
-               klass->unwrap_dbus_error (client, dbus_error, out_error);
+               class->unwrap_dbus_error (client, dbus_error, out_error);
        }
 }
 
index 4596da4..ffec27e 100644 (file)
@@ -20,11 +20,11 @@ static guint e_iterator_signals[LAST_SIGNAL] = { 0, };
 G_DEFINE_TYPE (EIterator, e_iterator, G_TYPE_OBJECT)
 
 static void
-e_iterator_class_init (EIteratorClass *klass)
+e_iterator_class_init (EIteratorClass *class)
 {
        GObjectClass *object_class;
 
-       object_class = G_OBJECT_CLASS (klass);
+       object_class = G_OBJECT_CLASS (class);
 
        e_iterator_signals[INVALIDATE] =
                g_signal_new ("invalidate",
@@ -34,17 +34,6 @@ e_iterator_class_init (EIteratorClass *klass)
                              NULL, NULL,
                              g_cclosure_marshal_VOID__VOID,
                              G_TYPE_NONE, 0);
-
-       klass->invalidate = NULL;
-       klass->get        = NULL;
-       klass->reset      = NULL;
-       klass->last       = NULL;
-       klass->next       = NULL;
-       klass->prev       = NULL;
-       klass->remove     = NULL;
-       klass->insert     = NULL;
-       klass->set        = NULL;
-       klass->is_valid   = NULL;
 }
 
 /**
index d5b7b77..4e30a90 100644 (file)
@@ -29,16 +29,15 @@ static void        e_list_iterator_dispose    (GObject *object);
 G_DEFINE_TYPE (EListIterator, e_list_iterator, E_TYPE_ITERATOR)
 
 static void
-e_list_iterator_class_init (EListIteratorClass *klass)
+e_list_iterator_class_init (EListIteratorClass *class)
 {
        GObjectClass *object_class;
        EIteratorClass *iterator_class;
 
-       object_class = G_OBJECT_CLASS (klass);
-       iterator_class = E_ITERATOR_CLASS (klass);
-
+       object_class = G_OBJECT_CLASS (class);
        object_class->dispose = e_list_iterator_dispose;
 
+       iterator_class = E_ITERATOR_CLASS (class);
        iterator_class->invalidate = e_list_iterator_invalidate;
        iterator_class->get        = e_list_iterator_get;
        iterator_class->reset      = e_list_iterator_reset;
index d63e9e4..6fcd2be 100644 (file)
 #include "e-list.h"
 #include "e-list-iterator.h"
 
-static void e_list_dispose (GObject *object);
-
 G_DEFINE_TYPE (EList, e_list, G_TYPE_OBJECT)
 
 static void
-e_list_class_init (EListClass *klass)
+list_dispose (GObject *object)
 {
-       GObjectClass *object_class;
+       EList *list = E_LIST (object);
 
-       object_class = G_OBJECT_CLASS (klass);
+       if (list->free)
+               g_list_foreach (list->list, (GFunc) list->free, list->closure);
+       g_list_free (list->list);
+       list->list = NULL;
+
+       /* Chain up to parent's dispose() method. */
+       G_OBJECT_CLASS (e_list_parent_class)->dispose (object);
+}
+
+static void
+e_list_class_init (EListClass *class)
+{
+       GObjectClass *object_class;
 
-       object_class->dispose = e_list_dispose;
+       object_class = G_OBJECT_CLASS (class);
+       object_class->dispose = list_dispose;
 }
 
 /**
@@ -31,8 +42,6 @@ e_list_class_init (EListClass *klass)
 static void
 e_list_init (EList *list)
 {
-       list->list = NULL;
-       list->iterators = NULL;
 }
 
 /**
@@ -178,17 +187,3 @@ e_list_remove_iterator (EList *list,
        list->iterators = g_list_remove (list->iterators, iterator);
 }
 
-/*
- * Virtual functions
- */
-static void
-e_list_dispose (GObject *object)
-{
-       EList *list = E_LIST (object);
-       if (list->free)
-               g_list_foreach (list->list, (GFunc) list->free, list->closure);
-       g_list_free (list->list);
-
-       (* G_OBJECT_CLASS (e_list_parent_class)->dispose) (object);
-}
-
index ef2450f..d80ca6a 100644 (file)
 #include <libsoup/soup-uri.h>
 #include "e-proxy.h"
 
+#define E_PROXY_GET_PRIVATE(obj) \
+       (G_TYPE_INSTANCE_GET_PRIVATE \
+       ((obj), E_TYPE_PROXY, EProxyPrivate))
+
 G_DEFINE_TYPE (EProxy, e_proxy, G_TYPE_OBJECT)
 
 /* Debug */
@@ -71,6 +75,10 @@ typedef enum {
        E_PROXY_KEY_AUTOCONFIG_URL
 } EProxyKey;
 
+#define E_PROXY_GET_PRIVATE(obj) \
+       (G_TYPE_INSTANCE_GET_PRIVATE \
+       ((obj), E_TYPE_PROXY, EProxyPrivate))
+
 struct _EProxyPrivate {
        SoupURI *uri_http, *uri_https, *uri_socks;
        GSList * ign_hosts;     /* List of hostnames. (Strings)         */
@@ -958,8 +966,7 @@ e_proxy_class_init (EProxyClass *class)
 static void
 e_proxy_init (EProxy *proxy)
 {
-       proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (
-               proxy, E_TYPE_PROXY, EProxyPrivate);
+       proxy->priv = E_PROXY_GET_PRIVATE (proxy);
 
        proxy->priv->type = PROXY_TYPE_SYSTEM;
 
index ac1dae9..ae807fc 100644 (file)
@@ -109,10 +109,6 @@ static struct _ESExpTerm * parse_value (ESExp *f);
 static void parse_dump_term (struct _ESExpTerm *t, gint depth);
 #endif
 
-#ifdef E_SEXP_IS_G_OBJECT
-static GObjectClass *parent_class;
-#endif
-
 typedef gboolean (ESGeneratorFunc) (gint argc, struct _ESExpResult **argv, struct _ESExpResult *r);
 typedef gboolean (ESOperatorFunc) (gint argc, struct _ESExpResult **argv, struct _ESExpResult *r);
 
@@ -1405,13 +1401,11 @@ static void e_sexp_finalise (gpointer);
 
 #ifdef E_SEXP_IS_G_OBJECT
 static void
-e_sexp_class_init (ESExpClass *klass)
+e_sexp_class_init (ESExpClass *class)
 {
-       GObjectClass *object_class = G_OBJECT_CLASS (klass);
+       GObjectClass *object_class = G_OBJECT_CLASS (class);
 
        object_class->finalize = e_sexp_finalise;
-
-       parent_class = g_type_class_ref (g_object_get_type ());
 }
 #endif
 
@@ -1464,7 +1458,7 @@ e_sexp_finalise (gpointer o)
        g_scanner_destroy (s->scanner);
 
 #ifdef E_SEXP_IS_G_OBJECT
-       G_OBJECT_CLASS (parent_class)->finalize (o);
+       G_OBJECT_CLASS (e_sexp_parent_class)->finalize (o);
 #endif
 }
 
index b5d8589..c16d264 100644 (file)
 #define XC (const xmlChar *)
 #define GC (const gchar *)
 
+#define E_SOURCE_GROUP_GET_PRIVATE(obj) \
+       (G_TYPE_INSTANCE_GET_PRIVATE \
+       ((obj), E_TYPE_SOURCE_GROUP, ESourceGroupPrivate))
+
 /* Private members.  */
 
 struct _ESourceGroupPrivate {
@@ -71,9 +75,11 @@ source_changed_callback (ESource *source,
 G_DEFINE_TYPE (ESourceGroup, e_source_group, G_TYPE_OBJECT)
 
 static void
-impl_dispose (GObject *object)
+source_group_dispose (GObject *object)
 {
-       ESourceGroupPrivate *priv = E_SOURCE_GROUP (object)->priv;
+       ESourceGroupPrivate *priv;
+
+       priv = E_SOURCE_GROUP_GET_PRIVATE (object);
 
        if (priv->sources != NULL) {
                GSList *p;
@@ -91,13 +97,16 @@ impl_dispose (GObject *object)
                priv->sources = NULL;
        }
 
-       (* G_OBJECT_CLASS (e_source_group_parent_class)->dispose) (object);
+       /* Chain up to parent's dispose() method. */
+       G_OBJECT_CLASS (e_source_group_parent_class)->dispose (object);
 }
 
 static void
-impl_finalize (GObject *object)
+source_group_finalize (GObject *object)
 {
-       ESourceGroupPrivate *priv = E_SOURCE_GROUP (object)->priv;
+       ESourceGroupPrivate *priv;
+
+       priv = E_SOURCE_GROUP_GET_PRIVATE (object);
 
        g_free (priv->uid);
        g_free (priv->name);
@@ -105,9 +114,8 @@ impl_finalize (GObject *object)
 
        g_hash_table_destroy (priv->properties);
 
-       g_free (priv);
-
-       (* G_OBJECT_CLASS (e_source_group_parent_class)->finalize) (object);
+       /* Chain up to parent's finalize() method. */
+       G_OBJECT_CLASS (e_source_group_parent_class)->finalize (object);
 }
 
 /* Initialization.  */
@@ -115,50 +123,54 @@ impl_finalize (GObject *object)
 static void
 e_source_group_class_init (ESourceGroupClass *class)
 {
-       GObjectClass *object_class = G_OBJECT_CLASS (class);
-
-       object_class->dispose  = impl_dispose;
-       object_class->finalize = impl_finalize;
-
-       signals[CHANGED] =
-               g_signal_new ("changed",
-                             G_OBJECT_CLASS_TYPE (object_class),
-                             G_SIGNAL_RUN_LAST,
-                             G_STRUCT_OFFSET (ESourceGroupClass, changed),
-                             NULL, NULL,
-                             g_cclosure_marshal_VOID__VOID,
-                             G_TYPE_NONE, 0);
-
-       signals[SOURCE_ADDED] =
-               g_signal_new ("source_added",
-                             G_OBJECT_CLASS_TYPE (object_class),
-                             G_SIGNAL_RUN_LAST,
-                             G_STRUCT_OFFSET (ESourceGroupClass, source_added),
-                             NULL, NULL,
-                             g_cclosure_marshal_VOID__OBJECT,
-                             G_TYPE_NONE, 1,
-                             G_TYPE_OBJECT);
-       signals[SOURCE_REMOVED] =
-               g_signal_new ("source_removed",
-                             G_OBJECT_CLASS_TYPE (object_class),
-                             G_SIGNAL_RUN_LAST,
-                             G_STRUCT_OFFSET (ESourceGroupClass, source_removed),
-                             NULL, NULL,
-                             g_cclosure_marshal_VOID__OBJECT,
-                             G_TYPE_NONE, 1,
-                             G_TYPE_OBJECT);
+       GObjectClass *object_class;
+
+       g_type_class_add_private (class, sizeof (ESourceGroupPrivate));
+
+       object_class = G_OBJECT_CLASS (class);
+       object_class->dispose = source_group_dispose;
+       object_class->finalize = source_group_finalize;
+
+       signals[CHANGED] = g_signal_new (
+               "changed",
+               G_OBJECT_CLASS_TYPE (object_class),
+               G_SIGNAL_RUN_LAST,
+               G_STRUCT_OFFSET (ESourceGroupClass, changed),
+               NULL, NULL,
+               g_cclosure_marshal_VOID__VOID,
+               G_TYPE_NONE, 0);
+
+       signals[SOURCE_ADDED] = g_signal_new (
+               "source_added",
+               G_OBJECT_CLASS_TYPE (object_class),
+               G_SIGNAL_RUN_LAST,
+               G_STRUCT_OFFSET (ESourceGroupClass, source_added),
+               NULL, NULL,
+               g_cclosure_marshal_VOID__OBJECT,
+               G_TYPE_NONE, 1,
+               G_TYPE_OBJECT);
+
+       signals[SOURCE_REMOVED] = g_signal_new (
+               "source_removed",
+               G_OBJECT_CLASS_TYPE (object_class),
+               G_SIGNAL_RUN_LAST,
+               G_STRUCT_OFFSET (ESourceGroupClass, source_removed),
+               NULL, NULL,
+               g_cclosure_marshal_VOID__OBJECT,
+               G_TYPE_NONE, 1,
+               G_TYPE_OBJECT);
 }
 
 static void
 e_source_group_init (ESourceGroup *source_group)
 {
-       ESourceGroupPrivate *priv;
-
-       priv = g_new0 (ESourceGroupPrivate, 1);
-       source_group->priv = priv;
+       source_group->priv = E_SOURCE_GROUP_GET_PRIVATE (source_group);
 
-       priv->properties = g_hash_table_new_full (g_str_hash, g_str_equal,
-                                                 g_free, g_free);
+       source_group->priv->properties = g_hash_table_new_full (
+               (GHashFunc) g_str_hash,
+               (GEqualFunc) g_str_equal,
+               (GDestroyNotify) g_free,
+               (GDestroyNotify) g_free);
 }
 
 static void
index cea5c34..0ca8f2e 100644 (file)
 #include <string.h>
 #include "e-source-list.h"
 
+#define E_SOURCE_LIST_GET_PRIVATE(obj) \
+       (G_TYPE_INSTANCE_GET_PRIVATE \
+       ((obj), E_TYPE_SOURCE_LIST, ESourceListPrivate))
+
 struct _ESourceListPrivate {
        GConfClient *gconf_client;
        gchar *gconf_path;
@@ -240,9 +244,11 @@ conf_changed_callback (GConfClient *client,
 G_DEFINE_TYPE (ESourceList, e_source_list, G_TYPE_OBJECT)
 
 static void
-impl_dispose (GObject *object)
+source_list_dispose (GObject *object)
 {
-       ESourceListPrivate *priv = E_SOURCE_LIST (object)->priv;
+       ESourceListPrivate *priv;
+
+       priv = E_SOURCE_LIST_GET_PRIVATE (object);
 
        if (priv->gconf_client != NULL && priv->gconf_notify_id != 0) {
                gconf_client_notify_remove (priv->gconf_client, priv->gconf_notify_id);
@@ -275,18 +281,21 @@ impl_dispose (GObject *object)
                priv->gconf_client = NULL;
        }
 
-       (* G_OBJECT_CLASS (e_source_list_parent_class)->dispose) (object);
+       /* Chain up to parent's dispose() method. */
+       G_OBJECT_CLASS (e_source_list_parent_class)->dispose (object);
 }
 
 static void
-impl_finalize (GObject *object)
+source_list_finalize (GObject *object)
 {
-       ESourceListPrivate *priv = E_SOURCE_LIST (object)->priv;
+       ESourceListPrivate *priv;
+
+       priv = E_SOURCE_LIST_GET_PRIVATE (object);
 
        g_free (priv->gconf_path);
-       g_free (priv);
 
-       (* G_OBJECT_CLASS (e_source_list_parent_class)->finalize) (object);
+       /* Chain up to parent's finalize() method. */
+       G_OBJECT_CLASS (e_source_list_parent_class)->finalize (object);
 }
 
 /* Initialization.  */
@@ -294,49 +303,48 @@ impl_finalize (GObject *object)
 static void
 e_source_list_class_init (ESourceListClass *class)
 {
-       GObjectClass *object_class = G_OBJECT_CLASS (class);
-
-       object_class->dispose  = impl_dispose;
-       object_class->finalize = impl_finalize;
-
-       signals[CHANGED] =
-               g_signal_new ("changed",
-                             G_OBJECT_CLASS_TYPE (object_class),
-                             G_SIGNAL_RUN_LAST,
-                             G_STRUCT_OFFSET (ESourceListClass, changed),
-                             NULL, NULL,
-                             g_cclosure_marshal_VOID__VOID,
-                             G_TYPE_NONE, 0);
-
-       signals[GROUP_REMOVED] =
-               g_signal_new ("group_removed",
-                             G_OBJECT_CLASS_TYPE (object_class),
-                             G_SIGNAL_RUN_LAST,
-                             G_STRUCT_OFFSET (ESourceListClass, group_removed),
-                             NULL, NULL,
-                             g_cclosure_marshal_VOID__OBJECT,
-                             G_TYPE_NONE, 1,
-                             E_TYPE_SOURCE_GROUP);
-
-       signals[GROUP_ADDED] =
-               g_signal_new ("group_added",
-                             G_OBJECT_CLASS_TYPE (object_class),
-                             G_SIGNAL_RUN_LAST,
-                             G_STRUCT_OFFSET (ESourceListClass, group_added),
-                             NULL, NULL,
-                             g_cclosure_marshal_VOID__OBJECT,
-                             G_TYPE_NONE, 1,
-                             E_TYPE_SOURCE_GROUP);
+       GObjectClass *object_class;
+
+       g_type_class_add_private (class, sizeof (ESourceListPrivate));
+
+       object_class = G_OBJECT_CLASS (class);
+       object_class->dispose  = source_list_dispose;
+       object_class->finalize = source_list_finalize;
+
+       signals[CHANGED] = g_signal_new (
+               "changed",
+               G_OBJECT_CLASS_TYPE (object_class),
+               G_SIGNAL_RUN_LAST,
+               G_STRUCT_OFFSET (ESourceListClass, changed),
+               NULL, NULL,
+               g_cclosure_marshal_VOID__VOID,
+               G_TYPE_NONE, 0);
+
+       signals[GROUP_REMOVED] = g_signal_new (
+               "group_removed",
+               G_OBJECT_CLASS_TYPE (object_class),
+               G_SIGNAL_RUN_LAST,
+               G_STRUCT_OFFSET (ESourceListClass, group_removed),
+               NULL, NULL,
+               g_cclosure_marshal_VOID__OBJECT,
+               G_TYPE_NONE, 1,
+               E_TYPE_SOURCE_GROUP);
+
+       signals[GROUP_ADDED] = g_signal_new (
+               "group_added",
+               G_OBJECT_CLASS_TYPE (object_class),
+               G_SIGNAL_RUN_LAST,
+               G_STRUCT_OFFSET (ESourceListClass, group_added),
+               NULL, NULL,
+               g_cclosure_marshal_VOID__OBJECT,
+               G_TYPE_NONE, 1,
+               E_TYPE_SOURCE_GROUP);
 }
 
 static void
 e_source_list_init (ESourceList *source_list)
 {
-       ESourceListPrivate *priv;
-
-       priv = g_new0 (ESourceListPrivate, 1);
-
-       source_list->priv = priv;
+       source_list->priv = E_SOURCE_LIST_GET_PRIVATE (source_list);
 }
 
 /* Public methods.  */
index 2552849..f7d1ab7 100644 (file)
 #include <libedataserver/e-uid.h>
 #include <libedataserver/e-source-group.h>
 
+#define E_SOURCE_GET_PRIVATE(obj) \
+       (G_TYPE_INSTANCE_GET_PRIVATE \
+       ((obj), E_TYPE_SOURCE, ESourcePrivate))
+
 struct _ESourcePrivate {
        ESourceGroup *group;
 
@@ -66,9 +70,11 @@ group_weak_notify (ESource *source,
 G_DEFINE_TYPE (ESource, e_source, G_TYPE_OBJECT)
 
 static void
-impl_finalize (GObject *object)
+source_finalize (GObject *object)
 {
-       ESourcePrivate *priv = E_SOURCE (object)->priv;
+       ESourcePrivate *priv;
+
+       priv = E_SOURCE_GET_PRIVATE (object);
 
        g_free (priv->uid);
        g_free (priv->name);
@@ -78,22 +84,24 @@ impl_finalize (GObject *object)
 
        g_hash_table_destroy (priv->properties);
 
-       g_free (priv);
-
-       (* G_OBJECT_CLASS (e_source_parent_class)->finalize) (object);
+       /* Chain up to parent's finalize() method. */
+       G_OBJECT_CLASS (e_source_parent_class)->finalize (object);
 }
 
 static void
-impl_dispose (GObject *object)
+source_dispose (GObject *object)
 {
-       ESourcePrivate *priv = E_SOURCE (object)->priv;
+       ESourcePrivate *priv;
+
+       priv = E_SOURCE_GET_PRIVATE (object);
 
        if (priv->group != NULL) {
                g_object_weak_unref (G_OBJECT (priv->group), (GWeakNotify) group_weak_notify, object);
                priv->group = NULL;
        }
 
-       (* G_OBJECT_CLASS (e_source_parent_class)->dispose) (object);
+       /* Chain up to parent's dispose() method. */
+       G_OBJECT_CLASS (e_source_parent_class)->dispose (object);
 }
 
 /* Initialization.  */
@@ -101,31 +109,34 @@ impl_dispose (GObject *object)
 static void
 e_source_class_init (ESourceClass *class)
 {
-       GObjectClass *object_class = G_OBJECT_CLASS (class);
-
-       object_class->dispose  = impl_dispose;
-       object_class->finalize = impl_finalize;
-
-       signals[CHANGED] =
-               g_signal_new ("changed",
-                             G_OBJECT_CLASS_TYPE (object_class),
-                             G_SIGNAL_RUN_LAST,
-                             G_STRUCT_OFFSET (ESourceClass, changed),
-                             NULL, NULL,
-                             g_cclosure_marshal_VOID__VOID,
-                             G_TYPE_NONE, 0);
+       GObjectClass *object_class;
+
+       g_type_class_add_private (class, sizeof (ESourcePrivate));
+
+       object_class = G_OBJECT_CLASS (class);
+       object_class->dispose = source_dispose;
+       object_class->finalize = source_finalize;
+
+       signals[CHANGED] = g_signal_new (
+               "changed",
+               G_OBJECT_CLASS_TYPE (object_class),
+               G_SIGNAL_RUN_LAST,
+               G_STRUCT_OFFSET (ESourceClass, changed),
+               NULL, NULL,
+               g_cclosure_marshal_VOID__VOID,
+               G_TYPE_NONE, 0);
 }
 
 static void
 e_source_init (ESource *source)
 {
-       ESourcePrivate *priv;
-
-       priv = g_new0 (ESourcePrivate, 1);
-       source->priv = priv;
+       source->priv = E_SOURCE_GET_PRIVATE (source);
 
-       priv->properties = g_hash_table_new_full (g_str_hash, g_str_equal,
-                                                 g_free, g_free);
+       source->priv->properties = g_hash_table_new_full (
+               (GHashFunc) g_str_hash,
+               (GEqualFunc) g_str_equal,
+               (GDestroyNotify) g_free,
+               (GDestroyNotify) g_free);
 }
 
 /* Private methods. */
index d6b201d..89e8d68 100644 (file)
 #include "e-category-completion.h"
 #include "e-category-editor.h"
 
+#define E_CATEGORIES_DIALOG_GET_PRIVATE(obj) \
+       (G_TYPE_INSTANCE_GET_PRIVATE \
+       ((obj), E_TYPE_CATEGORIES_DIALOG, ECategoriesDialogPrivate))
+
 G_DEFINE_TYPE (ECategoriesDialog, e_categories_dialog, GTK_TYPE_DIALOG)
 
 struct _ECategoriesDialogPrivate {
@@ -59,8 +63,7 @@ e_categories_dialog_init (ECategoriesDialog *dialog)
        GtkWidget *dialog_content;
        GtkWidget *categories_editor;
 
-       dialog->priv = G_TYPE_INSTANCE_GET_PRIVATE (
-               dialog, E_TYPE_CATEGORIES_DIALOG, ECategoriesDialogPrivate);
+       dialog->priv = E_CATEGORIES_DIALOG_GET_PRIVATE (dialog);
 
        categories_editor = e_categories_editor_new ();
        dialog->priv->categories_editor = categories_editor;
index 50b68c2..f86d059 100644 (file)
@@ -29,7 +29,9 @@
 #include "e-category-completion.h"
 #include "e-category-editor.h"
 
-G_DEFINE_TYPE (ECategoriesEditor, e_categories_editor, GTK_TYPE_TABLE)
+#define E_CATEGORIES_EDITOR_GET_PRIVATE(obj) \
+       (G_TYPE_INSTANCE_GET_PRIVATE \
+       ((obj), E_TYPE_CATEGORIES_EDITOR, ECategoriesEditorPrivate))
 
 struct _ECategoriesEditorPrivate {
        ECategoriesSelector *categories_list;
@@ -61,6 +63,8 @@ enum {
 
 static gint signals[LAST_SIGNAL] = {0};
 
+G_DEFINE_TYPE (ECategoriesEditor, e_categories_editor, GTK_TYPE_TABLE)
+
 static void
 entry_changed_cb (GtkEntry *entry,
                   ECategoriesEditor *editor)
@@ -285,8 +289,7 @@ e_categories_editor_init (ECategoriesEditor *editor)
        gtk_label_set_mnemonic_widget (
                GTK_LABEL (label2), categories_list);
 
-       editor->priv = G_TYPE_INSTANCE_GET_PRIVATE (
-               editor, E_TYPE_CATEGORIES_EDITOR, ECategoriesEditorPrivate);
+       editor->priv = E_CATEGORIES_EDITOR_GET_PRIVATE (editor);
 
        editor->priv->categories_list = E_CATEGORIES_SELECTOR (categories_list);
        editor->priv->categories_entry = entry_categories;
index 6321f14..9fd1677 100644 (file)
 #include "e-categories-selector.h"
 #include "e-data-server-ui-marshal.h"
 
-G_DEFINE_TYPE (
-       ECategoriesSelector,
-       e_categories_selector,
-       GTK_TYPE_TREE_VIEW)
+#define E_CATEGORIES_SELECTOR_GET_PRIVATE(obj) \
+       (G_TYPE_INSTANCE_GET_PRIVATE \
+       ((obj), E_TYPE_CATEGORIES_SELECTOR, ECategoriesSelectorPrivate))
 
 struct _ECategoriesSelectorPrivate {
        gboolean checkable;
@@ -55,6 +54,11 @@ enum {
 
 static gint signals[LAST_SIGNAL] = {0};
 
+G_DEFINE_TYPE (
+       ECategoriesSelector,
+       e_categories_selector,
+       GTK_TYPE_TREE_VIEW)
+
 static void
 categories_selector_build_model (ECategoriesSelector *selector)
 {
@@ -224,7 +228,7 @@ categories_selector_dispose (GObject *object)
 {
        ECategoriesSelectorPrivate *priv;
 
-       priv = E_CATEGORIES_SELECTOR (object)->priv;
+       priv = E_CATEGORIES_SELECTOR_GET_PRIVATE (object);
 
        if (priv->selected_categories != NULL) {
                g_hash_table_destroy (priv->selected_categories);
@@ -294,9 +298,7 @@ e_categories_selector_init (ECategoriesSelector *selector)
        GtkTreeViewColumn *column;
        GtkTreeSelection *selection;
 
-       selector->priv = G_TYPE_INSTANCE_GET_PRIVATE (
-               selector, E_TYPE_CATEGORIES_SELECTOR,
-               ECategoriesSelectorPrivate);
+       selector->priv = E_CATEGORIES_SELECTOR_GET_PRIVATE (selector);
 
        selector->priv->checkable = TRUE;
        selector->priv->selected_categories = g_hash_table_new_full (
index c56dedc..6ab1406 100644 (file)
@@ -25,7 +25,9 @@
 #include <glib/gi18n-lib.h>
 #include <libedataserver/e-categories.h>
 
-G_DEFINE_TYPE (ECategoryCompletion, e_category_completion, GTK_TYPE_ENTRY_COMPLETION)
+#define E_CATEGORY_COMPLETION_GET_PRIVATE(obj) \
+       (G_TYPE_INSTANCE_GET_PRIVATE \
+       ((obj), E_TYPE_CATEGORY_COMPLETION, ECategoryCompletionPrivate))
 
 struct _ECategoryCompletionPrivate {
        GtkWidget *last_known_entry;
@@ -40,7 +42,10 @@ enum {
        NUM_COLUMNS
 };
 
-static gpointer parent_class;
+G_DEFINE_TYPE (
+       ECategoryCompletion,
+       e_category_completion,
+       GTK_TYPE_ENTRY_COMPLETION)
 
 /* Forward Declarations */
 
@@ -173,7 +178,7 @@ category_completion_is_match (GtkEntryCompletion *completion,
        GValue value = { 0, };
        gboolean match;
 
-       priv = E_CATEGORY_COMPLETION (completion)->priv;
+       priv = E_CATEGORY_COMPLETION_GET_PRIVATE (completion);
        entry = gtk_entry_completion_get_entry (completion);
        model = gtk_entry_completion_get_model (completion);
 
@@ -208,7 +213,7 @@ category_completion_update_prefix (GtkEntryCompletion *completion)
        gchar *input;
        glong offset;
 
-       priv = E_CATEGORY_COMPLETION (completion)->priv;
+       priv = E_CATEGORY_COMPLETION_GET_PRIVATE (completion);
        entry = gtk_entry_completion_get_entry (completion);
        model = gtk_entry_completion_get_model (completion);
 
@@ -330,7 +335,7 @@ category_completion_track_entry (GtkEntryCompletion *completion)
 {
        ECategoryCompletionPrivate *priv;
 
-       priv = E_CATEGORY_COMPLETION (completion)->priv;
+       priv = E_CATEGORY_COMPLETION_GET_PRIVATE (completion);
 
        if (priv->last_known_entry != NULL) {
                g_signal_handlers_disconnect_matched (
@@ -370,7 +375,7 @@ category_completion_constructed (GObject *object)
        GtkEntryCompletion *completion;
 
        /* Chain up to parent's constructed() method. */
-       G_OBJECT_CLASS (parent_class)->constructed (object);
+       G_OBJECT_CLASS (e_category_completion_parent_class)->constructed (object);
 
        completion = GTK_ENTRY_COMPLETION (object);
 
@@ -401,7 +406,7 @@ category_completion_dispose (GObject *object)
 {
        ECategoryCompletionPrivate *priv;
 
-       priv = E_CATEGORY_COMPLETION (object)->priv;
+       priv = E_CATEGORY_COMPLETION_GET_PRIVATE (object);
 
        if (priv->last_known_entry != NULL) {
                g_signal_handlers_disconnect_matched (
@@ -412,7 +417,7 @@ category_completion_dispose (GObject *object)
        }
 
        /* Chain up to parent's dispose() method. */
-       G_OBJECT_CLASS (parent_class)->dispose (object);
+       G_OBJECT_CLASS (e_category_completion_parent_class)->dispose (object);
 }
 
 static void
@@ -420,7 +425,7 @@ category_completion_finalize (GObject *object)
 {
        ECategoryCompletionPrivate *priv;
 
-       priv = E_CATEGORY_COMPLETION (object)->priv;
+       priv = E_CATEGORY_COMPLETION_GET_PRIVATE (object);
 
        g_free (priv->create);
        g_free (priv->prefix);
@@ -430,7 +435,7 @@ category_completion_finalize (GObject *object)
                object);
 
        /* Chain up to parent's finalize() method. */
-       G_OBJECT_CLASS (parent_class)->finalize (object);
+       G_OBJECT_CLASS (e_category_completion_parent_class)->finalize (object);
 }
 
 static gboolean
@@ -454,7 +459,7 @@ category_completion_action_activated (GtkEntryCompletion *completion,
        ECategoryCompletionPrivate *priv;
        gchar *category;
 
-       priv = E_CATEGORY_COMPLETION (completion)->priv;
+       priv = E_CATEGORY_COMPLETION_GET_PRIVATE (completion);
 
        category = g_strdup (priv->create);
        e_categories_add (category, NULL, NULL, TRUE);
@@ -468,7 +473,6 @@ e_category_completion_class_init (ECategoryCompletionClass *class)
        GObjectClass *object_class;
        GtkEntryCompletionClass *entry_completion_class;
 
-       parent_class = g_type_class_peek_parent (class);
        g_type_class_add_private (class, sizeof (ECategoryCompletionPrivate));
 
        object_class = G_OBJECT_CLASS (class);
@@ -484,9 +488,8 @@ e_category_completion_class_init (ECategoryCompletionClass *class)
 static void
 e_category_completion_init (ECategoryCompletion *category_completion)
 {
-       category_completion->priv = G_TYPE_INSTANCE_GET_PRIVATE (
-               category_completion, E_TYPE_CATEGORY_COMPLETION,
-               ECategoryCompletionPrivate);
+       category_completion->priv =
+               E_CATEGORY_COMPLETION_GET_PRIVATE (category_completion);
 }
 
 /**
index e96e079..03d4e47 100644 (file)
 #include "libedataserver/e-categories.h"
 #include "e-category-editor.h"
 
-G_DEFINE_TYPE (ECategoryEditor, e_category_editor, GTK_TYPE_DIALOG)
+#define E_CATEGORY_EDITOR_GET_PRIVATE(obj) \
+       (G_TYPE_INSTANCE_GET_PRIVATE \
+       ((obj), E_TYPE_CATEGORY_EDITOR, ECategoryEditorPrivate))
 
 struct _ECategoryEditorPrivate {
        GtkWidget *category_name;
        GtkWidget *category_icon;
 };
 
+G_DEFINE_TYPE (ECategoryEditor, e_category_editor, GTK_TYPE_DIALOG)
+
 static void
 update_preview (GtkFileChooser *chooser,
                 gpointer user_data)
@@ -125,8 +129,7 @@ e_category_editor_init (ECategoryEditor *editor)
        GtkWidget *chooser_dialog;
        GtkWidget *preview;
 
-       editor->priv = G_TYPE_INSTANCE_GET_PRIVATE (
-               editor, E_TYPE_CATEGORY_EDITOR, ECategoryEditorPrivate);
+       editor->priv = E_CATEGORY_EDITOR_GET_PRIVATE (editor);
 
        chooser_dialog = gtk_file_chooser_dialog_new (
                _("Category Icon"),
index 3ccb55f..748bea5 100644 (file)
 #include <string.h>
 #include <glib/gi18n-lib.h>
 
+#define E_CELL_RENDERER_COLOR_GET_PRIVATE(obj) \
+       (G_TYPE_INSTANCE_GET_PRIVATE \
+       ((obj), E_TYPE_CELL_RENDERER_COLOR, ECellRendererColorPrivate))
+
 enum {
        PROP_0,
        PROP_COLOR
@@ -36,9 +40,10 @@ struct _ECellRendererColorPrivate {
        GdkColor *color;
 };
 
-static gpointer parent_class;
-
-G_DEFINE_TYPE (ECellRendererColor, e_cell_renderer_color, GTK_TYPE_CELL_RENDERER)
+G_DEFINE_TYPE (
+       ECellRendererColor,
+       e_cell_renderer_color,
+       GTK_TYPE_CELL_RENDERER)
 
 static void
 cell_renderer_color_get_size (GtkCellRenderer *cell,
@@ -104,7 +109,7 @@ cell_renderer_color_render (GtkCellRenderer *cell,
        guint xpad;
        guint ypad;
 
-       priv = E_CELL_RENDERER_COLOR (cell)->priv;
+       priv = E_CELL_RENDERER_COLOR_GET_PRIVATE (cell);
 
        if (priv->color == NULL)
                return;
@@ -138,7 +143,7 @@ cell_renderer_color_set_property (GObject *object,
 {
        ECellRendererColorPrivate *priv;
 
-       priv = E_CELL_RENDERER_COLOR (object)->priv;
+       priv = E_CELL_RENDERER_COLOR_GET_PRIVATE (object);
 
        switch (property_id) {
                case PROP_COLOR:
@@ -159,7 +164,7 @@ cell_renderer_color_get_property (GObject *object,
 {
        ECellRendererColorPrivate *priv;
 
-       priv = E_CELL_RENDERER_COLOR (object)->priv;
+       priv = E_CELL_RENDERER_COLOR_GET_PRIVATE (object);
 
        switch (property_id) {
                case PROP_COLOR:
@@ -175,13 +180,13 @@ cell_renderer_color_finalize (GObject *object)
 {
        ECellRendererColorPrivate *priv;
 
-       priv = E_CELL_RENDERER_COLOR (object)->priv;
+       priv = E_CELL_RENDERER_COLOR_GET_PRIVATE (object);
 
        if (priv->color != NULL)
                gdk_color_free (priv->color);
 
        /* Chain up to parent's finalize() method. */
-       G_OBJECT_CLASS (parent_class)->finalize (object);
+       G_OBJECT_CLASS (e_cell_renderer_color_parent_class)->finalize (object);
 }
 
 static void
@@ -190,8 +195,7 @@ e_cell_renderer_color_class_init (ECellRendererColorClass *class)
        GObjectClass *object_class;
        GtkCellRendererClass *cell_class;
 
-       parent_class = g_type_class_peek_parent (class);
-       g_type_class_add_private (class, sizeof (ECellRendererColor));
+       g_type_class_add_private (class, sizeof (ECellRendererColorPrivate));
 
        object_class = G_OBJECT_CLASS (class);
        object_class->set_property = cell_renderer_color_set_property;
@@ -216,9 +220,7 @@ e_cell_renderer_color_class_init (ECellRendererColorClass *class)
 static void
 e_cell_renderer_color_init (ECellRendererColor *cellcolor)
 {
-       cellcolor->priv = G_TYPE_INSTANCE_GET_PRIVATE (
-               cellcolor, E_TYPE_CELL_RENDERER_COLOR,
-               ECellRendererColorPrivate);
+       cellcolor->priv = E_CELL_RENDERER_COLOR_GET_PRIVATE (cellcolor);
 
        g_object_set (cellcolor, "xpad", 4, NULL);
 }
index 70197ca..9c81cd1 100644 (file)
        (iter)->user_data = GINT_TO_POINTER (index); \
        } G_STMT_END
 
+#define E_CONTACT_STORE_GET_PRIVATE(obj) \
+       (G_TYPE_INSTANCE_GET_PRIVATE \
+       ((obj), E_TYPE_CONTACT_STORE, EContactStorePrivate))
+
 struct _EContactStorePrivate {
        gint stamp;
        EBookQuery *query;
@@ -112,7 +116,7 @@ contact_store_dispose (GObject *object)
        EContactStorePrivate *priv;
        gint ii;
 
-       priv = E_CONTACT_STORE (object)->priv;
+       priv = E_CONTACT_STORE_GET_PRIVATE (object);
 
        /* Free sources and cached contacts */
        for (ii = 0; ii < priv->contact_sources->len; ii++) {
@@ -142,7 +146,7 @@ contact_store_finalize (GObject *object)
 {
        EContactStorePrivate *priv;
 
-       priv = E_CONTACT_STORE (object)->priv;
+       priv = E_CONTACT_STORE_GET_PRIVATE (object);
 
        g_array_free (priv->contact_sources, TRUE);
 
@@ -204,8 +208,7 @@ e_contact_store_init (EContactStore *contact_store)
 
        contact_sources = g_array_new (FALSE, FALSE, sizeof (ContactSource));
 
-       contact_store->priv = G_TYPE_INSTANCE_GET_PRIVATE (
-               contact_store, E_TYPE_CONTACT_STORE, EContactStorePrivate);
+       contact_store->priv = E_CONTACT_STORE_GET_PRIVATE (contact_store);
        contact_store->priv->stamp = g_random_int ();
        contact_store->priv->contact_sources = contact_sources;
 }
index a03b419..80e681c 100644 (file)
        (iter)->user_data = GINT_TO_POINTER (index); \
        } G_STMT_END
 
+#define E_DESTINATION_STORE_GET_PRIVATE(obj) \
+       (G_TYPE_INSTANCE_GET_PRIVATE \
+       ((obj), E_TYPE_DESTINATION_STORE, EDestinationStorePrivate))
+
 struct _EDestinationStorePrivate {
        GPtrArray *destinations;
        gint stamp;
@@ -92,7 +96,7 @@ destination_store_dispose (GObject *object)
        EDestinationStorePrivate *priv;
        gint ii;
 
-       priv = E_DESTINATION_STORE (object)->priv;
+       priv = E_DESTINATION_STORE_GET_PRIVATE (object);
 
        for (ii = 0; ii < priv->destinations->len; ii++) {
                EDestination *destination;
@@ -112,7 +116,7 @@ destination_store_finalize (GObject *object)
 {
        EDestinationStorePrivate *priv;
 
-       priv = E_DESTINATION_STORE (object)->priv;
+       priv = E_DESTINATION_STORE_GET_PRIVATE (object);
 
        g_ptr_array_free (priv->destinations, TRUE);
 
@@ -152,9 +156,9 @@ e_destination_store_tree_model_init (GtkTreeModelIface *iface)
 static void
 e_destination_store_init (EDestinationStore *destination_store)
 {
-       destination_store->priv = G_TYPE_INSTANCE_GET_PRIVATE (
-               destination_store, E_TYPE_DESTINATION_STORE,
-               EDestinationStorePrivate);
+       destination_store->priv =
+               E_DESTINATION_STORE_GET_PRIVATE (destination_store);
+
        destination_store->priv->destinations = g_ptr_array_new ();
        destination_store->priv->stamp = g_random_int ();
 }
index ea79284..f36e7fb 100644 (file)
 #include "e-name-selector-dialog.h"
 #include "e-name-selector-entry.h"
 
+#define E_NAME_SELECTOR_DIALOG_GET_PRIVATE(obj) \
+       (G_TYPE_INSTANCE_GET_PRIVATE \
+       ((obj), E_TYPE_NAME_SELECTOR_DIALOG, ENameSelectorDialogPrivate))
+
 typedef struct {
        gchar        *name;
 
@@ -173,9 +177,8 @@ e_name_selector_dialog_init (ENameSelectorDialog *name_selector_dialog)
        GtkWidget *status_message;
        GtkWidget *source_combo;
 
-       name_selector_dialog->priv = G_TYPE_INSTANCE_GET_PRIVATE (
-               name_selector_dialog, E_TYPE_NAME_SELECTOR_DIALOG,
-               ENameSelectorDialogPrivate);
+       name_selector_dialog->priv =
+               E_NAME_SELECTOR_DIALOG_GET_PRIVATE (name_selector_dialog);
 
        name_selector_box = gtk_vbox_new (FALSE, 6);
        gtk_widget_show (name_selector_box);
@@ -446,7 +449,7 @@ e_name_selector_dialog_finalize (GObject *object)
 {
        ENameSelectorDialogPrivate *priv;
 
-       priv = E_NAME_SELECTOR_DIALOG (object)->priv;
+       priv = E_NAME_SELECTOR_DIALOG_GET_PRIVATE (object);
 
        g_slist_foreach (priv->user_query_fields, (GFunc) g_free, NULL);
        g_slist_free (priv->user_query_fields);
@@ -730,7 +733,7 @@ add_section (ENameSelectorDialog *name_selector_dialog,
        g_assert (pretty_name != NULL);
        g_assert (E_IS_DESTINATION_STORE (destination_store));
 
-       priv = name_selector_dialog->priv;
+       priv = E_NAME_SELECTOR_DIALOG_GET_PRIVATE (name_selector_dialog);
 
        memset (&section, 0, sizeof (Section));
 
@@ -1009,7 +1012,7 @@ source_changed (ENameSelectorDialog *name_selector_dialog,
 static void
 search_changed (ENameSelectorDialog *name_selector_dialog)
 {
-       ENameSelectorDialogPrivate *priv = name_selector_dialog->priv;
+       ENameSelectorDialogPrivate *priv = E_NAME_SELECTOR_DIALOG_GET_PRIVATE (name_selector_dialog);
        EContactStore *contact_store;
        EBookQuery    *book_query;
        GtkWidget     *combo_box;
index 70a2c1e..1e2a6b1 100644 (file)
 
 #include "e-name-selector-entry.h"
 
+#define E_NAME_SELECTOR_ENTRY_GET_PRIVATE(obj) \
+       (G_TYPE_INSTANCE_GET_PRIVATE \
+       ((obj), E_TYPE_NAME_SELECTOR_ENTRY, ENameSelectorEntryPrivate))
+
 struct _ENameSelectorEntryPrivate {
 
        PangoAttrList *attr_list;
@@ -102,7 +106,7 @@ name_selector_entry_dispose (GObject *object)
 {
        ENameSelectorEntryPrivate *priv;
 
-       priv = E_NAME_SELECTOR_ENTRY (object)->priv;
+       priv = E_NAME_SELECTOR_ENTRY_GET_PRIVATE (object);
 
        if (priv->attr_list != NULL) {
                pango_attr_list_unref (priv->attr_list);
@@ -151,7 +155,7 @@ name_selector_entry_realize (GtkWidget *widget)
 {
        ENameSelectorEntryPrivate *priv;
 
-       priv = E_NAME_SELECTOR_ENTRY (widget)->priv;
+       priv = E_NAME_SELECTOR_ENTRY_GET_PRIVATE (widget);
 
        /* Chain up to parent's realize() method. */
        GTK_WIDGET_CLASS (e_name_selector_entry_parent_class)->realize (widget);
@@ -623,7 +627,7 @@ set_completion_query (ENameSelectorEntry *name_selector_entry,
        gchar      *file_as_query_str;
        gchar      *user_fields_str;
 
-       priv = name_selector_entry->priv;
+       priv = E_NAME_SELECTOR_ENTRY_GET_PRIVATE (name_selector_entry);
 
        if (!name_selector_entry->priv->contact_store)
                return;
@@ -938,7 +942,7 @@ type_ahead_complete (ENameSelectorEntry *name_selector_entry)
        gchar         *temp_str;
        ENameSelectorEntryPrivate *priv;
 
-       priv = name_selector_entry->priv;
+       priv = E_NAME_SELECTOR_ENTRY_GET_PRIVATE (name_selector_entry);
 
        cursor_pos = gtk_editable_get_position (GTK_EDITABLE (name_selector_entry));
        if (cursor_pos < 0)
@@ -1011,7 +1015,7 @@ clear_completion_model (ENameSelectorEntry *name_selector_entry)
 {
        ENameSelectorEntryPrivate *priv;
 
-       priv = name_selector_entry->priv;
+       priv = E_NAME_SELECTOR_ENTRY_GET_PRIVATE (name_selector_entry);
 
        if (!name_selector_entry->priv->contact_store)
                return;
@@ -1633,7 +1637,7 @@ entry_activate (ENameSelectorEntry *name_selector_entry)
        if (cursor_pos < 0)
                return;
 
-       priv = name_selector_entry->priv;
+       priv = E_NAME_SELECTOR_ENTRY_GET_PRIVATE (name_selector_entry);
 
        text = gtk_entry_get_text (GTK_ENTRY (name_selector_entry));
        if (!get_range_at_position (text, cursor_pos, &range_start, &range_end))
@@ -2982,9 +2986,8 @@ e_name_selector_entry_init (ENameSelectorEntry *name_selector_entry)
        GtkCellRenderer *renderer;
        GConfClient *gconf;
 
-       name_selector_entry->priv = G_TYPE_INSTANCE_GET_PRIVATE (
-               name_selector_entry, E_TYPE_NAME_SELECTOR_ENTRY,
-               ENameSelectorEntryPrivate);
+       name_selector_entry->priv =
+               E_NAME_SELECTOR_ENTRY_GET_PRIVATE (name_selector_entry);
 
        g_queue_init (&name_selector_entry->priv->cancellables);
 
index e8d2490..cf1c488 100644 (file)
 #include <libedataserverui/e-name-selector-entry.h>
 #include "e-name-selector-list.h"
 
+#define E_NAME_SELECTOR_LIST_GET_PRIVATE(obj) \
+       (G_TYPE_INSTANCE_GET_PRIVATE \
+       ((obj), E_TYPE_NAME_SELECTOR_LIST, ENameSelectorListPrivate))
+
 #define MAX_ROW        10
 
 struct _ENameSelectorListPrivate {
@@ -631,8 +635,7 @@ e_name_selector_list_init (ENameSelectorList *list)
        EDestinationStore *store;
        GtkEntryCompletion *completion;
 
-       list->priv = G_TYPE_INSTANCE_GET_PRIVATE (
-               list, E_TYPE_NAME_SELECTOR_LIST, ENameSelectorListPrivate);
+       list->priv = E_NAME_SELECTOR_LIST_GET_PRIVATE (list);
        list->priv->menu = NULL;
 
        entry = E_NAME_SELECTOR_ENTRY (list);
index ce3d5d3..98e66b1 100644 (file)
 #include <glib/gi18n-lib.h>
 #include "e-name-selector-model.h"
 
+#define E_NAME_SELECTOR_MODEL_GET_PRIVATE(obj) \
+       (G_TYPE_INSTANCE_GET_PRIVATE \
+       ((obj), E_TYPE_NAME_SELECTOR_MODEL, ENameSelectorModelPrivate))
+
 typedef struct {
        gchar              *name;
        gchar              *pretty_name;
@@ -69,9 +73,9 @@ G_DEFINE_TYPE (ENameSelectorModel, e_name_selector_model, G_TYPE_OBJECT)
 static void
 e_name_selector_model_init (ENameSelectorModel *name_selector_model)
 {
-       name_selector_model->priv = G_TYPE_INSTANCE_GET_PRIVATE (
-               name_selector_model, E_TYPE_NAME_SELECTOR_MODEL,
-               ENameSelectorModelPrivate);
+       name_selector_model->priv =
+               E_NAME_SELECTOR_MODEL_GET_PRIVATE (name_selector_model);
+
        name_selector_model->priv->sections       = g_array_new (FALSE, FALSE, sizeof (Section));
        name_selector_model->priv->contact_store  = e_contact_store_new ();
 
@@ -95,7 +99,7 @@ name_selector_model_finalize (GObject *object)
        ENameSelectorModelPrivate *priv;
        gint i;
 
-       priv = E_NAME_SELECTOR_MODEL (object)->priv;
+       priv = E_NAME_SELECTOR_MODEL_GET_PRIVATE (object);
 
        for (i = 0; i < priv->sections->len; i++)
                free_section (E_NAME_SELECTOR_MODEL (object), i);
index 41533e0..2cf3c70 100644 (file)
 #include "e-client-utils.h"
 #include "e-name-selector.h"
 
+#define E_NAME_SELECTOR_GET_PRIVATE(obj) \
+       (G_TYPE_INSTANCE_GET_PRIVATE \
+       ((obj), E_TYPE_NAME_SELECTOR, ENameSelectorPrivate))
+
 typedef struct {
        gchar *name;
        ENameSelectorEntry *entry;
@@ -69,7 +73,7 @@ reset_pointer_cb (gpointer data,
 
        g_return_if_fail (E_IS_NAME_SELECTOR (name_selector));
 
-       priv = name_selector->priv;
+       priv = E_NAME_SELECTOR_GET_PRIVATE (name_selector);
 
        for (ii = 0; ii < priv->sections->len; ii++) {
                Section *section;
@@ -231,7 +235,7 @@ name_selector_dispose (GObject *object)
        ENameSelectorPrivate *priv;
        guint ii;
 
-       priv = E_NAME_SELECTOR (object)->priv;
+       priv = E_NAME_SELECTOR_GET_PRIVATE (object);
 
        if (priv->cancellable) {
                g_cancellable_cancel (priv->cancellable);
@@ -274,7 +278,7 @@ name_selector_finalize (GObject *object)
 {
        ENameSelectorPrivate *priv;
 
-       priv = E_NAME_SELECTOR (object)->priv;
+       priv = E_NAME_SELECTOR_GET_PRIVATE (object);
 
        g_array_free (priv->source_books, TRUE);
        g_array_free (priv->sections, TRUE);
@@ -304,8 +308,7 @@ e_name_selector_init (ENameSelector *name_selector)
        sections = g_array_new (FALSE, FALSE, sizeof (Section));
        source_books = g_array_new (FALSE, FALSE, sizeof (SourceBook));
 
-       name_selector->priv = G_TYPE_INSTANCE_GET_PRIVATE (
-               name_selector, E_TYPE_NAME_SELECTOR, ENameSelectorPrivate);
+       name_selector->priv = E_NAME_SELECTOR_GET_PRIVATE (name_selector);
        name_selector->priv->sections = sections;
        name_selector->priv->model = e_name_selector_model_new ();
        name_selector->priv->source_books = source_books;
@@ -470,7 +473,7 @@ e_name_selector_peek_section_entry (ENameSelector *name_selector,
        g_return_val_if_fail (E_IS_NAME_SELECTOR (name_selector), NULL);
        g_return_val_if_fail (name != NULL, NULL);
 
-       priv = name_selector->priv;
+       priv = E_NAME_SELECTOR_GET_PRIVATE (name_selector);
        model = e_name_selector_peek_model (name_selector);
 
        if (!e_name_selector_model_peek_section (
@@ -539,7 +542,7 @@ e_name_selector_peek_section_list (ENameSelector *name_selector,
        g_return_val_if_fail (E_IS_NAME_SELECTOR (name_selector), NULL);
        g_return_val_if_fail (name != NULL, NULL);
 
-       priv = name_selector->priv;
+       priv = E_NAME_SELECTOR_GET_PRIVATE (name_selector);
        model = e_name_selector_peek_model (name_selector);
 
        if (!e_name_selector_model_peek_section (
index 89fdad2..0e632a5 100644 (file)
 #include "e-source-combo-box.h"
 #include "e-cell-renderer-color.h"
 
+#define E_SOURCE_COMBO_BOX_GET_PRIVATE(obj) \
+       (G_TYPE_INSTANCE_GET_PRIVATE \
+       ((obj), E_TYPE_SOURCE_COMBO_BOX, ESourceComboBoxPrivate))
+
 G_DEFINE_TYPE (ESourceComboBox, e_source_combo_box, GTK_TYPE_COMBO_BOX)
 
 struct _ESourceComboBoxPrivate {
@@ -261,7 +265,7 @@ e_source_combo_box_dispose (GObject *object)
 {
        ESourceComboBoxPrivate *priv;
 
-       priv = E_SOURCE_COMBO_BOX (object)->priv;
+       priv = E_SOURCE_COMBO_BOX_GET_PRIVATE (object);
 
        if (priv->source_list != NULL) {
                g_signal_handler_disconnect (
@@ -281,7 +285,7 @@ e_source_combo_box_finalize (GObject *object)
 {
        ESourceComboBoxPrivate *priv;
 
-       priv = E_SOURCE_COMBO_BOX (object)->priv;
+       priv = E_SOURCE_COMBO_BOX_GET_PRIVATE (object);
 
        g_hash_table_destroy (priv->uid_index);
 
@@ -296,7 +300,7 @@ e_source_combo_box_class_init (ESourceComboBoxClass *class)
 
        parent_class = g_type_class_peek_parent (class);
 
-       g_type_class_add_private (class, sizeof (ESourceComboBox));
+       g_type_class_add_private (class, sizeof (ESourceComboBoxPrivate));
 
        object_class->constructor = e_source_combo_box_constructor;
        object_class->set_property = e_source_combo_box_set_property;
@@ -318,9 +322,8 @@ e_source_combo_box_class_init (ESourceComboBoxClass *class)
 static void
 e_source_combo_box_init (ESourceComboBox *source_combo_box)
 {
-       source_combo_box->priv = G_TYPE_INSTANCE_GET_PRIVATE (
-               source_combo_box, E_TYPE_SOURCE_COMBO_BOX,
-               ESourceComboBoxPrivate);
+       source_combo_box->priv =
+               E_SOURCE_COMBO_BOX_GET_PRIVATE (source_combo_box);
        source_combo_box->priv->uid_index =
                g_hash_table_new_full (
                        g_str_hash, g_str_equal,
index cdd7064..dab186f 100644 (file)
 #include "e-source-selector.h"
 #include "e-source-selector-dialog.h"
 
+#define E_SOURCE_SELECTOR_DIALOG_GET_PRIVATE(obj) \
+       (G_TYPE_INSTANCE_GET_PRIVATE \
+       ((obj), E_TYPE_SOURCE_SELECTOR_DIALOG, ESourceSelectorDialogPrivate))
+
 struct _ESourceSelectorDialogPrivate {
        GtkWidget *source_selector;
        ESourceList *source_list;
        ESource *selected_source;
 };
 
-static GObjectClass *parent_class = NULL;
-
-/* GObject methods */
-
-G_DEFINE_TYPE (ESourceSelectorDialog, e_source_selector_dialog, GTK_TYPE_DIALOG)
+G_DEFINE_TYPE (
+       ESourceSelectorDialog,
+       e_source_selector_dialog,
+       GTK_TYPE_DIALOG)
 
 static void
-e_source_selector_dialog_dispose (GObject *object)
+source_selector_dialog_dispose (GObject *object)
 {
-       ESourceSelectorDialogPrivate *priv = E_SOURCE_SELECTOR_DIALOG (object)->priv;
+       ESourceSelectorDialogPrivate *priv;
+
+       priv = E_SOURCE_SELECTOR_DIALOG_GET_PRIVATE (object);
 
        if (priv->source_list) {
                g_object_unref (priv->source_list);
@@ -56,41 +61,28 @@ e_source_selector_dialog_dispose (GObject *object)
                priv->selected_source = NULL;
        }
 
-       (*G_OBJECT_CLASS (parent_class)->dispose) (object);
-}
-
-static void
-e_source_selector_dialog_finalize (GObject *object)
-{
-       ESourceSelectorDialogPrivate *priv = E_SOURCE_SELECTOR_DIALOG (object)->priv;
-
-       g_free (priv);
-       E_SOURCE_SELECTOR_DIALOG (object)->priv = NULL;
-
-       (* G_OBJECT_CLASS (parent_class)->finalize) (object);
+       /* Chain up to parent's dispose() method. */
+       G_OBJECT_CLASS (e_source_selector_dialog_parent_class)->dispose (object);
 }
 
 static void
-e_source_selector_dialog_class_init (ESourceSelectorDialogClass *klass)
+e_source_selector_dialog_class_init (ESourceSelectorDialogClass *class)
 {
-       GObjectClass *object_class = G_OBJECT_CLASS (klass);
+       GObjectClass *object_class;
 
-       object_class->dispose = e_source_selector_dialog_dispose;
-       object_class->finalize = e_source_selector_dialog_finalize;
+       g_type_class_add_private (class, sizeof (ESourceSelectorDialogPrivate));
 
-       parent_class = g_type_class_peek_parent (klass);
+       object_class = G_OBJECT_CLASS (class);
+       object_class->dispose = source_selector_dialog_dispose;
 }
 
 static void
 e_source_selector_dialog_init (ESourceSelectorDialog *dialog)
 {
-       ESourceSelectorDialogPrivate *priv;
        GtkWidget *action_area;
        GtkWidget *content_area;
 
-       priv = g_new0 (ESourceSelectorDialogPrivate, 1);
-       priv->selected_source = NULL;
-       dialog->priv = priv;
+       dialog->priv = E_SOURCE_SELECTOR_DIALOG_GET_PRIVATE (dialog);
 
        action_area = gtk_dialog_get_action_area (GTK_DIALOG (dialog));
        content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
index 3ab1c4b..5948d25 100644 (file)
 #include "e-data-server-ui-marshal.h"
 #include "e-source-selector.h"
 
+#define E_SOURCE_SELECTOR_GET_PRIVATE(obj) \
+       (G_TYPE_INSTANCE_GET_PRIVATE \
+       ((obj), E_TYPE_SOURCE_SELECTOR, ESourceSelectorPrivate))
+
 struct _ESourceSelectorPrivate {
        ESourceList *list;
 
@@ -115,11 +119,11 @@ safe_toggle_activate (GtkCellRenderer *cell,
 }
 
 static void
-e_cell_renderer_safe_toggle_class_init (ECellRendererSafeToggleClass *klass)
+e_cell_renderer_safe_toggle_class_init (ECellRendererSafeToggleClass *class)
 {
        GtkCellRendererClass *rndr_class;
 
-       rndr_class = GTK_CELL_RENDERER_CLASS (klass);
+       rndr_class = GTK_CELL_RENDERER_CLASS (class);
        rndr_class->activate = safe_toggle_activate;
 }
 
@@ -846,7 +850,9 @@ source_selector_get_property (GObject *object,
 static void
 source_selector_dispose (GObject *object)
 {
-       ESourceSelectorPrivate *priv = E_SOURCE_SELECTOR (object)->priv;
+       ESourceSelectorPrivate *priv;
+
+       priv = E_SOURCE_SELECTOR_GET_PRIVATE (object);
 
        g_hash_table_remove_all (priv->selected_sources);
 
@@ -869,7 +875,9 @@ source_selector_dispose (GObject *object)
 static void
 source_selector_finalize (GObject *object)
 {
-       ESourceSelectorPrivate *priv = E_SOURCE_SELECTOR (object)->priv;
+       ESourceSelectorPrivate *priv;
+
+       priv = E_SOURCE_SELECTOR_GET_PRIVATE (object);
 
        g_hash_table_destroy (priv->selected_sources);
 
@@ -1125,7 +1133,7 @@ source_selector_test_collapse_row (GtkTreeView *tree_view,
        GtkTreeModel *model;
        GtkTreeIter child_iter;
 
-       priv = E_SOURCE_SELECTOR (tree_view)->priv;
+       priv = E_SOURCE_SELECTOR_GET_PRIVATE (tree_view);
 
        /* Clear this because something else has been clicked on now */
        priv->toggled_last = FALSE;
@@ -1161,7 +1169,7 @@ source_selector_row_expanded (GtkTreeView *tree_view,
        GtkTreePath *child_path;
        GtkTreeIter child_iter;
 
-       priv = E_SOURCE_SELECTOR (tree_view)->priv;
+       priv = E_SOURCE_SELECTOR_GET_PRIVATE (tree_view);
 
        if (!priv->saved_primary_selection)
                return;
@@ -1293,16 +1301,13 @@ e_source_selector_class_init (ESourceSelectorClass *class)
 static void
 e_source_selector_init (ESourceSelector *selector)
 {
-       ESourceSelectorPrivate *priv;
        GtkTreeViewColumn *column;
        GtkCellRenderer *cell_renderer;
        GtkTreeSelection *selection;
        GtkTreeStore *tree_store;
        GtkTreeView *tree_view;
 
-       selector->priv = G_TYPE_INSTANCE_GET_PRIVATE (
-               selector, E_TYPE_SOURCE_SELECTOR, ESourceSelectorPrivate);
-       priv = selector->priv;
+       selector->priv = E_SOURCE_SELECTOR_GET_PRIVATE (selector);
 
        tree_view = GTK_TREE_VIEW (selector);
 
@@ -1310,11 +1315,11 @@ e_source_selector_init (ESourceSelector *selector)
        gtk_tree_view_set_search_equal_func (tree_view, group_search_function, NULL, NULL);
        gtk_tree_view_set_enable_search (tree_view, TRUE);
 
-       priv->toggled_last = FALSE;
-       priv->checkboxes_shown = TRUE;
-       priv->select_new = FALSE;
+       selector->priv->toggled_last = FALSE;
+       selector->priv->checkboxes_shown = TRUE;
+       selector->priv->select_new = FALSE;
 
-       priv->selected_sources = g_hash_table_new_full (
+       selector->priv->selected_sources = g_hash_table_new_full (
                g_direct_hash, g_direct_equal,
                (GDestroyNotify) g_object_unref,
                (GDestroyNotify) NULL);
index b870d85..122ed2d 100644 (file)
        (iter)->user_data2 = GINT_TO_POINTER (index); \
        } G_STMT_END
 
+#define E_TREE_MODEL_GENERATOR_GET_PRIVATE(obj) \
+       (G_TYPE_INSTANCE_GET_PRIVATE \
+       ((obj), E_TYPE_TREE_MODEL_GENERATOR, ETreeModelGeneratorPrivate))
+
 struct _ETreeModelGeneratorPrivate {
        GtkTreeModel *child_model;
        GArray *root_nodes;
@@ -235,9 +239,8 @@ e_tree_model_generator_tree_model_init (GtkTreeModelIface *iface)
 static void
 e_tree_model_generator_init (ETreeModelGenerator *tree_model_generator)
 {
-       tree_model_generator->priv = G_TYPE_INSTANCE_GET_PRIVATE (
-               tree_model_generator, E_TYPE_TREE_MODEL_GENERATOR,
-               ETreeModelGeneratorPrivate);
+       tree_model_generator->priv =
+               E_TREE_MODEL_GENERATOR_GET_PRIVATE (tree_model_generator);
 
        tree_model_generator->priv->stamp      = g_random_int ();
        tree_model_generator->priv->root_nodes = g_array_new (FALSE, FALSE, sizeof (Node));
index e279b2d..82148e3 100644 (file)
@@ -220,7 +220,9 @@ test_econtact (const gchar *vcard_str)
        return TRUE;
 }
 
-gint main (gint argc, gchar **argv)
+gint
+main (gint argc,
+      gchar **argv)
 {
        const gchar
                *test_vcard_no_uid_str = 
index 1cb29d0..d8a7692 100644 (file)
@@ -39,7 +39,7 @@ get_revision_compare_cycle (ECalClient *client)
        g_assert (strcmp (revision_before, revision_after) != 0);
 
        g_message ("Passed cycle, revision before '%s' revision after '%s'",
-                  revision_before, revision_after);
+                 revision_before, revision_after);
 
        g_free (revision_before);
        g_free (revision_after);
@@ -49,7 +49,8 @@ get_revision_compare_cycle (ECalClient *client)
 }
 
 gint
-main (gint argc, gchar **argv)
+main (gint argc,
+      gchar **argv)
 {
        ECalClient *cal_client;
        GError      *error = NULL;
index 73509af..423ceb6 100644 (file)
@@ -51,7 +51,7 @@ cl_printf (ECal *client,
 {
        va_list args;
 
-       if (client != client1) 
+       if (client != client1)
                return;
 
        va_start (args, format);