[gnome-builder/wip/gtk4-port: 115/1774] libide/gui: make IdeMarkedView inherit GtkWidget
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/wip/gtk4-port: 115/1774] libide/gui: make IdeMarkedView inherit GtkWidget
- Date: Mon, 11 Jul 2022 22:30:57 +0000 (UTC)
commit e3b1f5b054e5b6b38bf992154ca2b5d0e038e655
Author: Christian Hergert <chergert redhat com>
Date: Mon Mar 28 17:23:36 2022 -0700
libide/gui: make IdeMarkedView inherit GtkWidget
src/libide/gui/ide-marked-view.c | 22 ++++++++++++++++++----
src/libide/gui/ide-marked-view.h | 11 ++++++++---
2 files changed, 26 insertions(+), 7 deletions(-)
---
diff --git a/src/libide/gui/ide-marked-view.c b/src/libide/gui/ide-marked-view.c
index 5abbd95f0..35417ef73 100644
--- a/src/libide/gui/ide-marked-view.c
+++ b/src/libide/gui/ide-marked-view.c
@@ -337,17 +337,32 @@ parse_markdown (const gchar *markdown,
struct _IdeMarkedView
{
- AdwBin parent_instance;
+ GtkWidget parent_instance;
};
-G_DEFINE_FINAL_TYPE (IdeMarkedView, ide_marked_view, ADW_TYPE_BIN)
+G_DEFINE_FINAL_TYPE (IdeMarkedView, ide_marked_view, GTK_TYPE_WIDGET)
+
+static void
+ide_marked_view_dispose (GObject *object)
+{
+ for (GtkWidget *child = gtk_widget_get_first_child (GTK_WIDGET (object));
+ child != NULL;
+ child = gtk_widget_get_first_child (GTK_WIDGET (object)))
+ gtk_widget_unparent (child);
+
+ G_OBJECT_CLASS (ide_marked_view_parent_class)->dispose (object);
+}
static void
ide_marked_view_class_init (IdeMarkedViewClass *klass)
{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
+ object_class->dispose = ide_marked_view_dispose;
+
gtk_widget_class_set_css_name (widget_class, "markedview");
+ gtk_widget_class_set_layout_manager_type (widget_class, GTK_TYPE_BIN_LAYOUT);
}
static void
@@ -422,8 +437,7 @@ ide_marked_view_new (IdeMarkedContent *content)
break;
}
- if (child != NULL)
- gtk_container_add (GTK_CONTAINER (self), child);
+ gtk_widget_set_parent (child, GTK_WIDGET (self));
return GTK_WIDGET (self);
}
diff --git a/src/libide/gui/ide-marked-view.h b/src/libide/gui/ide-marked-view.h
index c52ea7d51..1c2780e85 100644
--- a/src/libide/gui/ide-marked-view.h
+++ b/src/libide/gui/ide-marked-view.h
@@ -20,7 +20,12 @@
#pragma once
+#if !defined (IDE_GUI_INSIDE) && !defined (IDE_GUI_COMPILATION)
+# error "Only <libide-gui.h> can be included directly."
+#endif
+
#include <gtk/gtk.h>
+
#include <libide-core.h>
#include <libide-io.h>
@@ -28,10 +33,10 @@ G_BEGIN_DECLS
#define IDE_TYPE_MARKED_VIEW (ide_marked_view_get_type())
-IDE_AVAILABLE_IN_3_32
-G_DECLARE_FINAL_TYPE (IdeMarkedView, ide_marked_view, IDE, MARKED_VIEW, AdwBin)
+IDE_AVAILABLE_IN_ALL
+G_DECLARE_FINAL_TYPE (IdeMarkedView, ide_marked_view, IDE, MARKED_VIEW, GtkWidget)
-IDE_AVAILABLE_IN_3_32
+IDE_AVAILABLE_IN_ALL
GtkWidget *ide_marked_view_new (IdeMarkedContent *content);
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]