#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"
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);
}
#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;
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",
#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"
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) {
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);
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);
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:
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);
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\" \"\")");
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));
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));
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:
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);
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);
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;
{
EBookBackendGooglePrivate *priv;
- priv = E_BOOK_BACKEND_GOOGLE (backend)->priv;
+ priv = E_BOOK_BACKEND_GOOGLE_GET_PRIVATE (backend);
if (priv->service == NULL)
return FALSE;
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;
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;
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;
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);
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);
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));
/* 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);
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));
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);
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) {
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));
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);
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);
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));
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:
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;
{
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. */
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);
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);
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) {
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))) {
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);
}
/* 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);
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;
ModifyContactData *data;
const gchar *vcard_str = vcards->data;
+ priv = E_BOOK_BACKEND_GOOGLE_GET_PRIVATE (backend);
+
__debug__ (G_STRFUNC);
__debug__ ("Updating: %s", vcard_str);
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);
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);
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);
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 */
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))) {
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)) {
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);
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));
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);
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);
}
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;
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",
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;
#endif
#endif
+ priv = E_BOOK_BACKEND_GOOGLE_GET_PRIVATE (backend);
+
attributes = e_vcard_get_attributes (E_VCARD (contact));
/* N and FN */
_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;
#endif
#endif
+ priv = E_BOOK_BACKEND_GOOGLE_GET_PRIVATE (backend);
+
uid = gdata_entry_get_id (entry);
if (NULL == uid)
return NULL;
/* 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,
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");
}
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;
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;
#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
}
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;
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",
#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)
G_DEFINE_TYPE (EBookBackendWebdav, e_book_backend_webdav, E_TYPE_BOOK_BACKEND)
-static EBookBackendClass *parent_class;
-
struct _EBookBackendWebdavPrivate {
gboolean marked_for_offline;
SoupSession *session;
#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;
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",
#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 {
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;
}
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] =
#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;
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
}
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;
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;
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;
}
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),
#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"
static gboolean unwrap_gerror (GError *error, GError **client_error);
G_DEFINE_TYPE (EBook, e_book, G_TYPE_OBJECT)
-
enum {
WRITABLE_STATUS,
CONNECTION_STATUS,
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++;
#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 {
#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;
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)
#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 {
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,
}
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);
}
/**
e_destination_empty (const EDestination *dest)
{
- struct _EDestinationPrivate *p;
+ EDestinationPrivate *p;
g_return_val_if_fail (E_IS_DESTINATION (dest), TRUE);
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);
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) {
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) {
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);
#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;
void e_destination_set_book (EDestination *dest, EBook *book);
#endif
+G_END_DECLS
+
#endif /* __E_DESTINATION_H__ */
#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
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 */
#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;
};
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);
}
/**
#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;
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;
}
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);
}
* 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 {
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 */
#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"
{
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) {
{
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);
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);
/* 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;
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);
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);
static gint
get_uids_and_rev_cb (gpointer user_data,
- gint col,
+ gint col,
gchar **cols,
gchar **name)
{
**/
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;
#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;
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;
}
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
* 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{
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 */
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
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;
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;
}
#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;
{
EBookBackendPrivate *priv;
- priv = E_BOOK_BACKEND (object)->priv;
+ priv = E_BOOK_BACKEND_GET_PRIVATE (object);
if (priv->views != NULL) {
g_slist_free (priv->views);
{
EBookBackendPrivate *priv;
- priv = E_BOOK_BACKEND (object)->priv;
+ priv = E_BOOK_BACKEND_GET_PRIVATE (object);
g_slist_free (priv->clients);
}
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,
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 ();
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;
#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 */
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;
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);
}
/**
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);
}
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
}
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;
}
/* ---------------------------------------------------------------------- */
-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,
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
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);
}
}
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;
}
/* ---------------------------------------------------------------------- */
-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,
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
#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;
{
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);
}
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;
}
/* ---------------------------------------------------------------------- */
-struct _EGdbusBookStubPrivate
-{
- gint foo;
-};
-
static void stub_iface_init (EGdbusBookIface *iface);
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
#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://"
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;
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;
}
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);
}
}
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;
}
gboolean *server_unreachable,
GError **perror)
{
- ECalBackendCalDAVPrivate *priv;
SoupMessage *message;
const gchar *header;
gboolean calendar_access;
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;
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) {
break;
}
- status_code_to_result (message, priv, perror);
+ status_code_to_result (message, cbdav->priv, perror);
g_object_unref (message);
return FALSE;
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
g_object_unref (message);
if (calendar_access) {
- priv->read_only = !(put_allowed && delete_allowed);
+ cbdav->priv->read_only = !(put_allowed && delete_allowed);
return TRUE;
}
static gboolean
check_calendar_changed_on_server (ECalBackendCalDAV *cbdav)
{
- ECalBackendCalDAVPrivate *priv;
xmlOutputBufferPtr buf;
SoupMessage *message;
xmlDocPtr doc;
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;
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);
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;
}
}
time_t start_time,
time_t end_time)
{
- ECalBackendCalDAVPrivate *priv;
xmlOutputBufferPtr buf;
SoupMessage *message;
xmlNodePtr node;
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;
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);
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);
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);
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);
gchar **post_fb,
GError **error)
{
- ECalBackendCalDAVPrivate *priv;
SoupMessage *message;
e_return_data_cal_error_if_fail (cbdav != NULL, InvalidArg);
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));
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
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);
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, '/');
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");
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);
"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);
static gboolean
caldav_receive_schedule_outbox_url (ECalBackendCalDAV *cbdav)
{
- ECalBackendCalDAVPrivate *priv;
SoupMessage *message;
xmlOutputBufferPtr buf;
xmlDocPtr doc;
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;
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);
/* 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);
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);
}
}
g_free (owner);
- return priv->schedule_outbox_url != NULL;
+ return cbdav->priv->schedule_outbox_url != NULL;
}
/* ************************************************************************* */
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;
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);
}
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 */
return;
}
- priv = cbdav->priv;
bkend = E_CAL_BACKEND (cbdav);
len = 0;
sobjs = NULL;
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);
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;
}
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;
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)) {
/* 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);
}
/* 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);
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;
/* 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;
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);
}
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);
}
}
- 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;
}
get_usermail (ECalBackend *backend)
{
ECalBackendCalDAV *cbdav;
- ECalBackendCalDAVPrivate *priv;
ESource *source;
gchar *res = NULL;
}
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;
initialize_backend (ECalBackendCalDAV *cbdav,
GError **perror)
{
- ECalBackendCalDAVPrivate *priv;
ECalBackend *backend;
ESource *source;
const gchar *os_val;
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));
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;
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) {
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 */
}
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;
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);
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;
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);
}
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
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
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
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;
}
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
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;
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;
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));
remove_cached_attachment (ECalBackendCalDAV *cbdav,
const gchar *uid)
{
- ECalBackendCalDAVPrivate *priv;
GSList *l;
guint len;
gchar *dir;
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);
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;
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)
}
/* 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;
ECalComponent **new_component,
GError **error)
{
- ECalBackendCalDAVPrivate *priv;
ECalComponent *comp;
icalcomponent *cache_comp;
gboolean online, did_put = FALSE;
struct icaltimetype current;
gchar *href = NULL, *etag = NULL;
- priv = cbdav->priv;
-
if (new_component)
*new_component = NULL;
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) {
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);
}
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;
}
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);
extract_timezones (ECalBackendCalDAV *cbdav,
icalcomponent *icomp)
{
- ECalBackendCalDAVPrivate *priv;
GSList *timezones = NULL, *iter;
icaltimezone *zone;
GError *err = NULL;
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);
}
_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 (
{
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));
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 {
GError **perror)
{
ECalBackendCalDAV *cbdav;
- ECalBackendCalDAVPrivate *priv;
ECalBackendSExp *sexp;
ECalBackend *bkend;
gboolean do_search;
gboolean prunning_by_time;
cbdav = E_CAL_BACKEND_CALDAV (backend);
- priv = cbdav->priv;
sexp = e_cal_backend_sexp_new (sexp_string);
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);
EDataCalView *query)
{
ECalBackendCalDAV *cbdav;
- ECalBackendCalDAVPrivate *priv;
ECalBackendSExp *sexp;
ECalBackend *bkend;
gboolean do_search;
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);
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);
GError **error)
{
ECalBackendCalDAV *cbdav;
- ECalBackendCalDAVPrivate *priv;
icalcomponent *icalcomp;
ECalComponent *comp;
ECalComponentDateTime dt;
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;
}
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);
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 */
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 *
{
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);
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);
}
}
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 */
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) {
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);
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);
#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
{
static gboolean
book_client_authenticate_cb (EClient *client,
- ECredentials *credentials,
- ECalBackendContacts *cbc)
+ ECredentials *credentials,
+ ECalBackendContacts *cbc)
{
ESource *source;
const gchar *source_uid;
}
static void
-cbc_reopen_book_client (ECalBackendContacts *cbc, EBookClient *book_client)
+cbc_reopen_book_client (ECalBackendContacts *cbc,
+ EBookClient *book_client)
{
GError *error = NULL;
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;
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;
static ContactRecordCB *
contact_record_cb_new (ECalBackendContacts *cbc,
ECalBackendSExp *sexp,
- gboolean as_string)
+ gboolean as_string)
{
ContactRecordCB *cb_data = g_new (ContactRecordCB, 1);
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);
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);
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;
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)
{
}
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)
{
}
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)
{
}
#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")
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 *
static void
save (ECalBackendFile *cbfile,
- gboolean do_bump_revision)
+ gboolean do_bump_revision)
{
ECalBackendFilePrivate *priv;
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
static icalproperty *
ensure_revision (ECalBackendFile *cbfile)
{
- icalproperty* prop;
+ icalproperty * prop;
prop = get_revision_property (cbfile);
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);
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);
}
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;
#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 */
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)
}
/* 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 */
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
/* 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;
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);
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;
#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)
guint begin_retrival_id;
};
-static ECalBackendSyncClass *parent_class;
-
static gboolean
reload_cb (ECalBackendWeather *cbw)
{
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;
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);
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);
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;
#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 */
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;
}
/* 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,
*/
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,
*/
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,
*/
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,
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,
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,
#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;
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;
}
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;
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,
#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 */
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;
}
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:
*
static void
update_fallback (gchar **fallback,
gchar *adept,
- GHashTable *ical_zones)
+ GHashTable *ical_zones)
{
g_return_if_fail (fallback != NULL);
gsize localtime_content_len,
const gchar *file,
CompareFiles compare_func,
- GHashTable *ical_zones,
+ GHashTable *ical_zones,
gint deep_level,
gchar **fallback)
{
static gboolean
system_timezone_is_valid (const gchar *tz,
- GHashTable *ical_zones)
+ GHashTable *ical_zones)
{
const gchar *c;
#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 {
static guint signals[LAST_SIGNAL];
+G_DEFINE_TYPE (ECalView, e_cal_view, G_TYPE_OBJECT);
+
static GList *
build_object_list (const gchar * const *seq)
{
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
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:
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));
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:
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;
/* 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,
*/
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,
*/
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,
*/
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,
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,
/* 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,
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,
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) {
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) {
#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"
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 \
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
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
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--;
/* 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,
*/
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,
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,
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,
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
#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;
};
{
ECalBackendCachePrivate *priv;
- priv = E_CAL_BACKEND_CACHE (object)->priv;
+ priv = E_CAL_BACKEND_CACHE_GET_PRIVATE (object);
g_hash_table_destroy (priv->timezones);
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,
#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;
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) {
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)) {
}
g_object_ref (comp);
- g_static_rw_lock_writer_unlock (&priv->lock);
+ g_static_rw_lock_writer_unlock (&fstore->priv->lock);
return TRUE;
}
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;
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;
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;
g_object_ref (comp);
end:
- g_static_rw_lock_reader_unlock (&priv->lock);
+ g_static_rw_lock_reader_unlock (&fstore->priv->lock);
return comp;
}
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;
}
ret_val = TRUE;
end:
- g_static_rw_lock_reader_unlock (&priv->lock);
+ g_static_rw_lock_reader_unlock (&fstore->priv->lock);
return ret_val;
}
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);
}
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);
}
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;
}
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;
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);
}
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;
}
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;
}
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;
}
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;
}
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);
}
}
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
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;
}
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;
}
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;
}
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;
}
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 ();
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 *
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;
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;
}
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;
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;
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;
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
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;
}
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);
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;
}
/**
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 *
}
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);
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;
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);
}
/**
#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;
}
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);
}
#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;
{
ECalBackendStorePrivate *priv;
- priv = E_CAL_BACKEND_STORE (object)->priv;
+ priv = E_CAL_BACKEND_STORE_GET_PRIVATE (object);
g_free (priv->path);
if (priv->intervaltree) {
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 ();
}
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;
}
/**
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);
}
/**
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);
}
/**
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);
}
/**
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);
}
/**
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;
}
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);
}
/**
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;
}
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);
}
/**
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);
}
/**
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);
}
/**
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);
}
/**
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);
}
/**
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);
}
/**
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);
}
/**
time_t start,
time_t end)
{
- ECalBackendStorePrivate *priv;
GList *l, *objects;
GSList *list = NULL;
icalcomponent *icalcomp;
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)) {
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);
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);
}
/**
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);
}
/**
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);
}
/**
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);
}
/**
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);
}
/**
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);
}
#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 {
}
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;
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 ();
}
+
#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)
{
ECalBackendPrivate *priv;
- priv = E_CAL_BACKEND (object)->priv;
+ priv = E_CAL_BACKEND_GET_PRIVATE (object);
g_assert (priv->clients == NULL);
}
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,
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 ();
(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;
GHashTable *connections;
};
+G_DEFINE_TYPE (EDataCalFactory, e_data_cal_factory, E_TYPE_DATA_FACTORY);
+
static const gchar *
calobjtype_to_string (const EDataCalObjType type)
{
#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 */
/* 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;
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
}
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;
}
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;
}
/* ---------------------------------------------------------------------- */
-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,
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
}
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;
}
/* ---------------------------------------------------------------------- */
-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,
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
#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;
{
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);
}
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;
}
/* ---------------------------------------------------------------------- */
-struct _EGdbusCalStubPrivate
-{
- gint foo;
-};
-
static void stub_iface_init (EGdbusCalIface *iface);
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
#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 */
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);
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;
#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)
{
CamelCipherContextPrivate *priv;
- priv = CAMEL_CIPHER_CONTEXT (object)->priv;
+ priv = CAMEL_CIPHER_CONTEXT_GET_PRIVATE (object);
if (priv->session != NULL) {
g_object_unref (priv->session);
{
CamelCipherContextPrivate *priv;
- priv = CAMEL_CIPHER_CONTEXT (object)->priv;
+ priv = CAMEL_CIPHER_CONTEXT_GET_PRIVATE (object);
g_mutex_free (priv->lock);
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 ();
}
#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)
{
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);
(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;
#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;
};
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",
/* 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,
{
CamelFilterDriverPrivate *priv;
- priv = CAMEL_FILTER_DRIVER (object)->priv;
+ priv = CAMEL_FILTER_DRIVER_GET_PRIVATE (object);
if (priv->defaultfolder != NULL) {
camel_folder_thaw (priv->defaultfolder);
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));
{
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);
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 */
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;
}
struct _CamelSExpResult **argv,
CamelFilterDriver *driver)
{
- CamelFilterDriverPrivate *p = driver->priv;
gint i;
d(fprintf (stderr, "copying message...\n"));
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);
}
}
struct _CamelSExpResult **argv,
CamelFilterDriver *driver)
{
- CamelFilterDriverPrivate *p = driver->priv;
gint i;
d(fprintf (stderr, "moving message...\n"));
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,
}
}
- 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);
}
}
/* implicit 'stop' with 'move' */
camel_filter_driver_log (driver, FILTER_LOG_ACTION, "Stopped processing");
- p->terminated = TRUE;
+ driver->priv->terminated = TRUE;
return NULL;
}
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;
}
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.
}
}
- 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);
}
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;
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");
}
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);
}
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);
}
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);
}
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);
}
struct _CamelSExpResult **argv,
CamelFilterDriver *driver)
{
- CamelFilterDriverPrivate *p = driver->priv;
gint i, pipe_to_child, pipe_from_child;
CamelMimeMessage *message = NULL;
CamelMimeParser *parser;
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;
}
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);
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;
(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);
struct _CamelSExpResult **argv,
CamelFilterDriver *driver)
{
- CamelFilterDriverPrivate *p = driver->priv;
GString *command;
GPtrArray *args;
gint i;
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);
}
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");
}
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");
}
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;
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;
* 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;
{
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;
const gchar *desc,
...)
{
- CamelFilterDriverPrivate *p = driver->priv;
-
- if (p->logfile) {
+ if (driver->priv->logfile) {
gchar *str = NULL;
if (desc) {
/* 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 */
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:
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);
GCancellable *cancellable,
GError **error)
{
- CamelFilterDriverPrivate *p = driver->priv;
CamelMimeParser *mp = NULL;
gchar *source_url = NULL;
gint fd = -1;
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"));
GCancellable *cancellable,
GError **error)
{
- CamelFilterDriverPrivate *p = driver->priv;
gboolean freeuids = FALSE;
CamelMessageInfo *info;
CamelStore *parent_store;
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)
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));
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:
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
}
/* 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");
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);
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;
}
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;
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);
}
#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;
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 ();
}
#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
{
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);
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;
#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)
gboolean delete_originals;
gboolean expunge;
CamelFetchType fetch_type;
- int limit;
+ gint limit;
gchar *start_uid;
gchar *end_uid;
{
CamelFolderPrivate *priv;
- priv = CAMEL_FOLDER (object)->priv;
+ priv = CAMEL_FOLDER_GET_PRIVATE (object);
g_free (priv->full_name);
g_free (priv->display_name);
static void
fetch_messages (CamelFolder *folder,
- CamelFetchType type,
- int limit,
+ CamelFetchType type,
+ gint limit,
gint io_priority,
GCancellable *cancellable,
GAsyncReadyCallback callback,
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;
static gboolean
purge_message_cache_finish (CamelFolder *folder,
- GAsyncResult *result,
- GError **error)
+ GAsyncResult *result,
+ GError **error)
{
GSimpleAsyncResult *simple;
AsyncContext *async_context;
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;
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 ();
* @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;
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;
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);
* @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.
**/
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;
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);
}
/**
*
* 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;
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);
}
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);
**/
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;
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;
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);
* 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;
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);
}
/**
*
* 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;
(*get_message_cached) (CamelFolder *folder,
const gchar *message_uid,
GCancellable *cancellable);
-
+
/* Synchronous I/O Methods */
gboolean (*append_message_sync) (CamelFolder *folder,
CamelMimeMessage *message,
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 *
(*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);
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,
(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,
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);
(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,
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);
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;
};
gboolean all_zero = *key == '0';
gint i = 0;
- while (key [i] && all_zero) {
+ while (key[i] && all_zero) {
all_zero = key[i] == '0';
i++;
}
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++;
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;
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);
}
/**
#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;
};
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;
}
#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
{
CamelMediumPrivate *priv;
- priv = CAMEL_MEDIUM (object)->priv;
+ priv = CAMEL_MEDIUM_GET_PRIVATE (object);
if (priv->content != NULL) {
g_object_unref (priv->content);
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);
}
/**
#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];
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:
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:
{
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:
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);
}
/**
#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 */
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;
{
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);
{
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;
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));
}
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;
#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,
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;
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);
}
/**
#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)
{
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);
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;
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;
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;
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) {
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;
}
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) {
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;
}
#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;
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;
{
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;
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;
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;
#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;
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);
{
CamelMimeFilterEnrichedPrivate *priv;
- priv = CAMEL_MIME_FILTER_ENRICHED (mime_filter)->priv;
+ priv = CAMEL_MIME_FILTER_ENRICHED_GET_PRIVATE (mime_filter);
priv->nofill = 0;
}
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);
}
/**
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;
}
/**
#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 {
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;
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);
}
/**
#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 {
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;
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) {
{
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);
{
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 (
{
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 (
{
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));
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);
}
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;
#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;
};
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));
{
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);
{
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 ();
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 ();
}
#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;
{
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);
{
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;
{
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;
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);
}
/**
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 */
#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;
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;
{
CamelMimeFilterLinewrapPrivate *priv;
- priv = CAMEL_MIME_FILTER_LINEWRAP (mime_filter)->priv;
+ priv = CAMEL_MIME_FILTER_LINEWRAP_GET_PRIVATE (mime_filter);
priv->nchars = 0;
}
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 *
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;
#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-----"
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);
{
CamelMimeFilterPgpPrivate *priv;
- priv = CAMEL_MIME_FILTER_PGP (mime_filter)->priv;
+ priv = CAMEL_MIME_FILTER_PGP_GET_PRIVATE (mime_filter);
priv->state = PGP_PREFACE;
}
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 *
#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)
{
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);
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)
{
CamelMimeFilterProgressPrivate *priv;
- priv = CAMEL_MIME_FILTER_PROGRESS (mime_filter)->priv;
+ priv = CAMEL_MIME_FILTER_PROGRESS_GET_PRIVATE (mime_filter);
priv->count = 0;
}
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);
}
/**
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);
#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;
};
{
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);
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);
}
/**
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);
#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;
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;
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) {
{
CamelMimeFilterToHTMLPrivate *priv;
- priv = CAMEL_MIME_FILTER_TOHTML (object)->priv;
+ priv = CAMEL_MIME_FILTER_TOHTML_GET_PRIVATE (object);
camel_url_scanner_free (priv->scanner);
{
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;
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 ();
}
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;
#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)
{
CamelMimeFilterWindowsPrivate *priv;
- priv = CAMEL_MIME_FILTER_WINDOWS (object)->priv;
+ priv = CAMEL_MIME_FILTER_WINDOWS_GET_PRIVATE (object);
g_free (priv->claimed_charset);
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;
{
CamelMimeFilterWindowsPrivate *priv;
- priv = CAMEL_MIME_FILTER_WINDOWS (mime_filter)->priv;
+ priv = CAMEL_MIME_FILTER_WINDOWS_GET_PRIVATE (mime_filter);
priv->is_windows = FALSE;
}
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);
}
/**
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);
#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;
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:
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:
{
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:
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;
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;
#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;
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;
struct _CamelMimeFilterPrivate *p;
gint newlen;
- p = f->priv;
+ p = CAMEL_MIME_FILTER_GET_PRIVATE (f);
newlen = len + prespace + f->backlen;
if (p->inlen < newlen) {
/* 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 {
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;
#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 {
{
CamelMimePartPrivate *priv;
- priv = CAMEL_MIME_PART (object)->priv;
+ priv = CAMEL_MIME_PART_GET_PRIVATE (object);
g_free (priv->description);
g_free (priv->content_id);
{
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);
while (iconv (cd, NULL, NULL, &outbuf, &outleft) == (gsize) -1) {
if (errno != E2BIG)
break;
-
+
outlen += 16;
converted = outbuf - out;
out = g_realloc (out, outlen + 4);
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);
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);
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;
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);
}
#define d(x)
+#define CAMEL_OBJECT_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), CAMEL_TYPE_OBJECT, CamelObjectPrivate))
+
struct _CamelObjectPrivate {
gchar *state_filename;
};
{
CamelObjectPrivate *priv;
- priv = CAMEL_OBJECT (object)->priv;
+ priv = CAMEL_OBJECT_GET_PRIVATE (object);
g_free (priv->state_filename);
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
#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;
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",
#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 */
{
CamelOperationPrivate *priv;
- priv = CAMEL_OPERATION (object)->priv;
+ priv = CAMEL_OPERATION_GET_PRIVATE (object);
LOCK ();
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);
/* 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 */
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);
/* ********************************************************************** */
-#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 */
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);
}
#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 */
};
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);
}
#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 = {
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);
}
#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
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);
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;
#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"),
if (token == NULL)
return NULL;
- priv = CAMEL_SASL_LOGIN (sasl)->priv;
+ priv = CAMEL_SASL_LOGIN_GET_PRIVATE (sasl);
service = camel_sasl_get_service (sasl);
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);
}
#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
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);
}
#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 */
};
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);
}
#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 */
};
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);
}
#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 {
static gboolean
camel_uwordcase (const gchar *haystack,
- const gchar *needle)
+ const gchar *needle)
{
struct _camel_search_words *hwords, *nwords;
gchar *copy_haystack, *copy_needle;
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 */
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 */
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);
}
/**
G_OBJECT_CLASS (camel_sexp_parent_class)->finalize (object);
}
-
static void
camel_sexp_class_init (CamelSExpClass *class)
{
#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;
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;
/* 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 */
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;
#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;
{
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);
{
CamelStreamBufferPrivate *priv;
- priv = CAMEL_STREAM_BUFFER (object)->priv;
+ priv = CAMEL_STREAM_BUFFER_GET_PRIVATE (object);
if (priv->stream != NULL) {
g_object_unref (priv->stream);
{
CamelStreamBufferPrivate *priv;
- priv = CAMEL_STREAM_BUFFER (object)->priv;
+ priv = CAMEL_STREAM_BUFFER_GET_PRIVATE (object);
if (!(priv->flags & BUF_USER))
g_free (priv->buf);
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) ==
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) ==
{
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;
{
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;
{
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;
}
{
CamelStreamBufferPrivate *priv;
- priv = CAMEL_STREAM_BUFFER (stream)->priv;
+ priv = CAMEL_STREAM_BUFFER_GET_PRIVATE (stream);
set_vbuf (stream, buf, mode, size);
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);
/*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;
gssize size;
struct _filter *f;
- priv = CAMEL_STREAM_FILTER (stream)->priv;
+ priv = CAMEL_STREAM_FILTER_GET_PRIVATE (stream);
priv->last_was_read = TRUE;
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;
gsize presize;
gsize len;
- priv = CAMEL_STREAM_FILTER (stream)->priv;
+ priv = CAMEL_STREAM_FILTER_GET_PRIVATE (stream);
if (priv->last_was_read)
return 0;
{
CamelStreamFilterPrivate *priv;
- priv = CAMEL_STREAM_FILTER (stream)->priv;
+ priv = CAMEL_STREAM_FILTER_GET_PRIVATE (stream);
/* Ignore errors while flushing. */
if (!priv->last_was_read)
{
CamelStreamFilterPrivate *priv;
- priv = CAMEL_STREAM_FILTER (stream)->priv;
+ priv = CAMEL_STREAM_FILTER_GET_PRIVATE (stream);
if (priv->filteredlen > 0)
return FALSE;
{
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
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 (
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;
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);
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++;
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) {
#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 */
};
{
CamelStreamFsPrivate *priv;
- priv = CAMEL_STREAM_FS (object)->priv;
+ priv = CAMEL_STREAM_FS_GET_PRIVATE (object);
if (priv->fd != -1)
close (priv->fd);
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);
{
CamelStreamFsPrivate *priv;
- priv = CAMEL_STREAM_FS (stream)->priv;
+ priv = CAMEL_STREAM_FS_GET_PRIVATE (stream);
return camel_write (priv->fd, buffer, n, cancellable, error);
}
{
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;
{
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;
{
CamelStreamFsPrivate *priv;
- priv = CAMEL_STREAM_FS (seekable)->priv;
+ priv = CAMEL_STREAM_FS_GET_PRIVATE (seekable);
return (goffset) lseek (priv->fd, 0, SEEK_CUR);
}
CamelStreamFsPrivate *priv;
goffset real = 0;
- priv = CAMEL_STREAM_FS (seekable)->priv;
+ priv = CAMEL_STREAM_FS_GET_PRIVATE (seekable);
switch (type) {
case G_SEEK_SET:
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;
}
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;
#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?
{
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
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) {
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) {
{
CamelStreamMemPrivate *priv;
- priv = CAMEL_STREAM_MEM (stream)->priv;
+ priv = CAMEL_STREAM_MEM_GET_PRIVATE (stream);
return priv->buffer->len <= priv->position;
}
{
CamelStreamMemPrivate *priv;
- priv = CAMEL_STREAM_MEM (seekable)->priv;
+ priv = CAMEL_STREAM_MEM_GET_PRIVATE (seekable);
return priv->position;
}
CamelStreamMemPrivate *priv;
goffset position;
- priv = CAMEL_STREAM_MEM (seekable)->priv;
+ priv = CAMEL_STREAM_MEM_GET_PRIVATE (seekable);
switch (type) {
case G_SEEK_SET:
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);
}
/**
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;
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)
{
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
#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;
{
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);
{
CamelTcpStreamSSLPrivate *priv;
- priv = CAMEL_TCP_STREAM_SSL (object)->priv;
+ priv = CAMEL_TCP_STREAM_SSL_GET_PRIVATE (object);
g_free (priv->expected_host);
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);
}
/**
#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;
g_free (stream->priv->socks_host);
+ /* Chain up to parent's finalize() method. */
G_OBJECT_CLASS (camel_tcp_stream_parent_class)->finalize (object);
}
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);
}
/**
/* ********************************************************************** */
+#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;
/* ****************************** */
+#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;
/* ****************************** */
+#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;
#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;
{
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)
{
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);
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;
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);
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)
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;
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;
}
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;
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;
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;
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);
}
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);
}
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);
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;
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;
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;
{
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);
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];
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);
{
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);
{
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);
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));
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;
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 *
{
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;
{
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);
{
CamelTextIndexKeyCursorPrivate *priv;
- priv = CAMEL_TEXT_INDEX_KEY_CURSOR (object)->priv;
+ priv = CAMEL_TEXT_INDEX_KEY_CURSOR_GET_PRIVATE (object);
g_free (priv->current);
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));
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;
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;
{
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);
#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 {
{
CamelTransportPrivate *priv;
- priv = CAMEL_TRANSPORT (object)->priv;
+ priv = CAMEL_TRANSPORT_GET_PRIVATE (object);
g_mutex_free (priv->send_lock);
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 ();
}
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 */
/* 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;
}
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;
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 */
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);
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);
}
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 */
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);
/* 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);
}
{
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);
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;
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));
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;
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 */
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;
**/
CamelImapResponse *
camel_imap_command_continuation (CamelImapStore *store,
- CamelFolder *folder,
+ CamelFolder *folder,
const gchar *cmd,
gsize cmdlen,
GCancellable *cancellable,
**/
CamelImapResponseType
camel_imap_command_response (CamelImapStore *store,
- CamelFolder *folder,
+ CamelFolder *folder,
gchar **response,
GCancellable *cancellable,
GError **error)
static CamelImapResponse *
imap_read_response (CamelImapStore *store,
- CamelFolder *folder,
+ CamelFolder *folder,
GCancellable *cancellable,
GError **error)
{
* 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 {
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));
{
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;
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
#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)
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 ();
}
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));
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:
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:
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;
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;
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,
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);
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;
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);
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;
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 */
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,
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);
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);
return TRUE;
}
-
data = g_slice_new0 (RefreshInfoData);
data->changes = camel_folder_change_info_new ();
data->fetch_msg_limit = limit;
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;
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);
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,
guint32 flags)
{
CamelFolder *folder;
- CamelService *service = (CamelService *)store;
+ CamelService *service = (CamelService *) store;
CamelSettings *settings;
gboolean mobile_mode;
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);
#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 {
{
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 |
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);
static gint
scan_dirs (CamelStore *store,
guint32 flags,
- gboolean can_inbox_sibling,
+ gboolean can_inbox_sibling,
CamelFolderInfo **topfi,
GCancellable *cancellable,
GError **error)
#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)
{
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);
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;
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;
}
#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);*/
{
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);
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
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));
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:
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:
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 ();
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 */
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
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);
#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;
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);
{
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;
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,
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);
/* 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));
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,
"auto-fetch", &auto_fetch,
NULL);
-
fi = g_hash_table_lookup (pop3_folder->uids_fi, uid);
if (fi == NULL) {
g_set_error (
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
}
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;
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);
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;
service = CAMEL_SERVICE (parent);
settings = camel_service_get_settings (service);
-
+
d(printf("opening pop3 INBOX folder\n"));
folder = g_object_new (
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);
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 {
"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,
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),
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);
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,
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,
(CamelPOP3Settings *settings);
void camel_pop3_settings_set_batch_fetch_count
(CamelPOP3Settings *settings,
- int batch_fetch_count);
+ gint batch_fetch_count);
G_END_DECLS
void
e_dbus_server_run (EDBusServer *server,
- gboolean wait_for_client)
+ gboolean wait_for_client)
{
EDBusServerClass *class;
#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 */
};
{
EExtensionPrivate *priv;
- priv = E_EXTENSION (object)->priv;
+ priv = E_EXTENSION_GET_PRIVATE (object);
if (priv->extensible != NULL) {
g_object_remove_weak_pointer (
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);
}
/**
#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;
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);
}
{
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
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);
}
/**
#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"
{
EModulePrivate *priv;
- priv = E_MODULE (object)->priv;
+ priv = E_MODULE_GET_PRIVATE (object);
g_free (priv->filename);
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);
{
EModulePrivate *priv;
- priv = E_MODULE (type_module)->priv;
+ priv = E_MODULE_GET_PRIVATE (type_module);
priv->unload (type_module);
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);
}
/**
#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 {
static guint signals[NUM_SIGNALS] = { 0 };
-static GObjectClass *parent_class = NULL;
-
struct _EOfflineListenerPrivate {
GConfClient *default_client;
gboolean is_offline_now;
}
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
{
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:
#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;
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] =
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
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,
#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;
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;
}
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;
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,
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,
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,
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,
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,
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 {
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);
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);
}
/**
gchar **capabilities,
GError **error)
{
- EClientClass *klass;
+ EClientClass *class;
gboolean res;
g_return_val_if_fail (client != NULL, FALSE);
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);
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);
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 (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);
}
/**
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);
}
/**
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);
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);
}
/**
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 (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);
}
/**
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);
}
/**
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);
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);
}
/**
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);
}
/**
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);
}
/**
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);
}
/**
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);
}
/**
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);
}
/**
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);
}
/**
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);
}
/**
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);
}
/**
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);
}
/**
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);
}
/**
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);
}
}
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",
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;
}
/**
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;
#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;
}
/**
static void
e_list_init (EList *list)
{
- list->list = NULL;
- list->iterators = NULL;
}
/**
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);
-}
-
#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 */
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) */
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;
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);
#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
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
}
#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 {
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;
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);
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. */
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
#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;
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);
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. */
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. */
#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;
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);
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. */
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. */
#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 {
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;
#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;
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)
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;
#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;
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)
{
{
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);
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 (
#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;
NUM_COLUMNS
};
-static gpointer parent_class;
+G_DEFINE_TYPE (
+ ECategoryCompletion,
+ e_category_completion,
+ GTK_TYPE_ENTRY_COMPLETION)
/* Forward Declarations */
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);
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);
{
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 (
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);
{
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 (
}
/* 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
{
ECategoryCompletionPrivate *priv;
- priv = E_CATEGORY_COMPLETION (object)->priv;
+ priv = E_CATEGORY_COMPLETION_GET_PRIVATE (object);
g_free (priv->create);
g_free (priv->prefix);
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
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);
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);
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);
}
/**
#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)
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"),
#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
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,
guint xpad;
guint ypad;
- priv = E_CELL_RENDERER_COLOR (cell)->priv;
+ priv = E_CELL_RENDERER_COLOR_GET_PRIVATE (cell);
if (priv->color == NULL)
return;
{
ECellRendererColorPrivate *priv;
- priv = E_CELL_RENDERER_COLOR (object)->priv;
+ priv = E_CELL_RENDERER_COLOR_GET_PRIVATE (object);
switch (property_id) {
case PROP_COLOR:
{
ECellRendererColorPrivate *priv;
- priv = E_CELL_RENDERER_COLOR (object)->priv;
+ priv = E_CELL_RENDERER_COLOR_GET_PRIVATE (object);
switch (property_id) {
case PROP_COLOR:
{
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
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;
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);
}
(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;
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++) {
{
EContactStorePrivate *priv;
- priv = E_CONTACT_STORE (object)->priv;
+ priv = E_CONTACT_STORE_GET_PRIVATE (object);
g_array_free (priv->contact_sources, TRUE);
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;
}
(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;
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;
{
EDestinationStorePrivate *priv;
- priv = E_DESTINATION_STORE (object)->priv;
+ priv = E_DESTINATION_STORE_GET_PRIVATE (object);
g_ptr_array_free (priv->destinations, TRUE);
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 ();
}
#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;
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);
{
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);
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 (§ion, 0, sizeof (Section));
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;
#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;
{
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);
{
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);
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;
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)
{
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;
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))
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);
#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 {
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);
#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;
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 ();
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);
#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;
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;
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);
{
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);
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;
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 (
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 (
#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 {
{
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 (
{
ESourceComboBoxPrivate *priv;
- priv = E_SOURCE_COMBO_BOX (object)->priv;
+ priv = E_SOURCE_COMBO_BOX_GET_PRIVATE (object);
g_hash_table_destroy (priv->uid_index);
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;
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,
#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);
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));
#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;
}
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;
}
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);
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);
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;
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;
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);
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);
(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;
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));
return TRUE;
}
-gint main (gint argc, gchar **argv)
+gint
+main (gint argc,
+ gchar **argv)
{
const gchar
*test_vcard_no_uid_str =
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);
}
gint
-main (gint argc, gchar **argv)
+main (gint argc,
+ gchar **argv)
{
ECalClient *cal_client;
GError *error = NULL;
{
va_list args;
- if (client != client1)
+ if (client != client1)
return;
va_start (args, format);