[evince/wip/gpoo/gtk4-preparation-ev-sidebar: 3/4] shell: Add access to internal child to EvMessageArea
- From: Germán Poo-Caamaño <gpoo src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evince/wip/gpoo/gtk4-preparation-ev-sidebar: 3/4] shell: Add access to internal child to EvMessageArea
- Date: Sat, 26 Mar 2022 18:25:54 +0000 (UTC)
commit e523541b0649c72498f1fe7db08f9022db33fcc8
Author: Qiu Wenbo <qiuwenbo kylinos com cn>
Date: Fri Mar 25 23:02:03 2022 -0300
shell: Add access to internal child to EvMessageArea
* Allow composite templates get access to internal main_box
container.
Co-authored-by: Germán Poo-Caamaño <gpoo gnome org>
shell/ev-message-area.c | 29 ++++++++++++++++++++++++++++-
1 file changed, 28 insertions(+), 1 deletion(-)
---
diff --git a/shell/ev-message-area.c b/shell/ev-message-area.c
index dd43c70ef..d3c939593 100644
--- a/shell/ev-message-area.c
+++ b/shell/ev-message-area.c
@@ -47,8 +47,12 @@ static void ev_message_area_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec);
+static void ev_message_area_buildable_iface_init (GtkBuildableIface *iface);
-G_DEFINE_TYPE_WITH_PRIVATE (EvMessageArea, ev_message_area, GTK_TYPE_INFO_BAR)
+G_DEFINE_TYPE_WITH_CODE (EvMessageArea, ev_message_area, GTK_TYPE_INFO_BAR,
+ G_ADD_PRIVATE (EvMessageArea)
+ G_IMPLEMENT_INTERFACE (GTK_TYPE_BUILDABLE,
+ ev_message_area_buildable_iface_init))
#define GET_PRIVATE(o) ev_message_area_get_instance_private (o);
@@ -203,6 +207,29 @@ ev_message_area_get_property (GObject *object,
}
}
+static GtkBuildableIface *parent_buildable_iface;
+
+static GObject *
+ev_message_area_buildable_get_internal_child (GtkBuildable *buildable,
+ GtkBuilder *builder,
+ const char *childname)
+{
+ EvMessageArea *area = EV_MESSAGE_AREA (buildable);
+
+ if (g_strcmp0 (childname, "main_box") == 0)
+ return G_OBJECT (_ev_message_area_get_main_box (area));
+
+ return parent_buildable_iface->get_internal_child (buildable, builder, childname);
+}
+
+static void
+ev_message_area_buildable_iface_init (GtkBuildableIface *iface)
+{
+ parent_buildable_iface = g_type_interface_peek_parent (iface);
+
+ iface->get_internal_child = ev_message_area_buildable_get_internal_child;
+}
+
void
_ev_message_area_add_buttons_valist (EvMessageArea *area,
const gchar *first_button_text,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]