[gnome-builder] new-file: implement new-file action for editor workspace
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] new-file: implement new-file action for editor workspace
- Date: Mon, 21 Dec 2015 07:59:20 +0000 (UTC)
commit 8dfc523c09e8818623bfe9ca64add3f74444a380
Author: Christian Hergert <chergert redhat com>
Date: Fri Dec 4 02:17:03 2015 -0800
new-file: implement new-file action for editor workspace
data/gtk/menus.ui | 2 +-
libide/editor/ide-editor-perspective.c | 22 ++++++++++++++++++++++
2 files changed, 23 insertions(+), 1 deletions(-)
---
diff --git a/data/gtk/menus.ui b/data/gtk/menus.ui
index 9aa6a57..9715052 100644
--- a/data/gtk/menus.ui
+++ b/data/gtk/menus.ui
@@ -64,7 +64,7 @@
<section id="gear-menu-new-section">
<item>
<attribute name="label" translatable="yes">_New File</attribute>
- <attribute name="action">win.new-document</attribute>
+ <attribute name="action">perspective.new-file</attribute>
</item>
</section>
<section id="gear-menu-open-section">
diff --git a/libide/editor/ide-editor-perspective.c b/libide/editor/ide-editor-perspective.c
index 331610c..2432a9a 100644
--- a/libide/editor/ide-editor-perspective.c
+++ b/libide/editor/ide-editor-perspective.c
@@ -188,6 +188,27 @@ global_search_activate (GSimpleAction *action,
}
static void
+new_file_activate (GSimpleAction *action,
+ GVariant *param,
+ gpointer user_data)
+{
+ IdeEditorPerspective *self = user_data;
+ IdeWorkbench *workbench;
+ IdeContext *context;
+ IdeBufferManager *bufmgr;
+ IdeBuffer *buffer;
+
+ g_assert (IDE_IS_EDITOR_PERSPECTIVE (self));
+
+ workbench = ide_widget_get_workbench (GTK_WIDGET (self));
+ context = ide_workbench_get_context (workbench);
+ bufmgr = ide_context_get_buffer_manager (context);
+ buffer = ide_buffer_manager_create_temporary_buffer (bufmgr);
+
+ g_clear_object (&buffer);
+}
+
+static void
ide_editor_perspective_finalize (GObject *object)
{
IdeEditorPerspective *self = (IdeEditorPerspective *)object;
@@ -240,6 +261,7 @@ ide_editor_perspective_init (IdeEditorPerspective *self)
{
GActionGroup *actions;
static const GActionEntry entries[] = {
+ { "new-file", new_file_activate },
{ "global-search", global_search_activate },
};
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]