[gnome-builder] libide/tweaks: implement get_internal_child fallbacks
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] libide/tweaks: implement get_internal_child fallbacks
- Date: Sun, 31 Jul 2022 12:01:45 +0000 (UTC)
commit a0281dd2bf20050d6ec9c38ff868845dce37f8a7
Author: Christian Hergert <chergert redhat com>
Date: Sun Jul 31 04:17:43 2022 -0700
libide/tweaks: implement get_internal_child fallbacks
This is handy so that we can resolve internal children that have been
joined across template ui mergining.
src/libide/tweaks/ide-tweaks-item.c | 27 +++++++++++++++++++++++++++
1 file changed, 27 insertions(+)
---
diff --git a/src/libide/tweaks/ide-tweaks-item.c b/src/libide/tweaks/ide-tweaks-item.c
index a80b702c7..ba1d5b610 100644
--- a/src/libide/tweaks/ide-tweaks-item.c
+++ b/src/libide/tweaks/ide-tweaks-item.c
@@ -467,10 +467,37 @@ ide_tweaks_item_add_child (GtkBuildable *buildable,
ide_tweaks_item_insert_after (IDE_TWEAKS_ITEM (child), self, NULL);
}
+static GObject *
+ide_tweaks_item_get_internal_child (GtkBuildable *buildable,
+ GtkBuilder *builder,
+ const char *child_name)
+{
+ IdeTweaksItem *self = (IdeTweaksItem *)buildable;
+
+ g_assert (IDE_IS_TWEAKS_ITEM (self));
+ g_assert (GTK_IS_BUILDER (builder));
+ g_assert (child_name != NULL);
+
+ for (IdeTweaksItem *child = ide_tweaks_item_get_first_child (self);
+ child != NULL;
+ child = ide_tweaks_item_get_next_sibling (child))
+ {
+ const char *buildable_id = gtk_buildable_get_buildable_id (GTK_BUILDABLE (child));
+
+ if (ide_str_equal0 (buildable_id, child_name))
+ return G_OBJECT (child);
+ }
+
+ return NULL;
+}
+
static void
buildable_iface_init (GtkBuildableIface *iface)
{
iface->add_child = ide_tweaks_item_add_child;
+ iface->get_internal_child = ide_tweaks_item_get_internal_child;
+}
+
void
_ide_tweaks_item_printf (IdeTweaksItem *self,
GString *string,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]