[gnome-builder] plugins/find-other-file: use action group for workspace addin
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] plugins/find-other-file: use action group for workspace addin
- Date: Fri, 29 Jul 2022 20:32:20 +0000 (UTC)
commit 3b53042694b82033a264b6bf6dd83bb4653e698a
Author: Christian Hergert <chergert redhat com>
Date: Fri Jul 29 13:32:15 2022 -0700
plugins/find-other-file: use action group for workspace addin
The action is now workspace.find-other-file.focus
.../gbp-find-other-file-workspace-addin.c | 22 ++++++----------------
src/plugins/find-other-file/gtk/keybindings.json | 2 +-
2 files changed, 7 insertions(+), 17 deletions(-)
---
diff --git a/src/plugins/find-other-file/gbp-find-other-file-workspace-addin.c
b/src/plugins/find-other-file/gbp-find-other-file-workspace-addin.c
index 629a37b3b..0f56eb6df 100644
--- a/src/plugins/find-other-file/gbp-find-other-file-workspace-addin.c
+++ b/src/plugins/find-other-file/gbp-find-other-file-workspace-addin.c
@@ -44,12 +44,9 @@ struct _GbpFindOtherFileWorkspaceAddin
};
static void
-find_other_file_action (GSimpleAction *action,
- GVariant *param,
- gpointer user_data)
+find_other_file_action (GbpFindOtherFileWorkspaceAddin *self,
+ GVariant *param)
{
- GbpFindOtherFileWorkspaceAddin *self = user_data;
-
g_assert (GBP_IS_FIND_OTHER_FILE_WORKSPACE_ADDIN (self));
if (self->menu_button != NULL &&
@@ -57,9 +54,9 @@ find_other_file_action (GSimpleAction *action,
gtk_menu_button_popup (self->menu_button);
}
-static GActionEntry actions[] = {
- { "find-other-file", find_other_file_action },
-};
+IDE_DEFINE_ACTION_GROUP (GbpFindOtherFileWorkspaceAddin, gbp_find_other_file_workspace_addin, {
+ { "focus", find_other_file_action },
+})
static void
gbp_find_other_file_workspace_addin_clear (GbpFindOtherFileWorkspaceAddin *self)
@@ -211,11 +208,6 @@ gbp_find_other_file_workspace_addin_load (IdeWorkspaceAddin *addin,
statusbar = ide_workspace_get_statusbar (workspace);
panel_statusbar_add_suffix (statusbar, 10000, GTK_WIDGET (self->menu_button));
- g_action_map_add_action_entries (G_ACTION_MAP (workspace),
- actions,
- G_N_ELEMENTS (actions),
- self);
-
IDE_EXIT;
}
@@ -233,9 +225,6 @@ gbp_find_other_file_workspace_addin_unload (IdeWorkspaceAddin *addin,
g_clear_object (&self->browser);
- for (guint i = 0; i < G_N_ELEMENTS (actions); i++)
- g_action_map_remove_action (G_ACTION_MAP (workspace), actions[i].name);
-
statusbar = ide_workspace_get_statusbar (workspace);
panel_statusbar_remove (statusbar, GTK_WIDGET (self->menu_button));
self->menu_button = NULL;
@@ -257,6 +246,7 @@ workspace_addin_iface_init (IdeWorkspaceAddinInterface *iface)
}
G_DEFINE_FINAL_TYPE_WITH_CODE (GbpFindOtherFileWorkspaceAddin, gbp_find_other_file_workspace_addin,
G_TYPE_OBJECT,
+ G_IMPLEMENT_INTERFACE (G_TYPE_ACTION_GROUP,
gbp_find_other_file_workspace_addin_init_action_group)
G_IMPLEMENT_INTERFACE (IDE_TYPE_WORKSPACE_ADDIN, workspace_addin_iface_init))
static void
diff --git a/src/plugins/find-other-file/gtk/keybindings.json
b/src/plugins/find-other-file/gtk/keybindings.json
index 15c99196c..95cdc7eca 100644
--- a/src/plugins/find-other-file/gtk/keybindings.json
+++ b/src/plugins/find-other-file/gtk/keybindings.json
@@ -1 +1 @@
-{ "trigger" : "<Control><Shift>o", "action" : "win.find-other-file", "when" : "canEdit()", "phase" :
"capture" },
+{ "trigger" : "<Control><Shift>o", "action" : "workspace.find-other-file.focus", "when" : "canEdit()",
"phase" : "capture" },
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]