InfGtkChat: libinfgtk-0.7 Reference Manual

## InfGtkChat InfGtkChat — Gtk interface to InfChatSession |

## Stability Level

Unstable, unless otherwise indicated

## Functions

GtkWidget * | inf_gtk_chat_new ()
void | inf_gtk_chat_set_session ()
InfUser * | inf_gtk_chat_get_active_user ()
void | inf_gtk_chat_set_active_user ()
GtkWidget * | inf_gtk_chat_get_entry ()

## Properties

InfUser * | active-user | Read / Write
InfChatSession * | session | Read / Write

## Types and Values

struct | InfGtkChat
struct | InfGtkChatClass

## Object Hierarchy

        GObject
        ╰── GInitiallyUnowned
            ╰── GtkWidget
                ╰── GtkContainer
                    ╰── GtkGrid
                        ╰── InfGtkChat

## Implemented Interfaces

InfGtkChat implements AtkImplementorIface, GtkBuildable and GtkOrientable.

## Includes

    #include <libinfgtk/inf-gtk-chat.h>

## Description

InfGtkChat is a widget showing a InfChatSession conversation. Use `inf_gtk_chat_set_session()` to set the session whose conversation to show in the widget. If you have a local user in the session you can also call `inf_gtk_chat_set_active_user()`. In this case the input text entry is made available and messages are sent via that user.

## Functions

### inf_gtk_chat_new ()

    GtkWidget *
    inf_gtk_chat_new (void);

Creates a new InfGtkChat. To show a chat conversation set a session to show via `inf_gtk_chat_set_session()`.

[constructor]

#### Returns

A new InfGtkChat.

[transfer floating]

### inf_gtk_chat_set_session ()

    void
    inf_gtk_chat_set_session (InfGtkChat *chat,
                              InfChatSession *session);

Sets the chat session to show in the chat widget. If there is a previous session set the chat view will be cleared before showing the new session. If the previous session had an active user set it will be unset. If `session` is `NULL` this function just clears the chat view and unsets the active user, if any.

#### Parameters

chat | A InfGtkChat. |
session | The InfChatSession to set. |

### inf_gtk_chat_get_active_user ()

    InfUser *
    inf_gtk_chat_get_active_user (InfGtkChat *chat);

Returns the active user for `chat` as set with `inf_gtk_chat_set_active_user()`.

#### Parameters

chat | A InfGtkChat. |

#### Returns

The chat's active user, or `NULL` if there is none.

[transfer none][allow-none]

### inf_gtk_chat_set_active_user ()

    void
    inf_gtk_chat_set_active_user (InfGtkChat *chat,
                                  InfUser *user);

Sets the active user for the chat. This must be a user in the chat's session's user table and it must have the `INF_USER_LOCAL` flag set, i.e. you need to have it joined before using `inf_session_proxy_join_user()`.

If an active user is set the chat's text entry is made sensitive and the user can type chat messages. They are sent to the session as originated by `user` . If `user` 's status changes to `INF_USER_UNAVAILABLE` or the `INF_USER_LOCAL` flag is removed the active user will be unset automatically.

This cannot be called when the chat has no session set yet. Use `inf_gtk_chat_set_session()` first.

#### Parameters

chat | A InfGtkChat. |
user | A local InfUser which joined chat's session. |

### inf_gtk_chat_get_entry ()

    GtkWidget *
    inf_gtk_chat_get_entry (InfGtkChat *chat);

Returns the chat's text input entry.

#### Parameters

chat | A InfGtkChat. |

#### Returns

The chat's GtkEntry. This is owned by the chat, so you don't need to free it.

[transfer none]

## Types and Values

### struct InfGtkChat

    struct InfGtkChat;

InfGtkChat is an opaque data type. You should only access it via the public API functions.

### struct InfGtkChatClass

    struct InfGtkChatClass {
    };

This structure does not contain any public fields.

## Property Details

### The `“active-user”` property

      “active-user”              InfUser *

The user outgoing messages come from.

Owner: InfGtkChat

Flags: Read / Write

### The `“session”` property

      “session”                  InfChatSession *

The chat session this widget is displaying.

Owner: InfGtkChat

Flags: Read / Write