diff options
Diffstat (limited to 'mail')
31 files changed, 547 insertions, 565 deletions
diff --git a/mail/e-mail-backend.c b/mail/e-mail-backend.c index 17b8b4b9a0..e2ca212627 100644 --- a/mail/e-mail-backend.c +++ b/mail/e-mail-backend.c @@ -385,7 +385,7 @@ mail_backend_constructed (GObject *object) shell = e_shell_backend_get_shell (shell_backend); /* This also initializes Camel, so it needs to happen early. */ - mail_session_init (); + mail_session_start (); online = e_shell_get_online (shell); camel_session_set_online (CAMEL_SESSION (session), online); diff --git a/mail/e-mail-local.c b/mail/e-mail-local.c index 0944c7da95..002865cd33 100644 --- a/mail/e-mail-local.c +++ b/mail/e-mail-local.c @@ -93,7 +93,7 @@ e_mail_local_init (const gchar *data_dir) camel_url_free (url); - camel_object_ref (service); + g_object_ref (service); local_store = CAMEL_STORE (service); return; diff --git a/mail/e-mail-migrate.c b/mail/e-mail-migrate.c index 5deca66c33..7f59d16a48 100644 --- a/mail/e-mail-migrate.c +++ b/mail/e-mail-migrate.c @@ -75,10 +75,8 @@ update_states_in_main_thread (const struct _migrate_state_info *info); /* 1.4 upgrade functions */ -#define EM_MIGRATE_SESSION_TYPE (em_migrate_session_get_type ()) -#define EM_MIGRATE_SESSION(obj) (CAMEL_CHECK_CAST((obj), EM_MIGRATE_SESSION_TYPE, EMMigrateSession)) -#define EM_MIGRATE_SESSION_CLASS(k) (CAMEL_CHECK_CLASS_CAST ((k), EM_MIGRATE_SESSION_TYPE, EMMigrateSessionClass)) -#define EM_MIGRATE_IS_SESSION(o) (CAMEL_CHECK_TYPE((o), EM_MIGRATE_SESSION_TYPE)) +#define EM_TYPE_MIGRATE_SESSION \ + (em_migrate_session_get_type ()) typedef struct _EMMigrateSession { CamelSession parent_object; @@ -92,33 +90,20 @@ typedef struct _EMMigrateSessionClass { } EMMigrateSessionClass; -static CamelType em_migrate_session_get_type (void); +GType em_migrate_session_get_type (void); + +G_DEFINE_TYPE (EMMigrateSession, em_migrate_session, CAMEL_TYPE_SESSION) + static CamelSession *em_migrate_session_new (const gchar *path); static void -class_init (EMMigrateSessionClass *klass) +em_migrate_session_class_init (EMMigrateSessionClass *class) { - ; } -static CamelType -em_migrate_session_get_type (void) +static void +em_migrate_session_init (EMMigrateSession *session) { - static CamelType type = CAMEL_INVALID_TYPE; - - if (type == CAMEL_INVALID_TYPE) { - type = camel_type_register ( - camel_session_get_type (), - "EMMigrateSession", - sizeof (EMMigrateSession), - sizeof (EMMigrateSessionClass), - (CamelObjectClassInitFunc) class_init, - NULL, - NULL, - NULL); - } - - return type; } static CamelSession * @@ -126,8 +111,7 @@ em_migrate_session_new (const gchar *path) { CamelSession *session; - session = CAMEL_SESSION (camel_object_new (EM_MIGRATE_SESSION_TYPE)); - + session = g_object_new (EM_TYPE_MIGRATE_SESSION, NULL); camel_session_construct (session, path); return session; diff --git a/mail/e-mail-reader.c b/mail/e-mail-reader.c index ac72b2a83e..abcdb4d3b5 100644 --- a/mail/e-mail-reader.c +++ b/mail/e-mail-reader.c @@ -185,7 +185,7 @@ action_add_to_address_book_cb (GtkAction *action, cia = camel_internet_address_new (); if (camel_address_decode (CAMEL_ADDRESS (cia), curl->path) < 0) { - camel_object_unref (cia); + g_object_unref (cia); goto exit; } @@ -197,7 +197,7 @@ action_add_to_address_book_cb (GtkAction *action, e_shell_event (shell, "contact-quick-add-email", email); emu_remove_from_mail_cache_1 (curl->path); - camel_object_unref (cia); + g_object_unref (cia); g_free (email); exit: @@ -1092,7 +1092,7 @@ action_search_folder_recipient_cb (GtkAction *action, inet_addr = camel_internet_address_new (); camel_address_decode (CAMEL_ADDRESS (inet_addr), curl->path); vfolder_gui_add_from_address (inet_addr, AUTO_TO, folder_uri); - camel_object_unref (inet_addr); + g_object_unref (inet_addr); } camel_url_free (curl); @@ -1130,7 +1130,7 @@ action_search_folder_sender_cb (GtkAction *action, inet_addr = camel_internet_address_new (); camel_address_decode (CAMEL_ADDRESS (inet_addr), curl->path); vfolder_gui_add_from_address (inet_addr, AUTO_FROM, folder_uri); - camel_object_unref (inet_addr); + g_object_unref (inet_addr); } camel_url_free (curl); diff --git a/mail/e-mail-store.c b/mail/e-mail-store.c index 1024ec6b68..3418404e06 100644 --- a/mail/e-mail-store.c +++ b/mail/e-mail-store.c @@ -74,7 +74,7 @@ store_info_new (CamelStore *store, store_info = g_slice_new0 (StoreInfo); store_info->ref_count = 1; - camel_object_ref (store); + g_object_ref (store); store_info->store = store; if (display_name == NULL) @@ -113,14 +113,14 @@ store_info_unref (StoreInfo *store_info) if (g_atomic_int_exchange_and_add (&store_info->ref_count, -1) > 1) return; - camel_object_unref (store_info->store); + g_object_unref (store_info->store); g_free (store_info->display_name); if (store_info->vtrash != NULL) - camel_object_unref (store_info->vtrash); + g_object_unref (store_info->vtrash); if (store_info->vjunk != NULL) - camel_object_unref (store_info->vjunk); + g_object_unref (store_info->vjunk); g_slice_free (StoreInfo, store_info); } @@ -327,7 +327,7 @@ e_mail_store_add_by_uri (const gchar *uri, e_mail_store_add (CAMEL_STORE (service), display_name); - camel_object_unref (service); + g_object_unref (service); return CAMEL_STORE (service); @@ -346,7 +346,7 @@ static void mail_store_remove_cb (CamelStore *store) { camel_service_disconnect (CAMEL_SERVICE (store), TRUE, NULL); - camel_object_unref (store); + g_object_unref (store); } void @@ -366,7 +366,7 @@ e_mail_store_remove (CamelStore *store) if (g_hash_table_lookup (store_table, store) == NULL) return; - camel_object_ref (store); + g_object_ref (store); g_hash_table_remove (store_table, store); mail_folder_cache_note_store_remove (mail_folder_cache_get_default (), store); @@ -402,7 +402,7 @@ e_mail_store_remove_by_uri (const gchar *uri) e_mail_store_remove (CAMEL_STORE (service)); - camel_object_unref (service); + g_object_unref (service); } void diff --git a/mail/em-composer-utils.c b/mail/em-composer-utils.c index 7e8d2b1dad..59e4a4545e 100644 --- a/mail/em-composer-utils.c +++ b/mail/em-composer-utils.c @@ -105,10 +105,10 @@ emcs_set_drafts_info (struct emcs_t *emcs, g_return_if_fail (drafts_uid != NULL); if (emcs->drafts_folder != NULL) - camel_object_unref (emcs->drafts_folder); + g_object_unref (emcs->drafts_folder); g_free (emcs->drafts_uid); - camel_object_ref (drafts_folder); + g_object_ref (drafts_folder); emcs->drafts_folder = drafts_folder; emcs->drafts_uid = g_strdup (drafts_uid); } @@ -125,10 +125,10 @@ emcs_set_folder_info (struct emcs_t *emcs, g_return_if_fail (uid != NULL); if (emcs->folder != NULL) - camel_object_unref (emcs->folder); + g_object_unref (emcs->folder); g_free (emcs->uid); - camel_object_ref (folder); + g_object_ref (folder); emcs->folder = folder; emcs->uid = g_strdup (uid); emcs->flags = flags; @@ -139,11 +139,11 @@ static void free_emcs (struct emcs_t *emcs) { if (emcs->drafts_folder != NULL) - camel_object_unref (emcs->drafts_folder); + g_object_unref (emcs->drafts_folder); g_free (emcs->drafts_uid); if (emcs->folder != NULL) - camel_object_unref (emcs->folder); + g_object_unref (emcs->folder); g_free (emcs->uid); g_free (emcs); @@ -233,7 +233,7 @@ composer_send_queued_cb (CamelFolder *folder, CamelMimeMessage *msg, CamelMessag camel_folder_set_message_flags (emcs->drafts_folder, emcs->drafts_uid, CAMEL_MESSAGE_DELETED | CAMEL_MESSAGE_SEEN, CAMEL_MESSAGE_DELETED | CAMEL_MESSAGE_SEEN); - camel_object_unref (emcs->drafts_folder); + g_object_unref (emcs->drafts_folder); emcs->drafts_folder = NULL; g_free (emcs->drafts_uid); emcs->drafts_uid = NULL; @@ -243,7 +243,7 @@ composer_send_queued_cb (CamelFolder *folder, CamelMimeMessage *msg, CamelMessag /* set any replied flags etc */ camel_folder_set_message_flags (emcs->folder, emcs->uid, emcs->flags, emcs->set); camel_folder_set_message_user_flag (emcs->folder, emcs->uid, "receipt-handled", TRUE); - camel_object_unref (emcs->folder); + g_object_unref (emcs->folder); emcs->folder = NULL; g_free (emcs->uid); emcs->uid = NULL; @@ -386,7 +386,7 @@ composer_get_message (EMsgComposer *composer, gboolean save_html_object_data) e_destination_freev (recipients_bcc); } - camel_object_unref (cia); + g_object_unref (cia); post_to_header = e_composer_header_table_get_header (table, E_COMPOSER_HEADER_POST_TO); if (e_composer_header_get_visible (post_to_header)) { @@ -521,7 +521,7 @@ em_utils_composer_send_cb (EMsgComposer *composer) return; folder = e_mail_local_get_folder (E_MAIL_FOLDER_OUTBOX); - camel_object_ref (folder); + g_object_ref (folder); /* mail the message */ e_msg_composer_set_mail_sent (composer, TRUE); @@ -541,8 +541,8 @@ em_utils_composer_send_cb (EMsgComposer *composer) mail_append_mail ( folder, message, info, composer_send_queued_cb, send); - camel_object_unref (folder); - camel_object_unref (message); + g_object_unref (folder); + g_object_unref (message); } struct _save_draft_info { @@ -587,7 +587,7 @@ save_draft_done (CamelFolder *folder, CamelMimeMessage *msg, CamelMessageInfo *i camel_folder_set_message_flags (emcs->drafts_folder, emcs->drafts_uid, CAMEL_MESSAGE_DELETED | CAMEL_MESSAGE_SEEN, CAMEL_MESSAGE_DELETED | CAMEL_MESSAGE_SEEN); - camel_object_unref (emcs->drafts_folder); + g_object_unref (emcs->drafts_folder); emcs->drafts_folder = NULL; g_free (emcs->drafts_uid); emcs->drafts_uid = NULL; @@ -596,14 +596,14 @@ save_draft_done (CamelFolder *folder, CamelMimeMessage *msg, CamelMessageInfo *i if (emcs->folder) { /* set the replied flags etc */ camel_folder_set_message_flags (emcs->folder, emcs->uid, emcs->flags, emcs->set); - camel_object_unref (emcs->folder); + g_object_unref (emcs->folder); emcs->folder = NULL; g_free (emcs->uid); emcs->uid = NULL; } if (appended_uid) { - camel_object_ref (folder); + g_object_ref (folder); emcs->drafts_folder = folder; emcs->drafts_uid = g_strdup (appended_uid); } @@ -626,7 +626,7 @@ save_draft_folder (gchar *uri, CamelFolder *folder, gpointer data) if (folder) { *save = folder; - camel_object_ref (folder); + g_object_ref (folder); } } @@ -672,7 +672,7 @@ em_utils_composer_save_draft_cb (EMsgComposer *composer) if (!folder || !account->enabled) { if (e_alert_run_dialog_for_args ((GtkWindow *)composer, "mail:ask-default-drafts", NULL) != GTK_RESPONSE_YES) { g_object_unref(composer); - camel_object_unref(msg); + g_object_unref (msg); if (sdi->emcs) emcs_unref(sdi->emcs); g_free(sdi); @@ -680,19 +680,19 @@ em_utils_composer_save_draft_cb (EMsgComposer *composer) } folder = local_drafts_folder; - camel_object_ref (local_drafts_folder); + g_object_ref (local_drafts_folder); } } else { folder = local_drafts_folder; - camel_object_ref (folder); + g_object_ref (folder); } info = camel_message_info_new(NULL); camel_message_info_set_flags(info, CAMEL_MESSAGE_DRAFT | CAMEL_MESSAGE_SEEN, ~0); mail_append_mail (folder, msg, info, save_draft_done, sdi); - camel_object_unref (folder); - camel_object_unref (msg); + g_object_unref (folder); + g_object_unref (msg); } static void @@ -941,13 +941,13 @@ traverse_parts (GSList *clues, CamelMimeMessage *message, CamelDataWrapper *cont camel_data_wrapper_decode_to_stream (content, stream); str = g_strndup ((gchar *) byte_array->data, byte_array->len); - camel_object_unref (stream); + g_object_unref (stream); if (replace_variables (clues, message, &str)) { stream = camel_stream_mem_new_with_buffer (str, strlen (str)); camel_stream_reset (stream); camel_data_wrapper_construct_from_stream (content, stream); - camel_object_unref (stream); + g_object_unref (stream); } g_free (str); @@ -1107,7 +1107,7 @@ composer_destroy_fad_cb (gpointer user_data, GObject *deadbeef) struct forward_attached_data *fad = (struct forward_attached_data*) user_data; if (fad) { - camel_object_unref (fad->folder); + g_object_unref (fad->folder); em_utils_uids_free (fad->uids); g_free (fad); } @@ -1121,7 +1121,7 @@ setup_forward_attached_callbacks (EMsgComposer *composer, CamelFolder *folder, G if (!composer || !folder || !uids || !uids->len) return; - camel_object_ref (folder); + g_object_ref (folder); fad = g_new0 (struct forward_attached_data, 1); fad->folder = folder; @@ -1329,7 +1329,7 @@ em_utils_forward_message (CamelMimeMessage *message, const gchar *fromuri) subject = mail_tool_generate_forward_subject (message); composer = forward_attached (NULL, NULL, messages, part, subject, fromuri); - camel_object_unref (part); + g_object_unref (part); g_free (subject); break; case MAIL_CONFIG_FORWARD_INLINE: @@ -1570,14 +1570,14 @@ em_utils_send_receipt (CamelFolder *folder, CamelMimeMessage *message) _("Your message to %s about \"%s\" on %s has been read."), self_address, message_subject, message_date); camel_data_wrapper_construct_from_stream (receipt_text, stream); - camel_object_unref (stream); + g_object_unref (stream); part = camel_mime_part_new (); camel_medium_set_content (CAMEL_MEDIUM (part), receipt_text); camel_mime_part_set_encoding (part, CAMEL_TRANSFER_ENCODING_QUOTEDPRINTABLE); - camel_object_unref (receipt_text); + g_object_unref (receipt_text); camel_multipart_add_part (body, part); - camel_object_unref (part); + g_object_unref (part); /* Create the machine-readable receipt */ receipt_data = camel_data_wrapper_new (); @@ -1598,7 +1598,7 @@ em_utils_send_receipt (CamelFolder *folder, CamelMimeMessage *message) "Disposition: manual-action/MDN-sent-manually; displayed\n", ua, recipient, message_id); camel_data_wrapper_construct_from_stream (receipt_data, stream); - camel_object_unref (stream); + g_object_unref (stream); g_free (ua); g_free (recipient); @@ -1606,13 +1606,13 @@ em_utils_send_receipt (CamelFolder *folder, CamelMimeMessage *message) camel_medium_set_content (CAMEL_MEDIUM (part), receipt_data); camel_mime_part_set_encoding (part, CAMEL_TRANSFER_ENCODING_7BIT); - camel_object_unref (receipt_data); + g_object_unref (receipt_data); camel_multipart_add_part (body, part); - camel_object_unref (part); + g_object_unref (part); /* Finish creating the message */ camel_medium_set_content (CAMEL_MEDIUM (receipt), CAMEL_DATA_WRAPPER (body)); - camel_object_unref (body); + g_object_unref (body); /* Translators: %s is the subject of the email message */ receipt_subject = g_strdup_printf (_("Delivery Notification for: \"%s\""), message_subject); @@ -1622,12 +1622,12 @@ em_utils_send_receipt (CamelFolder *folder, CamelMimeMessage *message) addr = camel_internet_address_new (); camel_address_decode (CAMEL_ADDRESS (addr), self_address); camel_mime_message_set_from (receipt, addr); - camel_object_unref (addr); + g_object_unref (addr); addr = camel_internet_address_new (); camel_address_decode (CAMEL_ADDRESS (addr), receipt_address); camel_mime_message_set_recipients (receipt, CAMEL_RECIPIENT_TYPE_TO, addr); - camel_object_unref (addr); + g_object_unref (addr); camel_medium_set_header (CAMEL_MEDIUM (receipt), "Return-Path", "<>"); camel_medium_set_header (CAMEL_MEDIUM (receipt), "X-Evolution-Account", account->uid); @@ -2127,7 +2127,7 @@ composer_set_body (EMsgComposer *composer, CamelMimeMessage *message, EMFormat * /* attach the original message as an attachment */ part = mail_tool_make_message_attachment (message); e_msg_composer_attach (composer, part); - camel_object_unref (part); + g_object_unref (part); break; case MAIL_CONFIG_REPLY_OUTLOOK: text = em_utils_message_to_html (message, _("-----Original Message-----"), EM_FORMAT_QUOTE_HEADERS, &len, source, start_bottom ? "<BR>" : NULL, &validity_found); @@ -2269,9 +2269,9 @@ em_utils_reply_to_message(CamelFolder *folder, const gchar *uid, CamelMimeMessag e_msg_composer_add_message_attachments (composer, message, TRUE); if (postto) - camel_object_unref(postto); - camel_object_unref(to); - camel_object_unref(cc); + g_object_unref (postto); + g_object_unref (to); + g_object_unref (cc); composer_set_body (composer, message, source); diff --git a/mail/em-config.c b/mail/em-config.c index 67cfddf4f9..4e9d52ce61 100644 --- a/mail/em-config.c +++ b/mail/em-config.c @@ -93,7 +93,7 @@ emp_target_free(EConfig *ep, EConfigTarget *t) EMConfigTargetFolder *s = (EMConfigTargetFolder *)t; g_free(s->uri); - camel_object_unref(s->folder); + g_object_unref (s->folder); break; } case EM_CONFIG_TARGET_PREFS: { EMConfigTargetPrefs *s = (EMConfigTargetPrefs *)t; @@ -184,7 +184,7 @@ em_config_target_new_folder(EMConfig *emp, CamelFolder *folder, const gchar *uri t->uri = g_strdup(uri); t->folder = folder; - camel_object_ref(folder); + g_object_ref (folder); return t; } diff --git a/mail/em-event.c b/mail/em-event.c index 6a77debd7e..a84eb92264 100644 --- a/mail/em-event.c +++ b/mail/em-event.c @@ -63,9 +63,9 @@ eme_target_free(EEvent *ep, EEventTarget *t) EMEventTargetMessage *s = (EMEventTargetMessage *)t; if (s->folder) - camel_object_unref(s->folder); + g_object_unref (s->folder); if (s->message) - camel_object_unref(s->message); + g_object_unref (s->message); g_free(s->uid); if (s->composer) g_object_unref (s->composer); @@ -162,10 +162,10 @@ em_event_target_new_message(EMEvent *eme, CamelFolder *folder, CamelMimeMessage t->uid = g_strdup (uid); t->folder = folder; if (folder) - camel_object_ref(folder); + g_object_ref (folder); t->message = message; if (message) - camel_object_ref(message); + g_object_ref (message); t->target.mask = ~flags; if (composer) t->composer = g_object_ref(G_OBJECT(composer)); diff --git a/mail/em-folder-properties.c b/mail/em-folder-properties.c index f3f41165c5..57753b8055 100644 --- a/mail/em-folder-properties.c +++ b/mail/em-folder-properties.c @@ -113,7 +113,7 @@ emfp_free(EConfig *ec, GSList *items, gpointer data) camel_object_free (prop_data->object, CAMEL_FOLDER_PROPERTIES, prop_data->properties); camel_object_free (prop_data->object, CAMEL_FOLDER_NAME, prop_data->name); - camel_object_unref (prop_data->object); + g_object_unref (prop_data->object); g_free (prop_data->argv); camel_folder_quota_info_free (prop_data->quota); @@ -315,7 +315,7 @@ emfp_dialog_got_folder_quota (CamelFolder *folder, prop_data = g_malloc0 (sizeof (*prop_data)); prop_data->object = folder; - camel_object_ref (folder); + g_object_ref (folder); prop_data->quota = camel_folder_quota_info_clone (quota); /* diff --git a/mail/em-folder-tree-model.c b/mail/em-folder-tree-model.c index e34f9110e1..0f6ba84b0f 100644 --- a/mail/em-folder-tree-model.c +++ b/mail/em-folder-tree-model.c @@ -104,7 +104,7 @@ store_info_free (EMFolderTreeModelStoreInfo *si) camel_object_remove_event (si->store, si->unsubscribed_id); g_free (si->display_name); - camel_object_unref (si->store); + g_object_unref (si->store); gtk_tree_row_reference_free (si->row); g_hash_table_destroy (si->full_hash); g_free (si); @@ -234,7 +234,7 @@ account_changed_cb (EAccountList *accounts, } em_folder_tree_model_add_store (model, store, account->name); - camel_object_unref (store); + g_object_unref (store); } static void @@ -656,7 +656,7 @@ em_folder_tree_model_set_folder_info (EMFolderTreeModel *model, unread = total > 0 ? total : 0; } - camel_object_unref(folder); + g_object_unref (folder); } /* TODO Maybe this should be handled by mail_get_folderinfo @@ -838,7 +838,7 @@ folder_subscribed (CamelStore *store, g_signal_emit (model, signals[FOLDER_ADDED], 0, fi->full_name, fi->uri); done: - camel_object_unref (store); + g_object_unref (store); camel_folder_info_free (fi); } @@ -849,7 +849,7 @@ folder_subscribed_cb (CamelStore *store, { CamelFolderInfo *fi; - camel_object_ref (store); + g_object_ref (store); fi = camel_folder_info_clone (event_data); mail_async_event_emit ( @@ -882,7 +882,7 @@ folder_unsubscribed (CamelStore *store, em_folder_tree_model_remove_folders (model, si, &iter); done: - camel_object_unref (store); + g_object_unref (store); camel_folder_info_free (fi); } @@ -893,7 +893,7 @@ folder_unsubscribed_cb (CamelStore *store, { CamelFolderInfo *fi; - camel_object_ref (store); + g_object_ref (store); fi = camel_folder_info_clone (event_data); mail_async_event_emit ( @@ -913,7 +913,7 @@ folder_created_cb (CamelStore *store, if (camel_store_supports_subscriptions (store)) return; - camel_object_ref (store); + g_object_ref (store); fi = camel_folder_info_clone (event_data); mail_async_event_emit ( @@ -933,7 +933,7 @@ folder_deleted_cb (CamelStore *store, if (camel_store_supports_subscriptions (store)) return; - camel_object_ref (store); + g_object_ref (store); fi = camel_folder_info_clone (event_data); mail_async_event_emit ( @@ -989,7 +989,7 @@ folder_renamed (CamelStore *store, em_folder_tree_model_set_folder_info (model, &iter, si, info->new, TRUE); done: - camel_object_unref (store); + g_object_unref (store); g_free (info->old_base); camel_folder_info_free (info->new); @@ -1003,7 +1003,7 @@ folder_renamed_cb (CamelStore *store, { CamelRenameInfo *rinfo, *info = event_data; - camel_object_ref (store); + g_object_ref (store); rinfo = g_new0 (CamelRenameInfo, 1); rinfo->old_base = g_strdup (info->old_base); @@ -1058,7 +1058,7 @@ em_folder_tree_model_add_store (EMFolderTreeModel *model, si = g_new (EMFolderTreeModelStoreInfo, 1); si->display_name = g_strdup (display_name); - camel_object_ref (store); + g_object_ref (store); si->store = store; si->account = account; si->row = gtk_tree_row_reference_copy (reference); diff --git a/mail/em-folder-tree.c b/mail/em-folder-tree.c index a74bfa26ae..40e692cbf4 100644 --- a/mail/em-folder-tree.c +++ b/mail/em-folder-tree.c @@ -317,7 +317,7 @@ folder_tree_get_folder_info__free (struct _EMFolderTreeGetFolderInfo *m) gtk_tree_row_reference_free (m->root); g_object_unref(m->folder_tree); - camel_object_unref (m->store); + g_object_unref (m->store); g_free (m->top); } @@ -341,7 +341,7 @@ folder_tree_free_select_uri (struct _selected_uri *u) { g_free (u->uri); if (u->store) - camel_object_unref (u->store); + g_object_unref (u->store); g_free (u->key); g_free (u->path); g_free (u); @@ -451,12 +451,12 @@ folder_tree_expand_node (const gchar *key, if (!(store = vfolder_store)) return; - camel_object_ref (store); + g_object_ref (store); } else if (!strcmp (uid, "local")) { if (!(store = e_mail_local_get_store ())) return; - camel_object_ref (store); + g_object_ref (store); } else { return; } @@ -464,11 +464,11 @@ folder_tree_expand_node (const gchar *key, si = em_folder_tree_model_lookup_store_info ( EM_FOLDER_TREE_MODEL (model), store); if (si == NULL) { - camel_object_unref (store); + g_object_unref (store); return; } - camel_object_unref (store); + g_object_unref (store); if (p != NULL) { if (!(row = g_hash_table_lookup (si->full_hash, p + 1))) @@ -923,7 +923,7 @@ folder_tree_row_expanded (GtkTreeView *tree_view, msg = mail_msg_new (&get_folder_info_info); msg->root = gtk_tree_row_reference_new (model, path); - camel_object_ref (store); + g_object_ref (store); msg->store = store; msg->folder_tree = g_object_ref (tree_view); msg->top = full_name; @@ -1506,7 +1506,7 @@ tree_drag_data_get(GtkWidget *widget, GdkDragContext *context, GtkSelectionData em_utils_selection_set_urilist(selection, folder, uids); camel_folder_free_uids(folder, uids); - camel_object_unref(folder); + g_object_unref (folder); } break; default: @@ -1556,7 +1556,7 @@ folder_tree_drop_folder(struct _DragDataReceivedAsync *m) return; em_folder_utils_copy_folders(src->parent_store, src->full_name, m->store, m->full_name?m->full_name:"", m->move); - camel_object_unref(src); + g_object_unref (src); } static gchar * @@ -1617,7 +1617,7 @@ folder_tree_drop_async__exec (struct _DragDataReceivedAsync *m) default: abort(); } - camel_object_unref(folder); + g_object_unref (folder); } } @@ -1625,7 +1625,7 @@ static void folder_tree_drop_async__free (struct _DragDataReceivedAsync *m) { g_object_unref(m->context); - camel_object_unref(m->store); + g_object_unref (m->store); g_free(m->full_name); gtk_selection_data_free (m->selection); } @@ -1696,7 +1696,7 @@ tree_drag_data_received(GtkWidget *widget, GdkDragContext *context, gint x, gint m->context = context; g_object_ref(context); m->store = store; - camel_object_ref(store); + g_object_ref (store); m->full_name = full_name; m->action = context->action; m->info = info; diff --git a/mail/em-folder-utils.c b/mail/em-folder-utils.c index 3381275858..ea26d9ed9a 100644 --- a/mail/em-folder-utils.c +++ b/mail/em-folder-utils.c @@ -158,7 +158,7 @@ emft_copy_folders__exec (struct _EMCopyFolders *m) goto exception; if (!(tofolder = camel_store_get_folder (m->tostore, toname->str, CAMEL_STORE_FOLDER_CREATE, &m->base.ex))) { - camel_object_unref (fromfolder); + g_object_unref (fromfolder); goto exception; } @@ -169,8 +169,8 @@ emft_copy_folders__exec (struct _EMCopyFolders *m) if (m->delete && !camel_exception_is_set (&m->base.ex)) camel_folder_sync(fromfolder, TRUE, NULL); - camel_object_unref (fromfolder); - camel_object_unref (tofolder); + g_object_unref (fromfolder); + g_object_unref (tofolder); } } @@ -217,8 +217,8 @@ emft_copy_folders__exec (struct _EMCopyFolders *m) static void emft_copy_folders__free (struct _EMCopyFolders *m) { - camel_object_unref (m->fromstore); - camel_object_unref (m->tostore); + g_object_unref (m->fromstore); + g_object_unref (m->tostore); g_free (m->frombase); g_free (m->tobase); @@ -239,9 +239,9 @@ em_folder_utils_copy_folders(CamelStore *fromstore, const gchar *frombase, Camel gint seq; m = mail_msg_new (©_folders_info); - camel_object_ref (fromstore); + g_object_ref (fromstore); m->fromstore = fromstore; - camel_object_ref (tostore); + g_object_ref (tostore); m->tostore = tostore; m->frombase = g_strdup (frombase); m->tobase = g_strdup (tobase); @@ -312,9 +312,9 @@ emfu_copy_folder_selected (const gchar *uri, gpointer data) camel_url_free (url); fail: if (fromstore) - camel_object_unref(fromstore); + g_object_unref (fromstore); if (tostore) - camel_object_unref(tostore); + g_object_unref (tostore); camel_exception_clear (&ex); g_free (cfd); } @@ -451,7 +451,7 @@ em_folder_utils_delete_folder (CamelFolder *folder) return; } - camel_object_ref (folder); + g_object_ref (folder); if (mail_folder_cache_get_folder_info_flags (mail_folder_cache_get_default (), folder, &flags) && (flags & CAMEL_FOLDER_CHILDREN)) { dialog = e_alert_dialog_new_for_args (parent, @@ -464,7 +464,7 @@ em_folder_utils_delete_folder (CamelFolder *folder) folder->full_name, NULL); } - g_object_set_data_full ((GObject *) dialog, "folder", folder, camel_object_unref); + g_object_set_data_full ((GObject *) dialog, "folder", folder, g_object_unref); g_signal_connect (dialog, "response", G_CALLBACK (emfu_delete_response), NULL); gtk_widget_show (dialog); } @@ -522,7 +522,7 @@ static void emfu_create_folder__free (struct _EMCreateFolder *m) { camel_store_free_folder_info (m->store, m->fi); - camel_object_unref (m->store); + g_object_unref (m->store); g_free (m->full_name); g_free (m->parent); g_free (m->name); @@ -554,7 +554,7 @@ emfu_create_folder_real (CamelStore *store, const gchar *full_name, void (* done } m = mail_msg_new (&create_folder_info); - camel_object_ref (store); + g_object_ref (store); m->store = store; m->full_name = g_strdup (full_name); m->parent = g_strdup (parent); @@ -618,7 +618,7 @@ emfu_popup_new_folder_response (EMFolderSelector *emfs, gint response, gpointer si = em_folder_tree_model_lookup_store_info ( EM_FOLDER_TREE_MODEL (model), store); if (si == NULL) { - camel_object_unref (store); + g_object_unref (store); g_return_if_reached(); } @@ -644,7 +644,7 @@ emfu_popup_new_folder_response (EMFolderSelector *emfs, gint response, gpointer emfu_create_folder_real (si->store, path, new_folder_created_cb, emcftd); } - camel_object_unref (store); + g_object_unref (store); camel_exception_clear (&ex); } diff --git a/mail/em-format-html-display.c b/mail/em-format-html-display.c index a0a6c6ecc1..422d5d23cc 100644 --- a/mail/em-format-html-display.c +++ b/mail/em-format-html-display.c @@ -714,7 +714,7 @@ efhd_message_prefix(EMFormat *emf, CamelStream *stream, CamelMimePart *part, EMF camel_stream_printf(stream, "<td align=\"left\"><img src=\"%s\"></td>", classid); (void)em_format_add_puri(emf, sizeof(EMFormatPURI), classid, iconpart, efhd_write_image); g_free(classid); - camel_object_unref(iconpart); + g_object_unref (iconpart); } } @@ -1032,7 +1032,7 @@ efhd_attachment_optional(EMFormatHTML *efh, GtkHTMLEmbedded *eb, EMFormatHTMLPOb byte_array = camel_stream_mem_get_byte_array (info->mstream); gtk_text_buffer_set_text ( buffer, (gchar *) byte_array->data, byte_array->len); - camel_object_unref(info->mstream); + g_object_unref (info->mstream); info->mstream = NULL; gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scroll), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); diff --git a/mail/em-format-html.c b/mail/em-format-html.c index b521264bd7..f2e2b5acfb 100644 --- a/mail/em-format-html.c +++ b/mail/em-format-html.c @@ -227,7 +227,7 @@ efh_format_exec (struct _format_msg *m) format->base = base; /* clean up the job */ - camel_object_unref(job->stream); + g_object_unref (job->stream); if (job->base) camel_url_free(job->base); g_free(job); @@ -242,7 +242,7 @@ efh_format_exec (struct _format_msg *m) d(printf("out of jobs, closing root stream\n")); camel_stream_write_string((CamelStream *)m->estream, "</body>\n</html>\n"); camel_stream_close((CamelStream *)m->estream); - camel_object_unref(m->estream); + g_object_unref (m->estream); m->estream = NULL; } @@ -271,13 +271,13 @@ efh_format_free (struct _format_msg *m) g_object_unref(m->format); if (m->estream) { camel_stream_close((CamelStream *)m->estream); - camel_object_unref(m->estream); + g_object_unref (m->estream); } if (m->folder) - camel_object_unref(m->folder); + g_object_unref (m->folder); g_free(m->uid); if (m->message) - camel_object_unref(m->message); + g_object_unref (m->message); if (m->format_source) g_object_unref(m->format_source); } @@ -367,7 +367,7 @@ static void efh_free_cache(struct _EMFormatHTMLCache *efhc) { if (efhc->textmp) - camel_object_unref(efhc->textmp); + g_object_unref (efhc->textmp); g_free(efhc); } @@ -622,10 +622,10 @@ efh_format_clone (EMFormat *emf, g_object_ref (emfsource); if (folder != NULL) - camel_object_ref (folder); + g_object_ref (folder); if (msg != NULL) - camel_object_ref (msg); + g_object_ref (msg); m = mail_msg_new (&efh_format_info); m->format = g_object_ref (emf); @@ -679,11 +679,11 @@ efh_format_source (EMFormat *emf, CAMEL_MIME_FILTER_TOHTML_PRESERVE_8BIT, 0); camel_stream_filter_add ( CAMEL_STREAM_FILTER (filtered_stream), filter); - camel_object_unref (filter); + g_object_unref (filter); camel_stream_write_string (stream, "<table><tr><td><tt>"); em_format_format_text (emf, (CamelStream *) filtered_stream, dw); - camel_object_unref (filtered_stream); + g_object_unref (filtered_stream); camel_stream_write_string(stream, "</tt></td></tr></table>"); } @@ -1187,12 +1187,12 @@ em_format_html_file_part(EMFormatHTML *efh, const gchar *mime_type, const gchar dw = camel_data_wrapper_new(); camel_data_wrapper_construct_from_stream(dw, stream); - camel_object_unref(stream); + g_object_unref (stream); if (mime_type) camel_data_wrapper_set_mime_type(dw, mime_type); part = camel_mime_part_new(); camel_medium_set_content ((CamelMedium *)part, dw); - camel_object_unref(dw); + g_object_unref (dw); basename = g_path_get_basename (filename); camel_mime_part_set_filename(part, basename); g_free (basename); @@ -1428,10 +1428,10 @@ static void emfh_gethttp(struct _EMFormatHTMLJob *job, gint cancelled) /* do not store broken files in a cache */ if (n != 0) camel_data_cache_remove(emfh_http_cache, EMFH_HTTP_CACHE_PATH, job->u.uri, NULL); - camel_object_unref(costream); + g_object_unref (costream); } - camel_object_unref(instream); + g_object_unref (instream); done: camel_operation_end(NULL); badurl: @@ -1586,7 +1586,7 @@ efh_format_secure(EMFormat *emf, CamelStream *stream, CamelMimePart *part, Camel iconpart = em_format_html_file_part((EMFormatHTML *)emf, "image/png", iconpath); if (iconpart) { (void)em_format_add_puri(emf, sizeof(EMFormatPURI), classid, iconpart, efh_write_image); - camel_object_unref(iconpart); + g_object_unref (iconpart); } g_free (iconpath); g_free(classid); @@ -1670,21 +1670,21 @@ efh_text_plain (EMFormatHTML *efh, null = camel_stream_null_new(); filtered_stream = camel_stream_filter_new (null); - camel_object_unref(null); + g_object_unref (null); inline_filter = em_inline_filter_new(camel_mime_part_get_encoding(part), ct); camel_stream_filter_add ( CAMEL_STREAM_FILTER (filtered_stream), CAMEL_MIME_FILTER (inline_filter)); camel_data_wrapper_write_to_stream(dw, (CamelStream *)filtered_stream); camel_stream_close((CamelStream *)filtered_stream); - camel_object_unref(filtered_stream); + g_object_unref (filtered_stream); mp = em_inline_filter_get_multipart(inline_filter); if (efhc == NULL) efhc = efh_insert_cache(efh, ((EMFormat *)efh)->part_id->str); efhc->textmp = mp; - camel_object_unref(inline_filter); + g_object_unref (inline_filter); camel_content_type_unref(ct); } @@ -1694,7 +1694,7 @@ efh_text_plain (EMFormatHTML *efh, html_filter = camel_mime_filter_tohtml_new(flags, rgb); camel_stream_filter_add ( CAMEL_STREAM_FILTER (filtered_stream), html_filter); - camel_object_unref(html_filter); + g_object_unref (html_filter); /* We handle our made-up multipart here, so we don't recursively call ourselves */ @@ -1731,7 +1731,7 @@ efh_text_plain (EMFormatHTML *efh, } } - camel_object_unref(filtered_stream); + g_object_unref (filtered_stream); } static void @@ -1752,7 +1752,7 @@ efh_text_enriched(EMFormatHTML *efh, CamelStream *stream, CamelMimePart *part, E filtered_stream = camel_stream_filter_new (stream); camel_stream_filter_add ( CAMEL_STREAM_FILTER (filtered_stream), enriched); - camel_object_unref(enriched); + g_object_unref (enriched); camel_stream_printf ( stream, "<div style=\"border: solid #%06x 1px; background-color: #%06x; padding: 10px; color: #%06x;\">\n" EFH_MESSAGE_START, @@ -1768,7 +1768,7 @@ efh_text_enriched(EMFormatHTML *efh, CamelStream *stream, CamelMimePart *part, E em_format_format_text((EMFormat *)efh, (CamelStream *)filtered_stream, (CamelDataWrapper *)part); - camel_object_unref(filtered_stream); + g_object_unref (filtered_stream); camel_stream_write_string(stream, "</div>"); } @@ -1786,7 +1786,7 @@ efh_write_text_html(EMFormat *emf, CamelStream *stream, EMFormatPURI *puri) dw = camel_medium_get_content (puri->part); if (dw) camel_data_wrapper_write_to_stream(dw, out); - camel_object_unref(out); + g_object_unref (out); #endif em_format_format_text(emf, stream, (CamelDataWrapper *)puri->part); } @@ -1961,7 +1961,7 @@ efh_message_deliverystatus(EMFormatHTML *efh, CamelStream *stream, CamelMimePart html_filter = camel_mime_filter_tohtml_new(efh->text_html_flags, rgb); camel_stream_filter_add ( CAMEL_STREAM_FILTER (filtered_stream), html_filter); - camel_object_unref(html_filter); + g_object_unref (html_filter); camel_stream_write_string(stream, "<tt>\n" EFH_MESSAGE_START); em_format_format_text((EMFormat *)efh, (CamelStream *)filtered_stream, (CamelDataWrapper *)part); @@ -2091,7 +2091,7 @@ efh_multipart_related(EMFormat *emf, CamelStream *stream, CamelMimePart *part, c /* queue a job to check for un-referenced parts to add as attachments */ job = em_format_html_job_new((EMFormatHTML *)emf, emfh_multipart_related_check, NULL); job->stream = stream; - camel_object_ref(stream); + g_object_ref (stream); em_format_html_job_queue((EMFormatHTML *)emf, job); em_format_pull_level(emf); @@ -2709,11 +2709,11 @@ efh_format_headers(EMFormatHTML *efh, CamelStream *stream, CamelMedium *part) classid); em_format_add_puri(emf, sizeof(EMFormatPURI), classid, photopart, efh_write_image); - camel_object_unref(photopart); + g_object_unref (photopart); g_free(classid); } - camel_object_unref(cia); + g_object_unref (cia); } if (!contact_has_photo && face_decoded) { @@ -2725,7 +2725,7 @@ efh_format_headers(EMFormatHTML *efh, CamelStream *stream, CamelMedium *part) classid = g_strdup_printf("icon:///em-format-html/face/photo/header"); camel_stream_printf(stream, "<td align=\"right\" valign=\"top\"><img width=48 src=\"%s\"></td>", classid); em_format_add_puri(emf, sizeof(EMFormatPURI), classid, part, efh_write_image); - camel_object_unref(part); + g_object_unref (part); } if (have_icon && efh->show_icon) { @@ -2748,7 +2748,7 @@ efh_format_headers(EMFormatHTML *efh, CamelStream *stream, CamelMedium *part) if (iconpart) { em_format_add_puri(emf, sizeof(EMFormatPURI), classid, iconpart, efh_write_image); - camel_object_unref(iconpart); + g_object_unref (iconpart); } g_free(classid); } diff --git a/mail/em-html-stream.c b/mail/em-html-stream.c index cc3c795d32..d86e2a3cb4 100644 --- a/mail/em-html-stream.c +++ b/mail/em-html-stream.c @@ -32,10 +32,10 @@ #define d(x) -static EMSyncStreamClass *parent_class = NULL; +G_DEFINE_TYPE (EMHTMLStream, em_html_stream, EM_TYPE_SYNC_STREAM) static void -emhs_cleanup (EMHTMLStream *emhs) +html_stream_cleanup (EMHTMLStream *emhs) { if (emhs->sync.cancel && emhs->html_stream) gtk_html_stream_close ( @@ -49,17 +49,28 @@ emhs_cleanup (EMHTMLStream *emhs) } static void -emhs_gtkhtml_destroy (GtkHTML *html, - EMHTMLStream *emhs) +html_stream_gtkhtml_destroy (GtkHTML *html, + EMHTMLStream *emhs) { emhs->sync.cancel = TRUE; - emhs_cleanup (emhs); + html_stream_cleanup (emhs); +} + +static void +html_stream_dispose (GObject *object) +{ + EMHTMLStream *emhs = EM_HTML_STREAM (object); + + if (emhs->html_stream) { + /* set 'in finalise' flag */ + camel_stream_close (CAMEL_STREAM (emhs)); + } } static gssize -emhs_sync_write (CamelStream *stream, - const gchar *buffer, - gsize n) +html_stream_sync_write (CamelStream *stream, + const gchar *buffer, + gsize n) { EMHTMLStream *emhs = EM_HTML_STREAM (stream); @@ -76,7 +87,7 @@ emhs_sync_write (CamelStream *stream, } static gint -emhs_sync_flush(CamelStream *stream) +html_stream_sync_flush (CamelStream *stream) { EMHTMLStream *emhs = (EMHTMLStream *)stream; @@ -89,7 +100,7 @@ emhs_sync_flush(CamelStream *stream) } static gint -emhs_sync_close (CamelStream *stream) +html_stream_sync_close (CamelStream *stream) { EMHTMLStream *emhs = (EMHTMLStream *)stream; @@ -97,7 +108,7 @@ emhs_sync_close (CamelStream *stream) return -1; gtk_html_stream_close (emhs->html_stream, GTK_HTML_STREAM_OK); - emhs_cleanup (emhs); + html_stream_cleanup (emhs); return 0; } @@ -105,14 +116,16 @@ emhs_sync_close (CamelStream *stream) static void em_html_stream_class_init (EMHTMLStreamClass *class) { + GObjectClass *object_class; EMSyncStreamClass *sync_stream_class; - parent_class = (EMSyncStreamClass *)em_sync_stream_get_type(); + object_class = G_OBJECT_CLASS (class); + object_class->dispose = html_stream_dispose; sync_stream_class = EM_SYNC_STREAM_CLASS (class); - sync_stream_class->sync_write = emhs_sync_write; - sync_stream_class->sync_flush = emhs_sync_flush; - sync_stream_class->sync_close = emhs_sync_close; + sync_stream_class->sync_write = html_stream_sync_write; + sync_stream_class->sync_flush = html_stream_sync_flush; + sync_stream_class->sync_close = html_stream_sync_close; } static void @@ -120,35 +133,6 @@ em_html_stream_init (EMHTMLStream *emhs) { } -static void -em_html_stream_finalize (EMHTMLStream *emhs) -{ - if (emhs->html_stream) { - /* set 'in finalise' flag */ - camel_stream_close (CAMEL_STREAM (emhs)); - } -} - -CamelType -em_html_stream_get_type (void) -{ - static CamelType type = CAMEL_INVALID_TYPE; - - if (G_UNLIKELY (type == CAMEL_INVALID_TYPE)) { - type = camel_type_register ( - em_sync_stream_get_type(), - "EMHTMLStream", - sizeof (EMHTMLStream), - sizeof (EMHTMLStreamClass), - (CamelObjectClassInitFunc) em_html_stream_class_init, - NULL, - (CamelObjectInitFunc) em_html_stream_init, - (CamelObjectFinalizeFunc) em_html_stream_finalize); - } - - return type; -} - /* TODO: Could pass NULL for html_stream, and do a gtk_html_begin on first data -> less flashing */ CamelStream * @@ -159,13 +143,13 @@ em_html_stream_new (GtkHTML *html, g_return_val_if_fail (GTK_IS_HTML (html), NULL); - new = EM_HTML_STREAM (camel_object_new (EM_HTML_STREAM_TYPE)); + new = g_object_new (EM_TYPE_HTML_STREAM, NULL); new->html_stream = html_stream; new->html = g_object_ref (html); new->flags = 0; new->destroy_id = g_signal_connect ( html, "destroy", - G_CALLBACK (emhs_gtkhtml_destroy), new); + G_CALLBACK (html_stream_gtkhtml_destroy), new); em_sync_stream_set_buffer_size (&new->sync, 8192); diff --git a/mail/em-html-stream.h b/mail/em-html-stream.h index 7bf79470dd..24d32f76d8 100644 --- a/mail/em-html-stream.h +++ b/mail/em-html-stream.h @@ -28,17 +28,24 @@ #include <gtkhtml/gtkhtml-stream.h> #include <mail/em-sync-stream.h> -#define EM_HTML_STREAM_TYPE \ +/* Standard GObject macros */ +#define EM_TYPE_HTML_STREAM \ (em_html_stream_get_type ()) #define EM_HTML_STREAM(obj) \ - (CAMEL_CHECK_CAST \ - ((obj), EM_HTML_STREAM_TYPE, EMHTMLStream)) + (G_TYPE_CHECK_INSTANCE_CAST \ + ((obj), EM_TYPE_HTML_STREAM, EMHTMLStream)) #define EM_HTML_STREAM_CLASS(cls) \ - (CAMEL_CHECK_CLASS_CAST \ - ((cls), EM_HTML_STREAM_TYPE, EMHTMLStreamClass)) + (G_TYPE_CHECK_CLASS_CAST \ + ((cls), EM_TYPE_HTML_STREAM, EMHTMLStreamClass)) #define EM_IS_HTML_STREAM(obj) \ - (CAMEL_CHECK_TYPE \ - ((obj), EM_HTML_STREAM_TYPE)) + (G_TYPE_CHECK_INSTANCE_TYPE \ + ((obj), EM_TYPE_HTML_STREAM)) +#define EM_IS_HTML_STREAM_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_TYPE \ + ((cls), EM_TYPE_HTML_STREAM)) +#define EM_HTML_STREAM_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS \ + ((obj), EM_TYPE_HTML_STREAM, EMHTMLStreamClass)) G_BEGIN_DECLS @@ -59,7 +66,7 @@ struct _EMHTMLStreamClass { }; -CamelType em_html_stream_get_type (void); +GType em_html_stream_get_type (void); CamelStream * em_html_stream_new (GtkHTML *html, GtkHTMLStream *html_stream); void em_html_stream_set_flags (EMHTMLStream *emhs, diff --git a/mail/em-inline-filter.c b/mail/em-inline-filter.c index 55a43caf83..1ac21667b9 100644 --- a/mail/em-inline-filter.c +++ b/mail/em-inline-filter.c @@ -33,65 +33,7 @@ #define d(x) -static void em_inline_filter_class_init (EMInlineFilterClass *klass); -static void em_inline_filter_init (CamelObject *object); -static void em_inline_filter_finalize (CamelObject *object); - -static void emif_filter(CamelMimeFilter *f, const gchar *in, gsize len, gsize prespace, gchar **out, gsize *outlen, gsize *outprespace); -static void emif_complete(CamelMimeFilter *f, const gchar *in, gsize len, gsize prespace, gchar **out, gsize *outlen, gsize *outprespace); -static void emif_reset(CamelMimeFilter *f); - -static CamelMimeFilterClass *parent_class = NULL; - -CamelType -em_inline_filter_get_type (void) -{ - static CamelType type = CAMEL_INVALID_TYPE; - - if (type == CAMEL_INVALID_TYPE) { - parent_class = (CamelMimeFilterClass *)camel_mime_filter_get_type(); - - type = camel_type_register(camel_mime_filter_get_type(), - "EMInlineFilter", - sizeof (EMInlineFilter), - sizeof (EMInlineFilterClass), - (CamelObjectClassInitFunc) em_inline_filter_class_init, - NULL, - (CamelObjectInitFunc) em_inline_filter_init, - (CamelObjectFinalizeFunc) em_inline_filter_finalize); - } - - return type; -} - -static void -em_inline_filter_class_init (EMInlineFilterClass *klass) -{ - ((CamelMimeFilterClass *)klass)->filter = emif_filter; - ((CamelMimeFilterClass *)klass)->complete = emif_complete; - ((CamelMimeFilterClass *)klass)->reset = emif_reset; -} - -static void -em_inline_filter_init (CamelObject *object) -{ - EMInlineFilter *emif = (EMInlineFilter *)object; - - emif->data = g_byte_array_new(); -} - -static void -em_inline_filter_finalize (CamelObject *object) -{ - EMInlineFilter *emif = (EMInlineFilter *)object; - - if (emif->base_type) - camel_content_type_unref(emif->base_type); - - emif_reset((CamelMimeFilter *)emif); - g_byte_array_free(emif->data, TRUE); - g_free(emif->filename); -} +G_DEFINE_TYPE (EMInlineFilter, em_inline_filter, CAMEL_TYPE_MIME_FILTER) enum { EMIF_PLAIN, @@ -117,7 +59,7 @@ static const struct { }; static void -emif_add_part(EMInlineFilter *emif, const gchar *data, gint len) +inline_filter_add_part(EMInlineFilter *emif, const gchar *data, gint len) { CamelTransferEncoding encoding; CamelContentType *content_type; @@ -142,7 +84,7 @@ emif_add_part(EMInlineFilter *emif, const gchar *data, gint len) dw = camel_data_wrapper_new(); camel_data_wrapper_construct_from_stream(dw, mem); - camel_object_unref(mem); + g_object_unref (mem); if (emif_types[emif->state].plain && emif->base_type) { camel_content_type_ref (emif->base_type); @@ -166,7 +108,7 @@ emif_add_part(EMInlineFilter *emif, const gchar *data, gint len) part = camel_mime_part_new(); camel_medium_set_content ((CamelMedium *)part, dw); camel_mime_part_set_encoding(part, encoding); - camel_object_unref(dw); + g_object_unref (dw); if (emif->filename) camel_mime_part_set_filename(part, emif->filename); @@ -188,7 +130,7 @@ emif_add_part(EMInlineFilter *emif, const gchar *data, gint len) } static gint -emif_scan(CamelMimeFilter *f, gchar *in, gsize len, gint final) +inline_filter_scan(CamelMimeFilter *f, gchar *in, gsize len, gint final) { EMInlineFilter *emif = (EMInlineFilter *)f; gchar *inptr = in, *inend = in+len; @@ -227,7 +169,7 @@ emif_scan(CamelMimeFilter *f, gchar *in, gsize len, gint final) if (start[i++] != ' ') break; - emif_add_part(emif, data_start, start-data_start); + inline_filter_add_part(emif, data_start, start-data_start); name = g_strndup(start+i, inptr-start-i-1); emif->filename = camel_header_decode_string(name, emif->base_type?camel_content_type_param(emif->base_type, "charset"):NULL); @@ -236,22 +178,22 @@ emif_scan(CamelMimeFilter *f, gchar *in, gsize len, gint final) emif->state = EMIF_UUENC; } else if (strncmp(start, "(This file must be converted with BinHex 4.0)", 45) == 0) { inptr[-1] = '\n'; - emif_add_part(emif, data_start, start-data_start); + inline_filter_add_part(emif, data_start, start-data_start); data_start = start; emif->state = EMIF_BINHEX; } else if (strncmp(start, "%!PS-Adobe-", 11) == 0) { inptr[-1] = '\n'; - emif_add_part(emif, data_start, start-data_start); + inline_filter_add_part(emif, data_start, start-data_start); data_start = start; emif->state = EMIF_POSTSCRIPT; } else if (strncmp(start, "-----BEGIN PGP SIGNED MESSAGE-----", 34) == 0) { inptr[-1] = '\n'; - emif_add_part(emif, data_start, start-data_start); + inline_filter_add_part(emif, data_start, start-data_start); data_start = start; emif->state = EMIF_PGPSIGNED; } else if (strncmp(start, "-----BEGIN PGP MESSAGE-----", 27) == 0) { inptr[-1] = '\n'; - emif_add_part(emif, data_start, start-data_start); + inline_filter_add_part(emif, data_start, start-data_start); data_start = start; emif->state = EMIF_PGPENCRYPTED; } @@ -260,7 +202,7 @@ emif_scan(CamelMimeFilter *f, gchar *in, gsize len, gint final) case EMIF_UUENC: if (strcmp(start, "end") == 0) { inptr[-1] = '\n'; - emif_add_part(emif, data_start, inptr-data_start); + inline_filter_add_part(emif, data_start, inptr-data_start); data_start = inptr; emif->state = EMIF_PLAIN; } else { @@ -276,7 +218,7 @@ emif_scan(CamelMimeFilter *f, gchar *in, gsize len, gint final) linelen *= 3; if (!(len == linelen || len == linelen-1 || len == linelen-2)) { inptr[-1] = '\n'; - emif_add_part(emif, data_start, start-data_start); + inline_filter_add_part(emif, data_start, start-data_start); data_start = start; inptr = start; emif->state = EMIF_PLAIN; @@ -287,7 +229,7 @@ emif_scan(CamelMimeFilter *f, gchar *in, gsize len, gint final) case EMIF_BINHEX: if (inptr > (start+1) && inptr[-2] == ':') { inptr[-1] = '\n'; - emif_add_part(emif, data_start, inptr-data_start); + inline_filter_add_part(emif, data_start, inptr-data_start); data_start = inptr; emif->state = EMIF_PLAIN; } @@ -295,7 +237,7 @@ emif_scan(CamelMimeFilter *f, gchar *in, gsize len, gint final) case EMIF_POSTSCRIPT: if (strcmp(start, "%%EOF") == 0) { inptr[-1] = '\n'; - emif_add_part(emif, data_start, inptr-data_start); + inline_filter_add_part(emif, data_start, inptr-data_start); data_start = inptr; emif->state = EMIF_PLAIN; } @@ -303,7 +245,7 @@ emif_scan(CamelMimeFilter *f, gchar *in, gsize len, gint final) case EMIF_PGPSIGNED: if (strcmp(start, "-----END PGP SIGNATURE-----") == 0) { inptr[-1] = '\n'; - emif_add_part(emif, data_start, inptr-data_start); + inline_filter_add_part(emif, data_start, inptr-data_start); data_start = inptr; emif->state = EMIF_PLAIN; } @@ -311,7 +253,7 @@ emif_scan(CamelMimeFilter *f, gchar *in, gsize len, gint final) case EMIF_PGPENCRYPTED: if (strcmp(start, "-----END PGP MESSAGE-----") == 0) { inptr[-1] = '\n'; - emif_add_part(emif, data_start, inptr-data_start); + inline_filter_add_part(emif, data_start, inptr-data_start); data_start = inptr; emif->state = EMIF_PLAIN; } @@ -325,7 +267,7 @@ emif_scan(CamelMimeFilter *f, gchar *in, gsize len, gint final) /* always stop as plain, especially when not read those tags fully */ emif->state = EMIF_PLAIN; - emif_add_part(emif, data_start, inend-data_start); + inline_filter_add_part(emif, data_start, inend-data_start); } else { g_byte_array_append(emif->data, (guchar *)data_start, inend-data_start); } @@ -334,9 +276,31 @@ emif_scan(CamelMimeFilter *f, gchar *in, gsize len, gint final) } static void -emif_filter(CamelMimeFilter *f, const gchar *in, gsize len, gsize prespace, gchar **out, gsize *outlen, gsize *outprespace) +inline_filter_finalize (GObject *object) +{ + EMInlineFilter *emif = EM_INLINE_FILTER (object); + + if (emif->base_type) + camel_content_type_unref(emif->base_type); + + camel_mime_filter_reset (CAMEL_MIME_FILTER (object)); + g_byte_array_free(emif->data, TRUE); + g_free(emif->filename); + + /* Chain up to parent's finalize() method. */ + G_OBJECT_CLASS (em_inline_filter_parent_class)->finalize (object); +} + +static void +inline_filter_filter (CamelMimeFilter *filter, + const gchar *in, + gsize len, + gsize prespace, + gchar **out, + gsize *outlen, + gsize *outprespace) { - emif_scan(f, (gchar *)in, len, FALSE); + inline_filter_scan (filter, (gchar *)in, len, FALSE); *out = (gchar *)in; *outlen = len; @@ -344,9 +308,15 @@ emif_filter(CamelMimeFilter *f, const gchar *in, gsize len, gsize prespace, gcha } static void -emif_complete(CamelMimeFilter *f, const gchar *in, gsize len, gsize prespace, gchar **out, gsize *outlen, gsize *outprespace) +inline_filter_complete (CamelMimeFilter *filter, + const gchar *in, + gsize len, + gsize prespace, + gchar **out, + gsize *outlen, + gsize *outprespace) { - emif_scan(f, (gchar *)in, len, TRUE); + inline_filter_scan (filter, (gchar *)in, len, TRUE); *out = (gchar *)in; *outlen = len; @@ -354,16 +324,16 @@ emif_complete(CamelMimeFilter *f, const gchar *in, gsize len, gsize prespace, gc } static void -emif_reset(CamelMimeFilter *f) +inline_filter_reset (CamelMimeFilter *filter) { - EMInlineFilter *emif = (EMInlineFilter *)f; + EMInlineFilter *emif = EM_INLINE_FILTER (filter); GSList *l; l = emif->parts; while (l) { GSList *n = l->next; - camel_object_unref(l->data); + g_object_unref (l->data); g_slist_free_1(l); l = n; @@ -372,6 +342,27 @@ emif_reset(CamelMimeFilter *f) g_byte_array_set_size(emif->data, 0); } +static void +em_inline_filter_class_init (EMInlineFilterClass *class) +{ + GObjectClass *object_class; + CamelMimeFilterClass *mime_filter_class; + + object_class = G_OBJECT_CLASS (class); + object_class->finalize = inline_filter_finalize; + + mime_filter_class = CAMEL_MIME_FILTER_CLASS (class); + mime_filter_class->filter = inline_filter_filter; + mime_filter_class->complete = inline_filter_complete; + mime_filter_class->reset = inline_filter_reset; +} + +static void +em_inline_filter_init (EMInlineFilter *emif) +{ + emif->data = g_byte_array_new(); +} + /** * em_inline_filter_new: * @base_encoding: The base transfer-encoding of the @@ -390,7 +381,7 @@ em_inline_filter_new(CamelTransferEncoding base_encoding, CamelContentType *base { EMInlineFilter *emif; - emif = (EMInlineFilter *)camel_object_new(em_inline_filter_get_type()); + emif = g_object_new (EM_TYPE_INLINE_FILTER, NULL); emif->base_encoding = base_encoding; if (base_type) { emif->base_type = base_type; diff --git a/mail/em-inline-filter.h b/mail/em-inline-filter.h index 11aaa7f5b8..8ee90a6640 100644 --- a/mail/em-inline-filter.h +++ b/mail/em-inline-filter.h @@ -26,14 +26,31 @@ #include <camel/camel.h> -#define EM_INLINE_FILTER_TYPE (em_inline_filter_get_type ()) -#define EM_INLINE_FILTER(obj) (CAMEL_CHECK_CAST((obj), EM_INLINE_FILTER_TYPE, EMInlineFilter)) -#define EM_INLINE_FILTER_CLASS(k) (CAMEL_CHECK_CLASS_CAST ((k), EM_INLINE_FILTER_TYPE, EMInlineFilterClass)) -#define EM_IS_INLINE_FILTER(o) (CAMEL_CHECK_TYPE((o), EM_INLINE_FILTER_TYPE)) +/* Standard GObject macros */ +#define EM_TYPE_INLINE_FILTER \ + (em_inline_filter_get_type ()) +#define EM_INLINE_FILTER(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST \ + ((obj), EM_TYPE_INLINE_FILTER, EMInlineFilter)) +#define EM_INLINE_FILTER_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_CAST \ + ((cls), EM_TYPE_INLINE_FILTER, EMInlineFilterClass)) +#define EM_IS_INLINE_FILTER(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE \ + ((obj), EM_TYPE_INLINE_FILTER)) +#define EM_IS_INLINE_FILTER_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_TYPE \ + ((cls), EM_TYPE_INLINE_FILTER)) +#define EM_INLINE_FILTER_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS \ + ((obj), EM_TYPE_INLINE_FILTER, EMInlineFilterClass)) G_BEGIN_DECLS -typedef struct _EMInlineFilter { +typedef struct _EMInlineFilter EMInlineFilter; +typedef struct _EMInlineFilterClass EMInlineFilterClass; + +struct _EMInlineFilter { CamelMimeFilter filter; gint state; @@ -44,15 +61,16 @@ typedef struct _EMInlineFilter { GByteArray *data; gchar *filename; GSList *parts; -} EMInlineFilter; +}; -typedef struct _EMInlineFilterClass { +struct _EMInlineFilterClass { CamelMimeFilterClass filter_class; -} EMInlineFilterClass; +}; -CamelType em_inline_filter_get_type(void); -EMInlineFilter *em_inline_filter_new(CamelTransferEncoding base_encoding, CamelContentType *type); -CamelMultipart *em_inline_filter_get_multipart(EMInlineFilter *emif); +GType em_inline_filter_get_type (void); +EMInlineFilter *em_inline_filter_new (CamelTransferEncoding base_encoding, + CamelContentType *type); +CamelMultipart *em_inline_filter_get_multipart (EMInlineFilter *emif); G_END_DECLS diff --git a/mail/em-subscribe-editor.c b/mail/em-subscribe-editor.c index 068d74c1d6..e1e0e1d629 100644 --- a/mail/em-subscribe-editor.c +++ b/mail/em-subscribe-editor.c @@ -144,7 +144,7 @@ sub_unref(EMSubscribe *sub) l = n; } if (sub->store) - camel_object_unref(sub->store); + g_object_unref (sub->store); g_free(sub->store_uri); g_free(sub); } @@ -594,7 +594,7 @@ subscribe_set_store(EMSubscribe *sub, CamelStore *store) GtkTreeStore *model; sub->store = store; - camel_object_ref(store); + g_object_ref (store); sub->folders = g_hash_table_new_full ( g_str_hash, g_str_equal, (GDestroyNotify) NULL, diff --git a/mail/em-sync-stream.c b/mail/em-sync-stream.c index 780ae9d7fd..d0dd6e7853 100644 --- a/mail/em-sync-stream.c +++ b/mail/em-sync-stream.c @@ -33,8 +33,6 @@ #include "mail-mt.h" -#define EMSS_CLASS(x) ((EMSyncStreamClass *)(((CamelObject *)(x))->klass)) - enum _write_msg_t { EMSS_WRITE, EMSS_FLUSH, @@ -51,10 +49,10 @@ struct _write_msg { gsize len; }; -static CamelStreamClass *parent_class = NULL; +G_DEFINE_TYPE (EMSyncStream, em_sync_stream, CAMEL_TYPE_STREAM) static gboolean -emss_process_message (struct _write_msg *msg) +sync_stream_process_message (struct _write_msg *msg) { struct _EMSyncStream *emss = msg->emss; @@ -67,7 +65,7 @@ emss_process_message (struct _write_msg *msg) /* Force out any pending data before doing anything else. */ if (emss->buffer != NULL && emss->buffer->len > 0) { - EMSS_CLASS (emss)->sync_write ( + EM_SYNC_STREAM_GET_CLASS (emss)->sync_write ( CAMEL_STREAM (emss), emss->buffer->str, emss->buffer->len); g_string_set_size (emss->buffer, 0); @@ -75,15 +73,15 @@ emss_process_message (struct _write_msg *msg) switch (msg->op) { case EMSS_WRITE: - EMSS_CLASS (emss)->sync_write ( + EM_SYNC_STREAM_GET_CLASS (emss)->sync_write ( CAMEL_STREAM (emss), msg->string, msg->len); break; case EMSS_FLUSH: - EMSS_CLASS (emss)->sync_flush ( + EM_SYNC_STREAM_GET_CLASS (emss)->sync_flush ( CAMEL_STREAM (emss)); break; case EMSS_CLOSE: - EMSS_CLASS (emss)->sync_close ( + EM_SYNC_STREAM_GET_CLASS (emss)->sync_close ( CAMEL_STREAM (emss)); break; } @@ -95,7 +93,7 @@ emss_process_message (struct _write_msg *msg) } static void -emss_sync_op (EMSyncStream *emss, enum _write_msg_t op, +sync_stream_sync_op (EMSyncStream *emss, enum _write_msg_t op, const gchar *string, gsize len) { struct _write_msg msg; @@ -106,20 +104,31 @@ emss_sync_op (EMSyncStream *emss, enum _write_msg_t op, msg.string = string; msg.len = len; - camel_object_ref (emss); + g_object_ref (emss); if (emss->idle_id) g_source_remove (emss->idle_id); - emss->idle_id = g_idle_add ((GSourceFunc) emss_process_message, &msg); + emss->idle_id = g_idle_add ((GSourceFunc) sync_stream_process_message, &msg); e_flag_wait (msg.done); e_flag_free (msg.done); - camel_object_unref (emss); + g_object_unref (emss); +} + +static void +sync_stream_finalize (GObject *object) +{ + EMSyncStream *emss = EM_SYNC_STREAM (object); + + if (emss->buffer != NULL) + g_string_free (emss->buffer, TRUE); + if (emss->idle_id) + g_source_remove (emss->idle_id); } static gssize -emss_stream_write (CamelStream *stream, const gchar *string, gsize len) +sync_stream_write (CamelStream *stream, const gchar *string, gsize len) { EMSyncStream *emss = EM_SYNC_STREAM (stream); @@ -127,21 +136,21 @@ emss_stream_write (CamelStream *stream, const gchar *string, gsize len) return -1; if (mail_in_main_thread ()) { - EMSS_CLASS (emss)->sync_write (stream, string, len); + EM_SYNC_STREAM_GET_CLASS (emss)->sync_write (stream, string, len); } else if (emss->buffer != NULL) { if (len < (emss->buffer->allocated_len - emss->buffer->len)) g_string_append_len (emss->buffer, string, len); else - emss_sync_op (emss, EMSS_WRITE, string, len); + sync_stream_sync_op (emss, EMSS_WRITE, string, len); } else { - emss_sync_op(emss, EMSS_WRITE, string, len); + sync_stream_sync_op(emss, EMSS_WRITE, string, len); } return (gssize) len; } static gint -emss_stream_flush (CamelStream *stream) +sync_stream_flush (CamelStream *stream) { EMSyncStream *emss = EM_SYNC_STREAM (stream); @@ -149,15 +158,15 @@ emss_stream_flush (CamelStream *stream) return -1; if (mail_in_main_thread ()) - return EMSS_CLASS (emss)->sync_flush (stream); + return EM_SYNC_STREAM_GET_CLASS (emss)->sync_flush (stream); else - emss_sync_op (emss, EMSS_FLUSH, NULL, 0); + sync_stream_sync_op (emss, EMSS_FLUSH, NULL, 0); return 0; } static gint -emss_stream_close (CamelStream *stream) +sync_stream_close (CamelStream *stream) { EMSyncStream *emss = EM_SYNC_STREAM (stream); @@ -167,9 +176,9 @@ emss_stream_close (CamelStream *stream) emss->idle_id = 0; if (mail_in_main_thread ()) - return EMSS_CLASS (emss)->sync_close (stream); + return EM_SYNC_STREAM_GET_CLASS (emss)->sync_close (stream); else - emss_sync_op (emss, EMSS_CLOSE, NULL, 0); + sync_stream_sync_op (emss, EMSS_CLOSE, NULL, 0); return 0; } @@ -177,41 +186,21 @@ emss_stream_close (CamelStream *stream) static void em_sync_stream_class_init (EMSyncStreamClass *class) { - CamelStreamClass *stream_class = CAMEL_STREAM_CLASS (class); + GObjectClass *object_class; + CamelStreamClass *stream_class; - parent_class = (CamelStreamClass *) CAMEL_STREAM_TYPE; + object_class = G_OBJECT_CLASS (class); + object_class->finalize = sync_stream_finalize; - stream_class->write = emss_stream_write; - stream_class->flush = emss_stream_flush; - stream_class->close = emss_stream_close; + stream_class = CAMEL_STREAM_CLASS (class); + stream_class->write = sync_stream_write; + stream_class->flush = sync_stream_flush; + stream_class->close = sync_stream_close; } static void -em_sync_stream_finalize (EMSyncStream *emss) -{ - if (emss->buffer != NULL) - g_string_free (emss->buffer, TRUE); - if (emss->idle_id) - g_source_remove (emss->idle_id); -} - -CamelType -em_sync_stream_get_type (void) +em_sync_stream_init (EMSyncStream *emss) { - static CamelType type = CAMEL_INVALID_TYPE; - - if (G_UNLIKELY (type == CAMEL_INVALID_TYPE)) - type = camel_type_register ( - CAMEL_STREAM_TYPE, - "EMSyncStream", - sizeof (EMSyncStream), - sizeof (EMSyncStreamClass), - (CamelObjectClassInitFunc) em_sync_stream_class_init, - NULL, - (CamelObjectInitFunc) NULL, - (CamelObjectFinalizeFunc) em_sync_stream_finalize); - - return type; } void diff --git a/mail/em-sync-stream.h b/mail/em-sync-stream.h index b8684ac109..593079021e 100644 --- a/mail/em-sync-stream.h +++ b/mail/em-sync-stream.h @@ -33,16 +33,24 @@ requests are always handled in the main gui thread in the correct order. #include <glib.h> #include <camel/camel.h> -#define EM_SYNC_STREAM_TYPE \ +/* Standard GObject macros */ +#define EM_TYPE_SYNC_STREAM \ (em_sync_stream_get_type ()) #define EM_SYNC_STREAM(obj) \ - (CAMEL_CHECK_CAST \ - ((obj), EM_SYNC_STREAM_TYPE, EMSyncStream)) + (G_TYPE_CHECK_INSTANCE_CAST \ + ((obj), EM_TYPE_SYNC_STREAM, EMSyncStream)) #define EM_SYNC_STREAM_CLASS(cls) \ - (CAMEL_CHECK_CLASS_CAST \ - ((cls), EM_SYNC_STREAM_TYPE, EMSyncStreamClass)) + (G_TYPE_CHECK_CLASS_CAST \ + ((cls), EM_TYPE_SYNC_STREAM, EMSyncStreamClass)) #define EM_IS_SYNC_STREAM(obj) \ - (CAMEL_CHECK_TYPE ((obj), EM_SYNC_STREAM_TYPE)) + (G_TYPE_CHECK_INSTANCE_TYPE \ + ((obj), EM_TYPE_SYNC_STREAM)) +#define EM_IS_SYNC_STREAM_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_TYPE \ + ((cls), EM_TYPE_SYNC_STREAM)) +#define EM_SYNC_STREAM_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS \ + ((obj), EM_TYPE_SYNC_STREAM, EMSyncStreamClass)) G_BEGIN_DECLS @@ -66,7 +74,7 @@ struct _EMSyncStreamClass { gint (*sync_flush) (CamelStream *stream); }; -CamelType em_sync_stream_get_type (void); +GType em_sync_stream_get_type (void); void em_sync_stream_set_buffer_size (EMSyncStream *stream, gsize size); diff --git a/mail/em-utils.c b/mail/em-utils.c index a1dd9ea565..e0e443331c 100644 --- a/mail/em-utils.c +++ b/mail/em-utils.c @@ -552,7 +552,7 @@ em_utils_write_messages_to_stream(CamelFolder *folder, GPtrArray *uids, CamelStr filtered_stream = camel_stream_filter_new (stream); camel_stream_filter_add ( CAMEL_STREAM_FILTER (filtered_stream), from_filter); - camel_object_unref(from_filter); + g_object_unref (from_filter); for (i=0; i<uids->len; i++) { CamelMimeMessage *message; @@ -574,13 +574,13 @@ em_utils_write_messages_to_stream(CamelFolder *folder, GPtrArray *uids, CamelStr res = -1; g_free(from); - camel_object_unref(message); + g_object_unref (message); if (res == -1) break; } - camel_object_unref(filtered_stream); + g_object_unref (filtered_stream); return res; } @@ -603,12 +603,12 @@ em_utils_read_messages_from_stream(CamelFolder *folder, CamelStream *stream) /* NB: de-from filter, once written */ msg = camel_mime_message_new(); if (camel_mime_part_construct_from_parser((CamelMimePart *)msg, mp) == -1) { - camel_object_unref(msg); + g_object_unref (msg); break; } camel_folder_append_message(folder, msg, NULL, NULL, ex); - camel_object_unref(msg); + g_object_unref (msg); if (camel_exception_is_set (ex)) break; @@ -616,7 +616,7 @@ em_utils_read_messages_from_stream(CamelFolder *folder, CamelStream *stream) camel_mime_parser_step(mp, NULL, NULL); } - camel_object_unref(mp); + g_object_unref (mp); if (!camel_exception_is_set(ex)) res = 0; camel_exception_free(ex); @@ -653,7 +653,7 @@ em_utils_selection_set_mailbox (GtkSelectionData *data, data, target, 8, byte_array->data, byte_array->len); - camel_object_unref (stream); + g_object_unref (stream); } /** @@ -685,7 +685,7 @@ em_utils_selection_get_mailbox (GtkSelectionData *selection_data, stream = (CamelStream *) camel_stream_mem_new_with_buffer ((gchar *) data, length); em_utils_read_messages_from_stream(folder, stream); - camel_object_unref(stream); + g_object_unref (stream); } /** @@ -717,8 +717,8 @@ em_utils_selection_get_message (GtkSelectionData *selection_data, msg = camel_mime_message_new(); if (camel_data_wrapper_construct_from_stream((CamelDataWrapper *)msg, stream) == 0) camel_folder_append_message(folder, msg, NULL, NULL, ex); - camel_object_unref(msg); - camel_object_unref(stream); + g_object_unref (msg); + g_object_unref (stream); camel_exception_free(ex); } @@ -808,7 +808,7 @@ em_utils_selection_get_uidlist (GtkSelectionData *selection_data, folder = mail_tool_uri_to_folder((gchar *) data, 0, ex); if (folder) { camel_folder_transfer_messages_to(folder, uids, dest, NULL, move, ex); - camel_object_unref(folder); + g_object_unref (folder); } em_utils_uids_free(uids); @@ -878,7 +878,7 @@ em_utils_selection_set_urilist(GtkSelectionData *data, CamelFolder *folder, GPtr g_free(uri_crlf); } - camel_object_unref(fstream); + g_object_unref (fstream); } else close(fd); @@ -928,7 +928,7 @@ em_utils_selection_get_urilist (GtkSelectionData *selection_data, stream = camel_stream_fs_new_with_fd(fd); if (stream) { res = em_utils_read_messages_from_stream(folder, stream); - camel_object_unref(stream); + g_object_unref (stream); } else close(fd); } @@ -1278,7 +1278,7 @@ em_utils_message_to_html (CamelMimeMessage *message, const gchar *credits, guint camel_stream_write ((CamelStream*)mem, append, strlen (append)); camel_stream_write((CamelStream *)mem, "", 1); - camel_object_unref(mem); + g_object_unref (mem); text = (gchar *)buf->data; if (len) @@ -1983,7 +1983,7 @@ emu_remove_from_mail_cache (const GSList *addresses) } } - camel_object_unref (cia); + g_object_unref (cia); } void diff --git a/mail/importers/mail-importer.c b/mail/importers/mail-importer.c index 2f2a7f5494..72a975f2cc 100644 --- a/mail/importers/mail-importer.c +++ b/mail/importers/mail-importer.c @@ -160,7 +160,7 @@ import_mbox_exec (struct _import_mbox_msg *m) msg = camel_mime_message_new(); if (camel_mime_part_construct_from_parser((CamelMimePart *)msg, mp) == -1) { /* set exception? */ - camel_object_unref(msg); + g_object_unref (msg); break; } @@ -179,7 +179,7 @@ import_mbox_exec (struct _import_mbox_msg *m) camel_message_info_set_flags(info, flags, ~0); camel_folder_append_message(folder, msg, info, NULL, &m->base.ex); camel_message_info_free(info); - camel_object_unref(msg); + g_object_unref (msg); if (camel_exception_is_set(&m->base.ex)) break; @@ -193,11 +193,11 @@ import_mbox_exec (struct _import_mbox_msg *m) if (m->cancel) camel_operation_register(oldcancel); fail2: - camel_object_unref(mp); + g_object_unref (mp); } fail1: camel_folder_sync(folder, FALSE, NULL); - camel_object_unref(folder); + g_object_unref (folder); } static void diff --git a/mail/mail-folder-cache.c b/mail/mail-folder-cache.c index 822afa3b25..0504bc7049 100644 --- a/mail/mail-folder-cache.c +++ b/mail/mail-folder-cache.c @@ -153,7 +153,7 @@ free_update(struct _folder_update *up) g_free (up->full_name); g_free (up->uri); if (up->store) - camel_object_unref(up->store); + g_object_unref (up->store); g_free (up->oldfull); g_free (up->olduri); g_free (up->msg_uid); @@ -205,7 +205,7 @@ real_flush_updates (gpointer o, gpointer event_data, gpointer data) if (folder) { mail_folder_cache_note_folder (self, folder); - camel_object_unref (folder); + g_object_unref (folder); } } @@ -250,7 +250,7 @@ unset_folder_info(MailFolderCache *self, struct _folder_info *mfi, gint delete, up->unsub = unsub; up->store = mfi->store_info->store; up->full_name = g_strdup (mfi->full_name); - camel_object_ref(up->store); + g_object_ref (up->store); up->uri = g_strdup(mfi->uri); g_queue_push_head (&self->priv->updates, up); @@ -342,7 +342,7 @@ update_1folder(MailFolderCache *self, struct _folder_info *mfi, gint new, const up->msg_uid = g_strdup (msg_uid); up->msg_sender = g_strdup (msg_sender); up->msg_subject = g_strdup (msg_subject); - camel_object_ref(up->store); + g_object_ref (up->store); g_queue_push_head (&self->priv->updates, up); flush_updates(self); } @@ -372,7 +372,7 @@ setup_folder(MailFolderCache *self, CamelFolderInfo *fi, struct _store_info *si) up->uri = g_strdup(fi->uri); up->unread = fi->unread; up->store = si->store; - camel_object_ref(up->store); + g_object_ref (up->store); if ((fi->flags & CAMEL_FOLDER_NOSELECT) == 0) up->add = TRUE; @@ -683,7 +683,7 @@ rename_folders(MailFolderCache *self, struct _store_info *si, const gchar *oldba up->uri = g_strdup(mfi->uri); up->unread = fi->unread==-1?0:fi->unread; up->store = si->store; - camel_object_ref(up->store); + g_object_ref (up->store); if ((fi->flags & CAMEL_FOLDER_NOSELECT) == 0) up->add = TRUE; @@ -838,7 +838,7 @@ mail_folder_cache_note_store_remove(MailFolderCache *self, CamelStore *store) link = g_list_next (link); } - camel_object_unref(si->store); + g_object_unref (si->store); g_hash_table_foreach(si->folders, (GHFunc)free_folder_info_hash, NULL); g_hash_table_destroy(si->folders); g_hash_table_destroy(si->folders_uri); @@ -914,7 +914,7 @@ ping_store_exec (struct _ping_store_msg *m) static void ping_store_free (struct _ping_store_msg *m) { - camel_object_unref (m->store); + g_object_unref (m->store); } static MailMsgInfo ping_store_info = { @@ -936,7 +936,7 @@ ping_store (gpointer key, gpointer val, gpointer user_data) m = mail_msg_new (&ping_store_info); m->store = store; - camel_object_ref (store); + g_object_ref (store); mail_msg_slow_ordered_push (m); } @@ -1002,7 +1002,7 @@ mail_folder_cache_note_store(MailFolderCache *self, CamelStore *store, CamelOper si->folders_uri = g_hash_table_new(CAMEL_STORE_CLASS(CAMEL_OBJECT_GET_CLASS(store))->hash_folder_name, CAMEL_STORE_CLASS(CAMEL_OBJECT_GET_CLASS(store))->compare_folder_name); si->store = store; - camel_object_ref((CamelObject *)store); + g_object_ref ((CamelObject *)store); g_hash_table_insert(self->priv->stores, store, si); g_queue_init (&si->folderinfo_updates); hook = TRUE; @@ -1094,7 +1094,7 @@ mail_folder_cache_get_folder_from_uri(MailFolderCache *self, const gchar *uri, C if (folderp) { if (fi.fi && fi.fi->folder) { *folderp = fi.fi->folder; - camel_object_ref(*folderp); + g_object_ref (*folderp); } else { *folderp = NULL; } diff --git a/mail/mail-ops.c b/mail/mail-ops.c index 3aa310b2f0..22edd9a6a1 100644 --- a/mail/mail-ops.c +++ b/mail/mail-ops.c @@ -131,7 +131,7 @@ em_filter_folder_element_exec (struct _filter_mail_msg *m) /* this may thaw/unref source folders, do it here so we dont do it in the main thread see also fetch_mail_fetch() below */ - camel_object_unref(m->driver); + g_object_unref (m->driver); m->driver = NULL; if (m->cancel) @@ -147,7 +147,7 @@ static void em_filter_folder_element_free (struct _filter_mail_msg *m) { if (m->source_folder) - camel_object_unref (m->source_folder); + g_object_unref (m->source_folder); if (m->source_uids) em_utils_uids_free (m->source_uids); @@ -156,10 +156,10 @@ em_filter_folder_element_free (struct _filter_mail_msg *m) camel_operation_unref (m->cancel); if (m->destination) - camel_object_unref (m->destination); + g_object_unref (m->destination); if (m->driver) - camel_object_unref (m->driver); + g_object_unref (m->driver); mail_session_flush_filter_log (); } @@ -181,7 +181,7 @@ mail_filter_folder (CamelFolder *source_folder, GPtrArray *uids, m = mail_msg_new (&em_filter_folder_element_info); m->source_folder = source_folder; - camel_object_ref (source_folder); + g_object_ref (source_folder); m->source_uids = uids; m->cache = NULL; m->delete = FALSE; @@ -255,7 +255,7 @@ fetch_mail_exec (struct _fetch_mail_msg *m) fm->destination = e_mail_local_get_folder (E_MAIL_FOLDER_LOCAL_INBOX); if (fm->destination == NULL) goto fail; - camel_object_ref (fm->destination); + g_object_ref (fm->destination); /* FIXME: this should support keep_on_server too, which would then perform a spool access thingy, right? problem is matching raw messages to uid's etc. */ @@ -331,7 +331,7 @@ fetch_mail_exec (struct _fetch_mail_msg *m) /* we unref the source folder here since we may now block in finalize (we try to disconnect cleanly) */ - camel_object_unref (fm->source_folder); + g_object_unref (fm->source_folder); fm->source_folder = NULL; } } @@ -343,7 +343,7 @@ fail: folders and whatnot) before we are really done */ /* should this be cancellable too? (i.e. above unregister above) */ if (fm->driver) { - camel_object_unref (fm->driver); + g_object_unref (fm->driver); fm->driver = NULL; } } @@ -553,7 +553,7 @@ mail_send_message (struct _send_queue_msg *m, CamelFolder *queue, const gchar *u folder = mail_tool_uri_to_folder(uri, 0, NULL); if (folder) { camel_folder_append_message(folder, message, info, NULL, NULL); - camel_object_unref(folder); + g_object_unref (folder); folder = NULL; } g_free(uri); @@ -592,7 +592,7 @@ mail_send_message (struct _send_queue_msg *m, CamelFolder *queue, const gchar *u if (!folder) { folder = e_mail_local_get_folder (E_MAIL_FOLDER_SENT); - camel_object_ref(folder); + g_object_ref (folder); } camel_folder_append_message (folder, message, info, NULL, ex); @@ -613,8 +613,8 @@ mail_send_message (struct _send_queue_msg *m, CamelFolder *queue, const gchar *u g_string_append_printf (err, _("Failed to append to %s: %s\n" "Appending to local 'Sent' folder instead."), name, camel_exception_get_description (ex)); - camel_object_ref (sent_folder); - camel_object_unref (folder); + g_object_ref (sent_folder); + g_object_unref (folder); folder = sent_folder; camel_exception_clear (ex); @@ -646,19 +646,19 @@ mail_send_message (struct _send_queue_msg *m, CamelFolder *queue, const gchar *u exit: if (folder) { camel_folder_sync(folder, FALSE, NULL); - camel_object_unref(folder); + g_object_unref (folder); } if (info) camel_message_info_free(info); - camel_object_unref(recipients); - camel_object_unref(from); + g_object_unref (recipients); + g_object_unref (from); if (xport) - camel_object_unref(xport); + g_object_unref (xport); g_free(sent_folder_uri); g_free(transport_url); camel_header_raw_clear(&xev); g_string_free(err, TRUE); - camel_object_unref(message); + g_object_unref (message); return; } @@ -782,7 +782,7 @@ send_queue_exec (struct _send_queue_msg *m) report_status (m, CAMEL_FILTER_STATUS_END, 100, _("Complete.")); if (m->driver) { - camel_object_unref (m->driver); + g_object_unref (m->driver); m->driver = NULL; } @@ -826,8 +826,8 @@ static void send_queue_free (struct _send_queue_msg *m) { if (m->driver) - camel_object_unref(m->driver); - camel_object_unref(m->queue); + g_object_unref (m->driver); + g_object_unref (m->queue); g_free(m->destination); if (m->cancel) camel_operation_unref(m->cancel); @@ -853,7 +853,7 @@ mail_send_queue(CamelFolder *queue, const gchar *destination, m = mail_msg_new(&send_queue_info); m->queue = queue; - camel_object_ref(queue); + g_object_ref (queue); m->destination = g_strdup(destination); if (cancel) { m->cancel = cancel; @@ -911,8 +911,8 @@ append_mail_done (struct _append_msg *m) static void append_mail_free (struct _append_msg *m) { - camel_object_unref(m->message); - camel_object_unref(m->folder); + g_object_unref (m->message); + g_object_unref (m->folder); g_free (m->appended_uid); } @@ -939,9 +939,9 @@ mail_append_mail (CamelFolder *folder, CamelMimeMessage *message, CamelMessageIn m = mail_msg_new (&append_mail_info); m->folder = folder; - camel_object_ref(folder); + g_object_ref (folder); m->message = message; - camel_object_ref(message); + g_object_ref (message); m->info = info; m->done = done; @@ -983,7 +983,7 @@ transfer_messages_exec (struct _transfer_msg *m) return; if (dest == m->source) { - camel_object_unref(dest); + g_object_unref (dest); /* no-op */ return; } @@ -1006,7 +1006,7 @@ transfer_messages_exec (struct _transfer_msg *m) camel_folder_thaw (m->source); camel_folder_thaw (dest); camel_folder_sync (dest, FALSE, NULL); - camel_object_unref (dest); + g_object_unref (dest); } static void @@ -1019,7 +1019,7 @@ transfer_messages_done (struct _transfer_msg *m) static void transfer_messages_free (struct _transfer_msg *m) { - camel_object_unref (m->source); + g_object_unref (m->source); g_free (m->dest_uri); em_utils_uids_free (m->uids); } @@ -1048,7 +1048,7 @@ mail_transfer_messages (CamelFolder *source, GPtrArray *uids, m = mail_msg_new(&transfer_messages_info); m->source = source; - camel_object_ref (source); + g_object_ref (source); m->uids = uids; m->delete = delete_from_source; m->dest_uri = g_strdup (dest_uri); @@ -1113,7 +1113,7 @@ get_folderinfo_free (struct _get_folderinfo_msg *m) { if (m->info && m->can_clear) camel_store_free_folder_info(m->store, m->info); - camel_object_unref(m->store); + g_object_unref (m->store); } static MailMsgInfo get_folderinfo_info = { @@ -1137,7 +1137,7 @@ mail_get_folderinfo (CamelStore *store, CamelOperation *op, gboolean (*done)(Cam camel_operation_ref(op); } m->store = store; - camel_object_ref(store); + g_object_ref (store); m->done = done; m->data = data; id = m->base.seq; @@ -1179,11 +1179,11 @@ do_build_attachment (CamelFolder *folder, GPtrArray *uids, GPtrArray *messages, for (i=0;i<messages->len;i++) { part = mail_tool_make_message_attachment(messages->pdata[i]); camel_multipart_add_part(multipart, part); - camel_object_unref(part); + g_object_unref (part); } part = camel_mime_part_new(); camel_medium_set_content (CAMEL_MEDIUM (part), CAMEL_DATA_WRAPPER(multipart)); - camel_object_unref(multipart); + g_object_unref (multipart); camel_mime_part_set_description(part, _("Forwarded messages")); } @@ -1191,7 +1191,7 @@ do_build_attachment (CamelFolder *folder, GPtrArray *uids, GPtrArray *messages, subject = mail_tool_generate_forward_subject(messages->pdata[0]); d->done(folder, messages, part, subject, d->data); g_free(subject); - camel_object_unref(part); + g_object_unref (part); g_free(d); } @@ -1247,7 +1247,7 @@ get_folder_free (struct _get_folder_msg *m) { g_free (m->uri); if (m->folder) - camel_object_unref (m->folder); + g_object_unref (m->folder); } static MailMsgInfo get_folder_info = { @@ -1312,7 +1312,7 @@ static void get_quota_free (struct _get_quota_msg *m) { if (m->folder) - camel_object_unref (m->folder); + g_object_unref (m->folder); if (m->quota) camel_folder_quota_info_free (m->quota); g_free (m->folder_uri); @@ -1343,7 +1343,7 @@ mail_get_folder_quota (CamelFolder *folder, m->data = data; m->done = done; - camel_object_ref (m->folder); + g_object_ref (m->folder); id = m->base.seq; dispatch (m); @@ -1389,7 +1389,7 @@ get_store_free (struct _get_store_msg *m) { g_free (m->uri); if (m->store) - camel_object_unref (m->store); + g_object_unref (m->store); } static MailMsgInfo get_store_info = { @@ -1513,7 +1513,7 @@ remove_folder_done (struct _remove_folder_msg *m) static void remove_folder_free (struct _remove_folder_msg *m) { - camel_object_unref (m->folder); + g_object_unref (m->folder); } static MailMsgInfo remove_folder_info = { @@ -1533,7 +1533,7 @@ mail_remove_folder (CamelFolder *folder, void (*done) (CamelFolder *folder, gboo m = mail_msg_new (&remove_folder_info); m->folder = folder; - camel_object_ref (folder); + g_object_ref (folder); m->data = data; m->done = done; @@ -1573,7 +1573,7 @@ sync_folder_done (struct _sync_folder_msg *m) static void sync_folder_free (struct _sync_folder_msg *m) { - camel_object_unref((CamelObject *)m->folder); + g_object_unref ((CamelObject *)m->folder); } static MailMsgInfo sync_folder_info = { @@ -1591,7 +1591,7 @@ mail_sync_folder(CamelFolder *folder, void (*done) (CamelFolder *folder, gpointe m = mail_msg_new(&sync_folder_info); m->folder = folder; - camel_object_ref(folder); + g_object_ref (folder); m->data = data; m->done = done; @@ -1640,7 +1640,7 @@ sync_store_done (struct _sync_store_msg *m) static void sync_store_free (struct _sync_store_msg *m) { - camel_object_unref(m->store); + g_object_unref (m->store); } static MailMsgInfo sync_store_info = { @@ -1659,7 +1659,7 @@ mail_sync_store(CamelStore *store, gint expunge, void (*done) (CamelStore *store m = mail_msg_new(&sync_store_info); m->store = store; m->expunge = expunge; - camel_object_ref(store); + g_object_ref (store); m->data = data; m->done = done; @@ -1699,7 +1699,7 @@ mail_refresh_folder(CamelFolder *folder, void (*done) (CamelFolder *folder, gpoi m = mail_msg_new(&refresh_folder_info); m->folder = folder; - camel_object_ref(folder); + g_object_ref (folder); m->data = data; m->done = done; @@ -1736,7 +1736,7 @@ mail_expunge_folder(CamelFolder *folder, void (*done) (CamelFolder *folder, gpoi m = mail_msg_new(&expunge_folder_info); m->folder = folder; - camel_object_ref(folder); + g_object_ref (folder); m->data = data; m->done = done; @@ -1778,7 +1778,7 @@ empty_trash_exec (struct _empty_trash_msg *m) if (trash) { camel_folder_expunge (trash, &m->base.ex); - camel_object_unref (trash); + g_object_unref (trash); } } @@ -1858,11 +1858,11 @@ static void get_message_free (struct _get_message_msg *m) { g_free (m->uid); - camel_object_unref (m->folder); + g_object_unref (m->folder); camel_operation_unref (m->cancel); if (m->message) - camel_object_unref (m->message); + g_object_unref (m->message); } static MailMsgInfo get_message_info = { @@ -1883,7 +1883,7 @@ mail_get_message(CamelFolder *folder, const gchar *uid, void (*done) (CamelFolde m = mail_msg_new(&get_message_info); m->folder = folder; - camel_object_ref(folder); + g_object_ref (folder); m->uid = g_strdup(uid); m->data = data; m->done = (void (*) (CamelFolder *, const gchar *, CamelMimeMessage *, gpointer )) done; @@ -1925,7 +1925,7 @@ mail_get_messagex(CamelFolder *folder, const gchar *uid, void (*done) (CamelFold m = mail_msg_new(&get_messagex_info); m->folder = folder; - camel_object_ref(folder); + g_object_ref (folder); m->uid = g_strdup(uid); m->data = data; m->done = (void (*) (CamelFolder *, const gchar *, CamelMimeMessage *, gpointer )) done; @@ -1991,10 +1991,10 @@ get_messages_free (struct _get_messages_msg *m) em_utils_uids_free (m->uids); for (i=0;i<m->messages->len;i++) { if (m->messages->pdata[i]) - camel_object_unref(m->messages->pdata[i]); + g_object_unref (m->messages->pdata[i]); } g_ptr_array_free(m->messages, TRUE); - camel_object_unref(m->folder); + g_object_unref (m->folder); } static MailMsgInfo get_messages_info = { @@ -2015,7 +2015,7 @@ mail_get_messages(CamelFolder *folder, GPtrArray *uids, m = mail_msg_new(&get_messages_info); m->folder = folder; - camel_object_ref(folder); + g_object_ref (folder); m->uids = uids; m->messages = g_ptr_array_new(); m->data = data; @@ -2098,7 +2098,7 @@ save_messages_exec (struct _save_messages_msg *m) filtered_stream = camel_stream_filter_new (stream); camel_stream_filter_add ( CAMEL_STREAM_FILTER (filtered_stream), from_filter); - camel_object_unref(from_filter); + g_object_unref (from_filter); if (path != m->path) g_free (path); @@ -2125,15 +2125,15 @@ save_messages_exec (struct _save_messages_msg *m) camel_exception_setv(&m->base.ex, CAMEL_EXCEPTION_SYSTEM, _("Error saving messages to: %s:\n %s"), m->path, g_strerror(errno)); g_free(from); - camel_object_unref((CamelObject *)message); + g_object_unref ((CamelObject *)message); break; } g_free(from); - camel_object_unref(message); + g_object_unref (message); } - camel_object_unref(filtered_stream); - camel_object_unref(stream); + g_object_unref (filtered_stream); + g_object_unref (stream); } static void @@ -2147,7 +2147,7 @@ static void save_messages_free (struct _save_messages_msg *m) { em_utils_uids_free (m->uids); - camel_object_unref(m->folder); + g_object_unref (m->folder); g_free(m->path); } @@ -2168,7 +2168,7 @@ mail_save_messages(CamelFolder *folder, GPtrArray *uids, const gchar *path, m = mail_msg_new(&save_messages_info); m->folder = folder; - camel_object_ref(folder); + g_object_ref (folder); m->uids = uids; m->path = g_strdup(path); m->data = data; @@ -2239,7 +2239,7 @@ save_part_exec (struct _save_part_msg *m) _("Could not write data: %s"), g_strerror (errno)); - camel_object_unref (stream); + g_object_unref (stream); } static void @@ -2252,7 +2252,7 @@ save_part_done (struct _save_part_msg *m) static void save_part_free (struct _save_part_msg *m) { - camel_object_unref (m->part); + g_object_unref (m->part); g_free (m->path); } @@ -2272,7 +2272,7 @@ mail_save_part (CamelMimePart *part, const gchar *path, gint id; m = mail_msg_new (&save_part_info); m->part = part; - camel_object_ref (part); + g_object_ref (part); m->path = g_strdup (path); m->data = data; m->done = done; @@ -2315,7 +2315,7 @@ prep_offline_exec (struct _prep_offline_msg *m) /* prepare_for_offline should do this? */ /* of course it should all be atomic, but ... */ camel_folder_sync(folder, FALSE, NULL); - camel_object_unref(folder); + g_object_unref (folder); } if (m->cancel) @@ -2431,7 +2431,7 @@ set_offline_done (struct _set_offline_msg *m) static void set_offline_free (struct _set_offline_msg *m) { - camel_object_unref(m->store); + g_object_unref (m->store); } static MailMsgInfo set_offline_info = { @@ -2458,7 +2458,7 @@ mail_store_set_offline (CamelStore *store, gboolean offline, m = mail_msg_new(&set_offline_info); m->store = store; - camel_object_ref(store); + g_object_ref (store); m->offline = offline; m->data = data; m->done = done; @@ -2505,7 +2505,7 @@ prepare_offline_done (struct _set_offline_msg *m) static void prepare_offline_free (struct _set_offline_msg *m) { - camel_object_unref (m->store); + g_object_unref (m->store); } static MailMsgInfo prepare_offline_info = { @@ -2528,7 +2528,7 @@ mail_store_prepare_offline (CamelStore *store) m = mail_msg_new(&prepare_offline_info); m->store = store; - camel_object_ref(store); + g_object_ref (store); m->data = NULL; m->done = NULL; @@ -2578,7 +2578,7 @@ check_service_exec (struct _check_msg *m) } m->authtypes = camel_service_query_auth_types(service, &m->base.ex); - camel_object_unref(service); + g_object_unref (service); } static void diff --git a/mail/mail-send-recv.c b/mail/mail-send-recv.c index ffce0912d5..1cfe345919 100644 --- a/mail/mail-send-recv.c +++ b/mail/mail-send-recv.c @@ -132,7 +132,7 @@ free_folder_info(struct _folder_info *info) { /*camel_folder_thaw (info->folder); */ mail_sync_folder(info->folder, NULL, NULL); - camel_object_unref(info->folder); + g_object_unref (info->folder); g_free(info->uri); g_free(info); } @@ -164,7 +164,7 @@ setup_send_data(void) (GDestroyNotify) free_folder_info); data->inbox = e_mail_local_get_folder ( E_MAIL_FOLDER_LOCAL_INBOX); - camel_object_ref(data->inbox); + g_object_ref (data->inbox); data->active = g_hash_table_new_full ( g_str_hash, g_str_equal, (GDestroyNotify) NULL, @@ -198,7 +198,7 @@ free_send_data(void) if (data->inbox) { mail_sync_folder(data->inbox, NULL, NULL); /*camel_folder_thaw (data->inbox); */ - camel_object_unref(data->inbox); + g_object_unref (data->inbox); } g_list_free(data->infos); @@ -803,7 +803,7 @@ receive_get_folder(CamelFilterDriver *d, const gchar *uri, gpointer data, CamelE oldinfo = g_hash_table_lookup(info->data->folders, uri); g_mutex_unlock(info->data->lock); if (oldinfo) { - camel_object_ref(oldinfo->folder); + g_object_ref (oldinfo->folder); return oldinfo->folder; } folder = mail_tool_uri_to_folder (uri, 0, ex); @@ -816,7 +816,7 @@ receive_get_folder(CamelFilterDriver *d, const gchar *uri, gpointer data, CamelE if (g_hash_table_lookup_extended (info->data->folders, uri, &oldkey, &oldinfoptr)) { oldinfo = (struct _folder_info *) oldinfoptr; - camel_object_unref(oldinfo->folder); + g_object_unref (oldinfo->folder); oldinfo->folder = folder; } else { /*camel_folder_freeze (folder); */ @@ -826,7 +826,7 @@ receive_get_folder(CamelFilterDriver *d, const gchar *uri, gpointer data, CamelE g_hash_table_insert(info->data->folders, oldinfo->uri, oldinfo); } - camel_object_ref (folder); + g_object_ref (folder); g_mutex_unlock(info->data->lock); @@ -890,7 +890,7 @@ refresh_folders_exec (struct _refresh_folders_msg *m) camel_exception_clear(&ex); camel_folder_refresh_info(folder, &ex); camel_exception_clear(&ex); - camel_object_unref(folder); + g_object_unref (folder); } else if (camel_exception_is_set(&ex)) { g_warning ("Failed to refresh folders: %s", camel_exception_get_description (&ex)); camel_exception_clear (&ex); @@ -917,7 +917,7 @@ refresh_folders_free (struct _refresh_folders_msg *m) g_ptr_array_free(m->folders, TRUE); camel_store_free_folder_info (m->store, m->finfo); - camel_object_unref(m->store); + g_object_unref (m->store); } static MailMsgInfo refresh_folders_info = { @@ -938,7 +938,7 @@ receive_update_got_folderinfo(CamelStore *store, CamelFolderInfo *info, gpointer m = mail_msg_new(&refresh_folders_info); m->store = store; - camel_object_ref(store); + g_object_ref (store); m->folders = folders; m->info = sinfo; m->finfo = info; diff --git a/mail/mail-session.c b/mail/mail-session.c index ac96a655e5..f55103290e 100644 --- a/mail/mail-session.c +++ b/mail/mail-session.c @@ -64,12 +64,13 @@ CamelSession *session; static gint session_check_junk_notify_id = -1; -#define MAIL_SESSION_TYPE (mail_session_get_type ()) -#define MAIL_SESSION(obj) (CAMEL_CHECK_CAST((obj), MAIL_SESSION_TYPE, MailSession)) -#define MAIL_SESSION_CLASS(k) (CAMEL_CHECK_CLASS_CAST ((k), MAIL_SESSION_TYPE, MailSessionClass)) -#define MAIL_IS_SESSION(o) (CAMEL_CHECK_TYPE((o), MAIL_SESSION_TYPE)) +#define MAIL_TYPE_SESSION \ + (mail_session_get_type ()) -typedef struct _MailSession { +typedef struct _MailSession MailSession; +typedef struct _MailSessionClass MailSessionClass; + +struct _MailSession { CamelSession parent_object; gboolean interactive; @@ -77,14 +78,12 @@ typedef struct _MailSession { GList *junk_plugins; MailAsyncEvent *async; -} MailSession; +}; -typedef struct _MailSessionClass { +struct _MailSessionClass { CamelSessionClass parent_class; +}; -} MailSessionClass; - -static CamelSessionClass *ms_parent_class; static gchar *mail_data_dir; static gchar *mail_config_dir; @@ -99,16 +98,15 @@ static gpointer ms_thread_msg_new(CamelSession *session, CamelSessionThreadOps * static void ms_thread_msg_free(CamelSession *session, CamelSessionThreadMsg *m); static void ms_forward_to (CamelSession *session, CamelFolder *folder, CamelMimeMessage *message, const gchar *address, CamelException *ex); -static void -init (MailSession *session) -{ - session->async = mail_async_event_new(); - session->junk_plugins = NULL; -} +GType mail_session_get_type (void); + +G_DEFINE_TYPE (MailSession, mail_session, CAMEL_TYPE_SESSION) static void -finalise (MailSession *session) +mail_session_finalize (GObject *object) { + MailSession *session = (MailSession *) object; + if (session_check_junk_notify_id != -1) gconf_client_notify_remove (mail_config_get_gconf_client (), session_check_junk_notify_id); @@ -116,44 +114,37 @@ finalise (MailSession *session) g_free (mail_data_dir); g_free (mail_config_dir); + + /* Chain up to parent's finalize() method. */ + G_OBJECT_CLASS (mail_session_parent_class)->finalize (object); } static void -class_init (MailSessionClass *mail_session_class) -{ - CamelSessionClass *camel_session_class = CAMEL_SESSION_CLASS (mail_session_class); - - /* virtual method override */ - camel_session_class->get_password = get_password; - camel_session_class->forget_password = forget_password; - camel_session_class->alert_user = alert_user; - camel_session_class->get_filter_driver = get_filter_driver; - camel_session_class->lookup_addressbook = lookup_addressbook; - camel_session_class->thread_msg_new = ms_thread_msg_new; - camel_session_class->thread_msg_free = ms_thread_msg_free; - camel_session_class->thread_status = ms_thread_status; - camel_session_class->forward_to = ms_forward_to; -} - -static CamelType -mail_session_get_type (void) -{ - static CamelType mail_session_type = CAMEL_INVALID_TYPE; - - if (mail_session_type == CAMEL_INVALID_TYPE) { - ms_parent_class = (CamelSessionClass *)camel_session_get_type(); - mail_session_type = camel_type_register ( - camel_session_get_type (), - "MailSession", - sizeof (MailSession), - sizeof (MailSessionClass), - (CamelObjectClassInitFunc) class_init, - NULL, - (CamelObjectInitFunc) init, - (CamelObjectFinalizeFunc) finalise); - } +mail_session_class_init (MailSessionClass *class) +{ + GObjectClass *object_class; + CamelSessionClass *session_class; + + object_class = G_OBJECT_CLASS (class); + object_class->finalize = mail_session_finalize; - return mail_session_type; + session_class = CAMEL_SESSION_CLASS (class); + session_class->get_password = get_password; + session_class->forget_password = forget_password; + session_class->alert_user = alert_user; + session_class->get_filter_driver = get_filter_driver; + session_class->lookup_addressbook = lookup_addressbook; + session_class->thread_msg_new = ms_thread_msg_new; + session_class->thread_msg_free = ms_thread_msg_free; + session_class->thread_status = ms_thread_status; + session_class->forward_to = ms_forward_to; +} + +static void +mail_session_init (MailSession *session) +{ + session->async = mail_async_event_new(); + session->junk_plugins = NULL; } static gchar * @@ -424,7 +415,7 @@ lookup_addressbook(CamelSession *session, const gchar *name) addr = camel_internet_address_new (); camel_address_decode ((CamelAddress *)addr, name); ret = em_utils_in_addressbook (addr, mail_config_get_lookup_book_local_only ()); - camel_object_unref (addr); + g_object_unref (addr); return ret; } @@ -481,7 +472,7 @@ main_play_sound (CamelFilterDriver *driver, gchar *filename, gpointer user_data) gdk_beep (); g_free (filename); - camel_object_unref (session); + g_object_unref (session); } static void @@ -489,7 +480,7 @@ session_play_sound (CamelFilterDriver *driver, const gchar *filename, gpointer u { MailSession *ms = (MailSession *) session; - camel_object_ref (session); + g_object_ref (session); mail_async_event_emit (ms->async, MAIL_ASYNC_GUI, (MailAsyncFunc) main_play_sound, driver, g_strdup (filename), user_data); @@ -499,7 +490,7 @@ static void main_system_beep (CamelFilterDriver *driver, gpointer user_data) { gdk_beep (); - camel_object_unref (session); + g_object_unref (session); } static void @@ -507,7 +498,7 @@ session_system_beep (CamelFilterDriver *driver, gpointer user_data) { MailSession *ms = (MailSession *) session; - camel_object_ref (session); + g_object_ref (session); mail_async_event_emit (ms->async, MAIL_ASYNC_GUI, (MailAsyncFunc) main_system_beep, driver, user_data, NULL); @@ -609,7 +600,11 @@ static MailMsgInfo ms_thread_info_dummy = { sizeof (MailMsg) }; static gpointer ms_thread_msg_new(CamelSession *session, CamelSessionThreadOps *ops, guint size) { - CamelSessionThreadMsg *msg = ms_parent_class->thread_msg_new(session, ops, size); + CamelSessionThreadMsg *msg; + CamelSessionClass *session_class; + + session_class = CAMEL_SESSION_CLASS (mail_session_parent_class); + msg = session_class->thread_msg_new (session, ops, size); /* We create a dummy mail_msg, and then copy its cancellation port over to ours, so we get cancellation and progress in common with hte existing mail code, for free */ @@ -625,13 +620,19 @@ static gpointer ms_thread_msg_new(CamelSession *session, CamelSessionThreadOps * return msg; } -static void ms_thread_msg_free(CamelSession *session, CamelSessionThreadMsg *m) +static void +ms_thread_msg_free(CamelSession *session, CamelSessionThreadMsg *m) { + CamelSessionClass *session_class; + + session_class = CAMEL_SESSION_CLASS (mail_session_parent_class); + mail_msg_unref(m->data); - ms_parent_class->thread_msg_free(session, m); + session_class->thread_msg_free(session, m); } -static void ms_thread_status(CamelSession *session, CamelSessionThreadMsg *msg, const gchar *text, gint pc) +static void +ms_thread_status(CamelSession *session, CamelSessionThreadMsg *msg, const gchar *text, gint pc) { /* This should never be called since we bypass it in alloc! */ printf("Thread status '%s' %d%%\n", text, pc); @@ -680,7 +681,7 @@ ms_forward_to (CamelSession *session, CamelFolder *folder, CamelMimeMessage *mes camel_data_wrapper_write_to_stream ((CamelDataWrapper *)message, mem); camel_seekable_stream_seek (CAMEL_SEEKABLE_STREAM (mem), 0, CAMEL_STREAM_SET); camel_data_wrapper_construct_from_stream ((CamelDataWrapper *)forward, mem); - camel_object_unref (mem); + g_object_unref (mem); /* clear previous recipients */ camel_mime_message_set_recipients (forward, CAMEL_RECIPIENT_TYPE_TO, NULL); @@ -705,13 +706,13 @@ ms_forward_to (CamelSession *session, CamelFolder *folder, CamelMimeMessage *mes addr = camel_internet_address_new (); camel_internet_address_add (addr, account->id->name, account->id->address); camel_mime_message_set_from (forward, addr); - camel_object_unref (addr); + g_object_unref (addr); /* to */ addr = camel_internet_address_new (); camel_address_decode (CAMEL_ADDRESS (addr), address); camel_mime_message_set_recipients (forward, CAMEL_RECIPIENT_TYPE_TO, addr); - camel_object_unref (addr); + g_object_unref (addr); /* subject */ subject = mail_tool_generate_forward_subject (message); @@ -797,7 +798,7 @@ mail_session_check_junk_notify (GConfClient *gconf, guint id, GConfEntry *entry, } void -mail_session_init (void) +mail_session_start (void) { GConfClient *gconf; @@ -806,7 +807,7 @@ mail_session_init (void) camel_provider_init(); - session = CAMEL_SESSION (camel_object_new (MAIL_SESSION_TYPE)); + session = g_object_new (MAIL_TYPE_SESSION, NULL); e_account_writable(NULL, E_ACCOUNT_SOURCE_SAVE_PASSWD); /* Init the EAccount Setup */ camel_session_construct (session, mail_session_get_data_dir ()); diff --git a/mail/mail-session.h b/mail/mail-session.h index 22dc792b93..4984a5822c 100644 --- a/mail/mail-session.h +++ b/mail/mail-session.h @@ -28,7 +28,7 @@ G_BEGIN_DECLS -void mail_session_init (void); +void mail_session_start (void); void mail_session_shutdown (void); gchar *mail_session_request_dialog (const gchar *prompt, gboolean secret, const gchar *key, gboolean async); diff --git a/mail/mail-tools.c b/mail/mail-tools.c index 92677a4d5a..d7cb5c6cca 100644 --- a/mail/mail-tools.c +++ b/mail/mail-tools.c @@ -54,7 +54,7 @@ mail_tool_get_inbox (const gchar *url, CamelException *ex) return NULL; folder = camel_store_get_inbox (store, ex); - camel_object_unref (store); + g_object_unref (store); return folder; } @@ -92,7 +92,7 @@ mail_tool_get_trash (const gchar *url, gint connect, CamelException *ex) else trash = NULL; - camel_object_unref (store); + g_object_unref (store); return trash; } @@ -328,7 +328,7 @@ mail_tool_uri_to_folder (const gchar *uri, guint32 flags, CamelException *ex) folder = camel_store_get_junk (store, ex); } else folder = camel_store_get_folder (store, name, flags, ex); - camel_object_unref (store); + g_object_unref (store); } if (folder) diff --git a/mail/mail-vfolder.c b/mail/mail-vfolder.c index 5f0f0c8a72..3ff43cd10c 100644 --- a/mail/mail-vfolder.c +++ b/mail/mail-vfolder.c @@ -111,7 +111,7 @@ vfolder_setup_exec (struct _setup_msg *m) l = m->sources_folder; while (l && !vfolder_shutdown) { d(printf(" Adding folder: %s\n", ((CamelFolder *)l->data)->full_name)); - camel_object_ref(l->data); + g_object_ref (l->data); list = g_list_append(list, l->data); l = l->next; } @@ -121,7 +121,7 @@ vfolder_setup_exec (struct _setup_msg *m) l = list; while (l) { - camel_object_unref(l->data); + g_object_unref (l->data); l = l->next; } g_list_free(list); @@ -137,7 +137,7 @@ vfolder_setup_free (struct _setup_msg *m) { GList *l; - camel_object_unref(m->folder); + g_object_unref (m->folder); g_free(m->query); l = m->sources_uri; @@ -149,7 +149,7 @@ vfolder_setup_free (struct _setup_msg *m) l = m->sources_folder; while (l) { - camel_object_unref(l->data); + g_object_unref (l->data); l = l->next; } g_list_free(m->sources_folder); @@ -172,7 +172,7 @@ vfolder_setup(CamelFolder *folder, const gchar *query, GList *sources_uri, GList m = mail_msg_new(&vfolder_setup_info); m->folder = folder; - camel_object_ref(folder); + g_object_ref (folder); m->query = g_strdup(query); m->sources_uri = sources_uri; m->sources_folder = sources_folder; @@ -270,7 +270,7 @@ vfolder_adduri_exec (struct _adduri_msg *m) camel_vee_folder_add_folder((CamelVeeFolder *)l->data, folder); l = l->next; } - camel_object_unref(folder); + g_object_unref (folder); } } @@ -282,7 +282,7 @@ vfolder_adduri_done(struct _adduri_msg *m) static void vfolder_adduri_free (struct _adduri_msg *m) { - g_list_foreach(m->folders, (GFunc)camel_object_unref, NULL); + g_list_foreach(m->folders, (GFunc)g_object_unref, NULL); g_list_free(m->folders); g_free(m->uri); } @@ -523,7 +523,7 @@ mail_vfolder_add_uri(CamelStore *store, const gchar *curi, gint remove) g_warning ("vf is NULL for %s\n", rule->name); continue; } - camel_object_ref(vf); + g_object_ref (vf); folders = g_list_prepend(folders, vf); } } @@ -890,7 +890,7 @@ static void context_rule_removed(ERuleContext *ctx, EFilterRule *rule) camel_store_delete_folder(vfolder_store, rule->name, NULL); /* this must be unref'd after its deleted */ if (folder) - camel_object_unref ((CamelFolder *) folder); + g_object_unref ((CamelFolder *) folder); } static void @@ -1350,7 +1350,7 @@ vfolder_foreach_cb (gpointer key, gpointer data, gpointer user_data) CamelFolder *folder = CAMEL_FOLDER (data); if (folder) - camel_object_unref(folder); + g_object_unref (folder); g_free (key); } @@ -1367,7 +1367,7 @@ mail_vfolder_shutdown (void) } if (vfolder_store) { - camel_object_unref (vfolder_store); + g_object_unref (vfolder_store); vfolder_store = NULL; } diff --git a/mail/message-list.c b/mail/message-list.c index 321edc3de3..895bc00191 100644 --- a/mail/message-list.c +++ b/mail/message-list.c @@ -264,7 +264,7 @@ e_mail_address_new (const gchar *address) cia = camel_internet_address_new (); if (camel_address_unformat (CAMEL_ADDRESS (cia), address) == -1) { - camel_object_unref (cia); + g_object_unref (cia); return NULL; } camel_internet_address_get (cia, 0, &name, &addr); @@ -277,7 +277,7 @@ e_mail_address_new (const gchar *address) new->wname = NULL; } - camel_object_unref (cia); + g_object_unref (cia); return new; } @@ -500,7 +500,7 @@ clear_selection(MessageList *ml, struct _MLSelection *selection) selection->uids = NULL; } if (selection->folder) { - camel_object_unref(selection->folder); + g_object_unref (selection->folder); selection->folder = NULL; } g_free(selection->folder_uri); @@ -884,7 +884,7 @@ message_list_copy(MessageList *ml, gboolean cut) p->clipboard.uids = uids; p->clipboard.folder = ml->folder; - camel_object_ref(p->clipboard.folder); + g_object_ref (p->clipboard.folder); p->clipboard.folder_uri = g_strdup(ml->folder_uri); gtk_selection_owner_set(p->invisible, GDK_SELECTION_CLIPBOARD, gtk_get_current_event_time()); } else { @@ -2137,7 +2137,7 @@ static void ml_drop_async_free (struct _drop_msg *m) { g_object_unref (m->context); - camel_object_unref (m->folder); + g_object_unref (m->folder); gtk_selection_data_free (m->selection); } @@ -2184,7 +2184,7 @@ ml_tree_drag_data_received (ETree *tree, m->context = context; g_object_ref(context); m->folder = ml->folder; - camel_object_ref(m->folder); + g_object_ref (m->folder); m->action = context->action; m->info = info; @@ -2369,7 +2369,7 @@ message_list_destroy(GtkObject *object) } camel_object_unhook_event(message_list->folder, "folder_changed", folder_changed, message_list); - camel_object_unref (message_list->folder); + g_object_unref (message_list->folder); message_list->folder = NULL; } @@ -3595,7 +3595,7 @@ message_list_set_folder (MessageList *message_list, CamelFolder *folder, const g if (message_list->folder) { camel_object_unhook_event((CamelObject *)message_list->folder, "folder_changed", folder_changed, message_list); - camel_object_unref (message_list->folder); + g_object_unref (message_list->folder); message_list->folder = NULL; } @@ -3619,7 +3619,7 @@ message_list_set_folder (MessageList *message_list, CamelFolder *folder, const g gint strikeout_col = -1; ECell *cell; - camel_object_ref (folder); + g_object_ref (folder); message_list->folder = folder; message_list->just_set_folder = TRUE; @@ -4461,7 +4461,7 @@ regen_list_free (struct _regen_list_msg *m) g_free (m->search); g_free (m->hideexpr); - camel_object_unref (m->folder); + g_object_unref (m->folder); if (m->changes) camel_folder_change_info_free (m->changes); @@ -4577,7 +4577,7 @@ mail_regen_list (MessageList *ml, const gchar *search, const gchar *hideexpr, Ca m->thread_subject = gconf_client_get_bool (gconf, "/apps/evolution/mail/display/thread_subject", NULL); g_object_ref(ml); m->folder = ml->folder; - camel_object_ref(m->folder); + g_object_ref (m->folder); m->last_row = -1; m->expand_state = NULL; |