X-Git-Url: https://www.fi.muni.cz/~kas/git//home/kas/public_html/git/?a=blobdiff_plain;f=backend%2Fev-attachment.c;h=63619afa61dc0f2772f2d645b72dae9a8a4c24f2;hb=e02e3fde2610db645a005f276286795025426186;hp=f0002f37230b362c22f835fe566351e23853895e;hpb=34f87f02fa13028c10ebf54be39f7d0045040505;p=evince.git diff --git a/backend/ev-attachment.c b/backend/ev-attachment.c index f0002f37..63619afa 100644 --- a/backend/ev-attachment.c +++ b/backend/ev-attachment.c @@ -293,14 +293,13 @@ ev_attachment_save (EvAttachment *attachment, g_return_val_if_fail (uri != NULL, FALSE); result = gnome_vfs_create (&handle, uri, - GNOME_VFS_OPEN_WRITE | - GNOME_VFS_OPEN_TRUNCATE, + GNOME_VFS_OPEN_WRITE, FALSE, 0644); if (result != GNOME_VFS_OK) { g_set_error (error, EV_ATTACHMENT_ERROR, (gint) result, - _("Couldn't save attachment '%s': %s"), + _("Couldn't save attachment “%s”: %s"), uri, gnome_vfs_result_to_string (result)); @@ -313,7 +312,7 @@ ev_attachment_save (EvAttachment *attachment, g_set_error (error, EV_ATTACHMENT_ERROR, (gint) result, - _("Couldn't save attachment '%s': %s"), + _("Couldn't save attachment “%s”: %s"), uri, gnome_vfs_result_to_string (result)); @@ -345,7 +344,7 @@ ev_attachment_launch_app (EvAttachment *attachment, g_set_error (error, EV_ATTACHMENT_ERROR, (gint) result, - _("Couldn't open attachment '%s': %s"), + _("Couldn't open attachment “%s”: %s"), attachment->priv->name, gnome_vfs_result_to_string (result)); @@ -367,21 +366,23 @@ ev_attachment_open (EvAttachment *attachment, gboolean retval = FALSE; GnomeVFSMimeApplication *default_app = NULL; - if (!attachment->priv->app) + g_return_val_if_fail (EV_IS_ATTACHMENT (attachment), FALSE); + + if (!attachment->priv->app) { default_app = gnome_vfs_mime_get_default_application (attachment->priv->mime_type); + attachment->priv->app = default_app; + } - if (!default_app) { + if (!attachment->priv->app) { g_set_error (error, EV_ATTACHMENT_ERROR, 0, - _("Couldn't open attachment '%s'"), + _("Couldn't open attachment “%s”"), attachment->priv->name); return FALSE; } - attachment->priv->app = default_app; - if (attachment->priv->tmp_uri && g_file_test (attachment->priv->tmp_uri, G_FILE_TEST_EXISTS)) { retval = ev_attachment_launch_app (attachment, error);