[gnome-builder] plugin: buildui: add option to clear build log pane on rebuild



commit 58a4c2bf9a2eee2acc9e83dee0b5e655951cf337
Author: Tomi Lähteenmäki <lihis lihis net>
Date:   Sun Oct 17 13:41:45 2021 +0300

    plugin: buildui: add option to clear build log pane on rebuild
    
    When enabled, pane will be cleared on build/rebuild/clean.
    
    Closes #1376

 data/gsettings/org.gnome.builder.build.gschema.xml | 5 +++++
 src/libide/gui/ide-preferences-builtin.c           | 1 +
 src/plugins/buildui/gbp-buildui-log-pane.c         | 6 ++++++
 src/plugins/buildui/gbp-buildui-log-pane.h         | 2 ++
 src/plugins/buildui/gbp-buildui-workspace-addin.c  | 4 ++++
 5 files changed, 18 insertions(+)
---
diff --git a/data/gsettings/org.gnome.builder.build.gschema.xml 
b/data/gsettings/org.gnome.builder.build.gschema.xml
index bf6cb0997..f5f3d4aa1 100644
--- a/data/gsettings/org.gnome.builder.build.gschema.xml
+++ b/data/gsettings/org.gnome.builder.build.gschema.xml
@@ -6,6 +6,11 @@
       <summary>Build Parallelism</summary>
       <description>Number of workers to use when performing builds. -1 for sensible default. 0 for number of 
CPU.</description>
     </key>
+    <key name="clear-build-log-pane" type="b">
+      <default>true</default>
+      <summary>Clear build logs</summary>
+      <description>If enabled, build log pane will be cleared on rebuild.</description>
+    </key>
     <key name="allow-network-when-metered" type="b">
       <default>false</default>
       <summary>Allow network when metered</summary>
diff --git a/src/libide/gui/ide-preferences-builtin.c b/src/libide/gui/ide-preferences-builtin.c
index 36a39a69d..bdd471a90 100644
--- a/src/libide/gui/ide-preferences-builtin.c
+++ b/src/libide/gui/ide-preferences-builtin.c
@@ -406,6 +406,7 @@ ide_preferences_builtin_register_build (DzlPreferences *preferences)
   g_signal_connect (widget, "input", G_CALLBACK (workers_input), NULL);
   g_signal_connect (widget, "output", G_CALLBACK (workers_output), NULL);
 
+  dzl_preferences_add_switch (preferences, "build", "basic", "org.gnome.builder.build", 
"clear-build-log-pane", NULL, NULL, _("Clear build logs"), _("Clear build log pane on rebuild"), NULL, 10);
   dzl_preferences_add_switch (preferences, "build", "basic", "org.gnome.builder", "clear-cache-at-startup", 
NULL, NULL, _("Clear build cache at startup"), _("Expired caches will be purged when Builder is started"), 
NULL, 10);
 
   dzl_preferences_add_list_group (preferences, "build", "network", _("Network"), GTK_SELECTION_NONE, 100);
diff --git a/src/plugins/buildui/gbp-buildui-log-pane.c b/src/plugins/buildui/gbp-buildui-log-pane.c
index bd6b02c9c..cc567fab8 100644
--- a/src/plugins/buildui/gbp-buildui-log-pane.c
+++ b/src/plugins/buildui/gbp-buildui-log-pane.c
@@ -130,6 +130,12 @@ gbp_buildui_log_pane_set_pipeline (GbpBuilduiLogPane *self,
     }
 }
 
+void
+gbp_buildui_log_pane_clear (GbpBuilduiLogPane *self)
+{
+  gbp_buildui_log_pane_reset_view (self);
+}
+
 static void
 gbp_buildui_log_pane_window_title_changed (GbpBuilduiLogPane *self,
                                            IdeTerminal       *terminal)
diff --git a/src/plugins/buildui/gbp-buildui-log-pane.h b/src/plugins/buildui/gbp-buildui-log-pane.h
index 23b84d903..0f6cab324 100644
--- a/src/plugins/buildui/gbp-buildui-log-pane.h
+++ b/src/plugins/buildui/gbp-buildui-log-pane.h
@@ -33,4 +33,6 @@ G_DECLARE_FINAL_TYPE (GbpBuilduiLogPane, gbp_buildui_log_pane, GBP, BUILDUI_LOG_
 void gbp_buildui_log_pane_set_pipeline (GbpBuilduiLogPane *self,
                                         IdePipeline  *pipeline);
 
+void gbp_buildui_log_pane_clear (GbpBuilduiLogPane *self);
+
 G_END_DECLS
diff --git a/src/plugins/buildui/gbp-buildui-workspace-addin.c 
b/src/plugins/buildui/gbp-buildui-workspace-addin.c
index ee40e8eed..55435cd14 100644
--- a/src/plugins/buildui/gbp-buildui-workspace-addin.c
+++ b/src/plugins/buildui/gbp-buildui-workspace-addin.c
@@ -226,6 +226,10 @@ gbp_buildui_workspace_addin_build_started (GbpBuilduiWorkspaceAddin *self,
 
   IDE_TRACE_MSG ("Pipeline phase 0x%x requested", phase);
 
+  g_autoptr(GSettings) settings = g_settings_new ("org.gnome.builder.build");
+  if (g_settings_get_boolean (settings, "clear-build-log-pane"))
+      gbp_buildui_log_pane_clear (self->log_pane);
+
   if (phase > IDE_PIPELINE_PHASE_CONFIGURE)
     dzl_dock_item_present (DZL_DOCK_ITEM (self->log_pane));
 


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