[gnome-builder/wip/gtk4-port] plugins/messages: start porting to GTK 4
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/wip/gtk4-port] plugins/messages: start porting to GTK 4
- Date: Wed, 30 Mar 2022 09:10:17 +0000 (UTC)
commit b8d6f9b0f1a6fb3181f91b717f3298a2923e4e01
Author: Christian Hergert <chergert redhat com>
Date: Wed Mar 30 02:10:10 2022 -0700
plugins/messages: start porting to GTK 4
src/plugins/messages/gbp-messages-panel.c | 31 ++++++----------------
src/plugins/messages/gbp-messages-panel.ui | 2 +-
.../messages/gbp-messages-workspace-addin.c | 23 ++++++----------
3 files changed, 17 insertions(+), 39 deletions(-)
---
diff --git a/src/plugins/messages/gbp-messages-panel.c b/src/plugins/messages/gbp-messages-panel.c
index 414d53222..e0676e5a9 100644
--- a/src/plugins/messages/gbp-messages-panel.c
+++ b/src/plugins/messages/gbp-messages-panel.c
@@ -21,15 +21,15 @@
#define G_LOG_DOMAIN "gbp-messages-panel"
#include <libide-gui.h>
-#include <libide-terminal.h>
+#include <vte/vte.h>
#include "gbp-messages-panel.h"
struct _GbpMessagesPanel
{
- IePane parent_instance;
+ IdePane parent_instance;
IdeSignalGroup *signals;
- IdeTerminal *terminal;
+ VteTerminal *terminal;
};
G_DEFINE_FINAL_TYPE (GbpMessagesPanel, gbp_messages_panel, IDE_TYPE_PANE)
@@ -87,15 +87,6 @@ gbp_messages_panel_log_cb (GbpMessagesPanel *self,
gtk_widget_show (GTK_WIDGET (self));
}
-#if 0
-static gboolean
-do_log (gpointer data)
-{
- ide_context_warning (data, "(some log message here)\nfoo\nbaz");
- return G_SOURCE_CONTINUE;
-}
-#endif
-
static void
gbp_messages_panel_set_context (GtkWidget *widget,
IdeContext *context)
@@ -106,31 +97,25 @@ gbp_messages_panel_set_context (GtkWidget *widget,
g_assert (!context || IDE_IS_CONTEXT (context));
ide_signal_group_set_target (self->signals, context);
-
-#if 0
- if (context != NULL)
- g_timeout_add (1000, do_log, context);
-
- g_assert (g_strcmp0 (ensure_crlf ("\nfoo\r\nbar\nbaz\r\r\n"), "\r\nfoo\r\nbar\r\nbaz\r\r\n") == 0);
-#endif
}
static void
-gbp_messages_panel_destroy (GtkWidget *widget)
+gbp_messages_panel_dispose (GObject *object)
{
- GbpMessagesPanel *self = (GbpMessagesPanel *)widget;
+ GbpMessagesPanel *self = (GbpMessagesPanel *)object;
g_clear_object (&self->signals);
- GTK_WIDGET_CLASS (gbp_messages_panel_parent_class)->destroy (widget);
+ G_OBJECT_CLASS (gbp_messages_panel_parent_class)->dispose (object);
}
static void
gbp_messages_panel_class_init (GbpMessagesPanelClass *klass)
{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
- widget_class->destroy = gbp_messages_panel_destroy;
+ object_class->dispose = gbp_messages_panel_dispose;
gtk_widget_class_set_template_from_resource (widget_class, "/plugins/messages/gbp-messages-panel.ui");
gtk_widget_class_bind_template_child (widget_class, GbpMessagesPanel, terminal);
diff --git a/src/plugins/messages/gbp-messages-panel.ui b/src/plugins/messages/gbp-messages-panel.ui
index 52fb27b81..3bea6545e 100644
--- a/src/plugins/messages/gbp-messages-panel.ui
+++ b/src/plugins/messages/gbp-messages-panel.ui
@@ -7,7 +7,7 @@
<object class="GtkScrolledWindow">
<property name="hexpand">true</property>
<child>
- <object class="IdeTerminal" id="terminal">
+ <object class="VteTerminal" id="terminal">
<property name="hexpand">true</property>
<property name="scroll-on-output">false</property>
</object>
diff --git a/src/plugins/messages/gbp-messages-workspace-addin.c
b/src/plugins/messages/gbp-messages-workspace-addin.c
index 196690344..8785e82f8 100644
--- a/src/plugins/messages/gbp-messages-workspace-addin.c
+++ b/src/plugins/messages/gbp-messages-workspace-addin.c
@@ -36,22 +36,16 @@ gbp_messages_workspace_addin_load (IdeWorkspaceAddin *addin,
IdeWorkspace *workspace)
{
GbpMessagesWorkspaceAddin *self = (GbpMessagesWorkspaceAddin *)addin;
- GtkWidget *utilities;
+ g_autoptr(IdePanelPosition) position = NULL;
g_assert (GBP_IS_MESSAGES_WORKSPACE_ADDIN (self));
g_assert (IDE_IS_WORKSPACE (workspace));
-#if 0
- utilities = ide_workspace_surface_get_utilities (workspace);
+ position = ide_panel_position_new ();
+ ide_panel_position_set_edge (position, PANEL_DOCK_POSITION_BOTTOM);
- /* hidden by default */
self->panel = g_object_new (GBP_TYPE_MESSAGES_PANEL, NULL);
- g_signal_connect (self->panel,
- "destroy",
- G_CALLBACK (gtk_widget_destroyed),
- &self->panel);
- gtk_container_add (GTK_CONTAINER (utilities), GTK_WIDGET (self->panel));
-#endif
+ ide_workspace_add_pane (workspace, IDE_PANE (self->panel), position);
}
static void
@@ -59,16 +53,15 @@ gbp_messages_workspace_addin_unload (IdeWorkspaceAddin *addin,
IdeWorkspace *workspace)
{
GbpMessagesWorkspaceAddin *self = (GbpMessagesWorkspaceAddin *)addin;
+ GtkWidget *frame;
g_assert (GBP_IS_MESSAGES_WORKSPACE_ADDIN (self));
g_assert (IDE_IS_WORKSPACE (workspace));
-#if 0
- if (self->panel != NULL)
- gtk_widget_destroy (GTK_WIDGET (self->panel));
-#endif
+ frame = gtk_widget_get_ancestor (GTK_WIDGET (self->panel), PANEL_TYPE_FRAME);
+ panel_frame_remove (PANEL_FRAME (frame), PANEL_WIDGET (self->panel));
- g_assert (self->panel == NULL);
+ self->panel = NULL;
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]