[gnome-builder/wip/gtk4-port: 810/1774] plugins/buildui: insert actions on pane
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/wip/gtk4-port: 810/1774] plugins/buildui: insert actions on pane
- Date: Mon, 11 Jul 2022 22:31:24 +0000 (UTC)
commit 6197886f8282e3c39112a7fc5236684302e9c2ea
Author: Christian Hergert <chergert redhat com>
Date: Fri Apr 29 10:10:33 2022 -0700
plugins/buildui: insert actions on pane
Until we can set action muxer parents, we'll have to install these to
the pane so that we can actually activate them from the popover (which
has to be parented there because GtkTreeView can't host them).
src/plugins/buildui/gbp-buildui-tree-addin.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
---
diff --git a/src/plugins/buildui/gbp-buildui-tree-addin.c b/src/plugins/buildui/gbp-buildui-tree-addin.c
index cdab48de2..88fdf0425 100644
--- a/src/plugins/buildui/gbp-buildui-tree-addin.c
+++ b/src/plugins/buildui/gbp-buildui-tree-addin.c
@@ -41,6 +41,7 @@ struct _GbpBuilduiTreeAddin
IdeTreeModel *model;
/* Owned references */
+ GtkWidget *pane;
GActionGroup *group;
};
@@ -310,6 +311,7 @@ gbp_buildui_tree_addin_load (IdeTreeAddin *addin,
{
GbpBuilduiTreeAddin *self = (GbpBuilduiTreeAddin *)addin;
IdeContext *context;
+ GtkWidget *pane;
static const GActionEntry actions[] = {
{ "build", gbp_buildui_tree_addin_action_build },
{ "rebuild", gbp_buildui_tree_addin_action_rebuild },
@@ -329,12 +331,16 @@ gbp_buildui_tree_addin_load (IdeTreeAddin *addin,
if (!ide_context_has_project (context))
return;
+ pane = gtk_widget_get_ancestor (GTK_WIDGET (tree), IDE_TYPE_PANE);
+ g_assert (IDE_IS_PANE (pane));
+
+ self->pane = g_object_ref (pane);
self->group = G_ACTION_GROUP (g_simple_action_group_new ());
g_action_map_add_action_entries (G_ACTION_MAP (self->group),
actions,
G_N_ELEMENTS (actions),
self);
- gtk_widget_insert_action_group (GTK_WIDGET (tree), "buildui", self->group);
+ gtk_widget_insert_action_group (pane, "buildui", self->group);
}
static void
@@ -349,8 +355,9 @@ gbp_buildui_tree_addin_unload (IdeTreeAddin *addin,
g_assert (IDE_IS_TREE (tree));
g_assert (IDE_IS_TREE_MODEL (model));
- gtk_widget_insert_action_group (GTK_WIDGET (tree), "buildui", NULL);
+ gtk_widget_insert_action_group (self->pane, "buildui", NULL);
+ g_clear_object (&self->pane);
g_clear_object (&self->group);
self->model = NULL;
self->tree = NULL;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]