[gedit-collaboration] Use new InfTextGtkView and InfTextGtkViewport



commit 3cba48e54208954e20bc97146c53fc11d3517b33
Author: Jesse van den Kieboom <jesse vandenkieboom epfl ch>
Date:   Sun Apr 3 17:09:54 2011 +0200

    Use new InfTextGtkView and InfTextGtkViewport

 src/gedit-collaboration-manager.c |   22 ++++++++++++++++++++++
 1 files changed, 22 insertions(+), 0 deletions(-)
---
diff --git a/src/gedit-collaboration-manager.c b/src/gedit-collaboration-manager.c
index 9b4b6b9..64d2608 100644
--- a/src/gedit-collaboration-manager.c
+++ b/src/gedit-collaboration-manager.c
@@ -5,6 +5,8 @@
 #include <libinftext/inf-text-session.h>
 #include <libinftext/inf-text-buffer.h>
 #include <libinftextgtk/inf-text-gtk-buffer.h>
+#include <libinftextgtk/inf-text-gtk-view.h>
+#include <libinftextgtk/inf-text-gtk-viewport.h>
 #include <gedit/gedit-view.h>
 #include <libinfinity/common/inf-error.h>
 #include "gedit-collaboration.h"
@@ -468,6 +470,9 @@ on_join_user_request_finished (InfcUserRequest *request,
 	GeditView *view;
 	GeditDocument *doc;
 	GeditCollaborationUndoManager *undo_manager;
+	InfTextGtkView *tv;
+	GtkScrolledWindow *sw;
+	InfTextGtkViewport *vp;
 
 	session = infc_session_proxy_get_session (subscription->proxy);
 	buffer = inf_session_get_buffer (session);
@@ -494,6 +499,23 @@ on_join_user_request_finished (InfcUserRequest *request,
 
 	g_object_unref (undo_manager);
 
+	tv = inf_text_gtk_view_new (subscription->manager->priv->io,
+	                            GTK_TEXT_VIEW (view),
+	                            inf_session_get_user_table (session));
+
+	inf_text_gtk_view_set_active_user (tv, INF_TEXT_USER (user));
+	inf_text_gtk_view_set_show_remote_cursors (tv, TRUE);
+	inf_text_gtk_view_set_show_remote_selections (tv, TRUE);
+
+	sw = GTK_SCROLLED_WINDOW (gtk_widget_get_parent (GTK_WIDGET (view)));
+	vp = inf_text_gtk_viewport_new (sw, inf_session_get_user_table (session));
+
+	inf_text_gtk_viewport_set_active_user (vp, INF_TEXT_USER (user));
+	inf_text_gtk_viewport_set_show_user_markers (vp, TRUE);
+
+	g_object_weak_ref (G_OBJECT (view), (GWeakNotify)g_object_unref, tv);
+	g_object_weak_ref (G_OBJECT (view), (GWeakNotify)g_object_unref, vp);
+
 	gtk_text_view_set_editable (GTK_TEXT_VIEW (view), TRUE);
 	gdk_window_set_cursor (gtk_widget_get_window (GTK_WIDGET (view)),
 	                       NULL);



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