[gnome-builder] tree: add stubs for context menu items
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] tree: add stubs for context menu items
- Date: Thu, 9 Apr 2015 00:09:05 +0000 (UTC)
commit f0dfee98013890803e045b4b124e87d82dc45ab0
Author: Christian Hergert <christian hergert me>
Date: Fri Apr 3 14:07:37 2015 -0700
tree: add stubs for context menu items
data/gtk/menus.ui | 40 ++++++++++++++++++++++++++++++
src/editor/gb-editor-workspace-actions.c | 24 ++++++++++++++++++
src/editor/gb-editor-workspace.c | 6 ++++
3 files changed, 70 insertions(+), 0 deletions(-)
---
diff --git a/data/gtk/menus.ui b/data/gtk/menus.ui
index 1bd72c4..6e5bec1 100644
--- a/data/gtk/menus.ui
+++ b/data/gtk/menus.ui
@@ -109,4 +109,44 @@
</section>
-->
</menu>
+ <menu id="project-tree-menu">
+ <section id="open-section">
+ <item>
+ <attribute name="label" translatable="yes">_Open</attribute>
+ <attribute name="action">tree.open</attribute>
+ </item>
+ <submenu>
+ <attribute name="label" translatable="yes">Open _With</attribute>
+ <section>
+ <item>
+ <attribute name="label" translatable="yes">Source Code Editor</attribute>
+ <attribute name="action">tree.open-with-editor</attribute>
+ </item>
+ </section>
+ <section id="open-by-mime-section">
+ </section>
+ </submenu>
+ </section>
+ <section id="open-containing-section">
+ <item>
+ <attribute name="label" translatable="yes">_Open Containing Folder</attribute>
+ <attribute name="action">tree.open-containing-folder</attribute>
+ </item>
+ </section>
+ <section id="display-options">
+ <submenu>
+ <attribute name="label" translatable="yes">Display Options</attribute>
+ <section>
+ <item>
+ <attribute name="label" translatable="yes">_Collapse All Nodes</attribute>
+ <attribute name="action">tree.collapse-all-nodes</attribute>
+ </item>
+ <item>
+ <attribute name="label" translatable="yes">_Refresh</attribute>
+ <attribute name="action">project-tree.refresh</attribute>
+ </item>
+ </section>
+ </submenu>
+ </section>
+ </menu>
</interface>
diff --git a/src/editor/gb-editor-workspace-actions.c b/src/editor/gb-editor-workspace-actions.c
index 09f2fc7..3719322 100644
--- a/src/editor/gb-editor-workspace-actions.c
+++ b/src/editor/gb-editor-workspace-actions.c
@@ -80,18 +80,42 @@ gb_editor_workspace_actions_toggle_sidebar (GSimpleAction *action,
g_variant_unref (state);
}
+static void
+gb_editor_workspace_tree_actions_refresh (GSimpleAction *action,
+ GVariant *variant,
+ gpointer user_data)
+{
+ GbEditorWorkspace *self = user_data;
+
+ g_assert (GB_IS_EDITOR_WORKSPACE (self));
+
+ gb_tree_rebuild (self->project_tree);
+
+ /* TODO: Try to expand back to our current position */
+}
+
static const GActionEntry GbEditorWorkspaceActions[] = {
{ "show-sidebar", NULL, NULL, "false", gb_editor_workspace_actions_show_sidebar },
{ "toggle-sidebar", gb_editor_workspace_actions_toggle_sidebar },
};
+static const GActionEntry GbEditorWorkspaceTreeActions[] = {
+ { "refresh", gb_editor_workspace_tree_actions_refresh },
+};
+
void
gb_editor_workspace_actions_init (GbEditorWorkspace *self)
{
g_autoptr(GSimpleActionGroup) group = NULL;
+ g_autoptr(GSimpleActionGroup) tree_group = NULL;
group = g_simple_action_group_new ();
g_action_map_add_action_entries (G_ACTION_MAP (group), GbEditorWorkspaceActions,
G_N_ELEMENTS (GbEditorWorkspaceActions), self);
gtk_widget_insert_action_group (GTK_WIDGET (self), "workspace", G_ACTION_GROUP (group));
+
+ tree_group = g_simple_action_group_new ();
+ g_action_map_add_action_entries (G_ACTION_MAP (group), GbEditorWorkspaceTreeActions,
+ G_N_ELEMENTS (GbEditorWorkspaceTreeActions), self);
+ gtk_widget_insert_action_group (GTK_WIDGET (self), "project-tree", G_ACTION_GROUP (group));
}
diff --git a/src/editor/gb-editor-workspace.c b/src/editor/gb-editor-workspace.c
index 55a7bec..550ff3d 100644
--- a/src/editor/gb-editor-workspace.c
+++ b/src/editor/gb-editor-workspace.c
@@ -146,6 +146,8 @@ static void
gb_editor_workspace_constructed (GObject *object)
{
GbEditorWorkspace *self = (GbEditorWorkspace *)object;
+ GApplication *app;
+ GMenu *menu;
IDE_ENTRY;
@@ -153,6 +155,10 @@ gb_editor_workspace_constructed (GObject *object)
gb_editor_workspace_actions_init (self);
+ app = g_application_get_default ();
+ menu = gtk_application_get_menu_by_id (GTK_APPLICATION (app), "project-tree-menu");
+ gb_tree_set_menu (self->project_tree, menu);
+
IDE_EXIT;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]