[gnome-builder/wip/gtk4-port: 198/736] 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: 198/736] plugins/messages: start porting to GTK 4
- Date: Tue, 26 Apr 2022 01:46:19 +0000 (UTC)
commit 063c87ee0df880f96d52a7769ba7a8115d98ede7
Author: Christian Hergert <chergert redhat com>
Date: Tue Mar 29 18:04:12 2022 -0700
plugins/messages: start porting to GTK 4
This needs some work in libide-gui for how we'll get panes from the
workspace (since that lives in subclasses) as well as the need for a
terminal widget from libide-terminal.
src/plugins/messages/gbp-messages-panel.c | 20 ++++-----
src/plugins/messages/gbp-messages-panel.h | 4 +-
src/plugins/messages/gbp-messages-panel.ui | 4 +-
...itor-addin.c => gbp-messages-workspace-addin.c} | 50 ++++++++++++----------
...itor-addin.h => gbp-messages-workspace-addin.h} | 6 +--
src/plugins/messages/meson.build | 2 +-
src/plugins/messages/messages-plugin.c | 9 ++--
src/plugins/messages/messages.plugin | 1 +
8 files changed, 49 insertions(+), 47 deletions(-)
---
diff --git a/src/plugins/messages/gbp-messages-panel.c b/src/plugins/messages/gbp-messages-panel.c
index 54fb23d9d..414d53222 100644
--- a/src/plugins/messages/gbp-messages-panel.c
+++ b/src/plugins/messages/gbp-messages-panel.c
@@ -20,21 +20,19 @@
#define G_LOG_DOMAIN "gbp-messages-panel"
-#include <libide-editor.h>
+#include <libide-gui.h>
#include <libide-terminal.h>
#include "gbp-messages-panel.h"
struct _GbpMessagesPanel
{
- DzlDockWidget parent_instance;
-
- DzlSignalGroup *signals;
-
- IdeTerminal *terminal;
+ IePane parent_instance;
+ IdeSignalGroup *signals;
+ IdeTerminal *terminal;
};
-G_DEFINE_FINAL_TYPE (GbpMessagesPanel, gbp_messages_panel, DZL_TYPE_DOCK_WIDGET)
+G_DEFINE_FINAL_TYPE (GbpMessagesPanel, gbp_messages_panel, IDE_TYPE_PANE)
static char *
ensure_crlf (const char *message)
@@ -85,7 +83,7 @@ gbp_messages_panel_log_cb (GbpMessagesPanel *self,
vte_terminal_feed (VTE_TERMINAL (self->terminal), message, -1);
vte_terminal_feed (VTE_TERMINAL (self->terminal), "\r\n", 2);
- dzl_dock_item_needs_attention (DZL_DOCK_ITEM (&self->parent_instance));
+ panel_widget_set_needs_attention (PANEL_WIDGET (self), TRUE);
gtk_widget_show (GTK_WIDGET (self));
}
@@ -107,7 +105,7 @@ gbp_messages_panel_set_context (GtkWidget *widget,
g_assert (GBP_IS_MESSAGES_PANEL (self));
g_assert (!context || IDE_IS_CONTEXT (context));
- dzl_signal_group_set_target (self->signals, context);
+ ide_signal_group_set_target (self->signals, context);
#if 0
if (context != NULL)
@@ -145,9 +143,9 @@ gbp_messages_panel_init (GbpMessagesPanel *self)
ide_widget_set_context_handler (GTK_WIDGET (self), gbp_messages_panel_set_context);
- self->signals = dzl_signal_group_new (IDE_TYPE_CONTEXT);
+ self->signals = ide_signal_group_new (IDE_TYPE_CONTEXT);
- dzl_signal_group_connect_object (self->signals,
+ ide_signal_group_connect_object (self->signals,
"log",
G_CALLBACK (gbp_messages_panel_log_cb),
self,
diff --git a/src/plugins/messages/gbp-messages-panel.h b/src/plugins/messages/gbp-messages-panel.h
index babbfd0a6..d4d64102d 100644
--- a/src/plugins/messages/gbp-messages-panel.h
+++ b/src/plugins/messages/gbp-messages-panel.h
@@ -20,12 +20,12 @@
#pragma once
-#include <dazzle.h>
+#include <libide-gui.h>
G_BEGIN_DECLS
#define GBP_TYPE_MESSAGES_PANEL (gbp_messages_panel_get_type())
-G_DECLARE_FINAL_TYPE (GbpMessagesPanel, gbp_messages_panel, GBP, MESSAGES_PANEL, DzlDockWidget)
+G_DECLARE_FINAL_TYPE (GbpMessagesPanel, gbp_messages_panel, GBP, MESSAGES_PANEL, IdePane)
G_END_DECLS
diff --git a/src/plugins/messages/gbp-messages-panel.ui b/src/plugins/messages/gbp-messages-panel.ui
index 82c187d16..52fb27b81 100644
--- a/src/plugins/messages/gbp-messages-panel.ui
+++ b/src/plugins/messages/gbp-messages-panel.ui
@@ -1,17 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
- <template class="GbpMessagesPanel" parent="DzlDockWidget">
+ <template class="GbpMessagesPanel" parent="IdePane">
<property name="icon-name">dialog-information-symbolic</property>
<property name="title" translatable="yes">Messages</property>
<child>
<object class="GtkScrolledWindow">
<property name="hexpand">true</property>
- <property name="visible">true</property>
<child>
<object class="IdeTerminal" id="terminal">
<property name="hexpand">true</property>
<property name="scroll-on-output">false</property>
- <property name="visible">true</property>
</object>
</child>
</object>
diff --git a/src/plugins/messages/gbp-messages-editor-addin.c
b/src/plugins/messages/gbp-messages-workspace-addin.c
similarity index 50%
rename from src/plugins/messages/gbp-messages-editor-addin.c
rename to src/plugins/messages/gbp-messages-workspace-addin.c
index 520da921f..196690344 100644
--- a/src/plugins/messages/gbp-messages-editor-addin.c
+++ b/src/plugins/messages/gbp-messages-workspace-addin.c
@@ -1,4 +1,4 @@
-/* gbp-messages-editor-addin.c
+/* gbp-messages-workspace-addin.c
*
* Copyright 2018-2019 Christian Hergert <chergert redhat com>
*
@@ -18,30 +18,31 @@
* SPDX-License-Identifier: GPL-3.0-or-later
*/
-#define G_LOG_DOMAIN "gbp-messages-editor-addin"
+#define G_LOG_DOMAIN "gbp-messages-workspace-addin"
-#include <libide-editor.h>
+#include <libide-gui.h>
-#include "gbp-messages-editor-addin.h"
+#include "gbp-messages-workspace-addin.h"
#include "gbp-messages-panel.h"
-struct _GbpMessagesEditorAddin
+struct _GbpMessagesWorkspaceAddin
{
GObject parent_instance;
GbpMessagesPanel *panel;
};
static void
-gbp_messages_editor_addin_load (IdeEditorAddin *addin,
- IdeEditorSurface *editor)
+gbp_messages_workspace_addin_load (IdeWorkspaceAddin *addin,
+ IdeWorkspace *workspace)
{
- GbpMessagesEditorAddin *self = (GbpMessagesEditorAddin *)addin;
+ GbpMessagesWorkspaceAddin *self = (GbpMessagesWorkspaceAddin *)addin;
GtkWidget *utilities;
- g_assert (GBP_IS_MESSAGES_EDITOR_ADDIN (self));
- g_assert (IDE_IS_EDITOR_SURFACE (editor));
+ g_assert (GBP_IS_MESSAGES_WORKSPACE_ADDIN (self));
+ g_assert (IDE_IS_WORKSPACE (workspace));
- utilities = ide_editor_surface_get_utilities (editor);
+#if 0
+ utilities = ide_workspace_surface_get_utilities (workspace);
/* hidden by default */
self->panel = g_object_new (GBP_TYPE_MESSAGES_PANEL, NULL);
@@ -50,39 +51,42 @@ gbp_messages_editor_addin_load (IdeEditorAddin *addin,
G_CALLBACK (gtk_widget_destroyed),
&self->panel);
gtk_container_add (GTK_CONTAINER (utilities), GTK_WIDGET (self->panel));
+#endif
}
static void
-gbp_messages_editor_addin_unload (IdeEditorAddin *addin,
- IdeEditorSurface *editor)
+gbp_messages_workspace_addin_unload (IdeWorkspaceAddin *addin,
+ IdeWorkspace *workspace)
{
- GbpMessagesEditorAddin *self = (GbpMessagesEditorAddin *)addin;
+ GbpMessagesWorkspaceAddin *self = (GbpMessagesWorkspaceAddin *)addin;
- g_assert (GBP_IS_MESSAGES_EDITOR_ADDIN (self));
- g_assert (IDE_IS_EDITOR_SURFACE (editor));
+ 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
g_assert (self->panel == NULL);
}
static void
-editor_addin_iface_init (IdeEditorAddinInterface *iface)
+workspace_addin_iface_init (IdeWorkspaceAddinInterface *iface)
{
- iface->load = gbp_messages_editor_addin_load;
- iface->unload = gbp_messages_editor_addin_unload;
+ iface->load = gbp_messages_workspace_addin_load;
+ iface->unload = gbp_messages_workspace_addin_unload;
}
-G_DEFINE_FINAL_TYPE_WITH_CODE (GbpMessagesEditorAddin, gbp_messages_editor_addin, G_TYPE_OBJECT,
- G_IMPLEMENT_INTERFACE (IDE_TYPE_EDITOR_ADDIN, editor_addin_iface_init))
+G_DEFINE_FINAL_TYPE_WITH_CODE (GbpMessagesWorkspaceAddin, gbp_messages_workspace_addin, G_TYPE_OBJECT,
+ G_IMPLEMENT_INTERFACE (IDE_TYPE_WORKSPACE_ADDIN, workspace_addin_iface_init))
static void
-gbp_messages_editor_addin_class_init (GbpMessagesEditorAddinClass *klass)
+gbp_messages_workspace_addin_class_init (GbpMessagesWorkspaceAddinClass *klass)
{
}
static void
-gbp_messages_editor_addin_init (GbpMessagesEditorAddin *self)
+gbp_messages_workspace_addin_init (GbpMessagesWorkspaceAddin *self)
{
}
diff --git a/src/plugins/messages/gbp-messages-editor-addin.h
b/src/plugins/messages/gbp-messages-workspace-addin.h
similarity index 77%
rename from src/plugins/messages/gbp-messages-editor-addin.h
rename to src/plugins/messages/gbp-messages-workspace-addin.h
index ae5c7c689..43e336ed4 100644
--- a/src/plugins/messages/gbp-messages-editor-addin.h
+++ b/src/plugins/messages/gbp-messages-workspace-addin.h
@@ -1,4 +1,4 @@
-/* gbp-messages-editor-addin.h
+/* gbp-messages-workspace-addin.h
*
* Copyright 2018-2019 Christian Hergert <chergert redhat com>
*
@@ -24,8 +24,8 @@
G_BEGIN_DECLS
-#define GBP_TYPE_MESSAGES_EDITOR_ADDIN (gbp_messages_editor_addin_get_type())
+#define GBP_TYPE_MESSAGES_WORKSPACE_ADDIN (gbp_messages_workspace_addin_get_type())
-G_DECLARE_FINAL_TYPE (GbpMessagesEditorAddin, gbp_messages_editor_addin, GBP, MESSAGES_EDITOR_ADDIN, GObject)
+G_DECLARE_FINAL_TYPE (GbpMessagesWorkspaceAddin, gbp_messages_workspace_addin, GBP,
MESSAGES_WORKSPACE_ADDIN, GObject)
G_END_DECLS
diff --git a/src/plugins/messages/meson.build b/src/plugins/messages/meson.build
index 78b97b43f..c3ef83779 100644
--- a/src/plugins/messages/meson.build
+++ b/src/plugins/messages/meson.build
@@ -1,5 +1,5 @@
plugins_sources += files([
- 'gbp-messages-editor-addin.c',
+ 'gbp-messages-workspace-addin.c',
'gbp-messages-panel.c',
'messages-plugin.c',
])
diff --git a/src/plugins/messages/messages-plugin.c b/src/plugins/messages/messages-plugin.c
index 2a93f433b..90ed94013 100644
--- a/src/plugins/messages/messages-plugin.c
+++ b/src/plugins/messages/messages-plugin.c
@@ -21,14 +21,15 @@
#include "config.h"
#include <libpeas/peas.h>
-#include <libide-editor.h>
-#include "gbp-messages-editor-addin.h"
+#include <libide-gui.h>
+
+#include "gbp-messages-workspace-addin.h"
_IDE_EXTERN void
_gbp_messages_register_types (PeasObjectModule *module)
{
peas_object_module_register_extension_type (module,
- IDE_TYPE_EDITOR_ADDIN,
- GBP_TYPE_MESSAGES_EDITOR_ADDIN);
+ IDE_TYPE_WORKSPACE_ADDIN,
+ GBP_TYPE_MESSAGES_WORKSPACE_ADDIN);
}
diff --git a/src/plugins/messages/messages.plugin b/src/plugins/messages/messages.plugin
index 139ad0c53..f8f987c95 100644
--- a/src/plugins/messages/messages.plugin
+++ b/src/plugins/messages/messages.plugin
@@ -8,3 +8,4 @@ Embedded=_gbp_messages_register_types
Hidden=true
Module=messages
Name=Internal Logging
+X-Workspace-Kind=primary;editor;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]