[gnome-builder/wip/gtk4-port] libide/editor: use progress from IdePage
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/wip/gtk4-port] libide/editor: use progress from IdePage
- Date: Mon, 4 Apr 2022 21:29:25 +0000 (UTC)
commit eb78febcde17c3acaf9b11caae53bb9c3ba4c3ee
Author: Christian Hergert <chergert redhat com>
Date: Mon Apr 4 14:28:17 2022 -0700
libide/editor: use progress from IdePage
Also, while we're here, update the MRU for the workspace when the focus
enters the IdeSourceView.
src/libide/editor/ide-editor-page.c | 20 +++++++++++++
src/libide/editor/ide-editor-page.ui | 55 +++++++++++++++++-------------------
2 files changed, 46 insertions(+), 29 deletions(-)
---
diff --git a/src/libide/editor/ide-editor-page.c b/src/libide/editor/ide-editor-page.c
index 5ae1e3873..28b7c370e 100644
--- a/src/libide/editor/ide-editor-page.c
+++ b/src/libide/editor/ide-editor-page.c
@@ -92,6 +92,25 @@ ide_editor_page_grab_focus (GtkWidget *widget)
return gtk_widget_grab_focus (GTK_WIDGET (IDE_EDITOR_PAGE (widget)->view));
}
+static void
+ide_editor_page_focus_enter_cb (IdeEditorPage *self,
+ GtkEventControllerFocus *controller)
+{
+ g_autofree char *title = NULL;
+
+ IDE_ENTRY;
+
+ g_assert (IDE_IS_EDITOR_PAGE (self));
+ g_assert (GTK_IS_EVENT_CONTROLLER_FOCUS (controller));
+
+ title = ide_buffer_dup_title (self->buffer);
+ g_debug ("Keyboard focus entered page \"%s\"", title);
+
+ ide_page_mark_used (IDE_PAGE (self));
+
+ IDE_EXIT;
+}
+
static void
ide_editor_page_dispose (GObject *object)
{
@@ -189,6 +208,7 @@ ide_editor_page_class_init (IdeEditorPageClass *klass)
gtk_widget_class_bind_template_child (widget_class, IdeEditorPage, map_revealer);
gtk_widget_class_bind_template_child (widget_class, IdeEditorPage, scroller);
gtk_widget_class_bind_template_child (widget_class, IdeEditorPage, view);
+ gtk_widget_class_bind_template_callback (widget_class, ide_editor_page_focus_enter_cb);
}
static void
diff --git a/src/libide/editor/ide-editor-page.ui b/src/libide/editor/ide-editor-page.ui
index e196b00e1..0ade17cfe 100644
--- a/src/libide/editor/ide-editor-page.ui
+++ b/src/libide/editor/ide-editor-page.ui
@@ -1,44 +1,41 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<template class="IdeEditorPage" parent="IdePage">
- <child>
- <object class="GtkOverlay" id="overlay">
+ <child type="content">
+ <object class="GtkBox">
+ <property name="orientation">horizontal</property>
+ <property name="vexpand">true</property>
<child>
- <object class="GtkBox">
- <property name="orientation">vertical</property>
+ <object class="GtkScrolledWindow" id="scroller">
<child>
- <object class="GtkBox">
- <property name="orientation">horizontal</property>
+ <object class="IdeSourceView" id="view">
+ <property name="monospace">true</property>
+ <property name="hexpand">true</property>
+ <property name="vexpand">true</property>
+ <!-- until we have custom gutter renderer ported -->
+ <property name="show-line-numbers">true</property>
<child>
- <object class="GtkScrolledWindow" id="scroller">
- <child>
- <object class="IdeSourceView" id="view">
- <property name="monospace">true</property>
- <property name="hexpand">true</property>
- <property name="vexpand">true</property>
- <!-- until we have custom gutter renderer ported -->
- <property name="show-line-numbers">true</property>
- </object>
- </child>
- </object>
- </child>
- <child>
- <object class="GtkRevealer" id="map_revealer">
- <property name="transition-type">slide-left</property>
- <property name="transition-duration">300</property>
- <property name="reveal-child">true</property>
- <child>
- <object class="GtkSourceMap" id="map">
- <property name="left-margin">6</property>
- <property name="view">view</property>
- </object>
- </child>
+ <object class="GtkEventControllerFocus">
+ <signal name="enter" handler="ide_editor_page_focus_enter_cb" swapped="true"
object="IdeEditorPage"/>
</object>
</child>
</object>
</child>
</object>
</child>
+ <child>
+ <object class="GtkRevealer" id="map_revealer">
+ <property name="transition-type">slide-left</property>
+ <property name="transition-duration">300</property>
+ <property name="reveal-child">true</property>
+ <child>
+ <object class="GtkSourceMap" id="map">
+ <property name="left-margin">6</property>
+ <property name="view">view</property>
+ </object>
+ </child>
+ </object>
+ </child>
</object>
</child>
</template>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]