Commit ac80fef0 authored by Christian Hergert's avatar Christian Hergert
Browse files

command-bar: close workbench cleanly when command bar focused

We got into a weird state trying to restore focus when leaving the command
bar and the workbench was closing.
parent 4517b61a
......@@ -117,11 +117,17 @@ gb_command_bar_hide (GbCommandBar *bar)
gtk_revealer_set_reveal_child (GTK_REVEALER (bar), FALSE);
workbench = gb_widget_get_workbench (GTK_WIDGET (bar));
if ((workbench == NULL) || gb_workbench_get_closing (workbench))
workspace = gb_workbench_get_active_workspace (workbench);
focus = GTK_WIDGET (workspace);
if (workspace == NULL)
if (bar->priv->last_focus)
focus = find_alternate_focus (bar->priv->last_focus);
focus = GTK_WIDGET (workspace);
gtk_widget_grab_focus (focus);
......@@ -884,3 +884,11 @@ gb_workbench_add_temporary_buffer (GbWorkbench *self)
buffer_manager = ide_context_get_buffer_manager (context);
buffer = ide_buffer_manager_create_buffer (buffer_manager);
gb_workbench_get_closing (GbWorkbench *self)
g_return_val_if_fail (GB_IS_WORKBENCH (self), FALSE);
return (self->unloading || (self->disposing > 0));
......@@ -53,6 +53,7 @@ void gb_workbench_open_uri_list (GbWorkbench *self,
GbCommandManager *gb_workbench_get_command_manager (GbWorkbench *self);
gpointer gb_workbench_get_workspace_typed (GbWorkbench *self,
GType workspace_type);
gboolean gb_workbench_get_closing (GbWorkbench *self);
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