[gnome-builder/gnome-builder-3-28] config: avoid writeback due to attaching config
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/gnome-builder-3-28] config: avoid writeback due to attaching config
- Date: Wed, 11 Apr 2018 01:52:37 +0000 (UTC)
commit 9d46e2eb3ff1321797b58724f0e4f61fdd48d633
Author: Christian Hergert <chergert redhat com>
Date: Tue Apr 10 18:51:30 2018 -0700
config: avoid writeback due to attaching config
When we attach the config, we might set a new prefix based on what the
runtime requires. We should not force a writeback in this case as it
causes spurious .buildconfig files upon loading a project.
src/libide/config/ide-configuration.c | 33 ++++++++++++++++++++++++++++++++-
1 file changed, 32 insertions(+), 1 deletion(-)
---
diff --git a/src/libide/config/ide-configuration.c b/src/libide/config/ide-configuration.c
index ded7f5fae..9e91bb816 100644
--- a/src/libide/config/ide-configuration.c
+++ b/src/libide/config/ide-configuration.c
@@ -54,6 +54,8 @@ typedef struct
gint parallelism;
guint sequence;
+ guint block_changed;
+
guint dirty : 1;
guint debug : 1;
guint has_attached : 1;
@@ -124,12 +126,35 @@ _value_new (GType type)
return value;
}
+static void
+ide_configuration_block_changed (IdeConfiguration *self)
+{
+ IdeConfigurationPrivate *priv = ide_configuration_get_instance_private (self);
+
+ g_assert (IDE_IS_CONFIGURATION (self));
+
+ priv->block_changed++;
+}
+
+static void
+ide_configuration_unblock_changed (IdeConfiguration *self)
+{
+ IdeConfigurationPrivate *priv = ide_configuration_get_instance_private (self);
+
+ g_assert (IDE_IS_CONFIGURATION (self));
+
+ priv->block_changed--;
+}
+
static void
ide_configuration_emit_changed (IdeConfiguration *self)
{
+ IdeConfigurationPrivate *priv = ide_configuration_get_instance_private (self);
+
g_assert (IDE_IS_CONFIGURATION (self));
- g_signal_emit (self, signals [CHANGED], 0);
+ if (priv->block_changed == 0)
+ g_signal_emit (self, signals [CHANGED], 0);
}
static IdeRuntime *
@@ -879,6 +904,9 @@ ide_configuration_set_dirty (IdeConfiguration *self,
g_return_if_fail (IDE_IS_CONFIGURATION (self));
+ if (priv->block_changed)
+ IDE_EXIT;
+
dirty = !!dirty;
if (dirty != priv->dirty)
@@ -1507,5 +1535,8 @@ _ide_configuration_attach (IdeConfiguration *self)
self,
G_CONNECT_SWAPPED);
+ /* Update the runtime and potentially set prefix, but do not emit changed */
+ ide_configuration_block_changed (self);
ide_configuration_runtime_manager_items_changed (self, 0, 0, 0, runtime_manager);
+ ide_configuration_unblock_changed (self);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]