Top | ![]() |
![]() |
![]() |
![]() |
enum | InfTextSessionError |
enum | InfTextOperationError |
struct | InfTextSession |
struct | InfTextSessionClass |
InfTextSession * inf_text_session_new (InfCommunicationManager *manager
,InfTextBuffer *buffer
,InfIo *io
,InfSessionStatus status
,InfCommunicationGroup *sync_group
,InfXmlConnection *sync_connection
);
Creates a new InfTextSession. The communication manager is used to send
and receive requests from subscription and synchronization. buffer
will be
set to be initially empty if the session is initially synchronized
(see below). io
is required to trigger timeouts.
If status
is INF_SESSION_PRESYNC
or INF_SESSION_SYNCHRONIZING
, then the
session will initially be sychronized, meaning the initial content is
retrieved from sync_connection
. If you are subscribed to the session, set
the subscription group via inf_session_set_subscription_group()
.
[constructor]
manager |
||
buffer |
An initial InfTextBuffer. |
|
io |
A InfIo object. |
|
status |
The initial status of the session. |
|
sync_group |
A group in which the session is synchronized.
Ignored if |
[allow-none] |
sync_connection |
A connection to synchronize the session
from. Ignored if |
[allow-none] |
InfTextSession * inf_text_session_new_with_user_table (InfCommunicationManager *manager
,InfTextBuffer *buffer
,InfIo *io
,InfUserTable *user_table
,InfSessionStatus status
,InfCommunicationGroup *sync_group
,InfXmlConnection *sync_connection
);
Creates a new InfTextSession. The connection manager is used to send and
receive requests from subscription and synchronization. buffer
will be
set to be initially empty if the session is initially synchronized
(see below). io
is required to trigger timeouts.
If status
is INF_SESSION_PRESYNC
or INF_SESSION_SYNCHRONIZING
, then the
session will initially be sychronized, meaning the initial content is
retrieved from sync_connection
. If you are subscribed to the session, set
the subscription group via inf_session_set_subscription_group()
.
user_table
is used as an initial user table. The user table should only
contain unavailable users, if any, that may rejoin during the session. If
there was an available user in the user table, it would probably belong
to another session, but different sessions cannot share the same user
object.
[constructor]
manager |
||
buffer |
An initial InfTextBuffer. |
|
io |
A InfIo object. |
|
user_table |
A InfUserTable. |
|
status |
The initial status for the session. |
|
sync_group |
A group in which the session is synchronized.
Ignored if |
[allow-none] |
sync_connection |
A connection to synchronize the session
from. Ignored if |
[allow-none] |
void inf_text_session_set_user_color (InfTextSession *session
,InfTextUser *user
,gdouble hue
);
Changes the user color of user
. user
must have the INF_USER_LOCAL
flag
set.
session |
||
user |
A local InfTextUser from |
|
hue |
New hue value for |
void inf_text_session_flush_requests_for_user (InfTextSession *session
,InfTextUser *user
);
This function sends all pending requests for user
immediately. Requests
that modify the buffer are not queued normally, but cursor movement
requests are delayed in case are issued frequently, to save bandwidth.
The main purpose of this function is to send all pending requests before changing a user's status to inactive or unavailable since inactive users are automatically activated as soon as they issue a request.
TODO: We should probably detect this automatically, without requiring people to call this function, i.e. flush requests for local users just before they become inactive.
user
must have the INF_USER_LOCAL
flag set.
InfRequest * inf_text_session_join_user (InfSessionProxy *proxy
,const gchar *name
,InfUserStatus status
,gdouble hue
,guint caret_position
,int selection_length
,InfRequestFunc func
,gpointer user_data
);
This functions creates a user join request for an InfTextSession. This is
a shortcut for inf_session_proxy_join_user()
.
proxy |
A InfSessionProxy with a InfTextSession session. |
|
name |
The name of the user to join. |
|
status |
The initial status of the user to join. Must not be
|
|
hue |
The user color of the user to join. |
|
caret_position |
The initial position of the new user's cursor. |
|
selection_length |
The initial length of the new user's selection. |
|
func |
Function to call after completion of the request,
or |
[scope async] |
user_data |
Additional data to pass to |
Error codes that can occur when applying a InfTextInsertOperation, InfTextDeleteOperation or InfTextMoveOperation to the buffer.
A InfTextInsertOperation attempted to insert text after the end of the buffer. |
||
A InfTextDeleteOperation attempted to delete text from after the end of the buffer. |
||
A InfTextMoveOperation attempted to move the cursor of a user behind the end of the buffer. |
||
No further specified error code. |