[gnome-builder] libide/tweaks: add set string helper



commit 7833d674c36f6a51886a5d522c5035d3e0e75c72
Author: Christian Hergert <chergert redhat com>
Date:   Thu Aug 25 21:47:29 2022 -0700

    libide/tweaks: add set string helper

 src/libide/tweaks/ide-tweaks-binding.c | 13 +++++++++++++
 src/libide/tweaks/ide-tweaks-binding.h |  3 +++
 2 files changed, 16 insertions(+)
---
diff --git a/src/libide/tweaks/ide-tweaks-binding.c b/src/libide/tweaks/ide-tweaks-binding.c
index 7faa912ba..9c2586846 100644
--- a/src/libide/tweaks/ide-tweaks-binding.c
+++ b/src/libide/tweaks/ide-tweaks-binding.c
@@ -438,3 +438,16 @@ ide_tweaks_binding_set_variant (IdeTweaksBinding *self,
 
   ide_tweaks_binding_set_value (self, &value);
 }
+
+void
+ide_tweaks_binding_set_string (IdeTweaksBinding *self,
+                               const char       *string)
+{
+  g_auto(GValue) value = G_VALUE_INIT;
+
+  g_return_if_fail (IDE_IS_TWEAKS_BINDING (self));
+
+  g_value_init (&value, G_TYPE_STRING);
+  g_value_set_static_string (&value, string);
+  ide_tweaks_binding_set_value (self, &value);
+}
diff --git a/src/libide/tweaks/ide-tweaks-binding.h b/src/libide/tweaks/ide-tweaks-binding.h
index b24d79846..5942a225d 100644
--- a/src/libide/tweaks/ide-tweaks-binding.h
+++ b/src/libide/tweaks/ide-tweaks-binding.h
@@ -63,6 +63,9 @@ void     ide_tweaks_binding_set_variant         (IdeTweaksBinding          *self
 IDE_AVAILABLE_IN_ALL
 char    *ide_tweaks_binding_dup_string          (IdeTweaksBinding          *self);
 IDE_AVAILABLE_IN_ALL
+void     ide_tweaks_binding_set_string          (IdeTweaksBinding          *self,
+                                                 const char                *string);
+IDE_AVAILABLE_IN_ALL
 void     ide_tweaks_binding_bind                (IdeTweaksBinding          *self,
                                                  gpointer                   instance,
                                                  const char                *property_name);


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