[gnome-builder] editor: implement new-document action and use <Control><Shift>N to activate
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] editor: implement new-document action and use <Control><Shift>N to activate
- Date: Thu, 11 Dec 2014 01:23:51 +0000 (UTC)
commit 86edf066d8bc9050f9656bb41aac5d05062547a3
Author: Christian Hergert <christian hergert me>
Date: Wed Dec 10 17:23:41 2014 -0800
editor: implement new-document action and use <Control><Shift>N to activate
src/editor/gb-editor-workspace.c | 24 ++++++++++++++++++++++++
src/resources/keybindings/default.ini | 1 +
2 files changed, 25 insertions(+), 0 deletions(-)
---
diff --git a/src/editor/gb-editor-workspace.c b/src/editor/gb-editor-workspace.c
index f13a158..bf8218f 100644
--- a/src/editor/gb-editor-workspace.c
+++ b/src/editor/gb-editor-workspace.c
@@ -106,6 +106,29 @@ jump_to_doc_tab (GSimpleAction *action,
}
static void
+new_document (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
+{
+ GbEditorWorkspace *workspace = user_data;
+ GbEditorDocument *document;
+ GbDocumentManager *manager;
+
+ g_return_if_fail (GB_IS_EDITOR_WORKSPACE (workspace));
+
+ /* TODO: We should fetch the document manager from the workbench so that we
+ * can have one per loaded project. */
+ manager = gb_document_manager_get_default ();
+ document = gb_editor_document_new ();
+
+ gb_document_manager_add (manager, GB_DOCUMENT (document));
+ gb_document_grid_focus_document (workspace->priv->document_grid,
+ GB_DOCUMENT (document));
+
+ g_clear_object (&document);
+}
+
+static void
open_tab (GSimpleAction *action,
GVariant *parameter,
gpointer user_data)
@@ -230,6 +253,7 @@ gb_editor_workspace_init (GbEditorWorkspace *workspace)
{
const GActionEntry entries[] = {
{ "open", open_tab },
+ { "new-document", new_document },
{ "jump-to-doc", jump_to_doc_tab, "s" },
};
diff --git a/src/resources/keybindings/default.ini b/src/resources/keybindings/default.ini
index aeba4a9..4e664a4 100644
--- a/src/resources/keybindings/default.ini
+++ b/src/resources/keybindings/default.ini
@@ -15,6 +15,7 @@ global-search = <Control>period
# the majority of that feature to the global search making it unnecessary.
open = <Control><Shift>O
preview = <Control><Alt>P
+new-document = <Control><Shift>N
[editor-frame]
find = <Control><Shift>F
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]