[gnome-builder/wip/gtk4-port] plugins/terminal: get some basics working of terminals



commit 444557c28c907b22f293f2989201e7f200dbd8e1
Author: Christian Hergert <chergert redhat com>
Date:   Sat Apr 9 10:33:49 2022 -0700

    plugins/terminal: get some basics working of terminals

 src/libide/gui/gtk/menus.ui                        |   8 +-
 src/libide/terminal/ide-terminal-page.ui           |  18 +-
 src/libide/terminal/ide-terminal-search.ui         |  23 +-
 src/plugins/meson.build                            |   2 +-
 .../terminal/gbp-terminal-application-addin.c      | 121 --------
 .../terminal/gbp-terminal-application-addin.h      |  31 --
 .../terminal/gbp-terminal-workspace-addin.c        | 330 ++++-----------------
 src/plugins/terminal/gtk/menus.ui                  |   2 +-
 src/plugins/terminal/meson.build                   |   3 +-
 src/plugins/terminal/terminal-plugin.c             |   8 +-
 src/plugins/terminal/terminal.plugin               |   4 +-
 11 files changed, 77 insertions(+), 473 deletions(-)
---
diff --git a/src/libide/gui/gtk/menus.ui b/src/libide/gui/gtk/menus.ui
index 9acbac1f1..462e26943 100644
--- a/src/libide/gui/gtk/menus.ui
+++ b/src/libide/gui/gtk/menus.ui
@@ -50,12 +50,6 @@
       </item>
     </section>
   </menu>
-  <menu id="ide-primary-workspace-new-menu">
-    <section id="new-document-section">
-    </section>
-    <section id="open-document-section">
-    </section>
-  </menu>
   <menu id="build-menu">
     <section id="build-menu-config">
       <submenu id="build-menu-configs">
@@ -209,7 +203,7 @@
   <menu id="new-document-menu">
     <section id="new-document-section"/>
     <section id="open-document-section"/>
-    <section id="terminal-section"/>
+    <section id="new-terminal-section"/>
   </menu>
   <menu id="project-tree-menu">
     <section id="project-tree-menu-placeholder0"/>
diff --git a/src/libide/terminal/ide-terminal-page.ui b/src/libide/terminal/ide-terminal-page.ui
index a8575b47e..4fb3c0540 100644
--- a/src/libide/terminal/ide-terminal-page.ui
+++ b/src/libide/terminal/ide-terminal-page.ui
@@ -1,26 +1,20 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <interface>
-  <!-- interface-requires gtk+ 3.16 -->
   <template class="IdeTerminalPage" parent="IdePage">
-    <property name="visible">true</property>
+    <property name="hexpand">true</property>
+    <property name="vexpand">true</property>
     <child>
       <object class="GtkPaned" id="paned">
-        <property name="expand">true</property>
         <property name="orientation">vertical</property>
-        <property name="visible">true</property>
         <child>
-          <object class="GtkOverlay" id="terminal_overlay_top">
-            <property name="expand">true</property>
-            <property name="visible">true</property>
+          <object class="GtkOverlay" id="terminal_overlay">
             <child>
               <object class="GtkScrolledWindow">
-                <property name="expand">true</property>
-                <property name="visible">true</property>
                 <child>
-                  <object class="IdeTerminal" id="terminal_top">
+                  <object class="IdeTerminal" id="terminal">
                     <property name="audible-bell">false</property>
-                    <property name="expand">true</property>
-                    <property name="visible">true</property>
+                    <property name="hexpand">true</property>
+                    <property name="vexpand">true</property>
                   </object>
                 </child>
               </object>
diff --git a/src/libide/terminal/ide-terminal-search.ui b/src/libide/terminal/ide-terminal-search.ui
index a4efbd42c..0e5254a7b 100644
--- a/src/libide/terminal/ide-terminal-search.ui
+++ b/src/libide/terminal/ide-terminal-search.ui
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <interface>
-  <template class="IdeTerminalSearch" parent="GtkBin">
+  <template class="IdeTerminalSearch" parent="AdwBin">
     <property name="halign">end</property>
     <property name="valign">start</property>
     <child>
@@ -105,8 +105,6 @@
                     <child>
                       <object class="GtkCheckButton" id="regex_checkbutton">
                         <property name="label" translatable="yes">Regex</property>
