295
ev_attachment_open (attachment, &error);
298
ev_attachment_open (attachment,
299
gtk_widget_get_screen (GTK_WIDGET (ev_attachbar)),
298
g_warning (error->message);
304
g_warning ("%s", error->message);
299
305
g_error_free (error);
621
job_finished_callback (EvJobAttachments *job,
622
EvSidebarAttachments *ev_attachbar)
626
for (l = job->attachments; l && l->data; l = g_list_next (l)) {
627
EvAttachment *attachment;
629
GdkPixbuf *pixbuf = NULL;
630
const gchar *mime_type;
632
attachment = EV_ATTACHMENT (l->data);
634
mime_type = ev_attachment_get_mime_type (attachment);
635
pixbuf = ev_sidebar_attachments_icon_cache_get (ev_attachbar,
638
gtk_list_store_append (ev_attachbar->priv->model, &iter);
639
gtk_list_store_set (ev_attachbar->priv->model, &iter,
640
COLUMN_NAME, ev_attachment_get_name (attachment),
642
COLUMN_ATTACHMENT, attachment,
646
g_object_unref (job);
615
650
ev_sidebar_attachments_set_document (EvSidebarPage *page,
616
651
EvDocument *document)
618
653
EvSidebarAttachments *ev_attachbar = EV_SIDEBAR_ATTACHMENTS (page);
619
GList *attachments = NULL;
622
656
if (!ev_document_has_attachments (document))
633
667
(gpointer) ev_attachbar);
636
attachments = ev_document_get_attachments (document);
638
670
gtk_list_store_clear (ev_attachbar->priv->model);
640
for (l = attachments; l && l->data; l = g_list_next (l)) {
641
EvAttachment *attachment;
643
GdkPixbuf *pixbuf = NULL;
644
const gchar *mime_type;
646
attachment = EV_ATTACHMENT (l->data);
648
mime_type = ev_attachment_get_mime_type (attachment);
649
pixbuf = ev_sidebar_attachments_icon_cache_get (ev_attachbar,
652
gtk_list_store_append (ev_attachbar->priv->model, &iter);
653
gtk_list_store_set (ev_attachbar->priv->model, &iter,
654
COLUMN_NAME, ev_attachment_get_name (attachment),
656
COLUMN_ATTACHMENT, attachment,
659
g_object_unref (attachment);
662
g_list_free (attachments);
672
job = ev_job_attachments_new (document);
673
g_signal_connect (job, "finished",
674
G_CALLBACK (job_finished_callback),
676
g_signal_connect (job, "cancelled",
677
G_CALLBACK (g_object_unref),
679
/* The priority doesn't matter for this job */
680
ev_job_scheduler_push_job (job, EV_JOB_PRIORITY_NONE);