Commit 22b658ad authored by Christian Hergert's avatar Christian Hergert
Browse files

workbench: avoid creating temporary file with command line params

There is a case we restored nothing, and the command line files have been
requested to be opened, but no buffers have yet been created.

We don't want to open a temporary buffer in that case.
parent fbc1d250
......@@ -54,8 +54,10 @@ struct _GbWorkbench
gulong project_notify_name_handler;
guint disposing;
guint building : 1;
guint unloading : 1;
guint has_opened : 1;
};
G_END_DECLS
......
......@@ -97,7 +97,7 @@ gb_workbench__context_restore_cb (GObject *object,
}
buffer_manager = ide_context_get_buffer_manager (context);
if (ide_buffer_manager_get_n_buffers (buffer_manager) == 0)
if ((ide_buffer_manager_get_n_buffers (buffer_manager) == 0) && (self->has_opened == FALSE))
gb_workbench_add_temporary_buffer (self);
gtk_widget_grab_focus (GTK_WIDGET (self->editor_workspace));
......@@ -121,11 +121,6 @@ gb_workbench_connect_context (GbWorkbench *self,
self,
G_CONNECT_SWAPPED);
gb_workbench__project_notify_name_cb (self, NULL, project);
ide_context_restore_async (context,
NULL,
gb_workbench__context_restore_cb,
g_object_ref (self));
}
static void
......@@ -301,6 +296,11 @@ gb_workbench_realize (GtkWidget *widget)
GTK_WIDGET_CLASS (gb_workbench_parent_class)->realize (widget);
gtk_widget_grab_focus (GTK_WIDGET (self->editor_workspace));
ide_context_restore_async (self->context,
NULL,
gb_workbench__context_restore_cb,
g_object_ref (self));
}
static void
......@@ -680,6 +680,8 @@ gb_workbench_open (GbWorkbench *self,
g_return_if_fail (self->unloading == FALSE);
g_return_if_fail (self->context);
self->has_opened = TRUE;
/*
* TODO: We probably want to dispatch this based on the type. But for now,
* we will just try to open it with the buffer manager.
......
Supports Markdown
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