-                        <property name="xalign">0</property>
-                        <property name="draw_indicator">true</property>
                         <layout>
                           <property name="column">0</property>
                           <property name="row">0</property>
@@ -116,8 +114,6 @@
                     <child>
                       <object class="GtkCheckButton" id="match_case_checkbutton">
                         <property name="label" translatable="yes">Case sensitive</property>
-                        <property name="xalign">0</property>
-                        <property name="draw_indicator">true</property>
                         <layout>
                           <property name="column">1</property>
                           <property name="row">0</property>
@@ -127,8 +123,6 @@
                     <child>
                       <object class="GtkCheckButton" id="entire_word_checkbutton">
                         <property name="label" translatable="yes">Match whole word</property>
-                        <property name="xalign">0</property>
-                        <property name="draw_indicator">true</property>
                         <layout>
                           <property name="column">2</property>
                           <property name="row">0</property>
@@ -138,20 +132,13 @@
                     <child>
                       <object class="GtkCheckButton" id="wrap_around_checkbutton">
                         <property name="label" translatable="yes">Wrap around</property>
-                        <property name="xalign">0</property>
-                        <property name="draw_indicator">true</property>
+                        <layout>
+                          <property name="column">3</property>
+                          <property name="row">0</property>
+                        </layout>
                       </object>
-                      <packing>
-                        <property name="left_attach">3</property>
-                        <property name="top_attach">0</property>
-                      </packing>
                     </child>
                   </object>
-                  <packing>
-                    <property name="expand">false</property>
-                    <property name="fill">true</property>
-                    <property name="position">1</property>
-                  </packing>
                 </child>
               </object>
             </child>
diff --git a/src/plugins/meson.build b/src/plugins/meson.build
index 6341d8588..e4b91f4c9 100644
--- a/src/plugins/meson.build
+++ b/src/plugins/meson.build
@@ -128,7 +128,7 @@ subdir('stylelint')
 #subdir('symbol-tree')
 #subdir('sysprof')
 #subdir('sysroot')
-#subdir('terminal')
+subdir('terminal')
 #subdir('testui')
 subdir('todo')
 #subdir('ts-language-server')
diff --git a/src/plugins/terminal/gbp-terminal-workspace-addin.c 
b/src/plugins/terminal/gbp-terminal-workspace-addin.c
index b0ca02e75..2522ebc7b 100644
--- a/src/plugins/terminal/gbp-terminal-workspace-addin.c
+++ b/src/plugins/terminal/gbp-terminal-workspace-addin.c
@@ -36,60 +36,13 @@ struct _GbpTerminalWorkspaceAddin
 
   IdeWorkspace       *workspace;
 
-  DzlDockWidget      *bottom_dock;
+  IdePane            *bottom_dock;
   IdeTerminalPage    *bottom;
 
-  DzlDockWidget      *run_panel;
+  IdePane            *run_panel;
   IdeTerminalPage    *run_terminal;
-
-  IdeTerminalPopover *popover;
 };
 
