[gimp/metadata-browser] file-pdf-load: Return execution error when no pages exist



commit 9c4ada25cb5f76a857be029f4fcc077cb1193de4
Author: Mukund Sivaraman <muks banu com>
Date:   Wed Dec 7 18:23:26 2011 +0530

    file-pdf-load: Return execution error when no pages exist

 plug-ins/common/file-pdf-load.c |   13 ++++++-------
 1 files changed, 6 insertions(+), 7 deletions(-)
---
diff --git a/plug-ins/common/file-pdf-load.c b/plug-ins/common/file-pdf-load.c
index 4138e74..25334cf 100644
--- a/plug-ins/common/file-pdf-load.c
+++ b/plug-ins/common/file-pdf-load.c
@@ -77,7 +77,7 @@ static gint32            load_image        (PopplerDocument        *doc,
                                             guint32                 resolution,
                                             PdfSelectedPages       *pages);
 
-static gboolean          load_dialog       (PopplerDocument        *doc,
+static GimpPDBStatusType load_dialog       (PopplerDocument        *doc,
                                             PdfSelectedPages       *pages);
 
 static PopplerDocument * open_document     (const gchar            *filename,
@@ -369,10 +369,9 @@ run (const gchar      *name,
               break;
             }
 
-          if (load_dialog (doc, &pages))
+          status = load_dialog (doc, &pages);
+          if (status == GIMP_PDB_SUCCESS)
             gimp_set_data (LOAD_PROC, &loadvals, sizeof(loadvals));
-          else
-            status = GIMP_PDB_CANCEL;
           break;
 
         case GIMP_RUN_WITH_LAST_VALS:
@@ -1042,7 +1041,7 @@ thumbnail_thread (gpointer data)
   return NULL;
 }
 
-static gboolean
+static GimpPDBStatusType
 load_dialog (PopplerDocument  *doc,
              PdfSelectedPages *pages)
 {
@@ -1105,7 +1104,7 @@ load_dialog (PopplerDocument  *doc,
   if (n_pages <= 0)
   {
     gimp_message (_("Error getting number of pages from the given pdf file\n"));
-    return FALSE;
+    return GIMP_PDB_EXECUTION_ERROR;
   }
 
   gimp_page_selector_set_n_pages (GIMP_PAGE_SELECTOR (selector), n_pages);
@@ -1186,7 +1185,7 @@ load_dialog (PopplerDocument  *doc,
   thread_data.stop_thumbnailing = TRUE;
   g_thread_join (thread);
 
-  return run;
+  return run ? GIMP_PDB_SUCCESS : GIMP_PDB_CANCEL;
 }
 
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]