static void attachment_store_dispose (GObject *object) { e_attachment_store_remove_all (E_ATTACHMENT_STORE (object)); /* Chain up to parent's dispose() method. */ G_OBJECT_CLASS (e_attachment_store_parent_class)->dispose (object); }
static void set_attachments (ECalClient *client, ECalComponent *comp, CamelMimeMessage *message) { /* XXX Much of this is copied from CompEditor::get_attachment_list(). * Perhaps it should be split off as a separate utility? */ EAttachmentStore *store; CamelDataWrapper *content; CamelMultipart *multipart; GFile *destination; GList *attachment_list = NULL; GSList *uri_list = NULL; const gchar *comp_uid = NULL; const gchar *local_store; gchar *filename_prefix, *tmp; gint ii, n_parts; struct _att_async_cb_data cb_data; cb_data.flag = e_flag_new (); cb_data.uris = NULL; content = camel_medium_get_content ((CamelMedium *) message); if (!content || !CAMEL_IS_MULTIPART (content)) return; n_parts = camel_multipart_get_number (CAMEL_MULTIPART (content)); if (n_parts < 1) return; e_cal_component_get_uid (comp, &comp_uid); g_return_if_fail (comp_uid != NULL); tmp = g_strdup (comp_uid); e_filename_make_safe (tmp); filename_prefix = g_strconcat (tmp, "-", NULL); g_free (tmp); local_store = e_cal_client_get_local_attachment_store (client); destination = g_file_new_for_path (local_store); /* Create EAttachments from the MIME parts and add them to the * attachment store. */ multipart = CAMEL_MULTIPART (content); store = E_ATTACHMENT_STORE (e_attachment_store_new ()); for (ii = 1; ii < n_parts; ii++) { EAttachment *attachment; CamelMimePart *mime_part; attachment = e_attachment_new (); mime_part = camel_multipart_get_part (multipart, ii); e_attachment_set_mime_part (attachment, mime_part); attachment_list = g_list_append (attachment_list, attachment); } e_flag_clear (cb_data.flag); e_attachment_store_load_async ( store, attachment_list, (GAsyncReadyCallback) attachment_load_finished, &cb_data); /* Loading should be instantaneous since we already have * the full content, but we need to wait for the callback. */ e_flag_wait (cb_data.flag); g_list_foreach (attachment_list, (GFunc) g_object_unref, NULL); g_list_free (attachment_list); cb_data.uris = NULL; e_flag_clear (cb_data.flag); e_attachment_store_save_async ( store, destination, filename_prefix, (GAsyncReadyCallback) attachment_save_finished, &cb_data); g_free (filename_prefix); /* We can't return until we have results. */ e_flag_wait (cb_data.flag); if (cb_data.uris == NULL) { e_flag_free (cb_data.flag); g_warning ("No attachment URIs retrieved."); return; } /* Transfer the URI strings to the GSList. */ for (ii = 0; cb_data.uris[ii] != NULL; ii++) { uri_list = g_slist_prepend (uri_list, cb_data.uris[ii]); cb_data.uris[ii] = NULL; } e_flag_free (cb_data.flag); g_free (cb_data.uris); /* XXX Does this take ownership of the list? */ e_cal_component_set_attachment_list (comp, uri_list); e_attachment_store_remove_all (store); g_object_unref (destination); g_object_unref (store); }
static void mail_attachment_bar_dispose (GObject *object) { EMailAttachmentBarPrivate *priv; priv = E_MAIL_ATTACHMENT_BAR (object)->priv; if (priv->model != NULL) { e_attachment_store_remove_all (E_ATTACHMENT_STORE (priv->model)); g_object_unref (priv->model); priv->model = NULL; } if (priv->vbox != NULL) { g_object_unref (priv->vbox); priv->vbox = NULL; } if (priv->expander != NULL) { g_object_unref (priv->expander); priv->expander = NULL; } if (priv->combo_box != NULL) { g_object_unref (priv->combo_box); priv->combo_box = NULL; } if (priv->icon_view != NULL) { g_object_unref (priv->icon_view); priv->icon_view = NULL; } if (priv->tree_view != NULL) { g_object_unref (priv->tree_view); priv->tree_view = NULL; } if (priv->icon_frame != NULL) { g_object_unref (priv->icon_frame); priv->icon_frame = NULL; } if (priv->tree_frame != NULL) { g_object_unref (priv->tree_frame); priv->tree_frame = NULL; } if (priv->status_icon != NULL) { g_object_unref (priv->status_icon); priv->status_icon = NULL; } if (priv->status_label != NULL) { g_object_unref (priv->status_label); priv->status_label = NULL; } if (priv->save_all_button != NULL) { g_object_unref (priv->save_all_button); priv->save_all_button = NULL; } if (priv->save_one_button != NULL) { g_object_unref (priv->save_one_button); priv->save_one_button = NULL; } /* Chain up to parent's dispose() method. */ G_OBJECT_CLASS (parent_class)->dispose (object); }
static void attachment_paned_dispose (GObject *object) { EAttachmentPanedPrivate *priv; priv = E_ATTACHMENT_PANED_GET_PRIVATE (object); if (priv->model != NULL) { e_attachment_store_remove_all (E_ATTACHMENT_STORE (priv->model)); g_object_unref (priv->model); priv->model = NULL; } if (priv->expander != NULL) { g_object_unref (priv->expander); priv->expander = NULL; } if (priv->notebook != NULL) { g_object_unref (priv->notebook); priv->notebook = NULL; } if (priv->combo_box != NULL) { g_object_unref (priv->combo_box); priv->combo_box = NULL; } if (priv->icon_view != NULL) { g_object_unref (priv->icon_view); priv->icon_view = NULL; } if (priv->tree_view != NULL) { g_object_unref (priv->tree_view); priv->tree_view = NULL; } if (priv->show_hide_label != NULL) { g_object_unref (priv->show_hide_label); priv->show_hide_label = NULL; } if (priv->status_icon != NULL) { g_object_unref (priv->status_icon); priv->status_icon = NULL; } if (priv->status_label != NULL) { g_object_unref (priv->status_label); priv->status_label = NULL; } if (priv->content_area != NULL) { g_object_unref (priv->content_area); priv->content_area = NULL; } /* Chain up to parent's dispose() method. */ G_OBJECT_CLASS (e_attachment_paned_parent_class)->dispose (object); }