-static void
-terminal_text_inserted_cb (IdeTerminalPage *page,
-                           DzlDockItem     *item)
-{
-  g_assert (IDE_IS_TERMINAL_PAGE (page));
-  g_assert (DZL_IS_DOCK_ITEM (item));
-
-  dzl_dock_item_needs_attention (item);
-}
-
-static void
-bind_needs_attention (DzlDockItem     *item,
-                      IdeTerminalPage *page)
-{
-  g_assert (DZL_IS_DOCK_ITEM (item));
-  g_assert (IDE_IS_TERMINAL_PAGE (page));
-
-  g_signal_connect_object (page,
-                           "text-inserted",
-                           G_CALLBACK (terminal_text_inserted_cb),
-                           item,
-                           0);
-}
-
-static void
-new_terminal_workspace (GSimpleAction *action,
-                        GVariant      *param,
-                        gpointer       user_data)
-{
-  GbpTerminalWorkspaceAddin *self = user_data;
-  IdeTerminalWorkspace *workspace;
-  IdeWorkbench *workbench;
-
-  g_assert (IDE_IS_MAIN_THREAD ());
-  g_assert (G_IS_SIMPLE_ACTION (action));
-  g_assert (GBP_IS_TERMINAL_WORKSPACE_ADDIN (self));
-
-  workbench = ide_widget_get_workbench (GTK_WIDGET (self->workspace));
-  workspace = g_object_new (IDE_TYPE_TERMINAL_WORKSPACE,
-                            "application", IDE_APPLICATION_DEFAULT,
-                            NULL);
-  ide_workbench_add_workspace (workbench, IDE_WORKSPACE (workspace));
-  ide_workbench_focus_workspace (workbench, IDE_WORKSPACE (workspace));
-}
-
 static IdeRuntime *
 find_runtime (IdeWorkspace *workspace)
 {
@@ -131,9 +84,9 @@ new_terminal_activate (GSimpleAction *action,
 {
   GbpTerminalWorkspaceAddin *self = user_data;
   g_autoptr(IdeTerminalLauncher) launcher = NULL;
+  g_autoptr(IdePanelPosition) position = NULL;
   g_autofree gchar *cwd = NULL;
-  IdeTerminalPage *page;
-  IdeSurface *surface;
+  IdePage *page;
   IdeRuntime *runtime = NULL;
   IdeContext *context;
   const gchar *name;
@@ -186,32 +139,14 @@ new_terminal_activate (GSimpleAction *action,
       runtime = find_runtime (self->workspace);
       launcher = ide_terminal_launcher_new_for_runner (runtime);
     }
-  else
-    {
-      if (self->popover != NULL)
-        {
-          runtime = ide_terminal_popover_get_runtime (self->popover);
-          launcher = ide_terminal_launcher_new_for_runtime (runtime);
-        }
-      else
-        {
-          launcher = ide_terminal_launcher_new (context);
-        }
-    }
 
-  if (!(surface = ide_workspace_get_surface_by_name (self->workspace, "editor")) &&
-      !(surface = ide_workspace_get_surface_by_name (self->workspace, "terminal")))
-    return;
-
-  ide_workspace_set_visible_surface (self->workspace, surface);
-
-  if (IDE_IS_EDITOR_SURFACE (surface) && ide_str_equal0 (name, "new-terminal-in-dir"))
+  if (ide_str_equal0 (name, "new-terminal-in-dir"))
     {
-      IdePage *editor = ide_editor_surface_get_active_page (IDE_EDITOR_SURFACE (surface));
+      page = ide_workspace_get_most_recent_page (self->workspace);
 
-      if (IDE_IS_EDITOR_PAGE (editor))
+      if (IDE_IS_EDITOR_PAGE (page))
         {
-          IdeBuffer *buffer = ide_editor_page_get_buffer (IDE_EDITOR_PAGE (editor));
+          IdeBuffer *buffer = ide_editor_page_get_buffer (IDE_EDITOR_PAGE (page));
 
           if (buffer != NULL)
             {
@@ -242,11 +177,11 @@ new_terminal_activate (GSimpleAction *action,
                        NULL);
 
   if (current_frame != NULL)
-    gtk_container_add (GTK_CONTAINER (current_frame), GTK_WIDGET (page));
+    position = ide_frame_get_position (IDE_FRAME (current_frame));
   else
-    gtk_container_add (GTK_CONTAINER (surface), GTK_WIDGET (page));
+    position = ide_panel_position_new ();
 
-  ide_widget_reveal_and_grab (GTK_WIDGET (page));
+  ide_workspace_add_page (self->workspace, page, position);
 }
 
 static void
@@ -283,37 +218,22 @@ on_run_manager_run (GbpTerminalWorkspaceAddin *self,
 
   if (self->run_terminal == NULL)
     {
-      IdeSurface *surface;
-      GtkWidget *bottom_pane;
+      g_autoptr(IdePanelPosition) position = NULL;
 
       self->run_terminal = g_object_new (IDE_TYPE_TERMINAL_PAGE,
                                          "manage-spawn", FALSE,
                                          "pty", pty,
-                                         "visible", TRUE,
                                          NULL);
-      g_signal_connect (self->run_terminal,
-                        "destroy",
-                        G_CALLBACK (gtk_widget_destroyed),
-                        &self->run_terminal);
-
-      self->run_panel = g_object_new (DZL_TYPE_DOCK_WIDGET,
+      self->run_panel = g_object_new (IDE_TYPE_PANE,
                                       "child", self->run_terminal,
                                       "expand", TRUE,
                                       "icon-name", "builder-run-start-symbolic",
                                       "title", _("Application Output"),
-                                      "visible", TRUE,
                                       NULL);
-      bind_needs_attention (DZL_DOCK_ITEM (self->run_panel), self->run_terminal);
-      g_signal_connect (self->run_panel,
-                        "destroy",
-                        G_CALLBACK (gtk_widget_destroyed),
-                        &self->run_panel);
 
-      surface = ide_workspace_get_surface_by_name (self->workspace, "editor");
-      g_assert (IDE_IS_EDITOR_SURFACE (surface));
-
-      bottom_pane = ide_editor_surface_get_utilities (IDE_EDITOR_SURFACE (surface));
-      gtk_container_add (GTK_CONTAINER (bottom_pane), GTK_WIDGET (self->run_panel));
+      position = ide_panel_position_new ();
+      ide_panel_position_set_edge (position, PANEL_DOCK_POSITION_BOTTOM);
+      ide_workspace_add_pane (self->workspace, self->run_panel, position);
     }
   else
     {
@@ -331,13 +251,9 @@ on_run_manager_run (GbpTerminalWorkspaceAddin *self,
 
   /* translators: %s is replaced with the current local time of day */
   formatted = g_strdup_printf (_("Application started at %s\r\n"), tmp);
-
   ide_terminal_page_feed (self->run_terminal, formatted);
 
-  dzl_dock_item_present (DZL_DOCK_ITEM (self->run_panel));
-
 failure:
-
   g_clear_object (&pty);
 
   IDE_EXIT;
@@ -355,7 +271,6 @@ on_run_manager_stopped (GbpTerminalWorkspaceAddin *self,
 }
 
 static const GActionEntry terminal_actions[] = {
-  { "new-terminal-workspace", new_terminal_workspace },
   { "new-terminal", new_terminal_activate },
   { "new-terminal-in-config", new_terminal_activate },
   { "new-terminal-in-runner", new_terminal_activate },
@@ -364,182 +279,59 @@ static const GActionEntry terminal_actions[] = {
   { "debug-terminal", new_terminal_activate },
 };
 
-#define I_ g_intern_string
-
-static const DzlShortcutEntry gbp_terminal_shortcut_entries[] = {
-  { "org.gnome.builder.workspace.new-terminal",
-    0, NULL,
-    N_("Workspace shortcuts"),
-    N_("General"),
-    N_("Terminal") },
-
-  { "org.gnome.builder.workspace.new-terminal-in-config",
-    0, NULL,
-    N_("Workspace shortcuts"),
-    N_("General"),
-    N_("Terminal in Build Runtime") },
-
-  { "org.gnome.builder.workspace.new-terminal-in-runner",
-    0, NULL,
-    N_("Workspace shortcuts"),
-    N_("General"),
-    N_("Terminal in Runtime") },
-};
-
-static void
-gbp_terminal_workspace_addin_setup_shortcuts (GbpTerminalWorkspaceAddin *self,
-                                              IdeWorkspace              *workspace)
-{
-  DzlShortcutController *controller;
-
-  g_assert (GBP_IS_TERMINAL_WORKSPACE_ADDIN (self));
-  g_assert (IDE_IS_WORKSPACE (workspace));
-
-  controller = dzl_shortcut_controller_find (GTK_WIDGET (workspace));
-
-  dzl_shortcut_controller_add_command_action (controller,
-                                              "org.gnome.builder.workspace.new-terminal",
-                                              I_("<primary><shift>t"),
-                                              DZL_SHORTCUT_PHASE_DISPATCH,
-                                              "win.new-terminal");
-
-  dzl_shortcut_controller_add_command_action (controller,
-                                              "org.gnome.builder.workspace.new-terminal-in-config",
-                                              I_("<primary><alt><shift>t"),
-                                              DZL_SHORTCUT_PHASE_DISPATCH,
-                                              "win.new-terminal-in-config");
-
-  dzl_shortcut_controller_add_command_action (controller,
-                                              "org.gnome.builder.workspace.new-terminal-in-runner",
-                                              I_("<primary><alt>t"),
-                                              DZL_SHORTCUT_PHASE_DISPATCH,
-                                              "win.new-terminal-in-runner");
-
-  dzl_shortcut_manager_add_shortcut_entries (NULL,
-                                             gbp_terminal_shortcut_entries,
-                                             G_N_ELEMENTS (gbp_terminal_shortcut_entries),
-                                             GETTEXT_PACKAGE);
-}
-
 static void
 gbp_terminal_workspace_addin_load (IdeWorkspaceAddin *addin,
                                    IdeWorkspace      *workspace)
 {
   GbpTerminalWorkspaceAddin *self = (GbpTerminalWorkspaceAddin *)addin;
   IdeWorkbench *workbench;
-  IdeSurface *surface;
-  GtkWidget *utilities;
+  g_autoptr(IdePanelPosition) position = NULL;
+  IdeRunManager *run_manager;
+  IdeContext *context;
 
   g_assert (GBP_IS_TERMINAL_WORKSPACE_ADDIN (self));
   g_assert (IDE_IS_PRIMARY_WORKSPACE (workspace) ||
-            IDE_IS_EDITOR_WORKSPACE (workspace) ||
-            IDE_IS_TERMINAL_WORKSPACE (workspace));
+            IDE_IS_EDITOR_WORKSPACE (workspace));
 
   self->workspace = workspace;
 
-  gbp_terminal_workspace_addin_setup_shortcuts (self, workspace);
   g_action_map_add_action_entries (G_ACTION_MAP (workspace),
                                    terminal_actions,
                                    G_N_ELEMENTS (terminal_actions),
                                    self);
 
-  if ((surface = ide_workspace_get_surface_by_name (workspace, "editor")) &&
-      IDE_IS_EDITOR_SURFACE (surface) &&
-      (utilities = ide_editor_surface_get_utilities (IDE_EDITOR_SURFACE (surface))))
-    {
-      IdeRunManager *run_manager;
-      IdeContext *context;
 
-      self->bottom_dock = g_object_new (DZL_TYPE_DOCK_WIDGET,
-                                        "title", _("Terminal"),
-                                        "icon-name", "builder-terminal-symbolic",
-                                        "visible", TRUE,
-                                        NULL);
-      g_signal_connect (self->bottom_dock,
-                        "destroy",
-                        G_CALLBACK (gtk_widget_destroyed),
-                        &self->bottom_dock);
-      gtk_container_add (GTK_CONTAINER (utilities), GTK_WIDGET (self->bottom_dock));
-
-      self->bottom = g_object_new (IDE_TYPE_TERMINAL_PAGE,
-                                   "respawn-on-exit", TRUE,
-                                   "visible", TRUE,
-                                   NULL);
-      bind_needs_attention (DZL_DOCK_ITEM (self->bottom_dock), self->bottom);
-      g_signal_connect (self->bottom,
-                        "destroy",
-                        G_CALLBACK (gtk_widget_destroyed),
-                        &self->bottom);
-      gtk_container_add (GTK_CONTAINER (self->bottom_dock), GTK_WIDGET (self->bottom));
-      dzl_dock_item_present (DZL_DOCK_ITEM (self->bottom_dock));
-
-      workbench = ide_widget_get_workbench (GTK_WIDGET (workspace));
-
-      if (ide_workbench_has_project (workbench) && IDE_IS_PRIMARY_WORKSPACE (workspace))
-        {
-          /* Setup terminals when a project is run */
-          context = ide_widget_get_context (GTK_WIDGET (workspace));
-          run_manager = ide_run_manager_from_context (context);
-          g_signal_connect_object (run_manager,
-                                   "run",
-                                   G_CALLBACK (on_run_manager_run),
-                                   self,
-                                   G_CONNECT_SWAPPED);
-          g_signal_connect_object (run_manager,
-                                   "stopped",
-                                   G_CALLBACK (on_run_manager_stopped),
-                                   self,
-                                   G_CONNECT_SWAPPED);
-        }
-    }
+  position = ide_panel_position_new ();
+  ide_panel_position_set_edge (position, PANEL_DOCK_POSITION_BOTTOM);
 
-  /* Add terminal popover button */
-  if (IDE_IS_TERMINAL_WORKSPACE (workspace))
-    {
-      DzlMenuButton *menu_button;
-      IdeHeaderBar *header_bar;
-      GtkButton *button;
-      GtkBox *box;
-
-      box = g_object_new (GTK_TYPE_BOX,
-                          "orientation", GTK_ORIENTATION_HORIZONTAL,
-                          "hexpand", FALSE,
-                          "visible", TRUE,
-                          NULL);
-      dzl_gtk_widget_add_style_class (GTK_WIDGET (box), "linked");
-
-      button = g_object_new (GTK_TYPE_BUTTON,
-                             "focus-on-click", FALSE,
-                             "action-name", "win.new-terminal",
-                             "child", g_object_new (GTK_TYPE_IMAGE,
-                                                    "icon-name", "container-terminal-symbolic",
-                                                    "visible", TRUE,
-                                                    NULL),
-                             "visible", TRUE,
-                             NULL);
-      dzl_gtk_widget_add_style_class (GTK_WIDGET (button), "image-button");
-      gtk_container_add (GTK_CONTAINER (box), GTK_WIDGET (button));
-
-      header_bar = ide_workspace_get_header_bar (workspace);
-      ide_header_bar_add_primary (header_bar, GTK_WIDGET (box));
-
-      self->popover = g_object_new (IDE_TYPE_TERMINAL_POPOVER,
+  self->bottom = g_object_new (IDE_TYPE_TERMINAL_PAGE,
+                               "respawn-on-exit", TRUE,
+                               "visible", TRUE,
+                               NULL);
+  self->bottom_dock = g_object_new (IDE_TYPE_PANE,
+                                    "title", _("Terminal"),
+                                    "icon-name", "builder-terminal-symbolic",
+                                    "child", self->bottom,
                                     NULL);
-      g_signal_connect (self->popover,
-                        "destroy",
-                        G_CALLBACK (gtk_widget_destroyed),
-                        &self->popover);
-
-      menu_button = g_object_new (DZL_TYPE_MENU_BUTTON,
-                                  "focus-on-click", FALSE,
-                                  "icon-name", "pan-down-symbolic",
-                                  "popover", self->popover,
-                                  "show-arrow", FALSE,
-                                  "visible", TRUE,
-                                  NULL);
-      dzl_gtk_widget_add_style_class (GTK_WIDGET (menu_button), "image-button");
-      dzl_gtk_widget_add_style_class (GTK_WIDGET (menu_button), "run-arrow-button");
-      gtk_container_add (GTK_CONTAINER (box), GTK_WIDGET (menu_button));
+  ide_workspace_add_pane (workspace, IDE_PANE (self->bottom_dock), position);
+
+  workbench = ide_widget_get_workbench (GTK_WIDGET (workspace));
+
+  if (ide_workbench_has_project (workbench) && IDE_IS_PRIMARY_WORKSPACE (workspace))
+    {
+      /* Setup terminals when a project is run */
+      context = ide_widget_get_context (GTK_WIDGET (workspace));
+      run_manager = ide_run_manager_from_context (context);
+      g_signal_connect_object (run_manager,
+                               "run",
+                               G_CALLBACK (on_run_manager_run),
+                               self,
+                               G_CONNECT_SWAPPED);
+      g_signal_connect_object (run_manager,
+                               "stopped",
+                               G_CALLBACK (on_run_manager_stopped),
+                               self,
+                               G_CONNECT_SWAPPED);
     }
 }
 
@@ -553,8 +345,7 @@ gbp_terminal_workspace_addin_unload (IdeWorkspaceAddin *addin,
   g_assert (IDE_IS_MAIN_THREAD ());
   g_assert (GBP_IS_TERMINAL_WORKSPACE_ADDIN (self));
   g_assert (IDE_IS_PRIMARY_WORKSPACE (workspace) ||
-            IDE_IS_EDITOR_WORKSPACE (workspace) ||
-            IDE_IS_TERMINAL_WORKSPACE (workspace));
+            IDE_IS_EDITOR_WORKSPACE (workspace));
 
   workbench = ide_widget_get_workbench (GTK_WIDGET (workspace));
 
@@ -573,23 +364,16 @@ gbp_terminal_workspace_addin_unload (IdeWorkspaceAddin *addin,
                                             self);
     }
 
-  if (self->popover != NULL)
-    gtk_widget_destroy (GTK_WIDGET (self->popover));
-
   for (guint i = 0; i < G_N_ELEMENTS (terminal_actions); i++)
     g_action_map_remove_action (G_ACTION_MAP (workspace), terminal_actions[i].name);
 
-  if (self->bottom_dock != NULL)
-    gtk_widget_destroy (GTK_WIDGET (self->bottom_dock));
-
-  if (self->run_panel != NULL)
-    gtk_widget_destroy (GTK_WIDGET (self->run_panel));
-
-  g_assert (self->bottom == NULL);
-  g_assert (self->bottom_dock == NULL);
+  g_clear_pointer ((PanelWidget **)&self->bottom_dock, panel_widget_close);
+  g_clear_pointer ((PanelWidget **)&self->run_panel, panel_widget_close);
 
-  g_assert (self->run_terminal == NULL);
-  g_assert (self->run_panel == NULL);
+  self->bottom = NULL;
+  self->bottom_dock = NULL;
+  self->run_terminal = NULL;
+  self->run_panel = NULL;
 
   self->workspace = NULL;
 }
@@ -602,7 +386,7 @@ workspace_addin_iface_init (IdeWorkspaceAddinInterface *iface)
 }
 
 G_DEFINE_FINAL_TYPE_WITH_CODE (GbpTerminalWorkspaceAddin, gbp_terminal_workspace_addin, G_TYPE_OBJECT,
-                         G_IMPLEMENT_INTERFACE (IDE_TYPE_WORKSPACE_ADDIN, workspace_addin_iface_init))
+                               G_IMPLEMENT_INTERFACE (IDE_TYPE_WORKSPACE_ADDIN, workspace_addin_iface_init))
 
 static void
 gbp_terminal_workspace_addin_class_init (GbpTerminalWorkspaceAddinClass *klass)
diff --git a/src/plugins/terminal/gtk/menus.ui b/src/plugins/terminal/gtk/menus.ui
index 28eaa3757..75480c185 100644
--- a/src/plugins/terminal/gtk/menus.ui
+++ b/src/plugins/terminal/gtk/menus.ui
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <interface>
   <menu id="new-document-menu">
-    <section id="new-document-section">
+    <section id="new-terminal-section">
       <item>
         <attribute name="id">new-terminal</attribute>
         <attribute name="after">new-file</attribute>
diff --git a/src/plugins/terminal/meson.build b/src/plugins/terminal/meson.build
index 5c1514330..0af36541b 100644
--- a/src/plugins/terminal/meson.build
+++ b/src/plugins/terminal/meson.build
@@ -1,6 +1,5 @@
 plugins_sources += files([
-  'gbp-terminal-application-addin.c',
-  'gbp-terminal-preferences-addin.c',
+  # 'gbp-terminal-preferences-addin.c',
   'gbp-terminal-workspace-addin.c',
   'terminal-plugin.c',
 ])
diff --git a/src/plugins/terminal/terminal-plugin.c b/src/plugins/terminal/terminal-plugin.c
index c0f05e747..ce2cf89ba 100644
--- a/src/plugins/terminal/terminal-plugin.c
+++ b/src/plugins/terminal/terminal-plugin.c
@@ -26,19 +26,17 @@
 #include <libide-gui.h>
 #include <libide-terminal.h>
 
-#include "gbp-terminal-application-addin.h"
-#include "gbp-terminal-preferences-addin.h"
+//#include "gbp-terminal-preferences-addin.h"
 #include "gbp-terminal-workspace-addin.h"
 
 _IDE_EXTERN void
 _gbp_terminal_register_types (PeasObjectModule *module)
 {
-  peas_object_module_register_extension_type (module,
-                                              IDE_TYPE_APPLICATION_ADDIN,
-                                              GBP_TYPE_TERMINAL_APPLICATION_ADDIN);
+#if 0
   peas_object_module_register_extension_type (module,
                                               IDE_TYPE_PREFERENCES_ADDIN,
                                               GBP_TYPE_TERMINAL_PREFERENCES_ADDIN);
+#endif
   peas_object_module_register_extension_type (module,
                                               IDE_TYPE_WORKSPACE_ADDIN,
                                               GBP_TYPE_TERMINAL_WORKSPACE_ADDIN);
diff --git a/src/plugins/terminal/terminal.plugin b/src/plugins/terminal/terminal.plugin
index fa450841f..d45696aa1 100644
--- a/src/plugins/terminal/terminal.plugin
+++ b/src/plugins/terminal/terminal.plugin
@@ -2,11 +2,11 @@
 Authors=Christian Hergert <christian hergert me>
 Builtin=true
 Copyright=Copyright © 2014-2018 Christian Hergert
-Depends=editor;
+Depends=
 Description=Builder's terminal support
 Embedded=_gbp_terminal_register_types
 Hidden=true
 Module=terminal
 Name=Terminal
 X-At-Startup=true
-X-Workspace-Kind=editor;primary;terminal;
+X-Workspace-Kind=editor;primary;


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