[gnome-builder] git: wire up reloading of change monitors when repository reloads



commit c9fc6ee14ef0d3fce26cb11218a29a4859e117b1
Author: Christian Hergert <chergert redhat com>
Date:   Sat Jun 27 14:38:46 2020 -0700

    git: wire up reloading of change monitors when repository reloads
    
    Related #1248

 src/plugins/git/daemon/ipc-git-change-monitor-impl.h |  5 +++--
 src/plugins/git/daemon/ipc-git-repository-impl.c     | 11 +++++++++++
 src/plugins/git/gbp-git-buffer-change-monitor.c      |  4 ++++
 3 files changed, 18 insertions(+), 2 deletions(-)
---
diff --git a/src/plugins/git/daemon/ipc-git-change-monitor-impl.h 
b/src/plugins/git/daemon/ipc-git-change-monitor-impl.h
index 768a51181..12bf87f43 100644
--- a/src/plugins/git/daemon/ipc-git-change-monitor-impl.h
+++ b/src/plugins/git/daemon/ipc-git-change-monitor-impl.h
@@ -30,7 +30,8 @@ G_BEGIN_DECLS
 
 G_DECLARE_FINAL_TYPE (IpcGitChangeMonitorImpl, ipc_git_change_monitor_impl, IPC, GIT_CHANGE_MONITOR_IMPL, 
IpcGitChangeMonitorSkeleton)
 
-IpcGitChangeMonitor *ipc_git_change_monitor_impl_new (GgitRepository *repository,
-                                                      const gchar    *path);
+IpcGitChangeMonitor *ipc_git_change_monitor_impl_new   (GgitRepository          *repository,
+                                                        const gchar             *path);
+void                 ipc_git_change_monitor_impl_reset (IpcGitChangeMonitorImpl *self);
 
 G_END_DECLS
diff --git a/src/plugins/git/daemon/ipc-git-repository-impl.c 
b/src/plugins/git/daemon/ipc-git-repository-impl.c
index f2631945d..74e4f500b 100644
--- a/src/plugins/git/daemon/ipc-git-repository-impl.c
+++ b/src/plugins/git/daemon/ipc-git-repository-impl.c
@@ -64,9 +64,20 @@ static void
 ipc_git_repository_impl_monitor_changed_cb (IpcGitRepositoryImpl *self,
                                             IpcGitIndexMonitor   *monitor)
 {
+  GHashTableIter iter;
+  gpointer key;
+
   g_assert (IPC_IS_GIT_REPOSITORY_IMPL (self));
   g_assert (IPC_IS_GIT_INDEX_MONITOR (monitor));
 
+  g_hash_table_iter_init (&iter, self->change_monitors);
+  while (g_hash_table_iter_next (&iter, (gpointer *)&key, NULL))
+    {
+      IpcGitChangeMonitorImpl *change_monitor = key;
+      g_assert (IPC_IS_GIT_CHANGE_MONITOR_IMPL (change_monitor));
+      ipc_git_change_monitor_impl_reset (change_monitor);
+    }
+
   ipc_git_repository_emit_changed (IPC_GIT_REPOSITORY (self));
 }
 
diff --git a/src/plugins/git/gbp-git-buffer-change-monitor.c b/src/plugins/git/gbp-git-buffer-change-monitor.c
index 4ef2e3a19..3528827c4 100644
--- a/src/plugins/git/gbp-git-buffer-change-monitor.c
+++ b/src/plugins/git/gbp-git-buffer-change-monitor.c
@@ -129,10 +129,14 @@ gbp_git_buffer_change_monitor_reload (IdeBufferChangeMonitor *monitor)
 {
   GbpGitBufferChangeMonitor *self = (GbpGitBufferChangeMonitor *)monitor;
 
+  IDE_ENTRY;
+
   g_assert (IDE_IS_MAIN_THREAD ());
   g_assert (GBP_IS_GIT_BUFFER_CHANGE_MONITOR (self));
 
   gbp_git_buffer_change_monitor_queue_update (self, FAST);
+
+  IDE_EXIT;
 }
 
 static void


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