[latexila] PostProcessor: succeeded parameter



commit 17f804bd2def362a4e86be4e94b587e1e7259c9c
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Tue Sep 30 17:27:50 2014 +0200

    PostProcessor: succeeded parameter

 src/liblatexila/latexila-build-job.c              |    3 ++-
 src/liblatexila/latexila-post-processor-latex.c   |    3 ++-
 src/liblatexila/latexila-post-processor-latexmk.c |   13 +++++++------
 src/liblatexila/latexila-post-processor.c         |   17 ++++++++++++-----
 src/liblatexila/latexila-post-processor.h         |    9 ++++++---
 5 files changed, 29 insertions(+), 16 deletions(-)
---
diff --git a/src/liblatexila/latexila-build-job.c b/src/liblatexila/latexila-build-job.c
index 4e4ab7c..ceac535 100644
--- a/src/liblatexila/latexila-build-job.c
+++ b/src/liblatexila/latexila-build-job.c
@@ -415,7 +415,8 @@ post_processor_cb (LatexilaPostProcessor *pp,
 {
   gboolean has_details;
 
-  latexila_post_processor_process_finish (pp, result);
+  /* TODO set succeeded */
+  latexila_post_processor_process_finish (pp, result, TRUE);
 
   g_object_get (pp, "has-details", &has_details, NULL);
 
diff --git a/src/liblatexila/latexila-post-processor-latex.c b/src/liblatexila/latexila-post-processor-latex.c
index e43d3d9..7e585d6 100644
--- a/src/liblatexila/latexila-post-processor-latex.c
+++ b/src/liblatexila/latexila-post-processor-latex.c
@@ -308,7 +308,8 @@ latexila_post_processor_latex_start (LatexilaPostProcessor *post_processor,
 }
 
 static void
-latexila_post_processor_latex_end (LatexilaPostProcessor *post_processor)
+latexila_post_processor_latex_end (LatexilaPostProcessor *post_processor,
+                                   gboolean               succeeded)
 {
   LatexilaPostProcessorLatex *pp = LATEXILA_POST_PROCESSOR_LATEX (post_processor);
   LatexilaBuildMsg *cur_msg = pp->priv->cur_msg;
diff --git a/src/liblatexila/latexila-post-processor-latexmk.c 
b/src/liblatexila/latexila-post-processor-latexmk.c
index afee449..fbb397f 100644
--- a/src/liblatexila/latexila-post-processor-latexmk.c
+++ b/src/liblatexila/latexila-post-processor-latexmk.c
@@ -515,7 +515,8 @@ latexila_post_processor_latexmk_process_line (LatexilaPostProcessor *post_proces
 }
 
 static void
-run_latex_post_processor (LatexilaPostProcessorLatexmk *pp)
+run_latex_post_processor (LatexilaPostProcessorLatexmk *pp,
+                          gboolean                      succeeded)
 {
   LatexilaPostProcessor *pp_latex;
   LatexilaBuildMsg *msg;
@@ -535,7 +536,7 @@ run_latex_post_processor (LatexilaPostProcessorLatexmk *pp)
   g_queue_free (pp->priv->last_latex_lines);
   pp->priv->last_latex_lines = NULL;
 
-  latexila_post_processor_end (pp_latex);
+  latexila_post_processor_end (pp_latex, succeeded);
 
   msg = pp->priv->last_latex_sub_command;
 
@@ -562,8 +563,7 @@ run_latex_post_processor (LatexilaPostProcessorLatexmk *pp)
    * If an error has occured, we verify if the last command was a latex command.
    * If it is the case, there is no need to show all output.
    */
-  /* TODO check the subprocess exit code */
-  if (pp->priv->last_rule_is_latex_rule)
+  if (succeeded || pp->priv->last_rule_is_latex_rule)
     g_object_set (pp, "has-details", TRUE, NULL);
 }
 
@@ -590,12 +590,13 @@ process_all_output (LatexilaPostProcessorLatexmk *pp)
 }
 
 static void
-latexila_post_processor_latexmk_end (LatexilaPostProcessor *post_processor)
+latexila_post_processor_latexmk_end (LatexilaPostProcessor *post_processor,
+                                     gboolean               succeeded)
 {
   LatexilaPostProcessorLatexmk *pp = LATEXILA_POST_PROCESSOR_LATEXMK (post_processor);
 
   if (pp->priv->last_latex_sub_command != NULL)
-    run_latex_post_processor (pp);
+    run_latex_post_processor (pp, succeeded);
 
   if (pp->priv->messages->length == 0)
     process_all_output (pp);
diff --git a/src/liblatexila/latexila-post-processor.c b/src/liblatexila/latexila-post-processor.c
index 2beed7f..950f72a 100644
--- a/src/liblatexila/latexila-post-processor.c
+++ b/src/liblatexila/latexila-post-processor.c
@@ -217,7 +217,8 @@ latexila_post_processor_process_line_default (LatexilaPostProcessor *pp,
 }
 
 static void
-latexila_post_processor_end_default (LatexilaPostProcessor *pp)
+latexila_post_processor_end_default (LatexilaPostProcessor *pp,
+                                     gboolean               succeeded)
 {
   /* Do nothing. */
 }
@@ -436,6 +437,7 @@ latexila_post_processor_process_async (LatexilaPostProcessor *pp,
  * latexila_post_processor_process_finish:
  * @pp: a post-processor.
  * @result: a #GAsyncResult.
+ * @succeeded: whether the subprocess has succeeded.
  *
  * Finishes an operation started with latexila_post_processor_process_async().
  * After calling this function, you can get the filtered messages with
@@ -443,13 +445,14 @@ latexila_post_processor_process_async (LatexilaPostProcessor *pp,
  */
 void
 latexila_post_processor_process_finish (LatexilaPostProcessor *pp,
-                                        GAsyncResult          *result)
+                                        GAsyncResult          *result,
+                                        gboolean               succeeded)
 {
   g_return_if_fail (g_task_is_valid (result, pp));
 
   g_task_propagate_boolean (G_TASK (result), NULL);
 
-  latexila_post_processor_end (pp);
+  latexila_post_processor_end (pp, succeeded);
 
   g_clear_object (&pp->priv->task);
   g_clear_object (&pp->priv->stream);
@@ -501,17 +504,21 @@ latexila_post_processor_process_line (LatexilaPostProcessor *pp,
 /**
  * latexila_post_processor_end:
  * @pp: a #LatexilaPostProcessor.
+ * @succeeded: whether the subprocess has succeeded.
  *
  * Manually ends the processing.
  *
  * Not needed if you use latexila_post_processor_process_async().
  */
 void
-latexila_post_processor_end (LatexilaPostProcessor *pp)
+latexila_post_processor_end (LatexilaPostProcessor *pp,
+                             gboolean               succeeded)
 {
   g_return_if_fail (LATEXILA_IS_POST_PROCESSOR (pp));
 
-  return LATEXILA_POST_PROCESSOR_GET_CLASS (pp)->end (pp);
+  succeeded = succeeded != FALSE;
+
+  return LATEXILA_POST_PROCESSOR_GET_CLASS (pp)->end (pp, succeeded);
 }
 
 /**
diff --git a/src/liblatexila/latexila-post-processor.h b/src/liblatexila/latexila-post-processor.h
index cec0acc..55f32a8 100644
--- a/src/liblatexila/latexila-post-processor.h
+++ b/src/liblatexila/latexila-post-processor.h
@@ -71,7 +71,8 @@ struct _LatexilaPostProcessorClass
   void (* process_line) (LatexilaPostProcessor *pp,
                          gchar                 *line);
 
-  void (* end) (LatexilaPostProcessor *pp);
+  void (* end) (LatexilaPostProcessor *pp,
+                gboolean               succeeded);
 
   const GList * (* get_messages) (LatexilaPostProcessor *pp,
                                   gboolean               show_details);
@@ -94,7 +95,8 @@ void                    latexila_post_processor_process_async         (LatexilaP
                                                                        gpointer               user_data);
 
 void                    latexila_post_processor_process_finish        (LatexilaPostProcessor *pp,
-                                                                       GAsyncResult          *result);
+                                                                       GAsyncResult          *result,
+                                                                       gboolean               succeeded);
 
 void                    latexila_post_processor_start                 (LatexilaPostProcessor *pp,
                                                                        GFile                 *file);
@@ -102,7 +104,8 @@ void                    latexila_post_processor_start                 (LatexilaP
 void                    latexila_post_processor_process_line          (LatexilaPostProcessor *pp,
                                                                        gchar                 *line);
 
-void                    latexila_post_processor_end                   (LatexilaPostProcessor *pp);
+void                    latexila_post_processor_end                   (LatexilaPostProcessor *pp,
+                                                                       gboolean               succeeded);
 
 const GList *           latexila_post_processor_get_messages          (LatexilaPostProcessor *pp,
                                                                        gboolean               show_details);


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