## GdictClientContext GdictClientContext — DICT client transport |

## Functions

GdictContext * | gdict_client_context_new ()
void | gdict_client_context_set_hostname ()
const gchar * | gdict_client_context_get_hostname ()
void | gdict_client_context_set_port ()
guint | gdict_client_context_get_port ()
void | gdict_client_context_set_client ()
const gchar * | gdict_client_context_get_client ()

## Properties

gchar * | client-name | Read / Write
gchar * | hostname | Read / Write
guint | port | Read / Write
GdictStatusCode | status | Read
gboolean | local-only | Read / Write

## Signals

void | connected | Run Last
void | disconnected | Run Last
void | database-found | Run Last
void | database-lookup-end | Run Last
void | database-lookup-start | Run Last
void | definition-found | Run Last
void | definition-lookup-end | Run Last
void | definition-lookup-start | Run Last
void | error | Run Last
void | lookup-end | Run Last
void | lookup-start | Run Last
void | match-found | Run Last
void | strategy-found | Run Last

## Types and Values

struct | GdictClientContext
struct | GdictClientContextClass
enum | GdictClientContextError

## Object Hierarchy

        GInterface
        ╰── GdictContext
        GObject
        ╰── GdictClientContext

## Implemented Interfaces

GdictClientContext implements

## Description

GdictClientContext is an implementation of the GdictContext interface. It implements the Dictionary Protocol as defined by the RFC 2229 in order to connect to a dictionary server.

You should rarely instantiate this object directely: use an appropriate GdictSource instead.

## Functions

### gdict_client_context_new ()

    GdictContext *
    gdict_client_context_new (const gchar *hostname,
                              gint port);

Creates a new GdictClientContext object for `hostname` . Use this object to connect and query the dictionary server using the Dictionary Protocol as defined by RFC 2229.

#### Parameters

hostname | the hostname of a dictionary server, or `NULL` for the default server. | [nullable]
port | port to be used when connecting to the dictionary server, or -1 for the default port |

#### Returns

the newly created GdictClientContext object.

[transfer full]

### gdict_client_context_set_hostname ()

    void
    gdict_client_context_set_hostname (GdictClientContext *context,
                                       const gchar *hostname);

Sets `hostname` as the hostname of the dictionary server to be used. If `hostname` is `NULL`, the default dictionary server will be used.

#### Parameters

context | a GdictClientContext |
hostname | the hostname of a Dictionary server, or `NULL`. | [nullable]

### gdict_client_context_get_hostname ()

    const gchar *
    gdict_client_context_get_hostname (GdictClientContext *context);

Gets the hostname of the dictionary server used by `context` .

#### Parameters

context | a GdictClientContext |

#### Returns

the hostname of a dictionary server. The returned string is owned by the GdictClientContext object and should never be modified or freed.

### gdict_client_context_set_port ()

    void
    gdict_client_context_set_port (GdictClientContext *context,
                                   gint port);

Sets the port of the dictionary server to be used when connecting.

If `port` is -1, the default port will be used.

#### Parameters

context | a GdictClientContext |
port | port of the dictionary server to be used, or -1 |

### gdict_client_context_get_port ()

    guint
    gdict_client_context_get_port (GdictClientContext *context);

Gets the port of the dictionary server used by `context` .

#### Parameters

context | a GdictClientContext |

#### Returns

the number of the port.

### gdict_client_context_set_client ()

    void
    gdict_client_context_set_client (GdictClientContext *context,
                                     const gchar *client);

Sets `client` as the client name to be used when advertising ourselves when a connection the the dictionary server has been established. If `client` is `NULL`, the default client name will be used.

#### Parameters

context | a GdictClientContext |
client | the client name to use, or `NULL`. | [nullable]

### gdict_client_context_get_client ()

    const gchar *
    gdict_client_context_get_client (GdictClientContext *context);

Gets the client name used by `context` . See `gdict_client_context_set_client()`.

#### Parameters

context | a GdictClientContext |

#### Returns

the client name. The returned string is owned by the GdictClientContext object and should never be modified or freed.

## Types and Values

### struct GdictClientContext

    struct GdictClientContext;

### struct GdictClientContextClass

    struct GdictClientContextClass {
      /* signals monitoring the lifetime of the connection with
       * the dictionary server
       */
      void (*connected)    (GdictClientContext *context);
      void (*disconnected) (GdictClientContext *context);
    };

### enum GdictClientContextError

GdictClientContext error enumeration

#### Members

GDICT_CLIENT_CONTEXT_ERROR_SOCKET |  |
GDICT_CLIENT_CONTEXT_ERROR_LOOKUP |  |
GDICT_CLIENT_CONTEXT_ERROR_NO_CONNECTION |  |
GDICT_CLIENT_CONTEXT_ERROR_SERVER_DOWN |  |

## Property Details

### The `“client-name”` property

      “client-name”              gchar *

The name of the client using this context; it will be advertised when connecting to the dictionary server.

Flags: Read / Write

Default value: NULL

Since: 1.0

### The `“hostname”` property

      “hostname”                 gchar *

The hostname of the dictionary server to connect to.

Flags: Read / Write

Default value: NULL

Since: 1.0

### The `“port”` property

      “port”                     guint

The port of the dictionary server to connect to.

