[gnome-builder/wip/gtk4-port] plugins/vim: close when last page in frame



commit 1672522b29dacbb231fa9b30fc4e48648c89d1ee
Author: Christian Hergert <chergert redhat com>
Date:   Fri May 13 22:39:52 2022 -0700

    plugins/vim: close when last page in frame

 src/plugins/vim/gbp-vim-editor-page-addin.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
---
diff --git a/src/plugins/vim/gbp-vim-editor-page-addin.c b/src/plugins/vim/gbp-vim-editor-page-addin.c
index e4236b13d..8cb1f85c2 100644
--- a/src/plugins/vim/gbp-vim-editor-page-addin.c
+++ b/src/plugins/vim/gbp-vim-editor-page-addin.c
@@ -364,7 +364,17 @@ gbp_vim_editor_page_addin_execute_command_cb (GbpVimEditorPageAddin *self,
       g_str_equal (command, ":quit") ||
       g_str_equal (command, "^Wc"))
     {
+      IdeGrid *grid = IDE_GRID (gtk_widget_get_ancestor (GTK_WIDGET (self->page), IDE_TYPE_GRID));
+      PanelGridColumn *column = PANEL_GRID_COLUMN (gtk_widget_get_ancestor (GTK_WIDGET (self->page), 
PANEL_TYPE_GRID_COLUMN));
+      IdeFrame *frame = IDE_FRAME (gtk_widget_get_ancestor (GTK_WIDGET (self->page), IDE_TYPE_FRAME));
+
       panel_widget_close (PANEL_WIDGET (self->page));
+
+      if (panel_frame_get_empty (PANEL_FRAME (frame)) &&
+          (panel_grid_get_n_columns (PANEL_GRID (grid)) > 1 ||
+           panel_grid_column_get_n_rows (column) > 1))
+        gtk_widget_activate_action (GTK_WIDGET (frame), "frame.close", NULL);
+
       IDE_RETURN (TRUE);
     }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]