[gnome-builder] libide/tweaks: add strv helper for bindings
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] libide/tweaks: add strv helper for bindings
- Date: Fri, 26 Aug 2022 21:35:07 +0000 (UTC)
commit 938f6b64b31194e0d9d96fb7217950b63a9a1d5a
Author: Christian Hergert <chergert redhat com>
Date: Fri Aug 26 14:31:41 2022 -0700
libide/tweaks: add strv helper for bindings
src/libide/tweaks/ide-tweaks-binding.c | 36 ++++++++++++++++++++++++++++++++++
src/libide/tweaks/ide-tweaks-binding.h | 5 +++++
2 files changed, 41 insertions(+)
---
diff --git a/src/libide/tweaks/ide-tweaks-binding.c b/src/libide/tweaks/ide-tweaks-binding.c
index 87f04677c..e523df180 100644
--- a/src/libide/tweaks/ide-tweaks-binding.c
+++ b/src/libide/tweaks/ide-tweaks-binding.c
@@ -471,3 +471,39 @@ ide_tweaks_binding_create_adjustment (IdeTweaksBinding *self)
return NULL;
}
+
+/**
+ * ide_tweaks_binding_get_strv:
+ * @self: a #IdeTweaksBinding
+ *
+ * Gets the value as a #GStrv.
+ *
+ * Returns: (transfer full) (nullable) (array zero-terminated=1) (element-type utf8): A
+ * newly allocated string array, or %NULL
+ */
+char **
+ide_tweaks_binding_get_strv (IdeTweaksBinding *self)
+{
+ g_auto(GValue) value = G_VALUE_INIT;
+
+ g_return_val_if_fail (IDE_IS_TWEAKS_BINDING (self), NULL);
+
+ g_value_init (&value, G_TYPE_STRV);
+ if (!ide_tweaks_binding_get_value (self, &value))
+ return NULL;
+
+ return g_value_dup_boxed (&value);
+}
+
+void
+ide_tweaks_binding_set_strv (IdeTweaksBinding *self,
+ const char * const *strv)
+{
+ g_auto(GValue) value = G_VALUE_INIT;
+
+ g_return_if_fail (IDE_IS_TWEAKS_BINDING (self));
+
+ g_value_init (&value, G_TYPE_STRV);
+ g_value_set_static_boxed (&value, strv);
+ 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 96b288bb4..befbd7ab3 100644
--- a/src/libide/tweaks/ide-tweaks-binding.h
+++ b/src/libide/tweaks/ide-tweaks-binding.h
@@ -67,6 +67,11 @@ IDE_AVAILABLE_IN_ALL
void ide_tweaks_binding_set_string (IdeTweaksBinding *self,
const char *string);
IDE_AVAILABLE_IN_ALL
+char **ide_tweaks_binding_get_strv (IdeTweaksBinding *self);
+IDE_AVAILABLE_IN_ALL
+void ide_tweaks_binding_set_strv (IdeTweaksBinding *self,
+ const char * const *strv);
+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]