[gnome-builder] plugins/valgrind: add tweaks for valgrind



commit 56b40b30739f76567673b7982c9e2adf72cd576e
Author: Christian Hergert <chergert redhat com>
Date:   Fri Aug 19 18:07:03 2022 -0700

    plugins/valgrind: add tweaks for valgrind

 src/plugins/valgrind/gbp-valgrind-tweaks-addin.c | 44 +++++++++++
 src/plugins/valgrind/gbp-valgrind-tweaks-addin.h | 31 ++++++++
 src/plugins/valgrind/meson.build                 |  1 +
 src/plugins/valgrind/tweaks.ui                   | 99 ++++++++++++++++++++++++
 src/plugins/valgrind/valgrind-plugin.c           |  4 +
 src/plugins/valgrind/valgrind.gresource.xml      |  1 +
 6 files changed, 180 insertions(+)
---
diff --git a/src/plugins/valgrind/gbp-valgrind-tweaks-addin.c 
b/src/plugins/valgrind/gbp-valgrind-tweaks-addin.c
new file mode 100644
index 000000000..ff297f7d6
--- /dev/null
+++ b/src/plugins/valgrind/gbp-valgrind-tweaks-addin.c
@@ -0,0 +1,44 @@
+/* gbp-valgrind-tweaks-addin.c
+ *
+ * Copyright 2022 Christian Hergert <chergert redhat com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
+ */
+
+#define G_LOG_DOMAIN "gbp-valgrind-tweaks-addin"
+
+#include "config.h"
+
+#include "gbp-valgrind-tweaks-addin.h"
+
+struct _GbpValgrindTweaksAddin
+{
+  IdeTweaksAddin parent_instance;
+};
+
+G_DEFINE_FINAL_TYPE (GbpValgrindTweaksAddin, gbp_valgrind_tweaks_addin, IDE_TYPE_TWEAKS_ADDIN)
+
+static void
+gbp_valgrind_tweaks_addin_class_init (GbpValgrindTweaksAddinClass *klass)
+{
+}
+
+static void
+gbp_valgrind_tweaks_addin_init (GbpValgrindTweaksAddin *self)
+{
+  ide_tweaks_addin_set_resource_paths (IDE_TWEAKS_ADDIN (self),
+                                       IDE_STRV_INIT ("/plugins/valgrind/tweaks.ui"));
+}
diff --git a/src/plugins/valgrind/gbp-valgrind-tweaks-addin.h 
b/src/plugins/valgrind/gbp-valgrind-tweaks-addin.h
new file mode 100644
index 000000000..c69382f96
--- /dev/null
+++ b/src/plugins/valgrind/gbp-valgrind-tweaks-addin.h
@@ -0,0 +1,31 @@
+/* gbp-valgrind-tweaks-addin.h
+ *
+ * Copyright 2022 Christian Hergert <chergert redhat com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
+ */
+
+#pragma once
+
+#include <libide-tweaks.h>
+
+G_BEGIN_DECLS
+
+#define GBP_TYPE_VALGRIND_TWEAKS_ADDIN (gbp_valgrind_tweaks_addin_get_type())
+
+G_DECLARE_FINAL_TYPE (GbpValgrindTweaksAddin, gbp_valgrind_tweaks_addin, GBP, VALGRIND_TWEAKS_ADDIN, 
IdeTweaksAddin)
+
+G_END_DECLS
diff --git a/src/plugins/valgrind/meson.build b/src/plugins/valgrind/meson.build
index b32e788d1..23e61c9a1 100644
--- a/src/plugins/valgrind/meson.build
+++ b/src/plugins/valgrind/meson.build
@@ -3,6 +3,7 @@ if get_option('plugin_valgrind')
 plugins_sources += files([
   'valgrind-plugin.c',
   'gbp-valgrind-tool.c',
+  'gbp-valgrind-tweaks-addin.c',
 ])
 
 plugin_valgrind_resources = gnome.compile_resources(
diff --git a/src/plugins/valgrind/tweaks.ui b/src/plugins/valgrind/tweaks.ui
new file mode 100644
index 000000000..45e22a71f
--- /dev/null
+++ b/src/plugins/valgrind/tweaks.ui
@@ -0,0 +1,99 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <template class="IdeTweaks">
+    <child>
+      <object class="IdeTweaksSettings" id="settings_org_gnome_builder_valgrind">
+        <property name="schema-id">org.gnome.builder.valgrind</property>
+        <property name="application-only">true</property>
+      </object>
+    </child>
+    <child internal-child="foundry_section">
+      <object class="IdeTweaksSection">
+        <child internal-child="build_page">
+          <object class="IdeTweaksPage">
+            <child>
+              <object class="IdeTweaksPage" id="build_valgrind_page">
+                <property name="icon-name">system-run-symbolic</property>
+                <property name="title" translatable="yes">Valgrind</property>
+                <child>
+                  <object class="IdeTweaksGroup">
+                    <property name="title" translatable="yes">Leak Kinds</property>
+                    <child>
+                      <object class="IdeTweaksRadio">
+                        <property name="title" translatable="yes">Definite</property>
+                        <property name="subtitle" translatable="yes">Include definite leaks in report 
summary</property>
+                        <property 
name="action-name">settings.org.gnome.builder.valgrind.leak-kind-definite</property>
+                      </object>
+                    </child>
+                    <child>
+                      <object class="IdeTweaksRadio">
+                        <property name="title" translatable="yes">Possible</property>
+                        <property name="subtitle" translatable="yes">Include possible leaks in report 
summary</property>
+                        <property 
name="action-name">settings.org.gnome.builder.valgrind.leak-kind-possible</property>
+                      </object>
+                    </child>
+                    <child>
+                      <object class="IdeTweaksRadio">
+                        <property name="title" translatable="yes">Indirect</property>
+                        <property name="subtitle" translatable="yes">Include indirect leaks in report 
summary</property>
+                        <property 
name="action-name">settings.org.gnome.builder.valgrind.leak-kind-indirect</property>
+                      </object>
+                    </child>
+                    <child>
+                      <object class="IdeTweaksRadio">
+                        <property name="title" translatable="yes">Reachable</property>
+                        <property name="subtitle" translatable="yes">Include reachable leaks in report 
summary</property>
+                        <property 
name="action-name">settings.org.gnome.builder.valgrind.leak-kind-reachable</property>
+                      </object>
+                    </child>
+                  </object>
+                </child>
+                <child>
+                  <object class="IdeTweaksGroup">
+                    <child>
+                      <object class="IdeTweaksSwitch">
+                        <property name="title" translatable="yes">Track Origins</property>
+                        <property name="subtitle" translatable="yes">Show origin of undefined 
values</property>
+                        <property 
name="action-name">settings.org.gnome.builder.valgrind.track-origins</property>
+                      </object>
+                    </child>
+                  </object>
+                </child>
+                <child>
+                  <object class="IdeTweaksGroup">
+                    <child>
+                      <object class="IdeTweaksCombo">
+                        <property name="title" translatable="yes">Leak Check</property>
+                        <property name="subtitle" translatable="yes">Search for memory leaks at 
exit</property>
+                        <property name="settings">settings_org_gnome_builder_valgrind</property>
+                        <property name="key">leak-check</property>
+                        <child>
+                          <object class="IdeTweaksChoice">
+                            <property name="title">No</property>
+                            <property name="action-target">'no'</property>
+                          </object>
+                        </child>
+                        <child>
+                          <object class="IdeTweaksChoice">
+                            <property name="title">Summary</property>
+                            <property name="action-target">'summary'</property>
+                          </object>
+                        </child>
+                        <child>
+                          <object class="IdeTweaksChoice">
+                            <property name="title">Full</property>
+                            <property name="action-target">'full'</property>
+                          </object>
+                        </child>
+                      </object>
+                    </child>
+                  </object>
+                </child>
+              </object>
+            </child>
+          </object>
+        </child>
+      </object>
+    </child>
+  </template>
+</interface>
diff --git a/src/plugins/valgrind/valgrind-plugin.c b/src/plugins/valgrind/valgrind-plugin.c
index bc798e63d..636ede814 100644
--- a/src/plugins/valgrind/valgrind-plugin.c
+++ b/src/plugins/valgrind/valgrind-plugin.c
@@ -27,6 +27,7 @@
 #include <libide-gui.h>
 
 #include "gbp-valgrind-tool.h"
+#include "gbp-valgrind-tweaks-addin.h"
 
 _IDE_EXTERN void
 _gbp_valgrind_register_types (PeasObjectModule *module)
@@ -34,4 +35,7 @@ _gbp_valgrind_register_types (PeasObjectModule *module)
   peas_object_module_register_extension_type (module,
                                               IDE_TYPE_RUN_TOOL,
                                               GBP_TYPE_VALGRIND_TOOL);
+  peas_object_module_register_extension_type (module,
+                                              IDE_TYPE_TWEAKS_ADDIN,
+                                              GBP_TYPE_VALGRIND_TWEAKS_ADDIN);
 }
diff --git a/src/plugins/valgrind/valgrind.gresource.xml b/src/plugins/valgrind/valgrind.gresource.xml
index bfc01b311..26c14069c 100644
--- a/src/plugins/valgrind/valgrind.gresource.xml
+++ b/src/plugins/valgrind/valgrind.gresource.xml
@@ -3,6 +3,7 @@
   <gresource prefix="/plugins/valgrind">
     <file>valgrind.plugin</file>
     <file preprocess="xml-stripblanks">gtk/menus.ui</file>
+    <file preprocess="xml-stripblanks">tweaks.ui</file>
     <file>gtk/keybindings.json</file>
   </gresource>
 </gresources>


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