[gnome-builder/wip/gtk4-port: 392/736] plugins/vcsui: port tree and workbench addins
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/wip/gtk4-port: 392/736] plugins/vcsui: port tree and workbench addins
- Date: Tue, 26 Apr 2022 01:46:25 +0000 (UTC)
commit 9c16017342f8f9c15c369303c8ed92f96ca18b85
Author: Christian Hergert <chergert redhat com>
Date: Mon Apr 4 16:51:36 2022 -0700
plugins/vcsui: port tree and workbench addins
This doesn't have everything yet, but it does get the tree and workbench
addins building and loading into the workbench.
src/plugins/meson.build | 2 +-
src/plugins/vcsui/gbp-vcsui-tree-addin.c | 18 +++++++++++-------
src/plugins/vcsui/gbp-vcsui-workbench-addin.c | 16 +++++++---------
src/plugins/vcsui/meson.build | 4 ++--
src/plugins/vcsui/vcsui-plugin.c | 5 ++++-
src/plugins/vcsui/vcsui.plugin | 4 ++--
6 files changed, 27 insertions(+), 22 deletions(-)
---
diff --git a/src/plugins/meson.build b/src/plugins/meson.build
index 09154a318..469a64281 100644
--- a/src/plugins/meson.build
+++ b/src/plugins/meson.build
@@ -137,7 +137,7 @@ subdir('update-manager')
#subdir('vagrant')
#subdir('vala-pack')
#subdir('valgrind')
-#subdir('vcsui')
+subdir('vcsui')
#subdir('vim')
#subdir('vls')
subdir('waf')
diff --git a/src/plugins/vcsui/gbp-vcsui-tree-addin.c b/src/plugins/vcsui/gbp-vcsui-tree-addin.c
index 9b8adac71..2250cdfea 100644
--- a/src/plugins/vcsui/gbp-vcsui-tree-addin.c
+++ b/src/plugins/vcsui/gbp-vcsui-tree-addin.c
@@ -37,6 +37,8 @@ struct _GbpVcsuiTreeAddin
{
GObject parent_instance;
+ GActionMap *actions;
+
IdeTree *tree;
IdeTreeModel *model;
IdeVcs *vcs;
@@ -170,6 +172,7 @@ gbp_vcsui_tree_addin_load (IdeTreeAddin *addin,
gtk_widget_insert_action_group (GTK_WIDGET (tree),
"vcsui",
G_ACTION_GROUP (group));
+ self->actions = g_object_ref (G_ACTION_MAP (group));
if ((workbench = ide_widget_get_workbench (GTK_WIDGET (tree))) &&
(vcs = ide_workbench_get_vcs (workbench)) &&
@@ -199,6 +202,7 @@ gbp_vcsui_tree_addin_unload (IdeTreeAddin *addin,
gtk_widget_insert_action_group (GTK_WIDGET (tree), "vcsui", NULL);
+ g_clear_object (&self->actions);
g_clear_object (&self->monitor);
g_clear_object (&self->vcs);
self->model = NULL;
@@ -211,6 +215,7 @@ gbp_vcsui_tree_addin_selection_changed (IdeTreeAddin *addin,
{
GbpVcsuiTreeAddin *self = (GbpVcsuiTreeAddin *)addin;
gboolean is_branch = FALSE;
+ GAction *action;
g_assert (IDE_IS_MAIN_THREAD ());
g_assert (GBP_IS_VCSUI_TREE_ADDIN (self));
@@ -219,12 +224,11 @@ gbp_vcsui_tree_addin_selection_changed (IdeTreeAddin *addin,
if (node != NULL)
is_branch = ide_tree_node_holds (node, IDE_TYPE_VCS_BRANCH);
- dzl_gtk_widget_action_set (GTK_WIDGET (self->tree), "vcsui", "switch-branch",
- "enabled", is_branch,
- NULL);
- dzl_gtk_widget_action_set (GTK_WIDGET (self->tree), "vcsui", "push-branch",
- "enabled", is_branch,
- NULL);
+ action = g_action_map_lookup_action (self->actions, "switch-branch");
+ g_simple_action_set_enabled (G_SIMPLE_ACTION (action), is_branch);
+
+ action = g_action_map_lookup_action (self->actions, "push-branch");
+ g_simple_action_set_enabled (G_SIMPLE_ACTION (action), is_branch);
}
static void
@@ -461,7 +465,7 @@ tree_addin_iface_init (IdeTreeAddinInterface *iface)
}
G_DEFINE_FINAL_TYPE_WITH_CODE (GbpVcsuiTreeAddin, gbp_vcsui_tree_addin, G_TYPE_OBJECT,
- G_IMPLEMENT_INTERFACE (IDE_TYPE_TREE_ADDIN, tree_addin_iface_init))
+ G_IMPLEMENT_INTERFACE (IDE_TYPE_TREE_ADDIN, tree_addin_iface_init))
static void
gbp_vcsui_tree_addin_class_init (GbpVcsuiTreeAddinClass *klass)
diff --git a/src/plugins/vcsui/gbp-vcsui-workbench-addin.c b/src/plugins/vcsui/gbp-vcsui-workbench-addin.c
index 6fa7e1cec..8e04beee0 100644
--- a/src/plugins/vcsui/gbp-vcsui-workbench-addin.c
+++ b/src/plugins/vcsui/gbp-vcsui-workbench-addin.c
@@ -22,7 +22,6 @@
#include "config.h"
-#include <dazzle.h>
#include <libide-gui.h>
#include <libide-vcs.h>
@@ -30,9 +29,8 @@
struct _GbpVcsuiWorkbenchAddin
{
- GObject parent_instance;
-
- DzlSignalGroup *vcs_signals;
+ GObject parent_instance;
+ IdeSignalGroup *vcs_signals;
};
static void
@@ -71,7 +69,7 @@ gbp_vcsui_workbench_addin_vcs_changed (IdeWorkbenchAddin *addin,
g_assert (GBP_IS_VCSUI_WORKBENCH_ADDIN (self));
g_assert (!vcs || IDE_IS_VCS (vcs));
- dzl_signal_group_set_target (self->vcs_signals, vcs);
+ ide_signal_group_set_target (self->vcs_signals, vcs);
if (vcs != NULL)
on_notify_branch_name (self, NULL, vcs);
@@ -87,8 +85,8 @@ gbp_vcsui_workbench_addin_load (IdeWorkbenchAddin *addin,
g_assert (GBP_IS_VCSUI_WORKBENCH_ADDIN (self));
g_assert (IDE_IS_WORKBENCH (workbench));
- self->vcs_signals = dzl_signal_group_new (G_TYPE_OBJECT);
- dzl_signal_group_connect_object (self->vcs_signals,
+ self->vcs_signals = ide_signal_group_new (G_TYPE_OBJECT);
+ ide_signal_group_connect_object (self->vcs_signals,
"notify::branch-name",
G_CALLBACK (on_notify_branch_name),
self,
@@ -104,7 +102,7 @@ gbp_vcsui_workbench_addin_unload (IdeWorkbenchAddin *addin,
g_assert (GBP_IS_VCSUI_WORKBENCH_ADDIN (self));
g_assert (IDE_IS_WORKBENCH (workbench));
- dzl_signal_group_set_target (self->vcs_signals, NULL);
+ ide_signal_group_set_target (self->vcs_signals, NULL);
g_clear_object (&self->vcs_signals);
}
@@ -117,7 +115,7 @@ workbench_addin_iface_init (IdeWorkbenchAddinInterface *iface)
}
G_DEFINE_FINAL_TYPE_WITH_CODE (GbpVcsuiWorkbenchAddin, gbp_vcsui_workbench_addin, G_TYPE_OBJECT,
- G_IMPLEMENT_INTERFACE (IDE_TYPE_WORKBENCH_ADDIN, workbench_addin_iface_init))
+ G_IMPLEMENT_INTERFACE (IDE_TYPE_WORKBENCH_ADDIN, workbench_addin_iface_init))
static void
gbp_vcsui_workbench_addin_class_init (GbpVcsuiWorkbenchAddinClass *klass)
diff --git a/src/plugins/vcsui/meson.build b/src/plugins/vcsui/meson.build
index 100110686..840d71ae4 100644
--- a/src/plugins/vcsui/meson.build
+++ b/src/plugins/vcsui/meson.build
@@ -1,9 +1,9 @@
plugins_sources += files([
'vcsui-plugin.c',
'gbp-vcsui-tree-addin.c',
- 'gbp-vcsui-editor-page-addin.c',
'gbp-vcsui-workbench-addin.c',
- 'gbp-vcsui-clone-widget.c',
+ # 'gbp-vcsui-editor-page-addin.c',
+ # 'gbp-vcsui-clone-widget.c',
])
plugin_vcsui_resources = gnome.compile_resources(
diff --git a/src/plugins/vcsui/vcsui-plugin.c b/src/plugins/vcsui/vcsui-plugin.c
index 0645ba3cc..199c48cd9 100644
--- a/src/plugins/vcsui/vcsui-plugin.c
+++ b/src/plugins/vcsui/vcsui-plugin.c
@@ -23,20 +23,23 @@
#include "config.h"
#include <libpeas/peas.h>
+
#include <libide-editor.h>
#include <libide-gui.h>
#include <libide-tree.h>
-#include "gbp-vcsui-editor-page-addin.h"
+//#include "gbp-vcsui-editor-page-addin.h"
#include "gbp-vcsui-tree-addin.h"
#include "gbp-vcsui-workbench-addin.h"
_IDE_EXTERN void
_gbp_vcsui_register_types (PeasObjectModule *module)
{
+#if 0
peas_object_module_register_extension_type (module,
IDE_TYPE_EDITOR_PAGE_ADDIN,
GBP_TYPE_VCSUI_EDITOR_PAGE_ADDIN);
+#endif
peas_object_module_register_extension_type (module,
IDE_TYPE_TREE_ADDIN,
GBP_TYPE_VCSUI_TREE_ADDIN);
diff --git a/src/plugins/vcsui/vcsui.plugin b/src/plugins/vcsui/vcsui.plugin
index 8772dac74..6e65b2c1e 100644
--- a/src/plugins/vcsui/vcsui.plugin
+++ b/src/plugins/vcsui/vcsui.plugin
@@ -1,8 +1,8 @@
[Plugin]
Authors=Christian Hergert <christian hergert me>
Builtin=true
-Copyright=Copyright © 2015-2018 Christian Hergert
-Depends=editor;project-tree;
+Copyright=Copyright © 2015-2022 Christian Hergert
+Depends=project-tree;
Description=Provides user interface components to display VCS
Embedded=_gbp_vcsui_register_types
Hidden=true
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]