[gnome-builder] libide/gui: add page.open-in-new-workspace action
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] libide/gui: add page.open-in-new-workspace action
- Date: Fri, 29 Jul 2022 19:15:55 +0000 (UTC)
commit c342eac6923c1bef6d39b70f53c30e47728b6d93
Author: Christian Hergert <chergert redhat com>
Date: Fri Jul 29 12:09:47 2022 -0700
libide/gui: add page.open-in-new-workspace action
This is useful for a number of pages that can be split and moved to another
workspace window instead of just editorui.
src/libide/gui/ide-page.c | 31 +++++++++++++++++++++++++++++++
1 file changed, 31 insertions(+)
---
diff --git a/src/libide/gui/ide-page.c b/src/libide/gui/ide-page.c
index 38b3cb440..2c0bebc22 100644
--- a/src/libide/gui/ide-page.c
+++ b/src/libide/gui/ide-page.c
@@ -30,6 +30,7 @@
#include "ide-application.h"
#include "ide-gui-global.h"
#include "ide-page-private.h"
+#include "ide-workbench-private.h"
#include "ide-workspace-private.h"
typedef struct
@@ -161,6 +162,33 @@ ide_page_mark_used (IdePage *self)
_ide_workspace_move_front_page_mru (workspace, &priv->mru_link);
}
+static void
+open_in_new_workspace_action (GtkWidget *widget,
+ const char *action_name,
+ GVariant *param)
+{
+ IdePage *self = (IdePage *)widget;
+ g_autoptr(IdePanelPosition) position = NULL;
+ IdeWorkspace *workspace;
+ IdeWorkbench *workbench;
+ IdePage *split;
+
+ IDE_ENTRY;
+
+ g_assert (IDE_IS_PAGE (self));
+
+ if (!(split = ide_page_create_split (self)))
+ IDE_EXIT;
+
+ workbench = ide_widget_get_workbench (GTK_WIDGET (self));
+ workspace = _ide_workbench_create_secondary (workbench);
+ ide_workspace_add_page (IDE_WORKSPACE (workspace), IDE_PAGE (split), position);
+
+ gtk_window_present (GTK_WINDOW (workspace));
+
+ IDE_EXIT;
+}
+
static void
ide_page_finalize (GObject *object)
{
@@ -226,6 +254,7 @@ ide_page_class_init (IdePageClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
+ PanelWidgetClass *panel_widget_class = PANEL_WIDGET_CLASS (klass);
object_class->finalize = ide_page_finalize;
object_class->get_property = ide_page_get_property;
@@ -287,6 +316,8 @@ ide_page_class_init (IdePageClass *klass)
gtk_widget_class_bind_template_child_private (widget_class, IdePage, content_box);
gtk_widget_class_bind_template_child_private (widget_class, IdePage, overlay);
gtk_widget_class_bind_template_child_private (widget_class, IdePage, progress_bar);
+
+ panel_widget_class_install_action (panel_widget_class, "open-in-new-workspace", NULL,
open_in_new_workspace_action);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]