[gnome-builder] editor-view: propagate failure to layout view



commit ab51bde5837912c8fd24581dfd2f8dc9492529c1
Author: Christian Hergert <chergert redhat com>
Date:   Wed Dec 13 01:28:44 2017 -0800

    editor-view: propagate failure to layout view
    
    This sets the failed property when the buffer fails. This is
    useful so that we can hide the failed view from the user, as
    it could be in a broken state.

 src/libide/editor/ide-editor-view.c |   21 +++++++++++++++++++++
 1 files changed, 21 insertions(+), 0 deletions(-)
---
diff --git a/src/libide/editor/ide-editor-view.c b/src/libide/editor/ide-editor-view.c
index 58134eb..d7705d4 100644
--- a/src/libide/editor/ide-editor-view.c
+++ b/src/libide/editor/ide-editor-view.c
@@ -88,6 +88,21 @@ ide_editor_view_load_fonts (IdeEditorView *self)
 }
 
 static void
+ide_editor_view_buffer_notify_failed (IdeEditorView *self,
+                                      GParamSpec    *pspec,
+                                      IdeBuffer     *buffer)
+{
+  gboolean failed;
+
+  g_assert (IDE_IS_EDITOR_VIEW (self));
+  g_assert (IDE_IS_BUFFER (buffer));
+
+  failed = ide_buffer_get_failed (buffer);
+
+  ide_layout_view_set_failed (IDE_LAYOUT_VIEW (self), failed);
+}
+
+static void
 ide_editor_view_stop_search (IdeEditorView      *self,
                              IdeEditorSearchBar *search_bar)
 {
@@ -300,6 +315,7 @@ ide_editor_view_bind_signals (IdeEditorView  *self,
   ide_editor_view_buffer_modified_changed (self, buffer);
   ide_editor_view_buffer_notify_language (self, NULL, buffer);
   ide_editor_view_buffer_notify_style_scheme (self, NULL, buffer);
+  ide_editor_view_buffer_notify_failed (self, NULL, buffer);
 }
 
 static void
@@ -929,6 +945,11 @@ ide_editor_view_init (IdeEditorView *self)
                                     self);
 
   dzl_signal_group_connect_swapped (self->buffer_signals,
+                                    "notify::failed",
+                                    G_CALLBACK (ide_editor_view_buffer_notify_failed),
+                                    self);
+
+  dzl_signal_group_connect_swapped (self->buffer_signals,
                                     "notify::language",
                                     G_CALLBACK (ide_editor_view_buffer_notify_language),
                                     self);


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