Flags: Read / Write

Allowed values: <= 65535

Default value: 2628

Since: 1.0

### The `“status”` property

      “status”                   GdictStatusCode

The status code as returned by the dictionary server.

Flags: Read

Default value: GDICT_STATUS_INVALID

Since: 1.0

### The `“local-only”` property

      “local-only”               gboolean

Whether the context uses only local dictionaries or not.

Flags: Read / Write

Default value: FALSE

Since: 1.0

## Signal Details

### The `“connected”` signal

    void
    user_function (GdictClientContext *client,
                   gpointer            user_data)

Emitted when a GdictClientContext has successfully established a connection with a dictionary server.

#### Parameters

client | the object which received the signal |
user_data | user data set when the signal handler was connected. |

Flags: Run Last

Since: 1.0

### The `“disconnected”` signal

    void
    user_function (GdictClientContext *client,
                   gpointer            user_data)

Emitted when a GdictClientContext has disconnected from a dictionary server.

#### Parameters

client | the object which received the signal |
user_data | user data set when the signal handler was connected. |

Flags: Run Last

Since: 1.0

### The `“database-found”` signal

    void
    user_function (GdictContext  *context,
                   GdictDatabase *database,
                   gpointer       user_data)

This signal is emitted when a database request has found a database.

#### Parameters

context | the object which received the signal |
database | a GdictDatabase |
user_data | user data set when the signal handler was connected. |

Flags: Run Last

Since: 1.0

### The `“database-lookup-end”` signal

    void
    user_function (GdictContext *context,
                   gpointer      user_data)

This signal is emitted when a database look up operation that has been issued using a GdictContext has been completed. Since every operation using a context is asynchronous, you can use this signal to know if the request has been completed or not.

#### Parameters

context | the object which received the signal |
user_data | user data set when the signal handler was connected. |

Flags: Run Last

Since: 1.0

### The `“database-lookup-start”` signal

    void
    user_function (GdictContext *context,
                   gpointer      user_data)

This signal is emitted when a database look up operation has been issued using a GdictContext. Since every operation using a context is asynchronous, you can use this signal to know if the request has been issued or not.

#### Parameters

context | the object which received the signal |
user_data | user data set when the signal handler was connected. |

Flags: Run Last

Since: 1.0

### The `“definition-found”` signal

    void
    user_function (GdictContext    *context,
                   GdictDefinition *definition,
                   gpointer         user_data)

This signal is emitted when a definition request has found a definition.

#### Parameters

context | the object which received the signal |
definition | a GdictDefinition |
user_data | user data set when the signal handler was connected. |

Flags: Run Last

Since: 1.0

### The `“definition-lookup-end”` signal

    void
    user_function (GdictContext *context,
                   gpointer      user_data)

This signal is emitted when a definition look up operation that has been issued using a GdictContext has been completed. Since every operation using a context is asynchronous, you can use this signal to know if the request has been completed or not.

#### Parameters

context | the object which received the signal |
user_data | user data set when the signal handler was connected. |

Flags: Run Last

Since: 1.0

### The `“definition-lookup-start”` signal

    void
    user_function (GdictContext *context,
                   gpointer      user_data)

This signal is emitted when a definition look up operation has been issued using a GdictContext. Since every operation using a context is asynchronous, you can use this signal to know if the request has been issued or not.

#### Parameters

context | the object which received the signal |
user_data | user data set when the signal handler was connected. |

Flags: Run Last

Since: 1.0

### The `“error”` signal

    void
    user_function (GdictContext *context,
                   gpointer      error,
                   gpointer      user_data)

This signal is emitted when an error happened during an asynchronous request.

#### Parameters

context | the object which received the signal |
error | a GError |
user_data | user data set when the signal handler was connected. |

Flags: Run Last

Since: 1.0

### The `“lookup-end”` signal

    void
    user_function (GdictContext *context,
                   gpointer      user_data)

This signal is emitted when a look up operation that has been issued using a GdictContext has been completed. Since every operation using a context is asynchronous, you can use this signal to know if the request has been completed or not.

#### Parameters

context | the object which received the signal |
user_data | user data set when the signal handler was connected. |

Flags: Run Last

Since: 1.0

### The `“lookup-start”` signal

    void
    user_function (GdictContext *context,
                   gpointer      user_data)

This signal is emitted when a look up operation has been issued using a GdictContext. Since every operation using a context is asynchronous, you can use this signal to know if the request has been issued or not.

#### Parameters

context | the object which received the signal |
user_data | user data set when the signal handler was connected. |

Flags: Run Last

Since: 1.0

### The `“match-found”` signal

    void
    user_function (GdictContext *context,
                   GdictMatch   *match,
                   gpointer      user_data)

This signal is emitted when a match request has found a match.

#### Parameters

context | the object which received the signal |
match | a GdictMatch |
user_data | user data set when the signal handler was connected. |

Flags: Run Last

Since: 1.0

### The `“strategy-found”` signal

    void
    user_function (GdictContext  *context,
                   GdictStrategy *strategy,
                   gpointer       user_data)

This signal is emitted when a strategy request has found a strategy.

#### Parameters

context | the object which received the signal |
strategy | a GdictStrategy |
user_data | user data set when the signal handler was connected. |

Flags: Run Last

Since: 1.0