[gtk/wip/otte/listview: 141/152] inspector: Make Controller page a GtkWidget
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/otte/listview: 141/152] inspector: Make Controller page a GtkWidget
- Date: Mon, 2 Dec 2019 03:37:23 +0000 (UTC)
commit fa5ab20f797db191f62360c3da53d8ef47bae45b
Author: Benjamin Otte <otte redhat com>
Date: Sat Nov 9 00:43:41 2019 +0100
inspector: Make Controller page a GtkWidget
gtk/inspector/controllers.c | 47 ++++++++++++++++++++++++++++++---------------
gtk/inspector/controllers.h | 4 ++--
2 files changed, 33 insertions(+), 18 deletions(-)
---
diff --git a/gtk/inspector/controllers.c b/gtk/inspector/controllers.c
index 516818dc17..977762368e 100644
--- a/gtk/inspector/controllers.c
+++ b/gtk/inspector/controllers.c
@@ -21,7 +21,7 @@
#include "controllers.h"
#include "object-tree.h"
-#include "gtksizegroup.h"
+#include "gtkbinlayout.h"
#include "gtkcomboboxtext.h"
#include "gtkflattenlistmodel.h"
#include "gtkframe.h"
@@ -31,14 +31,15 @@
#include "gtkmaplistmodel.h"
#include "gtkpropertylookuplistmodelprivate.h"
#include "gtkscrolledwindow.h"
+#include "gtksizegroup.h"
#include "gtksortlistmodel.h"
-#include "gtkwidgetprivate.h"
#include "gtkstack.h"
#include "gtkstylecontext.h"
+#include "gtkwidgetprivate.h"
struct _GtkInspectorControllers
{
- GtkBox parent_instance;
+ GtkWidget parent_instance;
GtkWidget *listbox;
GtkPropertyLookupListModel *model;
@@ -48,7 +49,7 @@ struct _GtkInspectorControllers
struct _GtkInspectorControllersClass
{
- GtkBoxClass parent_class;
+ GtkWidgetClass parent_class;
};
enum
@@ -57,7 +58,7 @@ enum
PROP_OBJECT_TREE
};
-G_DEFINE_TYPE (GtkInspectorControllers, gtk_inspector_controllers, GTK_TYPE_BOX)
+G_DEFINE_TYPE (GtkInspectorControllers, gtk_inspector_controllers, GTK_TYPE_WIDGET)
static void
row_activated (GtkListBox *box,
@@ -97,7 +98,7 @@ gtk_inspector_controllers_init (GtkInspectorControllers *self)
gtk_list_box_set_selection_mode (GTK_LIST_BOX (self->listbox), GTK_SELECTION_NONE);
gtk_container_add (GTK_CONTAINER (box), self->listbox);
- gtk_container_add (GTK_CONTAINER (self), sw);
+ gtk_widget_set_parent (sw, GTK_WIDGET (self));
}
static void
@@ -255,10 +256,10 @@ gtk_inspector_controllers_set_object (GtkInspectorControllers *self,
}
static void
-get_property (GObject *object,
- guint param_id,
- GValue *value,
- GParamSpec *pspec)
+gtk_inspector_controllers_get_property (GObject *object,
+ guint param_id,
+ GValue *value,
+ GParamSpec *pspec)
{
GtkInspectorControllers *self = GTK_INSPECTOR_CONTROLLERS (object);
@@ -275,10 +276,10 @@ get_property (GObject *object,
}
static void
-set_property (GObject *object,
- guint param_id,
- const GValue *value,
- GParamSpec *pspec)
+gtk_inspector_controllers_set_property (GObject *object,
+ guint param_id,
+ const GValue *value,
+ GParamSpec *pspec)
{
GtkInspectorControllers *self = GTK_INSPECTOR_CONTROLLERS (object);
@@ -294,17 +295,31 @@ set_property (GObject *object,
}
}
+static void
+gtk_inspector_controllers_dispose (GObject *object)
+{
+ GtkInspectorControllers *self = GTK_INSPECTOR_CONTROLLERS (object);
+
+ gtk_widget_unparent (gtk_widget_get_first_child (GTK_WIDGET (self)));
+
+ G_OBJECT_CLASS (gtk_inspector_controllers_parent_class)->dispose (object);
+}
+
static void
gtk_inspector_controllers_class_init (GtkInspectorControllersClass *klass)
{
+ GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
GObjectClass *object_class = G_OBJECT_CLASS (klass);
- object_class->get_property = get_property;
- object_class->set_property = set_property;
+ object_class->get_property = gtk_inspector_controllers_get_property;
+ object_class->set_property = gtk_inspector_controllers_set_property;
+ object_class->dispose= gtk_inspector_controllers_dispose;
g_object_class_install_property (object_class, PROP_OBJECT_TREE,
g_param_spec_object ("object-tree", "Widget Tree", "Widget tree",
GTK_TYPE_WIDGET, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+
+ gtk_widget_class_set_layout_manager_type (widget_class, GTK_TYPE_BIN_LAYOUT);
}
// vim: set et sw=2 ts=2:
diff --git a/gtk/inspector/controllers.h b/gtk/inspector/controllers.h
index d4c884cb0d..d4df218b88 100644
--- a/gtk/inspector/controllers.h
+++ b/gtk/inspector/controllers.h
@@ -18,13 +18,13 @@
#ifndef _GTK_INSPECTOR_CONTROLLERS_H_
#define _GTK_INSPECTOR_CONTROLLERS_H_
-#include <gtk/gtk.h>
+#include <gtk/gtkwidget.h>
G_BEGIN_DECLS
#define GTK_TYPE_INSPECTOR_CONTROLLERS gtk_inspector_controllers_get_type()
-G_DECLARE_FINAL_TYPE (GtkInspectorControllers, gtk_inspector_controllers, GTK, INSPECTOR_CONTROLLERS, GtkBox)
+G_DECLARE_FINAL_TYPE (GtkInspectorControllers, gtk_inspector_controllers, GTK, INSPECTOR_CONTROLLERS,
GtkWidget)
void gtk_inspector_controllers_set_object (GtkInspectorControllers *sl,
GObject *object);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]