[gnome-builder] layout: allow subclassing IdeLayoutPane
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] layout: allow subclassing IdeLayoutPane
- Date: Wed, 19 Jul 2017 11:17:18 +0000 (UTC)
commit 94b31f9dde6e2a489b89ec64c7bcbb892d03508f
Author: Christian Hergert <chergert redhat com>
Date: Wed Jul 12 16:37:28 2017 -0700
layout: allow subclassing IdeLayoutPane
We can use this to create a custom transient panel, and also
to reconfigure IdeEditorSidebar into a panel subclass.
libide/layout/ide-layout-pane.c | 14 +++++++-------
libide/layout/ide-layout-pane.h | 21 ++++++++++++++++-----
2 files changed, 23 insertions(+), 12 deletions(-)
---
diff --git a/libide/layout/ide-layout-pane.c b/libide/layout/ide-layout-pane.c
index f1ca4ef..c3acd4b 100644
--- a/libide/layout/ide-layout-pane.c
+++ b/libide/layout/ide-layout-pane.c
@@ -23,24 +23,24 @@
#include "ide-layout-pane.h"
#include "ide-macros.h"
-struct _IdeLayoutPane
+typedef struct
{
- DzlDockBinEdge parent_instance;
- DzlDockStack *dock_stack;
-};
+ DzlDockStack *dock_stack;
+} IdeLayoutPanePrivate;
-G_DEFINE_TYPE (IdeLayoutPane, ide_layout_pane, DZL_TYPE_DOCK_BIN_EDGE)
+G_DEFINE_TYPE_WITH_PRIVATE (IdeLayoutPane, ide_layout_pane, DZL_TYPE_DOCK_BIN_EDGE)
static void
ide_layout_pane_add (GtkContainer *container,
GtkWidget *widget)
{
IdeLayoutPane *self = (IdeLayoutPane *)container;
+ IdeLayoutPanePrivate *priv = ide_layout_pane_get_instance_private (self);
g_assert (IDE_IS_LAYOUT_PANE (self));
if (DZL_IS_DOCK_WIDGET (widget))
- gtk_container_add (GTK_CONTAINER (self->dock_stack), widget);
+ gtk_container_add (GTK_CONTAINER (priv->dock_stack), widget);
else
GTK_CONTAINER_CLASS (ide_layout_pane_parent_class)->add (container, widget);
}
@@ -54,7 +54,7 @@ ide_layout_pane_class_init (IdeLayoutPaneClass *klass)
container_class->add = ide_layout_pane_add;
gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/builder/ui/ide-layout-pane.ui");
- gtk_widget_class_bind_template_child (widget_class, IdeLayoutPane, dock_stack);
+ gtk_widget_class_bind_template_child_private (widget_class, IdeLayoutPane, dock_stack);
}
static void
diff --git a/libide/layout/ide-layout-pane.h b/libide/layout/ide-layout-pane.h
index c7ebe2f..04676b2 100644
--- a/libide/layout/ide-layout-pane.h
+++ b/libide/layout/ide-layout-pane.h
@@ -16,8 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef IDE_LAYOUT_PANE_H
-#define IDE_LAYOUT_PANE_H
+#pragma once
#include <dazzle.h>
@@ -25,8 +24,20 @@ G_BEGIN_DECLS
#define IDE_TYPE_LAYOUT_PANE (ide_layout_pane_get_type())
-G_DECLARE_FINAL_TYPE (IdeLayoutPane, ide_layout_pane, IDE, LAYOUT_PANE, DzlDockBinEdge)
+G_DECLARE_DERIVABLE_TYPE (IdeLayoutPane, ide_layout_pane, IDE, LAYOUT_PANE, DzlDockBinEdge)
-G_END_DECLS
+struct _IdeLayoutPaneClass
+{
+ DzlDockBinEdgeClass parent_class;
+
+ gpointer _reserved1;
+ gpointer _reserved2;
+ gpointer _reserved3;
+ gpointer _reserved4;
+ gpointer _reserved5;
+ gpointer _reserved6;
+ gpointer _reserved7;
+ gpointer _reserved8;
+};
-#endif /* IDE_LAYOUT_PANE_H */
+G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]