[latexila] PostProcessor: return GList for get_messages()
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [latexila] PostProcessor: return GList for get_messages()
- Date: Sun, 5 Oct 2014 16:28:43 +0000 (UTC)
commit 7b4a4b72901a78b692976762dd925e9bcb14d7da
Author: Sébastien Wilmet <swilmet gnome org>
Date: Tue Sep 30 15:21:04 2014 +0200
PostProcessor: return GList for get_messages()
src/liblatexila/latexila-build-job.c | 2 +-
src/liblatexila/latexila-build-view.c | 14 ++++++--------
src/liblatexila/latexila-build-view.h | 2 +-
.../latexila-post-processor-all-output.c | 4 ++--
src/liblatexila/latexila-post-processor-latex.c | 4 ++--
src/liblatexila/latexila-post-processor-latexmk.c | 9 +++++----
src/liblatexila/latexila-post-processor.c | 14 +++++++-------
src/liblatexila/latexila-post-processor.h | 6 +++---
8 files changed, 27 insertions(+), 28 deletions(-)
---
diff --git a/src/liblatexila/latexila-build-job.c b/src/liblatexila/latexila-build-job.c
index 7d7a424..4e4ab7c 100644
--- a/src/liblatexila/latexila-build-job.c
+++ b/src/liblatexila/latexila-build-job.c
@@ -391,7 +391,7 @@ show_details_notify_cb (LatexilaBuildView *build_view,
GParamSpec *pspec,
LatexilaBuildJob *build_job)
{
- const GQueue *messages;
+ const GList *messages;
gboolean show_details;
latexila_build_view_remove_children (build_view,
diff --git a/src/liblatexila/latexila-build-view.c b/src/liblatexila/latexila-build-view.c
index f956a0a..bcfb125 100644
--- a/src/liblatexila/latexila-build-view.c
+++ b/src/liblatexila/latexila-build-view.c
@@ -784,7 +784,8 @@ latexila_build_view_append_single_message (LatexilaBuildView *build_view,
* latexila_build_view_append_messages:
* @build_view: a #LatexilaBuildView.
* @parent: the parent row in the tree.
- * @messages: the tree of #LatexilaBuildMsg's to append.
+ * @messages: (element-type LatexilaBuildMsg): the tree of #LatexilaBuildMsg's
+ * to append.
* @expand: whether to expand the @parent.
*
* Appends a tree of messages to the build view.
@@ -792,15 +793,12 @@ latexila_build_view_append_single_message (LatexilaBuildView *build_view,
void
latexila_build_view_append_messages (LatexilaBuildView *build_view,
GtkTreeIter *parent,
- const GQueue *messages,
+ const GList *messages,
gboolean expand)
{
- GList *l;
+ const GList *l;
- if (messages == NULL)
- return;
-
- for (l = messages->head; l != NULL; l = l->next)
+ for (l = messages; l != NULL; l = l->next)
{
GtkTreeIter child;
LatexilaBuildMsg *build_msg = l->data;
@@ -813,7 +811,7 @@ latexila_build_view_append_messages (LatexilaBuildView *build_view,
{
latexila_build_view_append_messages (build_view,
&child,
- build_msg->children,
+ build_msg->children->head,
build_msg->expand);
}
}
diff --git a/src/liblatexila/latexila-build-view.h b/src/liblatexila/latexila-build-view.h
index b4ece6a..5780242 100644
--- a/src/liblatexila/latexila-build-view.h
+++ b/src/liblatexila/latexila-build-view.h
@@ -153,7 +153,7 @@ GtkTreeIter latexila_build_view_append_single_message (LatexilaBui
void latexila_build_view_append_messages (LatexilaBuildView *build_view,
GtkTreeIter *parent,
- const GQueue *messages,
+ const GList *messages,
gboolean expand);
void latexila_build_view_remove_children (LatexilaBuildView *build_view,
diff --git a/src/liblatexila/latexila-post-processor-all-output.c
b/src/liblatexila/latexila-post-processor-all-output.c
index b2107ac..9509479 100644
--- a/src/liblatexila/latexila-post-processor-all-output.c
+++ b/src/liblatexila/latexila-post-processor-all-output.c
@@ -55,13 +55,13 @@ latexila_post_processor_all_output_process_line (LatexilaPostProcessor *post_pro
}
}
-static const GQueue *
+static const GList *
latexila_post_processor_all_output_get_messages (LatexilaPostProcessor *post_processor,
gboolean show_details)
{
LatexilaPostProcessorAllOutput *pp = LATEXILA_POST_PROCESSOR_ALL_OUTPUT (post_processor);
- return pp->priv->messages;
+ return pp->priv->messages != NULL ? pp->priv->messages->head : NULL;
}
static GQueue *
diff --git a/src/liblatexila/latexila-post-processor-latex.c b/src/liblatexila/latexila-post-processor-latex.c
index 3c4eb25..e43d3d9 100644
--- a/src/liblatexila/latexila-post-processor-latex.c
+++ b/src/liblatexila/latexila-post-processor-latex.c
@@ -1362,13 +1362,13 @@ latexila_post_processor_latex_process_line (LatexilaPostProcessor *post_processo
g_free (line);
}
-static const GQueue *
+static const GList *
latexila_post_processor_latex_get_messages (LatexilaPostProcessor *post_processor,
gboolean show_details)
{
LatexilaPostProcessorLatex *pp = LATEXILA_POST_PROCESSOR_LATEX (post_processor);
- return pp->priv->messages;
+ return pp->priv->messages != NULL ? pp->priv->messages->head : NULL;
}
static GQueue *
diff --git a/src/liblatexila/latexila-post-processor-latexmk.c
b/src/liblatexila/latexila-post-processor-latexmk.c
index 56181eb..580728b 100644
--- a/src/liblatexila/latexila-post-processor-latexmk.c
+++ b/src/liblatexila/latexila-post-processor-latexmk.c
@@ -589,7 +589,7 @@ latexila_post_processor_latexmk_end (LatexilaPostProcessor *post_processor)
process_all_output (pp);
}
-static const GQueue *
+static const GList *
latexila_post_processor_latexmk_get_messages (LatexilaPostProcessor *post_processor,
gboolean show_details)
{
@@ -601,11 +601,12 @@ latexila_post_processor_latexmk_get_messages (LatexilaPostProcessor *post_proces
if (has_details && !show_details)
{
/* TODO don't display the command line */
- g_assert (pp->priv->last_latex_sub_command != NULL);
- return pp->priv->last_latex_sub_command->children;
+ LatexilaBuildMsg *msg = pp->priv->last_latex_sub_command;
+ g_assert (msg != NULL);
+ return msg->children != NULL ? msg->children->head : NULL;
}
- return pp->priv->messages;
+ return pp->priv->messages != NULL ? pp->priv->messages->head : NULL;
}
static GQueue *
diff --git a/src/liblatexila/latexila-post-processor.c b/src/liblatexila/latexila-post-processor.c
index 5f4daf5..2beed7f 100644
--- a/src/liblatexila/latexila-post-processor.c
+++ b/src/liblatexila/latexila-post-processor.c
@@ -222,7 +222,7 @@ latexila_post_processor_end_default (LatexilaPostProcessor *pp)
/* Do nothing. */
}
-static const GQueue *
+static const GList *
latexila_post_processor_get_messages_default (LatexilaPostProcessor *pp,
gboolean show_details)
{
@@ -533,19 +533,19 @@ latexila_post_processor_end (LatexilaPostProcessor *pp)
* Obviously if the build view is passed to the post-processor, the latexmk
* post-processor can output its messages only at the end. But another reason to
* not pass the build view is for the unit tests. It is easier for the unit
- * tests to check the returned #GQueue than analyzing a #GtkTreeView. Of course
- * it would be possible to keep also the messages in a #GQueue and have this
+ * tests to check the returned #GList than analyzing a #GtkTreeView. Of course
+ * it would be possible to keep also the messages in a #GList and have this
* function only for the unit tests, but it takes more memory (unless a custom
* #GtkTreeModel is implemented), or another function is needed to configure
- * whether a #GQueue is kept in memory or not... It becomes a little too
+ * whether a #GList is kept in memory or not... It becomes a little too
* complicated, and doesn't really worth the effort as most users use latexmk.
*
* The current solution is "good enough". And "good enough" is... "good enough".
*
- * Returns: (transfer none) (nullable): the tree of filtered messages, or %NULL.
- * Element types: #LatexilaBuildMsg.
+ * Returns: (transfer none) (element-type LatexilaBuildMsg): the tree of
+ * filtered messages.
*/
-const GQueue *
+const GList *
latexila_post_processor_get_messages (LatexilaPostProcessor *pp,
gboolean show_details)
{
diff --git a/src/liblatexila/latexila-post-processor.h b/src/liblatexila/latexila-post-processor.h
index 8d98bd3..cec0acc 100644
--- a/src/liblatexila/latexila-post-processor.h
+++ b/src/liblatexila/latexila-post-processor.h
@@ -73,8 +73,8 @@ struct _LatexilaPostProcessorClass
void (* end) (LatexilaPostProcessor *pp);
- const GQueue * (* get_messages) (LatexilaPostProcessor *pp,
- gboolean show_details);
+ const GList * (* get_messages) (LatexilaPostProcessor *pp,
+ gboolean show_details);
GQueue * (* take_messages) (LatexilaPostProcessor *pp);
};
@@ -104,7 +104,7 @@ void latexila_post_processor_process_line (LatexilaP
void latexila_post_processor_end (LatexilaPostProcessor *pp);
-const GQueue * latexila_post_processor_get_messages (LatexilaPostProcessor *pp,
+const GList * latexila_post_processor_get_messages (LatexilaPostProcessor *pp,
gboolean show_details);
GQueue * latexila_post_processor_take_messages (LatexilaPostProcessor *pp);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]