Commit 48269865 authored by Christian Hergert's avatar Christian Hergert

editor: reload change monitors upon IdeVcs::changed

When the VCS is reloaded from a new index then reload all our change
monitors so that we have the newest blob to compare against.

Fixes #1248
parent c9fc6ee1
......@@ -327,6 +327,67 @@ gbp_editor_workbench_addin_workspace_removed (IdeWorkbenchAddin *addin,
g_action_map_remove_action (G_ACTION_MAP (workspace), actions[i].name);
}
static void
gbp_editor_workbench_addin_vcs_changed_page_cb (GtkWidget *widget,
gpointer user_data)
{
IdePage *page = (IdePage *)widget;
IdeBufferChangeMonitor *change_monitor;
IdeBuffer *buffer;
g_assert (IDE_IS_PAGE (page));
if (!IDE_IS_EDITOR_PAGE (page))
return;
if (!(buffer = ide_editor_page_get_buffer (IDE_EDITOR_PAGE (page))))
return;
if (!(change_monitor = ide_buffer_get_change_monitor (buffer)))
return;
ide_buffer_change_monitor_reload (change_monitor);
}
static void
gbp_editor_workbench_addin_vcs_index_changed_cb (IdeWorkbenchAddin *addin,
IdeVcs *vcs)
{
GbpEditorWorkbenchAddin *self = (GbpEditorWorkbenchAddin *)addin;
IDE_ENTRY;
g_assert (IDE_IS_WORKBENCH_ADDIN (addin));
g_assert (IDE_IS_VCS (vcs));
ide_workbench_foreach_page (self->workbench,
(GtkCallback) gbp_editor_workbench_addin_vcs_changed_page_cb,
NULL);
IDE_EXIT;
}
static void
gbp_editor_workbench_addin_vcs_changed (IdeWorkbenchAddin *addin,
IdeVcs *vcs)
{
GbpEditorWorkbenchAddin *self = (GbpEditorWorkbenchAddin *)addin;
IDE_ENTRY;
g_assert (IDE_IS_WORKBENCH_ADDIN (addin));
g_assert (!vcs || IDE_IS_VCS (vcs));
if (vcs != NULL)
g_signal_connect_object (vcs,
"changed",
G_CALLBACK (gbp_editor_workbench_addin_vcs_index_changed_cb),
self,
G_CONNECT_SWAPPED);
IDE_EXIT;
}
static void
ide_workbench_addin_iface_init (IdeWorkbenchAddinInterface *iface)
{
......@@ -338,4 +399,5 @@ ide_workbench_addin_iface_init (IdeWorkbenchAddinInterface *iface)
iface->unload = gbp_editor_workbench_addin_unload;
iface->workspace_added = gbp_editor_workbench_addin_workspace_added;
iface->workspace_removed = gbp_editor_workbench_addin_workspace_removed;
iface->vcs_changed = gbp_editor_workbench_addin_vcs_changed;
}
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