Top | ![]() |
![]() |
![]() |
![]() |
GQuark | gdict_context_error_quark () |
GdictDatabase * | gdict_database_ref () |
void | gdict_database_unref () |
const gchar * | gdict_database_get_name () |
const gchar * | gdict_database_get_full_name () |
GdictStrategy * | gdict_strategy_ref () |
void | gdict_strategy_unref () |
const gchar * | gdict_strategy_get_name () |
const gchar * | gdict_strategy_get_description () |
GdictMatch * | gdict_match_ref () |
void | gdict_match_unref () |
const gchar * | gdict_match_get_word () |
const gchar * | gdict_match_get_database () |
GdictDefinition * | gdict_definition_ref () |
void | gdict_definition_unref () |
gint | gdict_definition_get_total () |
const gchar * | gdict_definition_get_word () |
const gchar * | gdict_definition_get_database () |
const gchar * | gdict_definition_get_text () |
void | gdict_context_set_local_only () |
gboolean | gdict_context_get_local_only () |
gboolean | gdict_context_lookup_databases () |
gboolean | gdict_context_lookup_strategies () |
gboolean | gdict_context_match_word () |
gboolean | gdict_context_define_word () |
void | database-found | Run Last |
void | definition-found | 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 |
#define | GDICT_CONTEXT_ERROR |
enum | GdictContextError |
struct | GdictContextIface |
GdictDatabase | |
GdictDefinition | |
GdictMatch | |
GdictStrategy |
GBoxed ├── GdictDatabase ├── GdictDefinition ├── GdictMatch ╰── GdictStrategy GInterface ╰── GdictContext
GdictContext is an interface used to uniformly access dictionary transport objects. Each implementation of GdictContext must provide functions for accessing the list of databases available on a dictionary source and the available matching strategies; a function for retrieving all words matching a given string, inside one (or more) of those databases and using one of those strategies; a function for querying one (or more) of those databases for a definition of a word.
Implementations of the GdictContext interface should query their dictionary sources asynchronously; methods of the GdictContext interface should return immediately, and each time a new database, strategy, match or definition has been found, a signal should be fired by those implementations.
GdictDatabase *
gdict_database_ref (GdictDatabase *db
);
Increases the reference count of db
by one.
Since: 1.0
void
gdict_database_unref (GdictDatabase *db
);
Decreases the reference count of db
by one. If the reference count reaches
zero, db
is destroyed.
Since: 1.0
const gchar *
gdict_database_get_name (GdictDatabase *db
);
Gets the short name of the database, to be used with functions like
gdict_context_match_word()
or gdict_context_define_word()
.
the short name of the database. The string is owned by the GdictDatabase object, and should never be modified or freed.
Since: 1.0
const gchar *
gdict_database_get_full_name (GdictDatabase *db
);
Gets the full name of the database, suitable for display.
the full name of the database. The string is owned by the GdictDatabase object, and should never be modified or freed.
Since: 1.0
GdictStrategy *
gdict_strategy_ref (GdictStrategy *strat
);
Increases the reference count of strat
by one.
Since: 1.0
void
gdict_strategy_unref (GdictStrategy *strat
);
Decreases the reference count of strat
by one. If the reference count
reaches zero, the GdictStrategy object is freed.
Since: 1.0
const gchar *
gdict_strategy_get_name (GdictStrategy *strat
);
FIXME
Since: 1.0
const gchar *
gdict_strategy_get_description (GdictStrategy *strat
);
FIXME
Since: 1.0
const gchar *
gdict_match_get_database (GdictMatch *match
);
FIXME
Since: 1.0
GdictDefinition *
gdict_definition_ref (GdictDefinition *def
);
Increases the reference count of def
by one.
Since: 1.0
void
gdict_definition_unref (GdictDefinition *def
);
Decreases the reference count of def
by one. If the reference count
reaches zero, the GdictDefinition object is freed.
Since: 1.0
gint
gdict_definition_get_total (GdictDefinition *def
);
Retrieves the total number of definitions that were found on a dictionary.
Since: 1.0
const gchar *
gdict_definition_get_word (GdictDefinition *def
);
Retrieves the word used by the dictionary database to store the definition.
a word. The returned string is owned by the GdictDefinition object and should not be modified or freed.
Since: 1.0
const gchar *
gdict_definition_get_database (GdictDefinition *def
);
Retrieves the full name of the dictionary database where the definition is stored.
the full name of a database. The returned string is owned by the GdictDefinition object and should not be modified or freed.
Since: 1.0
const gchar *
gdict_definition_get_text (GdictDefinition *def
);
Retrieves the text of the definition.
the text of the definition. The returned string is owned by the GdictDefinition object, and should not be modified or freed.
Since: 1.0
void gdict_context_set_local_only (GdictContext *context
,gboolean local_only
);
Sets whether only local resources will be used when querying for databases, strategies, matches or definitions.
Since: 1.0
gboolean
gdict_context_get_local_only (GdictContext *context
);
Gets whether only local resources will be used when querying.
Since: 1.0
gboolean gdict_context_lookup_databases (GdictContext *context
,GError **error
);
Query context
for the list of databases available. Each time a
database is found, the "database-found" signal is fired.
Since: 1.0
gboolean gdict_context_lookup_strategies (GdictContext *context
,GError **error
);
Query context
for the list of matching strategies available. Each
time a new strategy is found, the "strategy-found" signal is fired.
Since: 1.0
gboolean gdict_context_match_word (GdictContext *context
,const gchar *database
,const gchar *strategy
,const gchar *word
,GError **error
);
Query context
for a list of word matching word
inside database
,
using strategy
as a matching strategy. Each time a matching word
is found, the "match-found" signal is fired.
Since: 1.0
gboolean gdict_context_define_word (GdictContext *context
,const gchar *database
,const gchar *word
,GError **error
);
Query context
for a list of definitions of word
inside database
. Each
time a new definition is found, the "definition-found" signal is fired.
context |
||
database |
a database name to search into, or |
|
word |
the word to search |
|
error |
Since: 1.0
struct GdictContextIface { /* methods, not signals */ gboolean (*get_databases) (GdictContext *context, GError **error); gboolean (*get_strategies) (GdictContext *context, GError **error); gboolean (*match_word) (GdictContext *context, const gchar *database, const gchar *strategy, const gchar *word, GError **error); gboolean (*define_word) (GdictContext *context, const gchar *database, const gchar *word, GError **error); /* signals */ void (*lookup_start) (GdictContext *context); void (*lookup_end) (GdictContext *context); void (*database_found) (GdictContext *context, GdictDatabase *database); void (*strategy_found) (GdictContext *context, GdictStrategy *strategy); void (*match_found) (GdictContext *context, GdictMatch *match); void (*definition_found) (GdictContext *context, GdictDefinition *definition); /* fired each time there's an error; the GError is owned * by the context, and should never be modified or freed */ void (*error) (GdictContext *context, const GError *error); };
Interface defintion
typedef struct _GdictDatabase GdictDatabase;
A GdictDatabase represents a database inside a dictionary source.
The GdictDatabase structure is private and should only be accessed using the available functions.
typedef struct _GdictDefinition GdictDefinition;
A GdictDefinition represents a single definition for the searched word.
The GdictDefinition structure is private and should only be accessed using the available functions.
typedef struct _GdictMatch GdictMatch;
A GdictMatch represents a single match for the searched word.
The GdictMatch structure is private and should only be accessed using the available functions.
typedef struct _GdictStrategy GdictStrategy;
A GdictStrategy represents a matching strategy implemented by a dictionary source.
The GdictStrategy structure is private and should only be accessed using the available functions.
“local-only”
property“local-only” gboolean
Whether the context uses only local dictionaries or not.
Flags: Read / Write
Default value: FALSE
Since: 1.0
“database-found”
signalvoid user_function (GdictContext *context, GdictDatabase *database, gpointer user_data)
This signal is emitted when a database request has found a database.
context |
the object which received the signal |
|
database |
||
user_data |
user data set when the signal handler was connected. |
Flags: Run Last
Since: 1.0
“definition-found”
signalvoid user_function (GdictContext *context, GdictDefinition *definition, gpointer user_data)
This signal is emitted when a definition request has found a definition.
context |
the object which received the signal |
|
definition |
||
user_data |
user data set when the signal handler was connected. |
Flags: Run Last
Since: 1.0
“error”
signalvoid user_function (GdictContext *context, gpointer error, gpointer user_data)
This signal is emitted when an error happened during an asynchronous request.
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
“lookup-end”
signalvoid 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.
context |
the object which received the signal |
|
user_data |
user data set when the signal handler was connected. |
Flags: Run Last
Since: 1.0
“lookup-start”
signalvoid 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.
context |
the object which received the signal |
|
user_data |
user data set when the signal handler was connected. |
Flags: Run Last
Since: 1.0
“match-found”
signalvoid user_function (GdictContext *context, GdictMatch *match, gpointer user_data)
This signal is emitted when a match request has found a match.
context |
the object which received the signal |
|
match |
||
user_data |
user data set when the signal handler was connected. |
Flags: Run Last
Since: 1.0
“strategy-found”
signalvoid user_function (GdictContext *context, GdictStrategy *strategy, gpointer user_data)
This signal is emitted when a strategy request has found a strategy.
context |
the object which received the signal |
|
strategy |
||
user_data |
user data set when the signal handler was connected. |
Flags: Run Last
Since: 1.0