[gnome-builder] terminal: try harder to place terminal in MRU frame
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] terminal: try harder to place terminal in MRU frame
- Date: Thu, 2 May 2019 19:00:29 +0000 (UTC)
commit 950b26d05bf5e4f3d2469b5767e12223a61d1cb3
Author: Christian Hergert <chergert redhat com>
Date: Thu May 2 12:00:16 2019 -0700
terminal: try harder to place terminal in MRU frame
src/plugins/terminal/gbp-terminal-workspace-addin.c | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
---
diff --git a/src/plugins/terminal/gbp-terminal-workspace-addin.c
b/src/plugins/terminal/gbp-terminal-workspace-addin.c
index 6d1bccaea..a932bbc38 100644
--- a/src/plugins/terminal/gbp-terminal-workspace-addin.c
+++ b/src/plugins/terminal/gbp-terminal-workspace-addin.c
@@ -112,6 +112,7 @@ new_terminal_activate (GSimpleAction *action,
IdeSurface *surface;
IdeRuntime *runtime = NULL;
const gchar *name;
+ GtkWidget *current_frame = NULL;
IdePage *current_page;
const gchar *uri = NULL;
@@ -122,9 +123,12 @@ new_terminal_activate (GSimpleAction *action,
/* If we are creating a new terminal while we already have a terminal
* focused, then try to copy some details from that terminal.
*/
- if ((current_page = ide_workspace_get_most_recent_page (self->workspace)) &&
- IDE_IS_TERMINAL_PAGE (current_page))
- uri = ide_terminal_page_get_current_directory_uri (IDE_TERMINAL_PAGE (current_page));
+ if ((current_page = ide_workspace_get_most_recent_page (self->workspace)))
+ {
+ if (IDE_IS_TERMINAL_PAGE (current_page))
+ uri = ide_terminal_page_get_current_directory_uri (IDE_TERMINAL_PAGE (current_page));
+ current_frame = gtk_widget_get_ancestor (GTK_WIDGET (current_page), IDE_TYPE_FRAME);
+ }
name = g_action_get_name (G_ACTION (action));
@@ -198,7 +202,11 @@ new_terminal_activate (GSimpleAction *action,
"respawn-on-exit", FALSE,
"visible", TRUE,
NULL);
- gtk_container_add (GTK_CONTAINER (surface), GTK_WIDGET (page));
+
+ if (current_frame != NULL)
+ gtk_container_add (GTK_CONTAINER (current_frame), GTK_WIDGET (page));
+ else
+ gtk_container_add (GTK_CONTAINER (surface), GTK_WIDGET (page));
ide_widget_reveal_and_grab (GTK_WIDGET (page));
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]