[latexila/wip/build-tools-revamp] Clear last build tool run operation
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [latexila/wip/build-tools-revamp] Clear last build tool run operation
- Date: Sat, 24 May 2014 13:07:10 +0000 (UTC)
commit cdc3c42f1de5dafcdbac8732ed740a97f264ac79
Author: Sébastien Wilmet <swilmet gnome org>
Date: Sat May 24 15:00:24 2014 +0200
Clear last build tool run operation
docs/reference/latexila-sections.txt | 2 ++
src/liblatexila/latexila-build-job.c | 16 ++++++++++++++++
src/liblatexila/latexila-build-job.h | 2 ++
src/liblatexila/latexila-build-tool.c | 27 +++++++++++++++++++++++++++
src/liblatexila/latexila-build-tool.h | 2 ++
src/liblatexila/latexila-post-processor.c | 2 ++
src/main_window_build_tools.vala | 12 +++++++++++-
7 files changed, 62 insertions(+), 1 deletions(-)
---
diff --git a/docs/reference/latexila-sections.txt b/docs/reference/latexila-sections.txt
index 1b830d0..f05cba2 100644
--- a/docs/reference/latexila-sections.txt
+++ b/docs/reference/latexila-sections.txt
@@ -69,6 +69,7 @@ latexila_build_tool_get_description
latexila_build_tool_to_xml
latexila_build_tool_run_async
latexila_build_tool_run_finish
+latexila_build_tool_clear
<SUBSECTION Standard>
LATEXILA_BUILD_TOOL
LATEXILA_BUILD_TOOL_CLASS
@@ -90,6 +91,7 @@ latexila_build_job_clone
latexila_build_job_to_xml
latexila_build_job_run_async
latexila_build_job_run_finish
+latexila_build_job_clear
<SUBSECTION Standard>
LATEXILA_BUILD_JOB
LATEXILA_BUILD_JOB_CLASS
diff --git a/src/liblatexila/latexila-build-job.c b/src/liblatexila/latexila-build-job.c
index 641fc99..5b176b3 100644
--- a/src/liblatexila/latexila-build-job.c
+++ b/src/liblatexila/latexila-build-job.c
@@ -572,5 +572,21 @@ latexila_build_job_run_finish (LatexilaBuildJob *build_job,
}
g_clear_object (&build_job->priv->task);
+ g_clear_object (&build_job->priv->file);
+
return succeed;
}
+
+/**
+ * latexila_build_job_clear:
+ * @build_job: a build job.
+ *
+ * Clears the last run operation. latexila_build_job_run_finish() must have been
+ * called before calling this function.
+ */
+void
+latexila_build_job_clear (LatexilaBuildJob *build_job)
+{
+ g_clear_object (&build_job->priv->build_view);
+ g_clear_object (&build_job->priv->post_processor);
+}
diff --git a/src/liblatexila/latexila-build-job.h b/src/liblatexila/latexila-build-job.h
index f4bef9b..bff5294 100644
--- a/src/liblatexila/latexila-build-job.h
+++ b/src/liblatexila/latexila-build-job.h
@@ -66,6 +66,8 @@ void latexila_build_job_run_async (LatexilaBuild
gboolean latexila_build_job_run_finish (LatexilaBuildJob *build_job,
GAsyncResult *result);
+void latexila_build_job_clear (LatexilaBuildJob *build_job);
+
G_END_DECLS
#endif /* __LATEXILA_BUILD_JOB_H__ */
diff --git a/src/liblatexila/latexila-build-tool.c b/src/liblatexila/latexila-build-tool.c
index a45ff02..c2914f0 100644
--- a/src/liblatexila/latexila-build-tool.c
+++ b/src/liblatexila/latexila-build-tool.c
@@ -787,5 +787,32 @@ latexila_build_tool_run_finish (LatexilaBuildTool *build_tool,
}
g_task_propagate_boolean (G_TASK (result), NULL);
+
g_clear_object (&build_tool->priv->task);
+ g_clear_object (&build_tool->priv->file);
+ g_clear_object (&build_tool->priv->build_view);
+}
+
+/**
+ * latexila_build_tool_clear:
+ * @build_tool: a build tool
+ *
+ * Clears the last run operation. latexila_build_tool_run_finish() must have
+ * been called before calling this function.
+ *
+ * The build tool can keep build messages or other information in memory. For
+ * example if a build job contains detailed messages, the two trees of messages
+ * must be kept in memory so it can switch between them when the "More details"
+ * button is toggled.
+ */
+void
+latexila_build_tool_clear (LatexilaBuildTool *build_tool)
+{
+ GList *l;
+
+ for (l = build_tool->priv->jobs->head; l != NULL; l = l->next)
+ {
+ LatexilaBuildJob *build_job = l->data;
+ latexila_build_job_clear (build_job);
+ }
}
diff --git a/src/liblatexila/latexila-build-tool.h b/src/liblatexila/latexila-build-tool.h
index 32c5dc6..b497fe8 100644
--- a/src/liblatexila/latexila-build-tool.h
+++ b/src/liblatexila/latexila-build-tool.h
@@ -72,6 +72,8 @@ void latexila_build_tool_run_async (LatexilaBui
void latexila_build_tool_run_finish (LatexilaBuildTool *build_tool,
GAsyncResult *result);
+void latexila_build_tool_clear (LatexilaBuildTool *build_tool);
+
G_END_DECLS
#endif /* __LATEXILA_BUILD_TOOL_H__ */
diff --git a/src/liblatexila/latexila-post-processor.c b/src/liblatexila/latexila-post-processor.c
index a5a461b..a53b698 100644
--- a/src/liblatexila/latexila-post-processor.c
+++ b/src/liblatexila/latexila-post-processor.c
@@ -228,6 +228,7 @@ latexila_post_processor_finalize (GObject *object)
if (pp->priv->line_buffer != NULL)
{
g_string_free (pp->priv->line_buffer, TRUE);
+ pp->priv->line_buffer = NULL;
}
G_OBJECT_CLASS (latexila_post_processor_parent_class)->finalize (object);
@@ -467,6 +468,7 @@ latexila_post_processor_process_finish (LatexilaPostProcessor *pp,
if (pp->priv->line_buffer != NULL)
{
g_string_free (pp->priv->line_buffer, TRUE);
+ pp->priv->line_buffer = NULL;
}
}
diff --git a/src/main_window_build_tools.vala b/src/main_window_build_tools.vala
index d44b596..dc8d2de 100644
--- a/src/main_window_build_tools.vala
+++ b/src/main_window_build_tools.vala
@@ -57,6 +57,9 @@ public class MainWindowBuildTools
private UIManager _ui_manager;
private Latexila.BuildView _build_view;
private BottomPanel _bottom_panel;
+
+ // Used for running a build tool, and clear it when running another build tool.
+ private Latexila.BuildTool? _build_tool;
private Cancellable? _cancellable;
private Gtk.ActionGroup _static_action_group;
@@ -350,7 +353,12 @@ public class MainWindowBuildTools
Utils.flush_queue ();
}
- _bottom_panel.show ();
+ if (_build_tool != null)
+ _build_tool.clear ();
+
+ _build_tool = tool;
+
+ /* Run the build tool */
Gtk.Action stop_exec = _static_action_group.get_action ("BuildStopExecution");
stop_exec.sensitive = true;
@@ -363,6 +371,8 @@ public class MainWindowBuildTools
_cancellable = null;
stop_exec.sensitive = false;
});
+
+ _bottom_panel.show ();
}
private void connect_toggle_actions ()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]