]> www.fi.muni.cz Git - evince.git/blobdiff - backend/ev-attachment.c
Fix page-label command line option. Bug #342070.
[evince.git] / backend / ev-attachment.c
index 9d5aaffbe398d9b150d7f079a0a674df8c835a4e..331473814f3a8cc95bcbe76c5bae0edf22cb6f0e 100644 (file)
@@ -364,11 +364,25 @@ ev_attachment_open (EvAttachment *attachment,
                    GError      **error)
 {
 
-       gboolean retval = FALSE;
+       gboolean                 retval = FALSE;
+       GnomeVFSMimeApplication *default_app = NULL;
 
-       if (!attachment->priv->app)
-               attachment->priv->app =
-                       gnome_vfs_mime_get_default_application (attachment->priv->mime_type);
+       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 (!attachment->priv->app) {
+               g_set_error (error,
+                            EV_ATTACHMENT_ERROR,
+                            0,
+                            _("Couldn't open attachment '%s'"),
+                            attachment->priv->name);
+               
+               return FALSE;
+       }
 
        if (attachment->priv->tmp_uri &&
            g_file_test (attachment->priv->tmp_uri, G_FILE_TEST_EXISTS)) {