[gnome-builder/wip/gtk4-port: 332/1774] libide/editor: connect title and modified bit
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/wip/gtk4-port: 332/1774] libide/editor: connect title and modified bit
- Date: Mon, 11 Jul 2022 22:31:08 +0000 (UTC)
commit dc1e91de45ce317865e7258352e1e52f4fbbb15c
Author: Christian Hergert <chergert redhat com>
Date: Sat Apr 2 03:56:39 2022 -0700
libide/editor: connect title and modified bit
src/libide/editor/ide-editor-page.c | 32 +++++++++++++++++++++++++++++++-
1 file changed, 31 insertions(+), 1 deletion(-)
---
diff --git a/src/libide/editor/ide-editor-page.c b/src/libide/editor/ide-editor-page.c
index 129f169db..4999113ad 100644
--- a/src/libide/editor/ide-editor-page.c
+++ b/src/libide/editor/ide-editor-page.c
@@ -35,15 +35,45 @@ G_DEFINE_TYPE (IdeEditorPage, ide_editor_page, IDE_TYPE_PAGE)
static GParamSpec *properties [N_PROPS];
+static void
+ide_editor_page_modified_changed_cb (IdeEditorPage *self,
+ IdeBuffer *buffer)
+{
+ IDE_ENTRY;
+
+ g_assert (IDE_IS_EDITOR_PAGE (self));
+ g_assert (IDE_IS_BUFFER (buffer));
+
+ panel_widget_set_modified (PANEL_WIDGET (self),
+ gtk_text_buffer_get_modified (GTK_TEXT_BUFFER (buffer)));
+
+ IDE_EXIT;
+}
+
static void
ide_editor_page_set_buffer (IdeEditorPage *self,
IdeBuffer *buffer)
{
+ IDE_ENTRY;
+
g_assert (IDE_IS_EDITOR_PAGE (self));
g_assert (IDE_IS_BUFFER (buffer));
if (g_set_object (&self->buffer, buffer))
- gtk_text_view_set_buffer (GTK_TEXT_VIEW (self->view), GTK_TEXT_BUFFER (buffer));
+ {
+ gtk_text_view_set_buffer (GTK_TEXT_VIEW (self->view), GTK_TEXT_BUFFER (buffer));
+
+ g_signal_connect_object (buffer,
+ "modified-changed",
+ G_CALLBACK (ide_editor_page_modified_changed_cb),
+ self,
+ G_CONNECT_SWAPPED);
+
+ g_object_bind_property (buffer, "title", self, "title", G_BINDING_SYNC_CREATE);
+ ide_editor_page_modified_changed_cb (self, buffer);
+ }
+
+ IDE_EXIT;
}
static gboolean
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]