[gnome-builder] gui: allow setting placeholder for frame
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] gui: allow setting placeholder for frame
- Date: Sat, 27 Apr 2019 18:57:02 +0000 (UTC)
commit 9a682008dddcef851977fa7cec1a1b9c07efd875
Author: Christian Hergert <chergert redhat com>
Date: Sat Apr 27 11:56:06 2019 -0700
gui: allow setting placeholder for frame
src/libide/gui/ide-frame.c | 31 +++++++++++++++++++------------
src/libide/gui/ide-frame.h | 3 +++
2 files changed, 22 insertions(+), 12 deletions(-)
---
diff --git a/src/libide/gui/ide-frame.c b/src/libide/gui/ide-frame.c
index 67c445cca..5387944ec 100644
--- a/src/libide/gui/ide-frame.c
+++ b/src/libide/gui/ide-frame.c
@@ -18,8 +18,6 @@
* SPDX-License-Identifier: GPL-3.0-or-later
*/
-
-
#define G_LOG_DOMAIN "ide-frame"
#include "config.h"
@@ -1421,20 +1419,12 @@ ide_frame_add_child (GtkBuildable *buildable,
const gchar *type)
{
IdeFrame *self = (IdeFrame *)buildable;
- IdeFramePrivate *priv = ide_frame_get_instance_private (self);
GtkBuildableIface *parent = g_type_interface_peek_parent (GTK_BUILDABLE_GET_IFACE (buildable));
if (g_strcmp0 (type, "placeholder") == 0 && GTK_IS_WIDGET (object))
- {
- gtk_container_foreach (GTK_CONTAINER (priv->empty_placeholder),
- (GtkCallback) gtk_widget_destroy,
- NULL);
- gtk_container_add (GTK_CONTAINER (priv->empty_placeholder), GTK_WIDGET (object));
- }
+ ide_frame_set_placeholder (self, GTK_WIDGET (object));
else
- {
- parent->add_child (buildable, builder, object, type);
- }
+ parent->add_child (buildable, builder, object, type);
}
static void
@@ -1442,3 +1432,20 @@ buildable_iface_init (GtkBuildableIface *iface)
{
iface->add_child = ide_frame_add_child;
}
+
+void
+ide_frame_set_placeholder (IdeFrame *self,
+ GtkWidget *placeholder)
+{
+ IdeFramePrivate *priv = ide_frame_get_instance_private (self);
+
+ g_return_if_fail (IDE_IS_FRAME (self));
+ g_return_if_fail (!placeholder || GTK_IS_WIDGET (placeholder));
+
+ gtk_container_foreach (GTK_CONTAINER (priv->empty_placeholder),
+ (GtkCallback) gtk_widget_destroy,
+ NULL);
+
+ if (placeholder != NULL)
+ gtk_container_add (GTK_CONTAINER (priv->empty_placeholder), placeholder);
+}
diff --git a/src/libide/gui/ide-frame.h b/src/libide/gui/ide-frame.h
index 36e586d7c..8b4078e5a 100644
--- a/src/libide/gui/ide-frame.h
+++ b/src/libide/gui/ide-frame.h
@@ -80,5 +80,8 @@ IDE_AVAILABLE_IN_3_32
void ide_frame_add_with_depth (IdeFrame *self,
GtkWidget *widget,
guint position);
+IDE_AVAILABLE_IN_3_34
+void ide_frame_set_placeholder (IdeFrame *self,
+ GtkWidget *placeholder);
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]