[gnome-builder/wip/gtk4-port: 322/736] libide/gui: add IdeWorkspaceAddin.focus_changed
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/wip/gtk4-port: 322/736] libide/gui: add IdeWorkspaceAddin.focus_changed
- Date: Tue, 26 Apr 2022 01:46:23 +0000 (UTC)
commit 62e7d55c36193dcc88ae1acaee5e212dd4299e39
Author: Christian Hergert <chergert redhat com>
Date: Fri Apr 1 19:51:46 2022 -0700
libide/gui: add IdeWorkspaceAddin.focus_changed
This is to be used when the focus page changes within a workspace now that
the workspaces can have a bit more control without the need to indirect
through an IdeSurface.
A secondary goal here is to remove the need for IdeEditorAddin and just
use the IdeWorkspaceAddin directly (or IdeWorkbenchAddin when needed).
src/libide/gui/ide-workspace-addin.c | 19 +++++++++++++++++++
src/libide/gui/ide-workspace-addin.h | 20 ++++++++++++++++----
2 files changed, 35 insertions(+), 4 deletions(-)
---
diff --git a/src/libide/gui/ide-workspace-addin.c b/src/libide/gui/ide-workspace-addin.c
index 301777797..f6acde158 100644
--- a/src/libide/gui/ide-workspace-addin.c
+++ b/src/libide/gui/ide-workspace-addin.c
@@ -87,3 +87,22 @@ ide_workspace_addin_unload (IdeWorkspaceAddin *self,
if (IDE_WORKSPACE_ADDIN_GET_IFACE (self)->unload)
IDE_WORKSPACE_ADDIN_GET_IFACE (self)->unload (self, workspace);
}
+
+/**
+ * ide_workspace_addin_page_changed:
+ * @self: a #IdeWorkspaceAddin
+ * @page: (nullable): an #IdePage or %NULL
+ *
+ * Called when the current page has changed based on focus within
+ * the workspace.
+ */
+void
+ide_workspace_addin_page_changed (IdeWorkspaceAddin *self,
+ IdePage *page)
+{
+ g_return_if_fail (IDE_IS_WORKSPACE_ADDIN (self));
+ g_return_if_fail (!page || IDE_IS_PAGE (page));
+
+ if (IDE_WORKSPACE_ADDIN_GET_IFACE (self)->page_changed)
+ IDE_WORKSPACE_ADDIN_GET_IFACE (self)->page_changed (self, page);
+}
diff --git a/src/libide/gui/ide-workspace-addin.h b/src/libide/gui/ide-workspace-addin.h
index a38964a2b..4c915a841 100644
--- a/src/libide/gui/ide-workspace-addin.h
+++ b/src/libide/gui/ide-workspace-addin.h
@@ -20,6 +20,13 @@
#pragma once
+#if !defined (IDE_GUI_INSIDE) && !defined (IDE_GUI_COMPILATION)
+# error "Only <libide-gui.h> can be included directly."
+#endif
+
+#include <libide-core.h>
+
+#include "ide-page.h"
#include "ide-workspace.h"
G_BEGIN_DECLS
@@ -33,10 +40,12 @@ struct _IdeWorkspaceAddinInterface
{
GTypeInterface parent_iface;
- void (*load) (IdeWorkspaceAddin *self,
- IdeWorkspace *workspace);
- void (*unload) (IdeWorkspaceAddin *self,
- IdeWorkspace *workspace);
+ void (*load) (IdeWorkspaceAddin *self,
+ IdeWorkspace *workspace);
+ void (*unload) (IdeWorkspaceAddin *self,
+ IdeWorkspace *workspace);
+ void (*page_changed) (IdeWorkspaceAddin *self,
+ IdePage *page);
};
IDE_AVAILABLE_IN_ALL
@@ -46,6 +55,9 @@ IDE_AVAILABLE_IN_ALL
void ide_workspace_addin_unload (IdeWorkspaceAddin *self,
IdeWorkspace *workspace);
IDE_AVAILABLE_IN_ALL
+void ide_workspace_addin_page_changed (IdeWorkspaceAddin *self,
+ IdePage *page);
+IDE_AVAILABLE_IN_ALL
IdeWorkspaceAddin *ide_workspace_addin_find_by_module_name (IdeWorkspace *workspace,
const gchar *module_name);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]