[gnome-builder] editor: special case "gnome-builder -e"
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] editor: special case "gnome-builder -e"
- Date: Thu, 7 Feb 2019 23:21:14 +0000 (UTC)
commit e543f7ca26143f289dba91be7edd592f34ecb88f
Author: Christian Hergert <chergert redhat com>
Date: Thu Feb 7 15:17:01 2019 -0800
editor: special case "gnome-builder -e"
Fixes #804
src/plugins/editor/gbp-editor-application-addin.c | 33 ++++++++++++++++++++---
1 file changed, 30 insertions(+), 3 deletions(-)
---
diff --git a/src/plugins/editor/gbp-editor-application-addin.c
b/src/plugins/editor/gbp-editor-application-addin.c
index aff28f88a..a277fc09b 100644
--- a/src/plugins/editor/gbp-editor-application-addin.c
+++ b/src/plugins/editor/gbp-editor-application-addin.c
@@ -180,12 +180,39 @@ gbp_editor_application_addin_handle_command_line (IdeApplicationAddin *addin
g_assert (IDE_IS_APPLICATION (app));
g_assert (G_IS_APPLICATION_COMMAND_LINE (cmdline));
+ argv = g_application_command_line_get_arguments (cmdline, &argc);
+
if ((options = g_application_command_line_get_options_dict (cmdline)) &&
g_variant_dict_contains (options, "editor"))
- ide_application_set_workspace_type (application, IDE_TYPE_EDITOR_WORKSPACE);
+ {
+ ide_application_set_workspace_type (application, IDE_TYPE_EDITOR_WORKSPACE);
+
+ /* Just open the editor workspace if no files were specified */
+ if (argc < 2)
+ {
+ IdeEditorWorkspace *workspace;
+ IdeContext *context;
+
+ workdir = g_application_command_line_create_file_for_arg (cmdline, ".");
+ ide_application_set_command_line_handled (application, cmdline, TRUE);
+
+ workbench = ide_workbench_new ();
+ ide_application_add_workbench (app, workbench);
+
+ context = ide_workbench_get_context (workbench);
+ ide_context_set_workdir (context, workdir);
+
+ workspace = ide_editor_workspace_new (application);
+ ide_workbench_add_workspace (workbench, IDE_WORKSPACE (workspace));
+
+ _ide_window_settings_register (GTK_WINDOW (workspace));
+
+ ide_workbench_focus_workspace (workbench, IDE_WORKSPACE (workspace));
+
+ return;
+ }
+ }
- /* Ignore if no parameters were passed */
- argv = g_application_command_line_get_arguments (cmdline, &argc);
if (argc < 2)
return;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]