Commit 7f4bd68d authored by Christian Hergert's avatar Christian Hergert
Browse files

glade: update designer when source buffer is saved

parent 226e17dd
......@@ -240,6 +240,50 @@ viewport_style_changed_cb (GbpGladeView *self,
ide_layout_view_set_primary_color_fg (IDE_LAYOUT_VIEW (self), &fg);
static void
gbp_glade_view_buffer_saved_cb (GbpGladeView *self,
IdeBuffer *buffer,
IdeBufferManager *bufmgr)
IdeFile *file;
GFile *gfile;
g_assert (GBP_IS_GLADE_VIEW (self));
g_assert (IDE_IS_BUFFER (buffer));
g_assert (IDE_IS_BUFFER_MANAGER (bufmgr));
if (self->file == NULL)
file = ide_buffer_get_file (buffer);
gfile = ide_file_get_file (file);
if (g_file_equal (gfile, self->file))
_gbp_glade_view_reload (self);
static void
gbp_glade_view_context_set (GtkWidget *widget,
IdeContext *context)
GbpGladeView *self = (GbpGladeView *)widget;
IdeBufferManager *bufmgr;
g_assert (GBP_IS_GLADE_VIEW (self));
g_assert (!context || IDE_IS_CONTEXT (context));
if (context == NULL)
/* Track when buffers are saved so that we can reload the view */
bufmgr = ide_context_get_buffer_manager (context);
g_signal_connect_object (bufmgr,
G_CALLBACK (gbp_glade_view_buffer_saved_cb),
static void
gbp_glade_view_dispose (GObject *object)
......@@ -318,6 +362,8 @@ gbp_glade_view_init (GbpGladeView *self)
ide_layout_view_set_icon_name (IDE_LAYOUT_VIEW (self), "glade-symbolic");
ide_layout_view_set_menu_id (IDE_LAYOUT_VIEW (self), "gbp-glade-view-document-menu");
ide_widget_set_context_handler (self, gbp_glade_view_context_set);
self->project = glade_project_new ();
g_signal_connect_object (self->project,
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment