[gnome-builder] libide/gui: remove top-level foundry actions
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] libide/gui: remove top-level foundry actions
- Date: Thu, 28 Jul 2022 21:40:50 +0000 (UTC)
commit 5350d76bf55fdea10dbf8593ffd1dbb15251d9b2
Author: Christian Hergert <chergert redhat com>
Date: Thu Jul 28 14:40:39 2022 -0700
libide/gui: remove top-level foundry actions
src/libide/core/ide-context.c | 1 +
src/libide/gui/ide-primary-workspace.ui | 2 +-
src/libide/gui/ide-run-button.c | 4 +-
src/libide/gui/ide-run-button.ui | 2 +-
src/libide/gui/ide-workbench.c | 89 +----------------------
src/plugins/buildui/gbp-buildui-log-pane.ui | 2 +-
src/plugins/buildui/gbp-buildui-targets-dialog.c | 2 +-
src/plugins/buildui/gbp-buildui-targets-dialog.ui | 2 +-
src/plugins/buildui/gbp-buildui-workspace-addin.c | 2 +-
src/plugins/testui/gbp-testui-output-panel.ui | 2 +-
10 files changed, 13 insertions(+), 95 deletions(-)
---
diff --git a/src/libide/core/ide-context.c b/src/libide/core/ide-context.c
index 76f1c8ca6..23c4c46d8 100644
--- a/src/libide/core/ide-context.c
+++ b/src/libide/core/ide-context.c
@@ -79,6 +79,7 @@ static const char *app_schema_ids[] = {
"org.gnome.builder.terminal",
};
static const char *project_schema_ids[] = {
+ "org.gnome.builder.build",
"org.gnome.builder.debug",
"org.gnome.builder.project",
};
diff --git a/src/libide/gui/ide-primary-workspace.ui b/src/libide/gui/ide-primary-workspace.ui
index 7b4fc8678..dd4b86985 100644
--- a/src/libide/gui/ide-primary-workspace.ui
+++ b/src/libide/gui/ide-primary-workspace.ui
@@ -23,7 +23,7 @@
<child>
<object class="IdeOmniBar" id="omni_bar">
<property name="icon-name">builder-build-symbolic</property>
- <property name="action-name">build-manager.build</property>
+ <property name="action-name">context.build-manager.build</property>
<property name="menu-model">build_menu</property>
<child type="placeholder">
<object class="GtkLabel" id="project_title">
diff --git a/src/libide/gui/ide-run-button.c b/src/libide/gui/ide-run-button.c
index f44f35f5e..204be0a8c 100644
--- a/src/libide/gui/ide-run-button.c
+++ b/src/libide/gui/ide-run-button.c
@@ -57,12 +57,12 @@ on_icon_state_changed_cb (IdeRunButton *self,
if (!ide_run_manager_get_busy (run_manager))
{
icon_name = ide_run_manager_get_icon_name (run_manager);
- action_name = "run-manager.run";
+ action_name = "context.run-manager.run";
}
else
{
icon_name = "builder-run-stop-symbolic";
- action_name = "run-manager.stop";
+ action_name = "context.run-manager.stop";
}
g_object_set (self->split_button,
diff --git a/src/libide/gui/ide-run-button.ui b/src/libide/gui/ide-run-button.ui
index fadbd879d..4bb342b92 100644
--- a/src/libide/gui/ide-run-button.ui
+++ b/src/libide/gui/ide-run-button.ui
@@ -4,7 +4,7 @@
<template class="IdeRunButton" parent="GtkWidget">
<child>
<object class="AdwSplitButton" id="split_button">
- <property name="action-name">run-manager.run</property>
+ <property name="action-name">context.run-manager.run</property>
<property name="icon-name">builder-run-start-symbolic</property>
</object>
</child>
diff --git a/src/libide/gui/ide-workbench.c b/src/libide/gui/ide-workbench.c
index 13ef57702..ed85e5cdd 100644
--- a/src/libide/gui/ide-workbench.c
+++ b/src/libide/gui/ide-workbench.c
@@ -375,10 +375,11 @@ ide_workbench_constructed (GObject *object)
ide_action_mixin_constructed (&action_mixin, object);
ide_action_mixin_set_enabled (self, "configure", FALSE);
- /* Add workbench actions to the muxer */
+ /* Add various action groups to context muxer */
muxer = ide_context_ref_action_muxer (self->context);
our_muxer = ide_action_mixin_get_action_muxer (self);
ide_action_muxer_insert_action_group (muxer, "workbench", G_ACTION_GROUP (our_muxer));
+ ide_action_muxer_insert_action_group (muxer, "transfer-manager", _ide_transfer_manager_get_actions (NULL));
self->vcs_monitor = g_object_new (IDE_TYPE_VCS_MONITOR,
"parent", self->context,
@@ -751,73 +752,6 @@ ide_workbench_workspace_is_active_cb (IdeWorkbench *self,
}
}
-static void
-add_remove_foundry_action_groups (IdeWorkbench *self,
- IdeWorkspace *workspace,
- gboolean add)
-{
- struct {
- const gchar *name;
- GType child_type;
- } groups[] = {
- { "config-manager", IDE_TYPE_CONFIG_MANAGER },
- { "build-manager", IDE_TYPE_BUILD_MANAGER },
- { "device-manager", IDE_TYPE_DEVICE_MANAGER },
- { "run-manager", IDE_TYPE_RUN_MANAGER },
- { "test-manager", IDE_TYPE_TEST_MANAGER },
- };
-
- g_assert (IDE_IS_WORKBENCH (self));
- g_assert (IDE_IS_WORKSPACE (workspace));
-
- for (guint i = 0; i < G_N_ELEMENTS (groups); i++)
- {
- IdeObject *child = NULL;
-
- if (add)
- child = ide_context_peek_child_typed (self->context, groups[i].child_type);
-
- gtk_widget_insert_action_group (GTK_WIDGET (workspace),
- groups[i].name,
- G_ACTION_GROUP (child));
- }
-}
-
-static void
-insert_action_groups_foreach_cb (IdeWorkspace *workspace,
- gpointer user_data)
-{
- g_autoptr(IdeGSettingsActionGroup) project_settings_group = NULL;
- g_autoptr(IdeGSettingsActionGroup) build_settings_group = NULL;
- g_autoptr(GSettings) project_settings = NULL;
- g_autoptr(GSettings) build_settings = NULL;
- IdeWorkbench *self = user_data;
-
- g_assert (IDE_IS_MAIN_THREAD ());
- g_assert (IDE_IS_WORKBENCH (self));
- g_assert (IDE_IS_WORKSPACE (workspace));
- g_assert (IDE_IS_CONTEXT (self->context));
- g_assert (ide_context_has_project (self->context));
-
- add_remove_foundry_action_groups (self, workspace, TRUE);
-
- project_settings = ide_context_ref_project_settings (self->context);
- project_settings_group = g_object_new (IDE_TYPE_GSETTINGS_ACTION_GROUP,
- "settings", project_settings,
- NULL);
- gtk_widget_insert_action_group (GTK_WIDGET (workspace),
- "project-settings",
- G_ACTION_GROUP (project_settings_group));
-
- build_settings = g_settings_new ("org.gnome.builder.build");
- build_settings_group = g_object_new (IDE_TYPE_GSETTINGS_ACTION_GROUP,
- "settings", build_settings,
- NULL);
- gtk_widget_insert_action_group (GTK_WIDGET (workspace),
- "build-settings",
- G_ACTION_GROUP (build_settings_group));
-}
-
/**
* ide_workbench_add_workspace:
* @self: an #IdeWorkbench
@@ -866,12 +800,6 @@ ide_workbench_add_workspace (IdeWorkbench *self,
"context",
G_ACTION_GROUP (muxer));
- /* Give the workspace access to all the action groups of the context that
- * might be useful for them to access (debug-manager, run-manager, etc).
- */
- if (self->project_info != NULL)
- insert_action_groups_foreach_cb (workspace, self);
-
/* Setup capture shortcut controller for workspace */
shortcuts = ide_shortcut_manager_from_context (self->context);
_ide_workspace_set_shortcut_model (workspace, G_LIST_MODEL (shortcuts));
@@ -883,11 +811,6 @@ ide_workbench_add_workspace (IdeWorkbench *self,
self,
G_CONNECT_SWAPPED);
- /* Give access to transfer-manager */
- gtk_widget_insert_action_group (GTK_WIDGET (workspace),
- "transfer-manager",
- _ide_transfer_manager_get_actions (NULL));
-
/* Notify all the addins about the new workspace. */
if ((addins = ide_workbench_collect_addins (self)))
{
@@ -947,8 +870,7 @@ ide_workbench_remove_workspace (IdeWorkbench *self,
}
/* Clear our action groups (which drops an additional back-reference) */
- add_remove_foundry_action_groups (self, workspace, FALSE);
- gtk_widget_insert_action_group (GTK_WIDGET (workspace), "workbench", NULL);
+ gtk_widget_insert_action_group (GTK_WIDGET (workspace), "context", NULL);
/* Only cleanup the group if it hasn't already been removed */
if (gtk_window_has_group (GTK_WINDOW (workspace)))
@@ -1058,11 +980,6 @@ ide_workbench_load_project_completed (IdeWorkbench *self,
gtk_window_present_with_time (GTK_WINDOW (workspace), lp->present_time);
}
- /* Give workspaces access to the various GActionGroups */
- ide_workbench_foreach_workspace (self,
- (IdeWorkspaceCallback)insert_action_groups_foreach_cb,
- self);
-
/* Notify addins that projects have loaded */
peas_extension_set_foreach (self->addins,
ide_workbench_project_loaded_foreach_cb,
diff --git a/src/plugins/buildui/gbp-buildui-log-pane.ui b/src/plugins/buildui/gbp-buildui-log-pane.ui
index 7481ee50d..42c7d9d87 100644
--- a/src/plugins/buildui/gbp-buildui-log-pane.ui
+++ b/src/plugins/buildui/gbp-buildui-log-pane.ui
@@ -50,7 +50,7 @@
</child>
<child>
<object class="GtkButton" id="stop_button">
- <property name="action-name">build-manager.cancel</property>
+ <property name="action-name">context.build-manager.cancel</property>
<property name="hexpand">false</property>
<property name="vexpand">false</property>
<property name="tooltip-text" translatable="yes">Cancel build</property>
diff --git a/src/plugins/buildui/gbp-buildui-targets-dialog.c
b/src/plugins/buildui/gbp-buildui-targets-dialog.c
index 089c5babe..288600adb 100644
--- a/src/plugins/buildui/gbp-buildui-targets-dialog.c
+++ b/src/plugins/buildui/gbp-buildui-targets-dialog.c
@@ -68,7 +68,7 @@ create_target_row (gpointer item,
namev = g_variant_take_ref (g_variant_new_string (name ? name : ""));
check = g_object_new (GTK_TYPE_CHECK_BUTTON,
- "action-name", "build-manager.default-build-target",
+ "action-name", "context.build-manager.default-build-target",
"css-classes", IDE_STRV_INIT ("checkimage"),
"action-target", namev,
"valign", GTK_ALIGN_CENTER,
diff --git a/src/plugins/buildui/gbp-buildui-targets-dialog.ui
b/src/plugins/buildui/gbp-buildui-targets-dialog.ui
index 5b0b0040a..aaf6ca3a6 100644
--- a/src/plugins/buildui/gbp-buildui-targets-dialog.ui
+++ b/src/plugins/buildui/gbp-buildui-targets-dialog.ui
@@ -29,7 +29,7 @@
<property name="activatable-widget">default_target</property>
<child type="suffix">
<object class="GtkCheckButton" id="default_target">
- <property name="action-name">build-manager.default-build-target</property>
+ <property name="action-name">context.build-manager.default-build-target</property>
<property name="action-target">''</property>
<style>
<class name="checkimage"/>
diff --git a/src/plugins/buildui/gbp-buildui-workspace-addin.c
b/src/plugins/buildui/gbp-buildui-workspace-addin.c
index 3aea73dac..113691add 100644
--- a/src/plugins/buildui/gbp-buildui-workspace-addin.c
+++ b/src/plugins/buildui/gbp-buildui-workspace-addin.c
@@ -147,7 +147,7 @@ gbp_buildui_workspace_addin_notify_busy (GbpBuilduiWorkspaceAddin *self,
g_object_set (omni_bar,
"icon-name", busy ? "builder-build-stop-symbolic" : "builder-build-symbolic",
- "action-name", busy ? "build-manager.cancel" : "build-manager.build",
+ "action-name", busy ? "context.build-manager.cancel" : "context.build-manager.build",
NULL);
}
diff --git a/src/plugins/testui/gbp-testui-output-panel.ui b/src/plugins/testui/gbp-testui-output-panel.ui
index 026a674ce..bdd923ee9 100644
--- a/src/plugins/testui/gbp-testui-output-panel.ui
+++ b/src/plugins/testui/gbp-testui-output-panel.ui
@@ -45,7 +45,7 @@
</child>
<child>
<object class="GtkButton" id="stop_button">
- <property name="action-name">test-manager.cancel</property>
+ <property name="action-name">context.test-manager.cancel</property>
<property name="tooltip-text" translatable="yes">Cancel tests</property>
<property name="icon-name">builder-build-stop-symbolic</property>
<style>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]