Commit 28c30a57 authored by Sébastien Lafargue's avatar Sébastien Lafargue

workbennch: add a IDE_WORKBENCH_OPEN_FLAGS_NO_VIEW flag

to resume:

IDE_WORKBENCH_OPEN_FLAGS_NO_VIEW:
  load the buffer but don't create a view

IDE_WORKBENCH_OPEN_FLAGS_BACKGROUND:
  load the buffer, create the view, don't present it to the user

of course the buffer/view are only created if it's not already done.
parent 22e3f99e
......@@ -712,8 +712,9 @@ ide_buffer_manager__load_file_query_info_cb (GObject *object,
}
}
if (state->is_new || (state->flags & IDE_WORKBENCH_OPEN_FLAGS_BACKGROUND) == 0)
create_new_view = TRUE;
if (!(state->flags & IDE_WORKBENCH_OPEN_FLAGS_NO_VIEW))
if (state->is_new || (state->flags & IDE_WORKBENCH_OPEN_FLAGS_BACKGROUND) == 0)
create_new_view = TRUE;
g_signal_emit (self, signals [LOAD_BUFFER], 0, state->buffer, create_new_view);
......@@ -862,8 +863,9 @@ ide_buffer_manager_load_file_async (IdeBufferManager *self,
"fraction", 1.0,
NULL);
g_task_return_pointer (task, g_object_ref (buffer), g_object_unref);
if (!(flags & IDE_WORKBENCH_OPEN_FLAGS_BACKGROUND))
if (!(flags & IDE_WORKBENCH_OPEN_FLAGS_BACKGROUND || flags & IDE_WORKBENCH_OPEN_FLAGS_NO_VIEW))
ide_buffer_manager_set_focus_buffer (self, buffer);
IDE_EXIT;
}
......
......@@ -362,7 +362,9 @@ ide_editor_workbench_addin_open_cb (GObject *object,
}
}
if (self->perspective != NULL && !(open_file_task_data->flags & IDE_WORKBENCH_OPEN_FLAGS_BACKGROUND))
if (self->perspective != NULL &&
!(open_file_task_data->flags & IDE_WORKBENCH_OPEN_FLAGS_NO_VIEW) &&
!(open_file_task_data->flags & IDE_WORKBENCH_OPEN_FLAGS_BACKGROUND))
ide_editor_perspective_focus_buffer_in_current_stack (self->perspective, buffer);
g_task_return_boolean (task, TRUE);
......
......@@ -34,6 +34,7 @@ typedef enum
{
IDE_WORKBENCH_OPEN_FLAGS_NONE = 0,
IDE_WORKBENCH_OPEN_FLAGS_BACKGROUND = 1 << 0,
IDE_WORKBENCH_OPEN_FLAGS_NO_VIEW = 1 << 1,
} IdeWorkbenchOpenFlags;
#define IDE_TYPE_WORKBENCH (ide_workbench_get_type())
......
......@@ -616,7 +616,7 @@ load_split_async (GtkWidget *active_widget,
&file,
1,
"editor",
IDE_WORKBENCH_OPEN_FLAGS_BACKGROUND,
IDE_WORKBENCH_OPEN_FLAGS_NO_VIEW,
NULL,
callback,
split_callback_data);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment