mDictionary

multilingual dictionary for (N770, N800 & N810)

  and (N900 & netbook )

Developer's HOWTO:
making Your own plugin

The manual is available here

Developer's HOWTO:
making Your own GUI (new version of mDictionary)

The manual isn't available yet

Developer's HOWTO:
making Your own GUI for mDictionary (old versien of mDictionary)

mDictionary is intended to be as modifiable as possible. So apart from developing Your own dictionary engines, You can also create alternative user interface, should You find ours inattractive. For the intrepid ones, I have described how to do that. In this howto, I am going to explain how to communicate GUI with the engines's manager

The only header file You need to include in Your GUI is ws_dbus.h. It contains all the functions necessary to communicate with the engines manager. The header file is available from our svn repository at https://garage.maemo.org.

Firstly, You initialize our dbus wrapper library with ws_dbus_create function. You have to specify the name and the version of Your app and store the function's return value as it is necessary for further dbus wrapper communication.

dbus_data = ws_dbus_create ("mDictionaryGui", "v1.0");

Then You configure the remote and local addresses, by using ws_dbus_config. The settings should be the same as in the example, below:

ws_dbus_config( dbus_data, WS_DBUS_CONFIG_SERVICE, "org.maemo.mDictionaryGui" ); ws_dbus_config( dbus_data, WS_DBUS_CONFIG_OBJECT, "/org/maemo/mDictionaryGui" ); ws_dbus_config( dbus_data, WS_DBUS_CONFIG_IFACE, "org.maemo.mDictionaryGui" ); ws_dbus_config( dbus_data, WS_DBUS_CONFIG_REMOTE_SERVICE, "org.maemo.mDictionaryManager" ); ws_dbus_config( dbus_data, WS_DBUS_CONFIG_REMOTE_OBJECT, "/org/maemo/mDictionaryManager" ); ws_dbus_config( dbus_data, WS_DBUS_CONFIG_REMOTE_IFACE, "org.maemo.mDictionaryManager" );

Now You have to call the ws_dbus_connect function. It's an opaque function, which allows local methods to be run remotely.

ws_dbus_connect( dbus_data );

The only thing that's left now is specifying callback functions (with ws_dbus_set_cb), which are to be called whenever the manager calls a remote method.

ws_dbus_set_cb( dbus_data, "return_words", ws_gui_dbus_return_words, ws_gui_app );

Callbacks definition:

void ws_gui_dbus_return_words( GError *error, GArray *words, gpointer user_data );

Accessing received data inside a callback handling function:

In this case, words is a GArray of osso_rpc_t values. To access the contents of an osso_rpc_t variable, You first have to check its type by accessing the type field. The value field is an union of primitives. Depending on the type, You should read the value by accessing a proper field. Here is an example:

int i; osso_rpc_t data; for (i = 0; i < words->len; ++i) { data = g_array_index (words, osso_rpc_t, 0); if (DBUS_TYPE_STRING == data.type) { char *tmp_word = g_strdup(data.value.s); do_sth_with_word(tmp_word); }; };

Calling remote methods on manager:

ws_dbus_client_find_word (ws_gui_app->dbus_data, word);

All functions containing the word client in their name, should be called from the GUI application. Please refer to dbus wrapper API documentation for further info. It can be generated by issuing make docs command in dbus wrapper source directory.