[gnome-builder/wip/chergert/git-oop] propagate changed notification to peer
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/wip/chergert/git-oop] propagate changed notification to peer
- Date: Fri, 22 Mar 2019 02:04:51 +0000 (UTC)
commit 684edba31797d4a1a8801b7c832d1cb1fa268156
Author: Christian Hergert <chergert redhat com>
Date: Thu Mar 21 19:04:19 2019 -0700
propagate changed notification to peer
src/plugins/git/gnome-builder-git.c | 34 ++++++++++++++++++++++++++++++++++
1 file changed, 34 insertions(+)
---
diff --git a/src/plugins/git/gnome-builder-git.c b/src/plugins/git/gnome-builder-git.c
index dfc9d14ba..d72b9712f 100644
--- a/src/plugins/git/gnome-builder-git.c
+++ b/src/plugins/git/gnome-builder-git.c
@@ -1054,6 +1054,34 @@ handle_get_changes (JsonrpcServer *server,
client_op_ref (op));
}
+/* Git Monitor Change Notification */
+
+static void
+on_git_changed_cb (GbpGit *git,
+ JsonrpcClient *client)
+{
+ g_assert (GBP_IS_GIT (git));
+ g_assert (JSONRPC_IS_CLIENT (client));
+
+ jsonrpc_client_send_notification (client, "git/changed", NULL, NULL, NULL);
+}
+
+static void
+on_client_accepted_cb (JsonrpcServer *server,
+ JsonrpcClient *client,
+ GbpGit *git)
+{
+ g_assert (JSONRPC_IS_SERVER (server));
+ g_assert (JSONRPC_IS_CLIENT (client));
+ g_assert (GBP_IS_GIT (git));
+
+ g_signal_connect_object (git,
+ "changed",
+ G_CALLBACK (on_git_changed_cb),
+ client,
+ 0);
+}
+
/* Main Loop and Setup {{{1 */
gint
@@ -1079,6 +1107,12 @@ main (gint argc,
git = gbp_git_new ();
server = jsonrpc_server_new ();
+ g_signal_connect_object (server,
+ "client-accepted",
+ G_CALLBACK (on_client_accepted_cb),
+ git,
+ 0);
+
if (!g_unix_set_fd_nonblocking (STDIN_FILENO, TRUE, &error) ||
!g_unix_set_fd_nonblocking (STDOUT_FILENO, TRUE, &error))
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]