[gnome-builder] plugins/messages: port to GTK 4
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] plugins/messages: port to GTK 4
- Date: Tue, 12 Jul 2022 06:39:17 +0000 (UTC)
commit 9a859297b72fabdb96c4fc545d06698005d5508c
Author: Christian Hergert <chergert redhat com>
Date: Mon Jul 11 23:07:13 2022 -0700
plugins/messages: port to GTK 4
- Use libpanel for panels
- Use workspace addin
src/plugins/meson.build | 61 +++++++--------
src/plugins/messages/gbp-messages-editor-addin.c | 88 ----------------------
src/plugins/messages/gbp-messages-panel.c | 47 ++++--------
src/plugins/messages/gbp-messages-panel.h | 4 +-
src/plugins/messages/gbp-messages-panel.ui | 6 +-
.../messages/gbp-messages-workspace-addin.c | 85 +++++++++++++++++++++
...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 | 2 +-
10 files changed, 140 insertions(+), 170 deletions(-)
---
diff --git a/src/plugins/meson.build b/src/plugins/meson.build
index f4d29a5b2..8ac8f7dca 100644
--- a/src/plugins/meson.build
+++ b/src/plugins/meson.build
@@ -7,7 +7,6 @@ plugins_generated_sources = []
plugins_link_with = []
plugins_deps = [
- libdazzle_dep,
libgtk_dep,
libgtksource_dep,
libjsonrpc_glib_dep,
@@ -26,7 +25,6 @@ plugins_deps = [
libide_search_dep,
libide_sourceview_dep,
libide_terminal_dep,
- libide_themes_dep,
libide_threading_dep,
libide_tree_dep,
libide_vcs_dep,
@@ -38,7 +36,7 @@ endif
subdir('auto-save')
subdir('autotools')
-subdir('beautifier')
+subdir('bash-language-server')
subdir('blueprint')
subdir('buildconfig')
subdir('buildstream')
@@ -53,22 +51,17 @@ subdir('cmake')
subdir('codespell')
subdir('code-index')
subdir('codeui')
-subdir('color-picker')
-subdir('command-bar')
subdir('comment-code')
subdir('copyright')
subdir('c-pack')
subdir('create-project')
subdir('ctags')
subdir('debuggerui')
-subdir('devhelp')
-subdir('deviceui')
subdir('deviced')
subdir('doap')
subdir('dspy')
-subdir('editor')
+subdir('editorui')
subdir('editorconfig')
-subdir('emacs')
subdir('eslint')
subdir('flatpak')
subdir('file-search')
@@ -78,23 +71,21 @@ subdir('gdb')
subdir('gdiagnose')
subdir('gettext')
subdir('git')
-subdir('glade')
-subdir('gnome-code-assistance')
-subdir('go-langserv')
-subdir('gjs-symbols')
+subdir('gopls')
subdir('gradle')
subdir('greeter')
subdir('grep')
-subdir('gvls')
-subdir('history')
+subdir('host')
subdir('html-completion')
subdir('html-preview')
subdir('intelephense')
+subdir('jdtls')
subdir('jedi-language-server')
subdir('jhbuild')
-subdir('line-spacing')
subdir('ls')
subdir('make')
+subdir('make-templates')
+subdir('markdown-preview')
subdir('maven')
subdir('meson')
subdir('meson-templates')
@@ -109,22 +100,20 @@ subdir('open-with-external')
subdir('phpize')
subdir('podman')
subdir('project-tree')
-subdir('python-gi-imports-completion')
-subdir('python-pack')
+subdir('pygi')
subdir('qemu')
subdir('quick-highlight')
subdir('recent')
subdir('restore-cursor')
subdir('retab')
-subdir('rls')
subdir('rstcheck')
subdir('rubocop')
subdir('rust-analyzer')
subdir('shellcmd')
subdir('snippets')
subdir('spellcheck')
+subdir('sphinx-preview')
subdir('stylelint')
-subdir('sublime')
subdir('support')
subdir('symbol-tree')
subdir('sysprof')
@@ -135,13 +124,13 @@ subdir('todo')
subdir('ts-language-server')
subdir('trim-spaces')
subdir('update-manager')
-subdir('vagrant')
-subdir('vala-pack')
+subdir('valac')
subdir('valgrind')
subdir('vcsui')
subdir('vim')
subdir('vls')
subdir('waf')
+subdir('web-browser')
subdir('words')
subdir('xml-pack')
@@ -157,6 +146,7 @@ status += [
'',
'Autotools ............................ : @0@'.format(get_option('plugin_autotools')),
'Beautifier ........................... : @0@'.format(get_option('plugin_beautifier')),
+ 'BuildStream .......................... : @0@'.format(get_option('plugin_buildstream')),
'C Pack ............................... : @0@'.format(get_option('plugin_c_pack')),
'Cargo ................................ : @0@'.format(get_option('plugin_cargo')),
'Clang Format ......................... : @0@'.format(get_option('plugin_clang_format')),
@@ -166,7 +156,6 @@ status += [
'Color Pickr .......................... : @0@'.format(get_option('plugin_color_picker')),
'CTags ................................ : @0@'.format(get_option('plugin_ctags')),
'Copyright ............................ : @0@'.format(get_option('plugin_copyright')),
- 'Devhelp .............................. : @0@'.format(get_option('plugin_devhelp')),
'Deviced .............................. : @0@'.format(get_option('plugin_deviced')),
'D-Bus Spy ............................ : @0@'.format(get_option('plugin_dspy')),
'Editorconfig ......................... : @0@'.format(get_option('plugin_editorconfig')),
@@ -176,17 +165,17 @@ status += [
'GDB .................................. : @0@'.format(get_option('plugin_gdb')),
'Gettext .............................. : @0@'.format(get_option('plugin_gettext')),
'Git .................................. : @0@'.format(get_option('plugin_git')),
- 'GJS Symbols .......................... : @0@'.format(get_option('plugin_gjs_symbols')),
- 'Glade ................................ : @0@'.format(get_option('plugin_glade')),
- 'GNOME Code Assistance ................ : @0@'.format(get_option('plugin_gnome_code_assistance')),
'Gradle ............................... : @0@'.format(get_option('plugin_gradle')),
'Grep ................................. : @0@'.format(get_option('plugin_grep')),
'HTML Completion ...................... : @0@'.format(get_option('plugin_html_completion')),
'HTML Preview ......................... : @0@'.format(get_option('plugin_html_preview')),
'JHBuild .............................. : @0@'.format(get_option('plugin_jhbuild')),
'Make ................................. : @0@'.format(get_option('plugin_make')),
+ 'Make Templates ....................... : @0@'.format(get_option('plugin_make_templates')),
+ 'Markdown Preview ..................... : @0@'.format(get_option('plugin_markdown_preview')),
'Maven ................................ : @0@'.format(get_option('plugin_maven')),
'Meson ................................ : @0@'.format(get_option('plugin_meson')),
+ 'Meson Templates ...................... : @0@'.format(get_option('plugin_meson_templates')),
'Modelines ............................ : @0@'.format(get_option('plugin_modelines')),
'Mono ................................. : @0@'.format(get_option('plugin_mono')),
'Newcomers ............................ : @0@'.format(get_option('plugin_newcomers')),
@@ -194,10 +183,12 @@ status += [
'Npm .................................. : @0@'.format(get_option('plugin_npm')),
'PHPize ............................... : @0@'.format(get_option('plugin_phpize')),
'Podman ............................... : @0@'.format(get_option('plugin_podman')),
- 'Python Pack .......................... : @0@'.format(get_option('plugin_python_pack')),
+ 'PyGObject Imports .................... : @0@'.format(get_option('plugin_pygi')),
'Qemu ................................. : @0@'.format(get_option('plugin_qemu')),
'Quick Highlight ...................... : @0@'.format(get_option('plugin_quick_highlight')),
'Retab ................................ : @0@'.format(get_option('plugin_retab')),
+ 'rstcheck ............................. : @0@'.format(get_option('plugin_rstcheck')),
+ 'Sphinx Preview (reStructuredText) .... : @0@'.format(get_option('plugin_sphinx_preview')),
'Rubocop .............................. : @0@'.format(get_option('plugin_rubocop')),
'Spellcheck ........................... : @0@'.format(get_option('plugin_spellcheck')),
'Stylelint ............................ : @0@'.format(get_option('plugin_stylelint')),
@@ -205,8 +196,7 @@ status += [
'Sysroot .............................. : @0@'.format(get_option('plugin_sysroot')),
'Todo ................................. : @0@'.format(get_option('plugin_todo')),
'Update Manager ....................... : @0@'.format(get_option('plugin_update_manager')),
- 'Vala Pack ............................ : @0@'.format(get_option('plugin_vala')),
- 'Vagrant .............................. : @0@'.format(get_option('plugin_vagrant')),
+ 'Vala Compiler ........................ : @0@'.format(get_option('plugin_valac')),
'Valgrind ............................. : @0@'.format(get_option('plugin_valgrind')),
'Waf .................................. : @0@'.format(get_option('plugin_waf')),
'Word Completion ...................... : @0@'.format(get_option('plugin_words')),
@@ -214,17 +204,18 @@ status += [
'',
'Language Servers:',
'',
+ 'bash-language-server .......... (Bash) : @0@'.format(get_option('plugin_bash_language_server')),
'blueprint ................ (Blueprint) : @0@'.format(get_option('plugin_blueprint')),
+ 'clangd ............... (C, C++, Obj-C) : @0@ **'.format(get_option('plugin_clangd')),
'gnome-builder-clang .. (C, C++, Obj-C) : @0@'.format(get_option('plugin_clang')),
- 'clangd ............... (C, C++, Obj-C) : @0@ (Not Suggested)'.format(get_option('plugin_clangd')),
- 'gpls ............................ (Go) : @0@'.format(get_option('plugin_go_langserv')),
- 'intelephense ....................(PHP) : @0@'.format(get_option('plugin_intelephense')),
+ 'gopls ........................... (Go) : @0@'.format(get_option('plugin_gopls')),
+ 'intelephense ................... (PHP) : @0@'.format(get_option('plugin_intelephense')),
+ 'jdtls ......................... (Java) : @0@'.format(get_option('plugin_jdtls')),
'jedi-language-server ........ (Python) : @0@'.format(get_option('plugin_jedi_language_server')),
- 'rls ........................... (Rust) : @0@ (Not Suggested)'.format(get_option('plugin_rls')),
- 'rstcheck ...........(reStructuredText) : @0@'.format(get_option('plugin_rstcheck')),
'rust-analyzer ................. (Rust) : @0@'.format(get_option('plugin_rust_analyzer')),
'ts-language-server ... (JS/TypeScript) : @0@'.format(get_option('plugin_ts_language_server')),
- 'gvls .......................... (Vala) : @0@'.format(get_option('plugin_gvls')),
'vala-language-server .......... (Vala) : @0@'.format(get_option('plugin_vls')),
'',
+ ' ** Denotes plugins not recommended for distribution',
+ '',
]
diff --git a/src/plugins/messages/gbp-messages-panel.c b/src/plugins/messages/gbp-messages-panel.c
index 54fb23d9d..e0676e5a9 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-terminal.h>
+#include <libide-gui.h>
+#include <vte/vte.h>
#include "gbp-messages-panel.h"
struct _GbpMessagesPanel
{
- DzlDockWidget parent_instance;
-
- DzlSignalGroup *signals;
-
- IdeTerminal *terminal;
+ IdePane parent_instance;
+ IdeSignalGroup *signals;
+ VteTerminal *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,19 +83,10 @@ 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));
}
-#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)
@@ -107,32 +96,26 @@ 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);
-
-#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
+ ide_signal_group_set_target (self->signals, context);
}
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);
@@ -145,9 +128,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..3bea6545e 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">
+ <object class="VteTerminal" 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-workspace-addin.c
b/src/plugins/messages/gbp-messages-workspace-addin.c
new file mode 100644
index 000000000..8785e82f8
--- /dev/null
+++ b/src/plugins/messages/gbp-messages-workspace-addin.c
@@ -0,0 +1,85 @@
+/* gbp-messages-workspace-addin.c
+ *
+ * Copyright 2018-2019 Christian Hergert <chergert redhat com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
+ */
+
+#define G_LOG_DOMAIN "gbp-messages-workspace-addin"
+
+#include <libide-gui.h>
+
+#include "gbp-messages-workspace-addin.h"
+#include "gbp-messages-panel.h"
+
+struct _GbpMessagesWorkspaceAddin
+{
+ GObject parent_instance;
+ GbpMessagesPanel *panel;
+};
+
+static void
+gbp_messages_workspace_addin_load (IdeWorkspaceAddin *addin,
+ IdeWorkspace *workspace)
+{
+ GbpMessagesWorkspaceAddin *self = (GbpMessagesWorkspaceAddin *)addin;
+ g_autoptr(IdePanelPosition) position = NULL;
+
+ g_assert (GBP_IS_MESSAGES_WORKSPACE_ADDIN (self));
+ g_assert (IDE_IS_WORKSPACE (workspace));
+
+ position = ide_panel_position_new ();
+ ide_panel_position_set_edge (position, PANEL_DOCK_POSITION_BOTTOM);
+
+ self->panel = g_object_new (GBP_TYPE_MESSAGES_PANEL, NULL);
+ ide_workspace_add_pane (workspace, IDE_PANE (self->panel), position);
+}
+
+static void
+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));
+
+ frame = gtk_widget_get_ancestor (GTK_WIDGET (self->panel), PANEL_TYPE_FRAME);
+ panel_frame_remove (PANEL_FRAME (frame), PANEL_WIDGET (self->panel));
+
+ self->panel = NULL;
+}
+
+static void
+workspace_addin_iface_init (IdeWorkspaceAddinInterface *iface)
+{
+ iface->load = gbp_messages_workspace_addin_load;
+ iface->unload = gbp_messages_workspace_addin_unload;
+}
+
+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_workspace_addin_class_init (GbpMessagesWorkspaceAddinClass *klass)
+{
+}
+
+static void
+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..cbc499d86 100644
--- a/src/plugins/messages/messages.plugin
+++ b/src/plugins/messages/messages.plugin
@@ -2,9 +2,9 @@
Authors=Christian Hergert <christian hergert me>
Builtin=true
Copyright=Copyright © 2018 Christian Hergert
-Depends=editor;
Description=Show internal warning logs
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]