[gnome-builder/wip/gtk4-port] libide/gui: add helper to add content widget
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/wip/gtk4-port] libide/gui: add helper to add content widget
- Date: Thu, 21 Apr 2022 00:10:47 +0000 (UTC)
commit c53134c3fb62ea0ed41fcc0e7227efe503deab82
Author: Christian Hergert <chergert redhat com>
Date: Wed Apr 20 16:53:35 2022 -0700
libide/gui: add helper to add content widget
We need this for cases where we cannot use a template.
src/libide/gui/ide-page.c | 15 +++++++++++++--
src/libide/gui/ide-page.h | 3 +++
2 files changed, 16 insertions(+), 2 deletions(-)
---
diff --git a/src/libide/gui/ide-page.c b/src/libide/gui/ide-page.c
index c09fe9f6a..aa93e592c 100644
--- a/src/libide/gui/ide-page.c
+++ b/src/libide/gui/ide-page.c
@@ -496,6 +496,18 @@ ide_page_get_file_or_directory (IdePage *self)
return NULL;
}
+void
+ide_page_add_content_widget (IdePage *self,
+ GtkWidget *widget)
+{
+ IdePagePrivate *priv = ide_page_get_instance_private (self);
+
+ g_return_if_fail (IDE_IS_PAGE (self));
+ g_return_if_fail (GTK_IS_WIDGET (widget));
+
+ gtk_box_append (priv->content_box, widget);
+}
+
static void
ide_page_add_child (GtkBuildable *buildable,
GtkBuilder *builder,
@@ -503,7 +515,6 @@ ide_page_add_child (GtkBuildable *buildable,
const char *name)
{
IdePage *self = (IdePage *)buildable;
- IdePagePrivate *priv = ide_page_get_instance_private (self);
g_assert (IDE_IS_PAGE (self));
g_assert (GTK_IS_BUILDER (builder));
@@ -513,7 +524,7 @@ ide_page_add_child (GtkBuildable *buildable,
{
if (g_strcmp0 (name, "content") == 0)
{
- gtk_box_append (priv->content_box, GTK_WIDGET (object));
+ ide_page_add_content_widget (self, GTK_WIDGET (object));
return;
}
}
diff --git a/src/libide/gui/ide-page.h b/src/libide/gui/ide-page.h
index b462d1121..c0bbbafae 100644
--- a/src/libide/gui/ide-page.h
+++ b/src/libide/gui/ide-page.h
@@ -107,5 +107,8 @@ IDE_AVAILABLE_IN_ALL
void ide_page_destroy (IdePage *self);
IDE_AVAILABLE_IN_ALL
void ide_clear_page (IdePage **location);
+IDE_AVAILABLE_IN_ALL
+void ide_page_add_content_widget (IdePage *self,
+ GtkWidget *widget);
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]