Reformated code of gui, engin and manager
authormaritus <lucas.pawlik@gmail.com>
Fri, 20 Oct 2006 08:41:54 +0000 (08:41 +0000)
committermaritus <lucas.pawlik@gmail.com>
Fri, 20 Oct 2006 08:41:54 +0000 (08:41 +0000)
git-svn-id: file:///svnroot/mdictionary/trunk@27 5bde0345-f819-0410-ac75-e5045f9217cc

dbus/src/ws_dbus.c
gui/src/ws_gui.c
gui/src/ws_gui_callbacks.c
gui/src/ws_gui_layout.c
include/ws_dbus.h
include/ws_gui.h
include/ws_gui_callbacks.h
include/ws_gui_layout.h
include/ws_manager.h
manager/src/ws_manager.c

index 59a5f96..7272025 100644 (file)
@@ -20,9 +20,9 @@ Copyright 2006 ComArch S.A.
 
 struct _WSDBusCBData
 {
-       GQuark id;
-       gpointer handler;
-       gpointer user_data;
+        GQuark id;
+        gpointer handler;
+        gpointer user_data;
 };
 
 typedef struct _WSDBusCBData WSDBusCBData;
@@ -30,798 +30,809 @@ typedef struct _WSDBusCBData WSDBusCBData;
 static void ws_dbus_fill_message (DBusMessage *msg, void *data) 
 {
 
-       guint i;
-       gchar *buffer;
-       GArray *temp;
+        guint i;
+         gchar *buffer;
+        GArray *temp;
 
-       temp = (GArray *) data;
+        temp = (GArray *) data;
 
-//     printf ("DBUS: Data to send: %p, length: %d\n", temp, temp->len);
-
-       for (i=0;((i<temp->len) && (i<250));++i)
-       {
-               buffer = g_array_index (temp, gchar *, i);
-//             printf ("DBUS: Added string nr %d: %s\n", i, buffer);
-               dbus_message_append_args (msg, 
-                               DBUS_TYPE_STRING, &buffer,
-                               DBUS_TYPE_INVALID);
-       };
-
-//     buffer = strdup (">>>FIND MORE<<<");
-
-//     if (i == 250) dbus_message_append_args (msg,
-//                             DBUS_TYPE_STRING, &buffer,
-//                             DBUS_TYPE_INVALID);
-
-       printf ("DBUS: Added %d words\n", i);
+        for (i=0;((i<temp->len) && (i<250));++i)
+        {
+                buffer = g_array_index (temp, gchar *, i);
+                dbus_message_append_args (msg, 
+                                DBUS_TYPE_STRING, &buffer,
+                                DBUS_TYPE_INVALID);
+        };
+        printf ("DBUS: Added %d words\n", i);
 
 };
 
-static gint ws_dbus_cb_handler (const gchar * interface, const gchar * method, GArray * arguments, gpointer data, osso_rpc_t * retval)
+static gint ws_dbus_cb_handler (const gchar * interface,
+                                const gchar * method,
+                                GArray * arguments,
+                                gpointer data,
+                                osso_rpc_t * retval)
 
 {
-       WSDBusCBData cb_data;
-       GArray *dbus_cb_data;
-       GQuark temp;
-       guint i;
-       ws_dbus_cb cb;
-       dbus_cb_data = (GArray *) data;
-       gpointer tmp;
-       retval = NULL;
-
-//     printf ("DBUS: Interface:  %s\n", interface);
-       printf ("DBUS: Method:  %s\n", method);
-
-       temp = g_quark_try_string (method);
-
-       if (temp != 0) 
-
-       {
-
-               cb_data = g_array_index (dbus_cb_data, WSDBusCBData, temp-1);
-       
-               if (cb_data.id == temp) 
-               {
-                       cb = (ws_dbus_cb) cb_data.handler;
-                       tmp = cb_data.user_data;
-               }
-
-               else 
-
-               {
-//             printf ("The signal's name GQuark doesn't match the callback id, switching to iterational callback lookup\n");
-
-                       for (i=0; i < dbus_cb_data->len; ++i) 
-       
-                       {
-                               cb_data = g_array_index (dbus_cb_data, WSDBusCBData, i);
-                               if (cb_data.id == temp) 
-                               {
-                                       cb = (ws_dbus_cb) cb_data.handler;
-                                       tmp = cb_data.user_data;
-                               };
-                       };
-               };
-       }
-       
-       else 
-
-       {
-               printf ("Error in function %s, couldn't find the signal %s\n", __FUNCTION__, method);
-               return OSSO_ERROR;
-       };
-
-       if (cb != NULL) 
-       {
-               printf ("\nDBUS: Running callback for %s\n", method);
-               cb (NULL, arguments, tmp); 
-               retval = DBUS_TYPE_INVALID;
-               return OSSO_OK;
-       }
-       else
-       {
-               printf ("DBUS: No callback defined for this function\n");
-               return OSSO_ERROR;
-       };
+        WSDBusCBData cb_data;
+        GArray *dbus_cb_data;
+        GQuark temp;
+        guint i;
+        ws_dbus_cb cb;
+        dbus_cb_data = (GArray *) data;
+        gpointer tmp;
+        retval = NULL;
+        
+        printf ("DBUS: Method:  %s\n", method);
+
+        temp = g_quark_try_string (method);
+
+        if (temp != 0) 
+
+        {
+
+                cb_data = g_array_index (dbus_cb_data, WSDBusCBData, temp-1);
+        
+                if (cb_data.id == temp) 
+                {
+                        cb = (ws_dbus_cb) cb_data.handler;
+                        tmp = cb_data.user_data;
+                }
+
+                else 
+
+                {
+
+                        for (i=0; i < dbus_cb_data->len; ++i)     
+                        {
+                                cb_data = g_array_index (dbus_cb_data,
+                                                         WSDBusCBData,
+                                                         i);
+                                if (cb_data.id == temp) 
+                                {
+                                        cb = (ws_dbus_cb) cb_data.handler;
+                                        tmp = cb_data.user_data;
+                                };
+                        };
+                };
+        }
+        
+        else 
+        {
+                printf ("Error in function %s, couldn't find the signal %s\n",
+                        __FUNCTION__,
+                        method);
+                return OSSO_ERROR;
+        };
+
+        if (cb != NULL) 
+        {
+                printf ("\nDBUS: Running callback for %s\n", method);
+                cb (NULL, arguments, tmp); 
+                retval = DBUS_TYPE_INVALID;
+                return OSSO_OK;
+        }
+        else
+        {
+                printf ("DBUS: No callback defined for this function\n");
+                return OSSO_ERROR;
+        };
 
 };
 
 
 static void ws_dbus_libosso_errors (osso_return_t result)
 {
-       switch (result) 
-       {
-               case OSSO_OK: 
-                       printf ("All OK\n");
-                       break;
-                       
-               case OSSO_ERROR: 
-                       printf ("Ordinary Error\n");
-                       break;
-
-               case OSSO_INVALID: 
-                       printf ("At least one parameter is invalid\n");
-                       break;
-
-               case OSSO_RPC_ERROR: 
-                       printf ("Osso RPC method returned an error\n");
-                       break;
-
-               case OSSO_ERROR_NAME: 
-                       printf ("Error Name\n");
-                       break;
-
-               case OSSO_ERROR_NO_STATE: 
-                       printf ("No state file found to read\n");
-                       break;
-
-               case OSSO_ERROR_STATE_SIZE: 
-                       printf ("The size of the given structure is different from the saved size\n");
-                       break;
-
-       };
+        switch (result) 
+        {
+                case OSSO_OK: 
+                        printf ("All OK\n");
+                        break;
+                        
+                case OSSO_ERROR: 
+                        printf ("Ordinary Error\n");
+                        break;
+
+                case OSSO_INVALID: 
+                        printf ("At least one parameter is invalid\n");
+                        break;
+
+                case OSSO_RPC_ERROR: 
+                        printf ("Osso RPC method returned an error\n");
+                        break;
+
+                case OSSO_ERROR_NAME: 
+                        printf ("Error Name\n");
+                        break;
+
+                case OSSO_ERROR_NO_STATE: 
+                        printf ("No state file found to read\n");
+                        break;
+
+                case OSSO_ERROR_STATE_SIZE: 
+                        printf("The size of the given structure");
+                        printf(" is different from the saved size\n");
+                        break;
+
+        };
 };
 
 WSDBusData * ws_dbus_create (gchar *name, gchar *version)
 
 {
-       //added by me : search_in_history
-       gchar *cb_table[] = {"find_word", "find_translation", "return_words", "return_translations", "signal", "update_progressbar", "search_in_history"};
-       guint i;
-
-       WSDBusData *temp;
-       WSDBusCBData temp_cb_data;
-       GQuark temp_quark;
-
-       temp = (gpointer) g_try_malloc (sizeof (WSDBusData));
-
-       printf ("\nDBUS: ");
-
-       if (temp == NULL)
-       {
-               printf ("Error in function %s - cannot allocate memory\n", __FUNCTION__);
-               g_assert_not_reached();
-       }
-
-       else printf ("Memory allocation successful\n");
-
-       temp->name = g_strconcat (name, NULL);
-       temp->version = g_strconcat (version, NULL);
-
-       temp->cb_data = g_array_new (TRUE, TRUE, sizeof (WSDBusCBData));
-       
-       //added by me 6 to 7
-       for (i = 0; i < 7; i++)
-       {
-               temp_quark = g_quark_try_string (cb_table[i]);
-
-               if (temp_quark != 0)
-               {
-                       printf ("DBUS: \"%s\" - signal has already been registered - %d\n", cb_table[i], g_quark_from_string(cb_table[i]));                     
-               }
-
-               else
-               {
-                       temp_quark = g_quark_from_string (cb_table[i]);
-                       printf ("DBUS: Assigning signal \"%s\" an id %d\n", cb_table [i], temp_quark);
-                       temp_cb_data.id = temp_quark;
-                       temp_cb_data.handler = NULL;
-                       temp_cb_data.user_data = NULL;
-                       g_array_append_val (temp->cb_data, temp_cb_data);
-               };
-
-       };
-
-       printf ("DBUS: Signals were successfully added\n");
-
-       return temp;
+        gchar *cb_table[] = {"find_word",
+                             "find_translation",
+                             "return_words",
+                             "return_translations",
+                             "signal",
+                             "update_progressbar",
+                             "search_in_history"};
+        guint i;
+
+        WSDBusData *temp;
+        WSDBusCBData temp_cb_data;
+        GQuark temp_quark;
+
+        temp = (gpointer) g_try_malloc (sizeof (WSDBusData));
+
+        printf ("\nDBUS: ");
+
+        if (temp == NULL)
+        {
+                printf ("Error in function %s - cannot allocate memory\n",
+                        __FUNCTION__);
+                g_assert_not_reached();
+        }
+
+        else printf ("Memory allocation successful\n");
+
+        temp->name = g_strconcat (name, NULL);
+        temp->version = g_strconcat (version, NULL);
+
+        temp->cb_data = g_array_new (TRUE, TRUE, sizeof (WSDBusCBData));      
+    
+        for (i = 0; i < 7; i++)
+        {
+                temp_quark = g_quark_try_string (cb_table[i]);
+
+                if (temp_quark != 0)
+                {
+                     printf(
+                     "DBUS: \"%s\" - signal has already been registered - %d\n",
+                      cb_table[i],
+                      g_quark_from_string(cb_table[i]));                        
+                }
+
+                else
+                {
+                        temp_quark = g_quark_from_string (cb_table[i]);
+                        printf ("DBUS: Assigning signal \"%s\" an id %d\n",
+                                cb_table [i],
+                                temp_quark);
+                        temp_cb_data.id = temp_quark;
+                        temp_cb_data.handler = NULL;
+                        temp_cb_data.user_data = NULL;
+                        g_array_append_val (temp->cb_data, temp_cb_data);
+                };
+
+        };
+
+        printf ("DBUS: Signals were successfully added\n");
+
+        return temp;
 };
 
-WSDBusStatus ws_dbus_config (WSDBusData * ws_dbus_data, WSDBusConfig field, gchar *value)
+WSDBusStatus ws_dbus_config (WSDBusData * ws_dbus_data,
+                             WSDBusConfig field,
+                             gchar *value)
 
 {
-       if (ws_dbus_data == NULL) 
-       {
-               printf ("\nDBUS: Error in function %s - ws_dbus_data is NULL\n", __FUNCTION__);
-       };
-
-       switch (field) 
-       {
-               case WS_DBUS_CONFIG_SERVICE :
-                       ws_dbus_data->service = g_strconcat (value, NULL);
-                       break;
-               case WS_DBUS_CONFIG_OBJECT :
-                       ws_dbus_data->object = g_strconcat (value, NULL);
-                       break;
-               case WS_DBUS_CONFIG_IFACE :
-                       ws_dbus_data->iface = g_strconcat (value, NULL);
-                       break;
-               case WS_DBUS_CONFIG_REMOTE_SERVICE :
-                       ws_dbus_data->remote_service = g_strconcat (value, NULL);
-                       break;
-               case WS_DBUS_CONFIG_REMOTE_OBJECT :
-                       ws_dbus_data->remote_object = g_strconcat (value, NULL);
-                       break;
-               case WS_DBUS_CONFIG_REMOTE_IFACE :
-                       ws_dbus_data->remote_iface = g_strconcat (value, NULL);
-                       break;
-       };
-       
-       return WS_DBUS_STATUS_OK;
+        if (ws_dbus_data == NULL) 
+        {
+                printf ("\nDBUS: Error in function %s - ws_dbus_data is NULL\n",
+                        __FUNCTION__);
+        };
+
+        switch (field) 
+        {
+                case WS_DBUS_CONFIG_SERVICE :
+                        ws_dbus_data->service = g_strconcat (value, NULL);
+                        break;
+                case WS_DBUS_CONFIG_OBJECT :
+                        ws_dbus_data->object = g_strconcat (value, NULL);
+                        break;
+                case WS_DBUS_CONFIG_IFACE :
+                        ws_dbus_data->iface = g_strconcat (value, NULL);
+                        break;
+                case WS_DBUS_CONFIG_REMOTE_SERVICE :
+                        ws_dbus_data->remote_service = g_strconcat (value, NULL);
+                        break;
+                case WS_DBUS_CONFIG_REMOTE_OBJECT :
+                        ws_dbus_data->remote_object = g_strconcat (value, NULL);
+                        break;
+                case WS_DBUS_CONFIG_REMOTE_IFACE :
+                        ws_dbus_data->remote_iface = g_strconcat (value, NULL);
+                        break;
+        };
+        
+        return WS_DBUS_STATUS_OK;
 };
 
 WSDBusStatus ws_dbus_connect (WSDBusData * ws_dbus_data)
 
 {
-       osso_return_t result;
-
-       ws_dbus_data->context = osso_initialize (ws_dbus_data->name, ws_dbus_data->version, FALSE, NULL);
-       osso_rpc_set_timeout (ws_dbus_data->context, 100);
-
-       result = osso_rpc_set_cb_f(ws_dbus_data->context, 
-                               ws_dbus_data->service, 
-                               ws_dbus_data->object, 
-                               ws_dbus_data->iface,
-                               ws_dbus_cb_handler, 
-                               ws_dbus_data->cb_data); 
-
-       if (result == OSSO_OK) return WS_DBUS_STATUS_OK;
-       else return WS_DBUS_STATUS_ERROR;
+        osso_return_t result;
+
+        ws_dbus_data->context = osso_initialize (ws_dbus_data->name,
+                                                 ws_dbus_data->version,
+                                                 FALSE,
+                                                 NULL);
+        osso_rpc_set_timeout (ws_dbus_data->context, 100);
+
+        result = osso_rpc_set_cb_f(ws_dbus_data->context, 
+                                ws_dbus_data->service, 
+                                ws_dbus_data->object, 
+                                ws_dbus_data->iface,
+                                ws_dbus_cb_handler, 
+                                ws_dbus_data->cb_data);        
+
+        if (result == OSSO_OK) return WS_DBUS_STATUS_OK;
+        else return WS_DBUS_STATUS_ERROR;
 };
 
 void ws_dbus_destroy (WSDBusData * ws_dbus_data)
 
 {
-//     guint i;
-
-       if (ws_dbus_data == NULL) 
-       {
-               printf ("\nDBUS: Error in function %s - cannot free osso_context\n", __FUNCTION__);
-               g_free (ws_dbus_data);
-               g_assert_not_reached();
-       };
-       
-       printf ("\nDBUS deinitialization by %s:\n----------------------------------\n", ws_dbus_data->service);
-       osso_deinitialize (ws_dbus_data->context);
-       printf ("| Deinitializing osso context    |\n");
-       if (ws_dbus_data->cb_data != NULL) 
-               {
-               g_array_free (ws_dbus_data->cb_data, TRUE);//val FALSE
-               printf ("| Freeing callback pointers list |\n");
-               };
-
-       g_free (ws_dbus_data->name);
-       g_free (ws_dbus_data->version);
-       g_free (ws_dbus_data->service);
-       g_free (ws_dbus_data->object);
-       g_free (ws_dbus_data->iface);
-
-       g_free (ws_dbus_data->remote_service);
-       g_free (ws_dbus_data->remote_object);
-       g_free (ws_dbus_data->remote_iface);
-
-       /*for (i=0; i< ws_dbus_data->cb_data->len; i++)
-       {
-               g_free (g_array_index (ws_dbus_data->cb_data, WSDBusCBData *, i));
-       };*/
-
-       g_free (ws_dbus_data);
-       printf ("| Freeing WSDBusData structure   |\n----------------------------------\n");
+        if (ws_dbus_data == NULL) 
+        {
+            printf ("\nDBUS: Error in function %s - cannot free osso_context\n",
+                    __FUNCTION__);
+            g_free (ws_dbus_data);
+            g_assert_not_reached();
+        };
+        
+        printf ("\nDBUS deinitialization by %s:\n---------------------------\n",
+                ws_dbus_data->service);
+        osso_deinitialize (ws_dbus_data->context);
+        printf ("| Deinitializing osso context    |\n");
+        if (ws_dbus_data->cb_data != NULL) 
+        {
+                g_array_free (ws_dbus_data->cb_data, TRUE);
+                printf ("| Freeing callback pointers list |\n");
+        };
+
+        g_free (ws_dbus_data->name);
+        g_free (ws_dbus_data->version);
+        g_free (ws_dbus_data->service);
+        g_free (ws_dbus_data->object);
+        g_free (ws_dbus_data->iface);
+
+        g_free (ws_dbus_data->remote_service);
+        g_free (ws_dbus_data->remote_object);
+        g_free (ws_dbus_data->remote_iface);
+
+        g_free (ws_dbus_data);
+        printf ("| Freeing WSDBusData structure   |\n----------------------\n");
 };
 
 
-WSDBusStatus ws_dbus_set_cb (WSDBusData * ws_dbus_data, gchar * detailed_signal, gpointer c_func, gpointer user_data)
+WSDBusStatus ws_dbus_set_cb (WSDBusData * ws_dbus_data,
+                             gchar * detailed_signal,
+                             gpointer c_func,
+                             gpointer user_data)
 
 {
-       WSDBusCBData cb_data;
-       GQuark temp;
-       guint i;
-
-       temp = g_quark_try_string  (detailed_signal);
-
-       if (temp == 0) 
-       {
-               printf ("DBUS: \"%s\" - signal not defined or invalid signal name\n", detailed_signal);
-               return WS_DBUS_STATUS_ERROR;
-       }
-
-       else
-       {
-               for (i = 0; i < ws_dbus_data->cb_data->len; ++i)
-
-               {
-
-                       cb_data = g_array_index (ws_dbus_data->cb_data, WSDBusCBData, i);
-                       if (cb_data.id == temp)
-       
-                       {
-                               cb_data.handler = c_func;
-                               cb_data.user_data = user_data;
-                               g_array_insert_val (ws_dbus_data->cb_data, i, cb_data);
-                               g_array_remove_index (ws_dbus_data->cb_data, i+1);
-                       };
-
-               };
-       
-       };
-
-       return WS_DBUS_STATUS_OK;
+        WSDBusCBData cb_data;
+        GQuark temp;
+        guint i;
+
+        temp = g_quark_try_string  (detailed_signal);
+
+        if (temp == 0) 
+        {
+              printf ("DBUS:\"%s\"-signal not defined or invalid signal name\n",
+                      detailed_signal);
+              return WS_DBUS_STATUS_ERROR;
+        }
+
+        else
+        {
+                for (i = 0; i < ws_dbus_data->cb_data->len; ++i)
+                {
+                        cb_data = g_array_index (ws_dbus_data->cb_data,
+                                                 WSDBusCBData,
+                                                 i);
+                        if (cb_data.id == temp)
+        
+                        {
+                                cb_data.handler = c_func;
+                                cb_data.user_data = user_data;
+                                g_array_insert_val(ws_dbus_data->cb_data,
+                                                   i,
+                                                   cb_data);
+                                g_array_remove_index (ws_dbus_data->cb_data,
+                                                      i+1);
+                        };
+
+                };
+        
+        };
+
+        return WS_DBUS_STATUS_OK;
 };
 
-WSDBusStatus ws_dbus_notify (WSDBusData * ws_dbus_data, WSDBusNotify ws_dbus_info)
-
+WSDBusStatus ws_dbus_notify (WSDBusData * ws_dbus_data,
+                             WSDBusNotify ws_dbus_info)
 {
-       osso_return_t result;
-       osso_rpc_t *retval;
-
-       retval = g_try_malloc (sizeof (osso_rpc_t));
-
-       if (retval == NULL) 
-       {
-               printf ("DBUS: Error in function %s: Couldn't allocate memory for message's return value\n", __FUNCTION__);
-       };
-
-       result = osso_rpc_run (ws_dbus_data->context, 
-                               ws_dbus_data->remote_service, 
-                               ws_dbus_data->remote_object, 
-                               ws_dbus_data->remote_iface, 
-                               "signal", 
-                               retval,
-                               DBUS_TYPE_INT32,
-                               ws_dbus_info,
-                               DBUS_TYPE_INVALID);
-
-       
-       printf ("\nDBUS: %s: ", __FUNCTION__);
-       ws_dbus_libosso_errors (result);
-
-       if (result != OSSO_OK)
-       {
-               printf ("Error message: %s\n", retval->value.s);
-               if (strcmp (retval->value.s, "No reply within specified time") != 0) 
-               {
-                       osso_rpc_free_val (retval);
-                       g_free (retval);
-                       return WS_DBUS_STATUS_ERROR;
-               };
-       };
-
-       osso_rpc_free_val (retval);
-       g_free (retval);
-       return WS_DBUS_STATUS_OK;
+        osso_return_t result;
+        osso_rpc_t *retval;
+
+        retval = g_try_malloc (sizeof (osso_rpc_t));
+
+        if (retval == NULL) 
+        {
+                printf("DBUS: Error in function %s: ",__FUNCTION__);
+                printf("Couldn't allocate memory for message's return value\n");
+        };
+
+        result = osso_rpc_run (ws_dbus_data->context, 
+                               ws_dbus_data->remote_service, 
+                               ws_dbus_data->remote_object, 
+                               ws_dbus_data->remote_iface, 
+                               "signal", 
+                               retval,
+                               DBUS_TYPE_INT32,
+                               ws_dbus_info,
+                               DBUS_TYPE_INVALID);       
+        printf ("\nDBUS: %s: ", __FUNCTION__);
+        ws_dbus_libosso_errors (result);
+
+        if (result != OSSO_OK)
+        {
+                printf ("Error message: %s\n", retval->value.s);
+                if (strcmp (retval->value.s,
+                            "No reply within specified time") != 0) 
+                {
+                        osso_rpc_free_val (retval);
+                        g_free (retval);
+                        return WS_DBUS_STATUS_ERROR;
+                };
+        };
+
+        osso_rpc_free_val (retval);
+        g_free (retval);
+        return WS_DBUS_STATUS_OK;
 };
 
 WSDBusStatus ws_dbus_client_find_word (WSDBusData * ws_dbus_data, gchar * word)
 
 {
-       osso_return_t result;
-       osso_rpc_t *retval;
-
-       retval = g_try_malloc (sizeof (osso_rpc_t));
-
-       if (retval == NULL) 
-       {
-               printf ("DBUS: Error in function %s: Couldn't allocate memory for message's return value\n", __FUNCTION__);
-       };
-
-       result = osso_rpc_run (ws_dbus_data->context, 
-                               ws_dbus_data->remote_service, 
-                               ws_dbus_data->remote_object, 
-                               ws_dbus_data->remote_iface, 
-                               "find_word", 
-//                             NULL,
-                               retval,
-                               DBUS_TYPE_STRING,
-                               word,
-                               DBUS_TYPE_INVALID);
-
-       printf ("\nDBUS: %s: ", __FUNCTION__);
-
-       ws_dbus_libosso_errors (result);
-
-       if (result != OSSO_OK)
-       {
-               printf ("Error message: %s\n", retval->value.s);
-               osso_rpc_free_val (retval);
-               g_free (retval);
-               return WS_DBUS_STATUS_ERROR;
-       };
-
-       osso_rpc_free_val (retval);
-       g_free (retval);
-       return WS_DBUS_STATUS_OK;
+        osso_return_t result;
+        osso_rpc_t *retval;
+
+        retval = g_try_malloc (sizeof (osso_rpc_t));
+
+        if (retval == NULL) 
+        {
+                printf("DBUS: Error in function %s:",__FUNCTION__);
+                printf(" Couldn't allocate memory for message's return value\n");
+        };
+
+        result = osso_rpc_run (ws_dbus_data->context, 
+                               ws_dbus_data->remote_service, 
+                               ws_dbus_data->remote_object, 
+                               ws_dbus_data->remote_iface, 
+                               "find_word", 
+                               retval,
+                               DBUS_TYPE_STRING,
+                               word,
+                               DBUS_TYPE_INVALID);
+
+        printf ("\nDBUS: %s: ", __FUNCTION__);
+
+        ws_dbus_libosso_errors (result);
+
+        if (result != OSSO_OK)
+        {
+                printf ("Error message: %s\n", retval->value.s);
+                 osso_rpc_free_val (retval);
+                g_free (retval);
+                return WS_DBUS_STATUS_ERROR;
+        };
+
+         osso_rpc_free_val (retval);
+        g_free (retval);
+        return WS_DBUS_STATUS_OK;
 };
 
-WSDBusStatus ws_dbus_client_find_translation (WSDBusData * ws_dbus_data, gchar * word)
-
+WSDBusStatus ws_dbus_client_find_translation (WSDBusData * ws_dbus_data,
+                                              gchar * word)
 {
-       osso_return_t result;
-       osso_rpc_t *retval;
-
-       retval = g_try_malloc (sizeof (osso_rpc_t));
-
-       if (retval == NULL) 
-       {
-               printf ("DBUS: Error in function %s: Couldn't allocate memory for message's return value\n",  __FUNCTION__);
-       };
-
-       result = osso_rpc_run (ws_dbus_data->context, 
-                               ws_dbus_data->remote_service, 
-                               ws_dbus_data->remote_object, 
-                               ws_dbus_data->remote_iface, 
-                               "find_translation", 
-//                             NULL,
-                               retval,
-                               DBUS_TYPE_STRING,
-                               word,
-                               DBUS_TYPE_INVALID);
-
-       printf ("\nDBUS: %s: ", __FUNCTION__);
-
-       ws_dbus_libosso_errors (result);
-
-       if (result != OSSO_OK)
-       {
-               printf ("Error message: %s\n", retval->value.s);
-               osso_rpc_free_val (retval);
-               g_free (retval);
-               return WS_DBUS_STATUS_ERROR;
-       };
-
-       osso_rpc_free_val (retval);
-       g_free (retval);
-       return WS_DBUS_STATUS_OK;
+        osso_return_t result;
+        osso_rpc_t *retval;
+        
+        retval = g_try_malloc (sizeof (osso_rpc_t));
+
+        if (retval == NULL) 
+        {
+                printf("DBUS: Error in function %s: ",__FUNCTION__);
+                printf(" Couldn't allocate memory for message's return value\n");
+        };
+
+        result = osso_rpc_run (ws_dbus_data->context, 
+                               ws_dbus_data->remote_service, 
+                               ws_dbus_data->remote_object, 
+                               ws_dbus_data->remote_iface, 
+                               "find_translation", 
+                               retval,
+                               DBUS_TYPE_STRING,
+                               word,
+                               DBUS_TYPE_INVALID);
+
+        printf ("\nDBUS: %s: ", __FUNCTION__);
+
+        ws_dbus_libosso_errors (result);
+
+        if (result != OSSO_OK)
+        {
+                printf ("Error message: %s\n", retval->value.s);
+                 osso_rpc_free_val (retval);
+                g_free (retval);
+                return WS_DBUS_STATUS_ERROR;
+        };
+
+         osso_rpc_free_val (retval);
+        g_free (retval);
+        return WS_DBUS_STATUS_OK;
 };
 
-WSDBusStatus ws_dbus_client_search_in_history (WSDBusData * ws_dbus_data, gchar * word)
+WSDBusStatus ws_dbus_client_search_in_history (WSDBusData* ws_dbus_data,
+                                               gchar* word)
 {
-       osso_return_t result;
-       osso_rpc_t *retval;
-
-       retval = g_try_malloc (sizeof (osso_rpc_t));
-
-       if (retval == NULL) 
-       {
-               printf ("DBUS: Error in function %s: Couldn't allocate memory for message's return value\n",  __FUNCTION__);
-       };
-
-       result = osso_rpc_run (ws_dbus_data->context, 
-                               ws_dbus_data->remote_service, 
-                               ws_dbus_data->remote_object, 
-                               ws_dbus_data->remote_iface, 
-                               "search_in_history", 
-//                             NULL,
-                               retval,
-                               DBUS_TYPE_STRING,
-                               word,
-                               DBUS_TYPE_INVALID);
-
-       printf ("\nDBUS: %s: ", __FUNCTION__);
-
-       ws_dbus_libosso_errors (result);
-
-       if (result != OSSO_OK)
-       {
-               printf ("Error message: %s\n", retval->value.s);
-               osso_rpc_free_val (retval);
-               g_free (retval);
-               return WS_DBUS_STATUS_ERROR;
-       };
-
-       osso_rpc_free_val (retval);
-       g_free (retval);
-       return WS_DBUS_STATUS_OK;
+        osso_return_t result;
+        osso_rpc_t *retval;
+
+        retval = g_try_malloc (sizeof (osso_rpc_t));
+
+        if (retval == NULL) 
+        {
+                printf("DBUS: Error in function %s:",__FUNCTION__);
+                printf(" Couldn't allocate memory for message's return value\n");
+        };
+
+        result = osso_rpc_run (ws_dbus_data->context, 
+                               ws_dbus_data->remote_service, 
+                               ws_dbus_data->remote_object, 
+                               ws_dbus_data->remote_iface, 
+                               "search_in_history", 
+                               retval,
+                               DBUS_TYPE_STRING,
+                               word,
+                               DBUS_TYPE_INVALID);
+
+        printf ("\nDBUS: %s: ", __FUNCTION__);
+
+        ws_dbus_libosso_errors (result);
+
+        if (result != OSSO_OK)
+        {
+                printf ("Error message: %s\n", retval->value.s);
+                 osso_rpc_free_val (retval);
+                g_free (retval);
+                return WS_DBUS_STATUS_ERROR;
+        };
+
+         osso_rpc_free_val (retval);
+        g_free (retval);
+        return WS_DBUS_STATUS_OK;
 };
 
 WSDBusStatus ws_dbus_server_return_words  (WSDBusData * ws_dbus_data, GArray * words)
 
 {
-       osso_return_t result;
-       osso_rpc_t *retval;
-
-       retval = g_try_malloc (sizeof (osso_rpc_t));
-
-       if (retval == NULL) 
-       {
-               printf ("DBUS: Error in function %s: Couldn't allocate memory for message's return value\n", __FUNCTION__);
-       };
-
-       result = osso_rpc_run_with_argfill (ws_dbus_data->context, 
-                               ws_dbus_data->remote_service, 
-                               ws_dbus_data->remote_object, 
-                               ws_dbus_data->remote_iface, 
-                               "return_words",
-//                             NULL,
-                               retval,
-                               ws_dbus_fill_message,
-                               words);
-
-       printf ("\nDBUS: %s: ", __FUNCTION__);
-
-       ws_dbus_libosso_errors (result);
-
-       if (result != OSSO_OK)
-       {
-               printf ("Error message: %s\n", retval->value.s);
-               osso_rpc_free_val (retval);
-               g_free (retval);
-               return WS_DBUS_STATUS_ERROR;
-       };
-
-       osso_rpc_free_val (retval);
-       g_free (retval);
-       return WS_DBUS_STATUS_OK;
+        osso_return_t result;
+        osso_rpc_t *retval;
+
+        retval = g_try_malloc (sizeof (osso_rpc_t));
+
+        if (retval == NULL) 
+        {
+                printf("DBUS: Error in function %s:",__FUNCTION__);
+                printf(" Couldn't allocate memory for message's return value\n");
+        };
+
+        result = osso_rpc_run_with_argfill (ws_dbus_data->context, 
+                                            ws_dbus_data->remote_service, 
+                                            ws_dbus_data->remote_object, 
+                                            ws_dbus_data->remote_iface, 
+                                            "return_words",
+                                            retval,
+                                            ws_dbus_fill_message,
+                                            words);
+        printf ("\nDBUS: %s: ", __FUNCTION__);
+
+        ws_dbus_libosso_errors (result);
+
+        if (result != OSSO_OK)
+        {
+                printf ("Error message: %s\n", retval->value.s);
+                 osso_rpc_free_val (retval);
+                g_free (retval);
+                return WS_DBUS_STATUS_ERROR;
+        };
+
+         osso_rpc_free_val (retval);
+        g_free (retval);
+        return WS_DBUS_STATUS_OK;
 };
 
-WSDBusStatus ws_dbus_server_return_words_last  (WSDBusData * ws_dbus_data, GArray * words)
+WSDBusStatus ws_dbus_server_return_words_last(WSDBusData * ws_dbus_data,
+                                              GArray * words)
 
 {
-       osso_return_t result;
-       osso_rpc_t *retval;
-
-       retval = g_try_malloc (sizeof (osso_rpc_t));
-
-       if (retval == NULL) 
-       {
-               printf ("DBUS: Error in function %s: Couldn't allocate memory for message's return value\n",  __FUNCTION__);
-       };
-
-       result = osso_rpc_run_with_argfill (ws_dbus_data->context, 
-                               ws_dbus_data->remote_service, 
-                               ws_dbus_data->remote_object, 
-                               ws_dbus_data->remote_iface, 
-                               "return_words", 
-                               retval,
-                               ws_dbus_fill_message,
-                               words);
-       
-       printf ("\nDBUS: %s: ", __FUNCTION__);
-
-       ws_dbus_libosso_errors (result);
-
-       if (result != OSSO_OK)
-       {
-               printf ("Error message: %s\n", retval->value.s);
-               osso_rpc_free_val (retval);
-               g_free (retval);
-               return WS_DBUS_STATUS_ERROR;
-       };
-
-       osso_rpc_free_val (retval);
-       g_free (retval);
-       return WS_DBUS_STATUS_OK;
+        osso_return_t result;
+        osso_rpc_t *retval;
+
+        retval = g_try_malloc (sizeof (osso_rpc_t));
+
+        if (retval == NULL) 
+        {
+                printf("DBUS: Error in function %s:",__FUNCTION__);
+                printf(" Couldn't allocate memory for message's return value\n");
+        };
+
+        result = osso_rpc_run_with_argfill (ws_dbus_data->context, 
+                                            ws_dbus_data->remote_service, 
+                                            ws_dbus_data->remote_object, 
+                                            ws_dbus_data->remote_iface, 
+                                            "return_words", 
+                                            retval,
+                                            ws_dbus_fill_message,
+                                            words);
+        
+        printf ("\nDBUS: %s: ", __FUNCTION__);
+
+        ws_dbus_libosso_errors (result);
+
+        if (result != OSSO_OK)
+        {
+                printf ("Error message: %s\n", retval->value.s);
+                 osso_rpc_free_val (retval);
+                g_free (retval);
+                return WS_DBUS_STATUS_ERROR;
+        };
+
+         osso_rpc_free_val (retval);
+        g_free (retval);
+        return WS_DBUS_STATUS_OK;
 };
 
-WSDBusStatus ws_dbus_server_return_translations (WSDBusData * ws_dbus_data, gchar * translation)
+WSDBusStatus ws_dbus_server_return_translations(WSDBusData * ws_dbus_data,
+                                                gchar * translation)
 
 {
-       osso_return_t result;
-       osso_rpc_t *retval;
-
-       retval = g_try_malloc (sizeof (osso_rpc_t));
-
-       if (retval == NULL) 
-       {
-               printf ("DBUS: Error in function %s: Couldn't allocate memory for message's return value\n",  __FUNCTION__);
-       };
-
-       result = osso_rpc_run (ws_dbus_data->context, 
-                               ws_dbus_data->remote_service, 
-                               ws_dbus_data->remote_object, 
-                               ws_dbus_data->remote_iface, 
-                               "return_translations", 
-//                             NULL,
-                               retval,
-                               DBUS_TYPE_STRING,
-                               translation,
-                               DBUS_TYPE_INVALID);
-
-       printf ("\nDBUS: %s: ", __FUNCTION__);
-
-       ws_dbus_libosso_errors (result);
-
-       if (result != OSSO_OK)
-       {
-               printf ("Error message: %s\n", retval->value.s);
-               osso_rpc_free_val (retval);
-               g_free (retval);
-               return WS_DBUS_STATUS_ERROR;
-       };
-
-       osso_rpc_free_val (retval);
-       g_free (retval);
-       return WS_DBUS_STATUS_OK;
+        osso_return_t result;
+        osso_rpc_t *retval;
+
+        retval = g_try_malloc (sizeof (osso_rpc_t));
+
+        if (retval == NULL) 
+        {
+                printf("DBUS: Error in function %s:",  __FUNCTION__);
+                printf(" Couldn't allocate memory for message's return value\n");
+        };
+
+        result = osso_rpc_run (ws_dbus_data->context, 
+                               ws_dbus_data->remote_service, 
+                               ws_dbus_data->remote_object, 
+                               ws_dbus_data->remote_iface, 
+                               "return_translations", 
+                               retval,
+                               DBUS_TYPE_STRING,
+                               translation,
+                               DBUS_TYPE_INVALID);
+
+        printf ("\nDBUS: %s: ", __FUNCTION__);
+
+        ws_dbus_libosso_errors (result);
+
+        if (result != OSSO_OK)
+        {
+                printf ("Error message: %s\n", retval->value.s);
+                 osso_rpc_free_val (retval);
+                g_free (retval);
+                return WS_DBUS_STATUS_ERROR;
+        };
+
+         osso_rpc_free_val (retval);
+        g_free (retval);
+        return WS_DBUS_STATUS_OK;
 };
 
-WSDBusStatus ws_dbus_send_ptrtodata (WSDBusData * ws_dbus_data, gchar *method, gulong data_address)
+WSDBusStatus ws_dbus_send_ptrtodata(WSDBusData * ws_dbus_data,
+                                    gchar *method,
+                                    gulong data_address)
 
 {
-       osso_return_t result;
-       osso_rpc_t *retval;
-
-       retval = g_try_malloc (sizeof (osso_rpc_t));
-
-       if (retval == NULL) 
-       {
-               printf ("DBUS: Error in function %s: Couldn't allocate memory for message's return value\n",  __FUNCTION__);
-       };
-
-       result = osso_rpc_run (ws_dbus_data->context, 
-                               ws_dbus_data->remote_service, 
-                               ws_dbus_data->remote_object, 
-                               ws_dbus_data->remote_iface, 
-                               method, 
-                               retval,
-                               DBUS_TYPE_INT32,
-                               data_address,
-                               DBUS_TYPE_INVALID);
-
-       printf ("\nDBUS: %s: ", __FUNCTION__);
-
-       ws_dbus_libosso_errors (result);
-
-       if (result != OSSO_OK)
-       {
-               printf ("Error message: %s\n", retval->value.s);
-               osso_rpc_free_val (retval);
-               g_free (retval);
-               return WS_DBUS_STATUS_ERROR;
-       };
-
-       osso_rpc_free_val (retval);
-       g_free (retval);
-       return WS_DBUS_STATUS_OK;
+        osso_return_t result;
+        osso_rpc_t *retval;
+
+        retval = g_try_malloc (sizeof (osso_rpc_t));
+
+        if (retval == NULL) 
+        {
+                printf("DBUS: Error in function %s:",__FUNCTION__);
+                printf(" Couldn't allocate memory for message's return value\n");
+        };
+
+        result = osso_rpc_run (ws_dbus_data->context, 
+                               ws_dbus_data->remote_service, 
+                               ws_dbus_data->remote_object, 
+                               ws_dbus_data->remote_iface, 
+                               method, 
+                               retval,
+                               DBUS_TYPE_INT32,
+                               data_address,
+                               DBUS_TYPE_INVALID);
+
+        printf ("\nDBUS: %s: ", __FUNCTION__);
+
+        ws_dbus_libosso_errors (result);
+
+        if (result != OSSO_OK)
+        {
+                printf ("Error message: %s\n", retval->value.s);
+                 osso_rpc_free_val (retval);
+                g_free (retval);
+                return WS_DBUS_STATUS_ERROR;
+        };
+
+         osso_rpc_free_val (retval);
+        g_free (retval);
+        return WS_DBUS_STATUS_OK;
 
 };
 
 
-WSDBusStatus ws_dbus_server_return_translations_last (WSDBusData * ws_dbus_data, gchar * translation)
+WSDBusStatus ws_dbus_server_return_translations_last(WSDBusData * ws_dbus_data,
+                                                     gchar * translation)
 
 {
-       osso_return_t result;
-       osso_rpc_t *retval;
-
-       retval = g_try_malloc (sizeof (osso_rpc_t));
-
-       if (retval == NULL) 
-       {
-               printf ("DBUS: Error in function %s: Couldn't allocate memory for message's return value\n",  __FUNCTION__);
-       };
-
-       result = osso_rpc_run (ws_dbus_data->context, 
-                               ws_dbus_data->remote_service, 
-                               ws_dbus_data->remote_object, 
-                               ws_dbus_data->remote_iface, 
-                               "return_translations", 
-                               retval,
-                               DBUS_TYPE_STRING,
-                               translation,
-                               DBUS_TYPE_INVALID);
-       
-       printf ("\nDBUS: %s: ", __FUNCTION__);
-
-       ws_dbus_libosso_errors (result);
-
-       if (result != OSSO_OK)
-       {
-               printf ("Error message: %s\n", retval->value.s);
-               osso_rpc_free_val (retval);
-               g_free (retval);
-               return WS_DBUS_STATUS_ERROR;
-       };
-
-       osso_rpc_free_val (retval);
-       g_free (retval);
-       return WS_DBUS_STATUS_OK;
+        osso_return_t result;
+        osso_rpc_t *retval;
+
+        retval = g_try_malloc (sizeof (osso_rpc_t));
+
+        if (retval == NULL) 
+        {
+                printf("DBUS: Error in function %s:", __FUNCTION__);
+                printf(" Couldn't allocate memory for message's return value\n");
+        };
+
+        result = osso_rpc_run(ws_dbus_data->context, 
+                              ws_dbus_data->remote_service, 
+                              ws_dbus_data->remote_object, 
+                              ws_dbus_data->remote_iface, 
+                              "return_translations", 
+                              retval,
+                              DBUS_TYPE_STRING,
+                              translation,
+                              DBUS_TYPE_INVALID);
+        
+        printf ("\nDBUS: %s: ", __FUNCTION__);
+
+        ws_dbus_libosso_errors (result);
+
+        if (result != OSSO_OK)
+        {
+                printf ("Error message: %s\n", retval->value.s);
+                 osso_rpc_free_val (retval);
+                g_free (retval);
+                return WS_DBUS_STATUS_ERROR;
+        };
+
+        osso_rpc_free_val (retval);
+        g_free (retval);
+        return WS_DBUS_STATUS_OK;
 };
 
 gpointer ws_dbus_concat_data (GArray *garray)
 {
-       guint i;
-       gchar temp_len = 0;
-       gulong total_len = 0;
-       gpointer temp = NULL, start;
-       gchar *array;
-
-       for (i=0;i<garray->len;++i)
-       {
-               array = g_array_index (garray, gchar *, i);
-               printf ("DBUS: %s: text added: %s\n", __FUNCTION__, array);
-               temp = start;
-               temp_len = strlen (array);
-               printf ("length: %d\n", temp_len);
-               start = g_malloc (total_len + temp_len + 1);
-               memcpy (start, temp, total_len);
-               if (i > 0) g_free (temp);
-               temp = start + total_len;
-               memcpy (temp, &temp_len, 1);
-               memcpy (temp+1, array, temp_len);
-               total_len = total_len + temp_len + 1;
-       };
-/*
-//     Dodaj 0 na koñcu stringa
-       temp = start;
-       start = g_malloc (total_len + 1);
-       memcpy (start, temp, total_len);
-       g_free (temp);
-       temp = start + total_len;
-       temp_len = 0;
-       memcpy (temp, &temp_len, 1);
-*/
-       
-       return start;
+        guint i;
+        gchar temp_len = 0;
+        gulong total_len = 0;
+        gpointer temp = NULL, start;
+        gchar *array;
+
+        for (i=0;i<garray->len;++i)
+        {
+                array = g_array_index (garray, gchar *, i);
+                printf ("DBUS: %s: text added: %s\n", __FUNCTION__, array);
+                temp = start;
+                temp_len = strlen (array);
+                printf ("length: %d\n", temp_len);
+                start = g_malloc (total_len + temp_len + 1);
+                memcpy (start, temp, total_len);
+                if (i > 0) g_free (temp);
+                temp = start + total_len;
+                memcpy (temp, &temp_len, 1);
+                memcpy (temp+1, array, temp_len);
+                total_len = total_len + temp_len + 1;
+        };      
+        return start;
 };
 
 GArray * ws_dbus_split_data (gpointer buffer)
 {
-       gchar *temp;
-       gchar *str;
-       guint len;
-       guint total_len = 0;
-       guint buffer_len;
-       guint i = 0;
-       GArray *garray;
-
-       temp = buffer;
-
-       buffer_len = strlen (buffer);
-
-       printf ("Buffer length %d\n", strlen (buffer));
-       garray = g_array_new (TRUE, TRUE, sizeof(gchar *));
-       
-       while (temp[0] != 0)
-       {
-//             printf ("DBUS: $s: length = %d\n", __FUNCTION__, temp[0]);
-               len = temp[0];
-               total_len = total_len + len;
-               str = g_malloc (len + 1);
-               memcpy (str, temp+1, len);
-               str[len] = 0;
-               temp = temp + len + 1;
-               printf ("Received text: %s, %d\n", str, len);
-               g_array_append_val (garray, str);
-               ++i;
-       };      
-
-       return garray;
+        gchar *temp;
+        gchar *str;
+        guint len;
+        guint total_len = 0;
+        guint buffer_len;
+        guint i = 0;
+        GArray *garray;
+
+        temp = buffer;
+
+        buffer_len = strlen (buffer);
+
+        printf ("Buffer length %d\n", strlen (buffer));
+        garray = g_array_new (TRUE, TRUE, sizeof(gchar *));
+        
+        while (temp[0] != 0)
+        {
+                len = temp[0];
+                total_len = total_len + len;
+                str = g_malloc (len + 1);
+                memcpy (str, temp+1, len);
+                str[len] = 0;
+                temp = temp + len + 1;
+                printf ("Received text: %s, %d\n", str, len);
+                g_array_append_val (garray, str);
+                ++i;
+        };        
+
+        return garray;
 };
 
-WSDBusStatus ws_dbus_update_progressbar (WSDBusData * ws_dbus_data, double progress)
+WSDBusStatus ws_dbus_update_progressbar (WSDBusData * ws_dbus_data,
+                                         double progress)
 
 {
-       osso_return_t result;
-       osso_rpc_t *retval;
-
-       retval = g_try_malloc (sizeof (osso_rpc_t));
-
-       if (retval == NULL) 
-       {
-               printf ("DBUS: Error in function %s: Couldn't allocate memory for message's return value\n", __FUNCTION__);
-       };
-
-       result = osso_rpc_run (ws_dbus_data->context, 
-                               ws_dbus_data->remote_service, 
-                               ws_dbus_data->remote_object, 
-                               ws_dbus_data->remote_iface, 
-                               "update_progressbar", 
-                               retval,
-                               DBUS_TYPE_DOUBLE,
-                               progress,
-                               DBUS_TYPE_INVALID);
-
-       printf ("\nDBUS: %s: ", __FUNCTION__);
-
-       ws_dbus_libosso_errors (result);
-
-       if (result != OSSO_OK)
-       {
-               printf ("Error message: %s\n", retval->value.s);
-               osso_rpc_free_val (retval);
-               g_free (retval);
-               return WS_DBUS_STATUS_ERROR;
-       };
-
-       osso_rpc_free_val (retval);
-       g_free (retval);
-       return WS_DBUS_STATUS_OK;
+        osso_return_t result;
+        osso_rpc_t *retval;
+
+        retval = g_try_malloc (sizeof (osso_rpc_t));
+
+        if (retval == NULL) 
+        {
+                printf("DBUS: Error in function %s:", __FUNCTION__);
+                printf(" Couldn't allocate memory for message's return value\n");
+        };
+
+        result = osso_rpc_run (ws_dbus_data->context, 
+                               ws_dbus_data->remote_service, 
+                               ws_dbus_data->remote_object, 
+                               ws_dbus_data->remote_iface, 
+                               "update_progressbar", 
+                               retval,
+                               DBUS_TYPE_DOUBLE,
+                               progress,
+                               DBUS_TYPE_INVALID);
+
+        printf ("\nDBUS: %s: ", __FUNCTION__);
+
+        ws_dbus_libosso_errors (result);
+
+        if (result != OSSO_OK)
+        {
+                printf ("Error message: %s\n", retval->value.s);
+                 osso_rpc_free_val (retval);
+                g_free (retval);
+                return WS_DBUS_STATUS_ERROR;
+        };
+
+         osso_rpc_free_val (retval);
+        g_free (retval);
+        return WS_DBUS_STATUS_OK;
 };
index 8664fbd..7db7387 100644 (file)
@@ -1,4 +1,4 @@
-/************************************************************************************************
+/*******************************************************************************
 This file is part of WhiteStork.
 
 WhiteStork is free software; you can redistribute it and/or modify
@@ -16,92 +16,105 @@ along with WhiteStork; if not, write to the Free Software
 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
 
 Copyright 2006 ComArch S.A.
-************************************************************************************************/
-
-
+*******************************************************************************/
 #include "../../include/ws_gui.h"
 #include "../../include/ws_gui_callbacks.h"
 #include "../../include/ws_gui_layout.h"
 
 //int ws_gui_init(int argc, char *argv[])
 int main(int argc, char *argv[])
-{      
-       gtk_init(&argc, &argv);
-       
-       //gconf_init(argc, argv, NULL);
-       
-       WSGuiApp *ws_gui_app;
-       ws_gui_app = (WSGuiApp*)g_malloc(sizeof(WSGuiApp));     
+{           
+        gtk_init(&argc, &argv);
+           
+           //gconf_init(argc, argv, NULL);
+           
+        WSGuiApp *ws_gui_app;
+        ws_gui_app = (WSGuiApp*)g_malloc(sizeof(WSGuiApp));           
 
-       //memory allocation
-       ws_gui_app->ws_gui_w_list = (struct WSGuiList*)g_malloc(sizeof(struct WSGuiList));
-       ws_gui_app->ws_gui_menu = (struct WSGuiMenu*)g_malloc(sizeof(struct WSGuiMenu));
+           //memory allocation
+        ws_gui_app->ws_gui_w_list = 
+                (struct WSGuiList*)g_malloc(sizeof(struct WSGuiList));
+        ws_gui_app->ws_gui_menu = 
+                (struct WSGuiMenu*)g_malloc(sizeof(struct WSGuiMenu));
 
-       ws_gui_create_window(ws_gui_app);
-       ws_gui_read_adjustment(ws_gui_app);
-       
-       //gonf
-       ws_gui_app->client = gconf_client_get_default();
-       
+        ws_gui_create_window(ws_gui_app);
+        ws_gui_read_adjustment(ws_gui_app);
+           
+           //gonf
+        ws_gui_app->client = gconf_client_get_default();
+           
 
-       //dbus wrapper
-       ws_gui_app->dbus_data = ws_dbus_create ("WhiteStorkGui", "v1.0");
+           //dbus wrapper
+        ws_gui_app->dbus_data = ws_dbus_create ("WhiteStorkGui", "v1.0");
 
-       ws_dbus_config (ws_gui_app->dbus_data, WS_DBUS_CONFIG_SERVICE, "org.maemo.WhiteStorkGui");
-       ws_dbus_config (ws_gui_app->dbus_data, WS_DBUS_CONFIG_OBJECT, "/org/maemo/WhiteStorkGui");
-       ws_dbus_config (ws_gui_app->dbus_data, WS_DBUS_CONFIG_IFACE, "org.maemo.WhiteStorkGui");
-       ws_dbus_config (ws_gui_app->dbus_data, WS_DBUS_CONFIG_REMOTE_SERVICE, "org.maemo.WhiteStorkManager");
-       ws_dbus_config (ws_gui_app->dbus_data, WS_DBUS_CONFIG_REMOTE_OBJECT, "/org/maemo/WhiteStorkManager");
-       ws_dbus_config (ws_gui_app->dbus_data, WS_DBUS_CONFIG_REMOTE_IFACE, "org.maemo.WhiteStorkManager");
-       
-       ws_dbus_connect (ws_gui_app->dbus_data);
+        ws_dbus_config (ws_gui_app->dbus_data, 
+                        WS_DBUS_CONFIG_SERVICE,
+                        "org.maemo.WhiteStorkGui");
+        ws_dbus_config (ws_gui_app->dbus_data,
+                        WS_DBUS_CONFIG_OBJECT,
+                        "/org/maemo/WhiteStorkGui");
+        ws_dbus_config (ws_gui_app->dbus_data,
+                        WS_DBUS_CONFIG_IFACE,
+                        "org.maemo.WhiteStorkGui");
+        ws_dbus_config (ws_gui_app->dbus_data,
+                        WS_DBUS_CONFIG_REMOTE_SERVICE,
+                        "org.maemo.WhiteStorkManager");
+        ws_dbus_config (ws_gui_app->dbus_data,
+                        WS_DBUS_CONFIG_REMOTE_OBJECT,
+                        "/org/maemo/WhiteStorkManager");
+        ws_dbus_config (ws_gui_app->dbus_data,
+                        WS_DBUS_CONFIG_REMOTE_IFACE,
+                        "org.maemo.WhiteStorkManager");
+           
+        ws_dbus_connect (ws_gui_app->dbus_data);
 
-       ws_dbus_set_cb (ws_gui_app->dbus_data, "return_words", ws_gui_dbus_return_words, ws_gui_app);
+        ws_dbus_set_cb (ws_gui_app->dbus_data,
+                        "return_words",
+                        ws_gui_dbus_return_words,
+                        ws_gui_app);
 
-       ws_dbus_set_cb (ws_gui_app->dbus_data, "return_translations", ws_gui_dbus_return_translation, ws_gui_app);
-       ws_dbus_set_cb (ws_gui_app->dbus_data, "update_progressbar", ws_dbus_progress_bar, ws_gui_app);
-       ws_dbus_set_cb (ws_gui_app->dbus_data, "signal", ws_gui_signal_hander, ws_gui_app);
-       
-       //setting the clipboard
-       ws_gui_app->ws_gui_clipboard = gtk_widget_get_clipboard (GTK_WIDGET(ws_gui_app->ws_gui_html), GDK_SELECTION_CLIPBOARD);
-       
-       //connecting the signals
-       g_signal_connect (G_OBJECT (ws_gui_app->ws_gui_w_list->ws_gui_selection), "changed", G_CALLBACK (ws_gui_tree_selection_changed), ws_gui_app);
-       g_signal_connect(G_OBJECT(ws_gui_app->ws_gui_hildon_window), "key-press-event", G_CALLBACK(hildon_key_press_listener), ws_gui_app);
-       g_signal_connect(G_OBJECT(ws_gui_app->ws_gui_html), "button-press-event", G_CALLBACK(ws_gui_button_press), ws_gui_app);
-       g_signal_connect(G_OBJECT(ws_gui_app->ws_gui_html), "button-release-event", G_CALLBACK(ws_gui_button_release), ws_gui_app);
-       g_signal_connect(G_OBJECT(ws_gui_app->ws_gui_hildon_window), "delete-event", G_CALLBACK(ws_gui_on_exit), ws_gui_app);
+        ws_dbus_set_cb (ws_gui_app->dbus_data,
+                        "return_translations",
+                        ws_gui_dbus_return_translation,
+                        ws_gui_app);
+        ws_dbus_set_cb (ws_gui_app->dbus_data,
+                        "update_progressbar",
+                        ws_dbus_progress_bar,
+                        ws_gui_app);
+        ws_dbus_set_cb (ws_gui_app->dbus_data,
+                        "signal",
+                        ws_gui_signal_hander,
+                        ws_gui_app);
+           
+           //setting the clipboard
+        ws_gui_app->ws_gui_clipboard = 
+                gtk_widget_get_clipboard (GTK_WIDGET(ws_gui_app->ws_gui_html),
+                                          GDK_SELECTION_CLIPBOARD);
+           
+           //connecting the signals
+        g_signal_connect(G_OBJECT (ws_gui_app->ws_gui_w_list->ws_gui_selection),
+                         "changed",
+                         G_CALLBACK (ws_gui_tree_selection_changed), ws_gui_app);
+        g_signal_connect(G_OBJECT(ws_gui_app->ws_gui_hildon_window),
+                        "key-press-event",
+                         G_CALLBACK(hildon_key_press_listener),
+                         ws_gui_app);
+        g_signal_connect(G_OBJECT(ws_gui_app->ws_gui_html),
+                         "button-press-event",
+                         G_CALLBACK(ws_gui_button_press),
+                         ws_gui_app);
+        g_signal_connect(G_OBJECT(ws_gui_app->ws_gui_html),
+                         "button-release-event",
+                         G_CALLBACK(ws_gui_button_release),
+                         ws_gui_app);
+        g_signal_connect(G_OBJECT(ws_gui_app->ws_gui_hildon_window),
+                         "delete-event",
+                         G_CALLBACK(ws_gui_on_exit),
+                         ws_gui_app);
 
-       //checking license (gconf entry)
-//     gchar *path = g_strconcat(GCONF_CONF, "/licence", NULL);
-//     if (gconf_client_get_bool(ws_gui_app->client, path, NULL) == FALSE)
-//     {
-//             ws_gui_app->licence_dialog = licence_dialog(ws_gui_app);
-//             if (gtk_dialog_run(GTK_DIALOG(ws_gui_app->licence_dialog)) == GTK_RESPONSE_OK)
-//                     {
-//                             gtk_widget_destroy(GTK_WIDGET(ws_gui_app->licence_dialog));
-//                             gconf_client_set_bool (ws_gui_app->client, path, TRUE, NULL);
-//                             ws_dbus_notify(ws_gui_app->dbus_data, WS_DBUS_ERROR_UNKNOWN);
-//                             g_free(path);
-//                             gtk_main();
-//                     }
-//             else
-//             {
-//                             gtk_widget_destroy(GTK_WIDGET(ws_gui_app->licence_dialog));
-//                             //ws_dbus_notify(ws_gui_app->dbus_data, WS_DBUS_INFO_TERMINATE);
-//                             ws_dbus_destroy (ws_gui_app->dbus_data);
-//                             ws_gui_free_memory(ws_gui_app);
-//                             g_free(path);
-//                             exit(0);
-//             }
-//     }
-//     else
-//     {
-//             ws_dbus_notify(ws_gui_app->dbus_data, WS_DBUS_ERROR_UNKNOWN);
-//             gtk_main();
-//     }
-       ws_dbus_notify(ws_gui_app->dbus_data, WS_DBUS_ERROR_UNKNOWN);
-       gtk_main();
-       return 0;
+        ws_dbus_notify(ws_gui_app->dbus_data,
+                       WS_DBUS_ERROR_UNKNOWN);
+        gtk_main();
+        return 0;
 }
 
index fb8e221..0b34065 100644 (file)
@@ -1,4 +1,4 @@
-/************************************************************************************************
+/*******************************************************************************
 This file is part of WhiteStork.
 
 WhiteStork is free software; you can redistribute it and/or modify
@@ -16,7 +16,7 @@ along with WhiteStork; if not, write to the Free Software
 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
 
 Copyright 2006 ComArch S.A.
-************************************************************************************************/
+*******************************************************************************/
 #include "../../include/ws_gui_callbacks.h"
 #include "../../include/ws_gui.h"
 #include "../../include/ws_gui_layout.h"
@@ -27,58 +27,68 @@ Copyright 2006 ComArch S.A.
  */
 static double timer(gboolean start, gchar* message)
 {
-       static GArray* stack = NULL;
-       static gboolean first_run = TRUE;
-       static struct timeval actual_time;
-       static struct timeval last_time;
-       static struct timeval result;
-       static double seconds = 0.0;
-       if(first_run)   
-       {
-               first_run = FALSE;
-               //g_debug("XDXF->%s() - TOP OF THE STACK!\n",__FUNCTION__);
-               stack = g_array_new(TRUE, TRUE, sizeof(struct timeval));
-       };      
-
-       if (start)      // things to do on the beggining of function's work
-       {
-               g_debug("XDXF->%s() start counting time for function '%s()'.\n",__FUNCTION__,message);
-               g_array_prepend_val(stack, actual_time);
-               gettimeofday(&g_array_index(stack, struct timeval, 0),NULL);
-               return -1.0;
-       }
-       else {          // we just want to end some timer - print some information about working time;
-               gettimeofday(&actual_time,NULL);
-               last_time = g_array_index(stack, struct timeval, 0);
-               g_array_remove_index(stack, 0);
-
-               if (actual_time.tv_usec < last_time.tv_usec) {
-                       int nsec = (last_time.tv_usec - actual_time.tv_usec) / 1000000 + 1;
-                       last_time.tv_usec -= 1000000 * nsec;
-                       last_time.tv_sec += nsec;
-               }
-               if (actual_time.tv_usec - last_time.tv_usec > 1000000) {
-                       int nsec = (last_time.tv_usec - actual_time.tv_usec) / 1000000;
-                       last_time.tv_usec += 1000000 * nsec;
-                       last_time.tv_sec -= nsec;
-               }
-               result.tv_sec = actual_time.tv_sec - last_time.tv_sec;
-               result.tv_usec = actual_time.tv_usec - last_time.tv_usec;
-               seconds = (((double)(result.tv_usec)) / 1e6) + ((double)(result.tv_sec));
-
-               g_debug("XDXF->%s() function \'%s()\' was working for: %g [s] or %ld [us].\n",__FUNCTION__,message,seconds,((long)(result.tv_sec*1e6)+(result.tv_usec)));
-               if(stack->len == 0)     // stack is empty so we delete everything
-               {
-                       g_array_free(stack, TRUE);
-                       first_run = TRUE;
-               }
-               return seconds;
-       }
-       return -2.0;
-}
-
-
-/**  this function handles signals from dbus; it is called when there are any messages from other modules
+        static GArray* stack = NULL;
+        static gboolean first_run = TRUE;
+        static struct timeval actual_time;
+        static struct timeval last_time;
+        static struct timeval result;
+        static double seconds = 0.0;
+        if(first_run)                      
+        {
+                first_run = FALSE;
+                stack = g_array_new(TRUE, TRUE, sizeof(struct timeval));
+        };                      
+        // things to do on the beggining of function's work
+        if (start)                       
+        {
+                g_debug("XDXF->%s() start counting time for function '%s()'.\n",
+                        __FUNCTION__,message);
+                g_array_prepend_val(stack, actual_time);
+                gettimeofday(&g_array_index(stack, struct timeval, 0),NULL);
+                return -1.0;
+        }
+        // we just want to end some timer - print some information 
+        //about working time;
+        else {
+                gettimeofday(&actual_time,NULL);
+                last_time = g_array_index(stack, struct timeval, 0);
+                g_array_remove_index(stack, 0);
+                
+                if (actual_time.tv_usec < last_time.tv_usec) {
+                        int nsec = (last_time.tv_usec - 
+                                             actual_time.tv_usec) / 1000000 + 1;
+                        last_time.tv_usec -= 1000000 * nsec;
+                        last_time.tv_sec += nsec;
+                }
+                if (actual_time.tv_usec - last_time.tv_usec > 1000000) {
+                        int nsec = (last_time.tv_usec -
+                                                 actual_time.tv_usec) / 1000000;
+                        last_time.tv_usec += 1000000 * nsec;
+                        last_time.tv_sec -= nsec;
+                }
+                result.tv_sec = actual_time.tv_sec - last_time.tv_sec;
+                result.tv_usec = actual_time.tv_usec - last_time.tv_usec;
+                seconds = (((double)(result.tv_usec)) / 1e6) + 
+                                                      ((double)(result.tv_sec));
+
+                g_debug("XDXF->%s() function \'%s()\' was working for: %g [s] or %ld [us].\n",
+                        __FUNCTION__,
+                        message,seconds,
+                        ((long)(result.tv_sec*1e6)+(result.tv_usec)));
+               // stack is empty so we delete everything
+               if(stack->len == 0) 
+               {
+                        g_array_free(stack, TRUE);
+                        first_run = TRUE;
+               }
+               return seconds;
+        }
+        return -2.0;
+}
+
+
+/**  this function handles signals from dbus; it is called 
+when there are any messages from other modules
  *
  * @param error - error message recived from DBUS
  * @param words - array with recived data structure
@@ -87,94 +97,129 @@ static double timer(gboolean start, gchar* message)
  */
 void ws_gui_signal_hander (GError *error, GArray *words, gpointer user_data)
 {
-       WSGuiApp* ws_gui_app=(WSGuiApp*)user_data;
-       osso_rpc_t osss_data;
-       osss_data = g_array_index (words, osso_rpc_t, 0);
-       switch(osss_data.value.i)
-       {
-               case WS_DBUS_ERROR_ENGINE_NOT_FOUND:
-               {
-               ws_gui_app->ws_message_dialog = gtk_message_dialog_new (GTK_WINDOW(ws_gui_app->ws_gui_hildon_window),
-                                  GTK_DIALOG_DESTROY_WITH_PARENT,
-                                  GTK_MESSAGE_ERROR,
-                                  GTK_BUTTONS_OK,
-                                  "An error occured");
-               gtk_widget_show_all(ws_gui_app->ws_message_dialog);
-
-               g_signal_connect_swapped (GTK_OBJECT (ws_gui_app->ws_message_dialog), "response", G_CALLBACK (gtk_main_quit), ws_gui_app);
-               break;
-               }
-
-               case WS_DBUS_ERROR_FILE_NOT_FOUND:
-               {
-               ws_gui_app->ws_message_dialog = gtk_message_dialog_new (GTK_WINDOW(ws_gui_app->ws_gui_hildon_window),
-                                  GTK_DIALOG_DESTROY_WITH_PARENT,
-                                  GTK_MESSAGE_ERROR,
-                                  GTK_BUTTONS_OK,
-                                  "There is no dictionary file available");
-               
-               gtk_widget_show_all(ws_gui_app->ws_message_dialog);
-
-               GArray *tmp;
-               tmp = g_array_new(TRUE, TRUE, sizeof(gchar*));
-               gtk_list_store_clear(ws_gui_app->ws_gui_w_list->ws_gui_store);
-               ws_gui_app->ws_gui_w_list->ws_gui_model = create_and_fill_model(tmp, ws_gui_app);
-               ws_gui_fill_html(" ", ws_gui_app);
-               
-               gtk_widget_set_sensitive (GTK_WIDGET(ws_gui_app->ws_gui_hildon_find_toolbar), FALSE);
-               gtk_widget_set_sensitive (GTK_WIDGET(ws_gui_app->ws_gui_menu->ws_gui_menu_search), FALSE);
-
-               if (gtk_dialog_run (GTK_DIALOG (ws_gui_app->ws_message_dialog)) == GTK_RESPONSE_OK)
-               {
-                       gtk_widget_destroy(ws_gui_app->ws_message_dialog);
-               }
-               
-               break;
-               }       
-
-               case WS_DBUS_INFO_CACHING:
-               {
-               ws_gui_app->ws_gui_banner_caching = hildon_banner_show_progress(GTK_WIDGET(ws_gui_app->ws_gui_hildon_window), NULL, "caching ..." );
-               ws_gui_app->caching_flag = TRUE;
-               hildon_banner_set_fraction(HILDON_BANNER(ws_gui_app->ws_gui_banner_caching), 0.0);
-               gtk_widget_set_sensitive (GTK_WIDGET(ws_gui_app->ws_gui_hildon_find_toolbar), FALSE);
-               gtk_widget_set_sensitive (GTK_WIDGET(ws_gui_app->ws_gui_menu->ws_gui_menu_search), FALSE);
-               break;
-               }
-               
-               case WS_DBUS_INFO_CACHING_FINISHED:
-               {
-               gtk_widget_destroy(GTK_WIDGET(ws_gui_app->ws_gui_banner_caching));
-               ws_gui_app->caching_flag = FALSE;
-               gtk_widget_set_sensitive (GTK_WIDGET(ws_gui_app->ws_gui_hildon_find_toolbar), TRUE);
-               gtk_widget_set_sensitive (GTK_WIDGET(ws_gui_app->ws_gui_menu->ws_gui_menu_search), TRUE);
-               break;
-               }
-               
-               case WS_DBUS_ERROR_DICTIONARY_NOT_LOAD:
-               {
-                       if (ws_gui_app->ws_gui_history_cur_pos >= 0 && ws_gui_app->ws_gui_history_cur_pos <=HISTORY_LEN)
-                       {
-                               g_array_remove_index(ws_gui_app->ws_gui_history, ws_gui_app->ws_gui_history_cur_pos);
-                       }
-                       
-                       ws_gui_app->ws_message_dialog = gtk_message_dialog_new (GTK_WINDOW(ws_gui_app->ws_gui_hildon_window),
-                                  GTK_DIALOG_DESTROY_WITH_PARENT,
-                                  GTK_MESSAGE_ERROR,
-                                  GTK_BUTTONS_OK,
+        WSGuiApp* ws_gui_app=(WSGuiApp*)user_data;
+        osso_rpc_t osss_data;
+        osss_data = g_array_index (words, osso_rpc_t, 0);
+        switch(osss_data.value.i)
+        {
+                case WS_DBUS_ERROR_ENGINE_NOT_FOUND:
+                {
+                        ws_gui_app->ws_message_dialog = 
+                        gtk_message_dialog_new(
+                                   GTK_WINDOW(ws_gui_app->ws_gui_hildon_window),
+                                   GTK_DIALOG_DESTROY_WITH_PARENT,
+                                   GTK_MESSAGE_ERROR,
+                                   GTK_BUTTONS_OK,
+                                   "An error occured");
+                        gtk_widget_show_all(ws_gui_app->ws_message_dialog);
+
+                        g_signal_connect_swapped(
+                                     GTK_OBJECT (ws_gui_app->ws_message_dialog),
+                                     "response",
+                                     G_CALLBACK (gtk_main_quit),
+                                     ws_gui_app);
+                        break;
+                }
+
+                case WS_DBUS_ERROR_FILE_NOT_FOUND:
+                {
+                        ws_gui_app->ws_message_dialog = 
+                                gtk_message_dialog_new(
+                                   GTK_WINDOW(ws_gui_app->ws_gui_hildon_window),
+                                   GTK_DIALOG_DESTROY_WITH_PARENT,
+                                   GTK_MESSAGE_ERROR,
+                                   GTK_BUTTONS_OK,
+                                   "There is no dictionary file available");
+                                            
+                        gtk_widget_show_all(ws_gui_app->ws_message_dialog);
+
+                        GArray *tmp;
+                        tmp = g_array_new(TRUE, TRUE, sizeof(gchar*));
+                        gtk_list_store_clear(
+                                       ws_gui_app->ws_gui_w_list->ws_gui_store);
+                        ws_gui_app->ws_gui_w_list->ws_gui_model = 
+                                create_and_fill_model(tmp, ws_gui_app);
+                        ws_gui_fill_html(" ", ws_gui_app);
+                                             
+                        gtk_widget_set_sensitive(
+                             GTK_WIDGET(ws_gui_app->ws_gui_hildon_find_toolbar),
+                             FALSE);
+                        gtk_widget_set_sensitive(
+                        GTK_WIDGET(ws_gui_app->ws_gui_menu->ws_gui_menu_search),
+                        FALSE);
+
+                        if (gtk_dialog_run(
+                                GTK_DIALOG(ws_gui_app->ws_message_dialog)) == GTK_RESPONSE_OK)
+                        {
+                                gtk_widget_destroy(
+                                                 ws_gui_app->ws_message_dialog);
+                        }
+                        break;
+                }                      
+
+                case WS_DBUS_INFO_CACHING:
+                {
+                        ws_gui_app->ws_gui_banner_caching =
+                                hildon_banner_show_progress(
+                                   GTK_WIDGET(ws_gui_app->ws_gui_hildon_window),
+                                   NULL,
+                                   "caching ..." );
+                       ws_gui_app->caching_flag = TRUE;
+                       hildon_banner_set_fraction(
+                               HILDON_BANNER(ws_gui_app->ws_gui_banner_caching),
+                               0.0);
+                       gtk_widget_set_sensitive(
+                             GTK_WIDGET(ws_gui_app->ws_gui_hildon_find_toolbar),
+                             FALSE);
+                       gtk_widget_set_sensitive(
+                        GTK_WIDGET(ws_gui_app->ws_gui_menu->ws_gui_menu_search),
+                        FALSE);
+                       
+                       break;
+                }
+                
+                case WS_DBUS_INFO_CACHING_FINISHED:
+                {
+                        gtk_widget_destroy(
+                                 GTK_WIDGET(ws_gui_app->ws_gui_banner_caching));
+                        ws_gui_app->caching_flag = FALSE;
+                        gtk_widget_set_sensitive(
+                             GTK_WIDGET(ws_gui_app->ws_gui_hildon_find_toolbar),
+                             TRUE);
+                        gtk_widget_set_sensitive(
+                       GTK_WIDGET(ws_gui_app->ws_gui_menu->ws_gui_menu_search),
+                       TRUE);
+                                            
+                        break;
+                }
+                                            
+                case WS_DBUS_ERROR_DICTIONARY_NOT_LOAD:
+                {
+                        if (ws_gui_app->ws_gui_history_cur_pos >= 0 &&
+                               ws_gui_app->ws_gui_history_cur_pos <=HISTORY_LEN)
+                        { 
+                                g_array_remove_index(ws_gui_app->ws_gui_history,
+                                            ws_gui_app->ws_gui_history_cur_pos);
+                        }
+                                                                  
+                        ws_gui_app->ws_message_dialog = gtk_message_dialog_new(
+                                   GTK_WINDOW(ws_gui_app->ws_gui_hildon_window),
+                                   GTK_DIALOG_DESTROY_WITH_PARENT,
+                                   GTK_MESSAGE_ERROR,
+                                   GTK_BUTTONS_OK,
                                   "Dictionary unavailable");
-                       gtk_widget_show_all(ws_gui_app->ws_message_dialog);
-
-                       if (gtk_dialog_run (GTK_DIALOG (ws_gui_app->ws_message_dialog)) == GTK_RESPONSE_OK)
-                       {
-                               gtk_widget_destroy(ws_gui_app->ws_message_dialog);
-                       }
-               break;  
-               }
-       }
+                       gtk_widget_show_all(ws_gui_app->ws_message_dialog);
+                       if (gtk_dialog_run(
+                       GTK_DIALOG(ws_gui_app->ws_message_dialog)) == GTK_RESPONSE_OK)
+                       {
+                               gtk_widget_destroy(ws_gui_app->ws_message_dialog);
+                       }
+                       break;                      
+                }
+        }
 }
-
-/**  this function handles signals from dbus; it is called when progress bar status has been changed
+/**  this function handles signals from dbus; it is called when progress bar
+ status has been changed
  *
  * @param error - error message recived from DBUS
  * @param words - array with recived data structure
@@ -183,17 +228,20 @@ void ws_gui_signal_hander (GError *error, GArray *words, gpointer user_data)
  */
 void ws_dbus_progress_bar(GError *error, GArray *words, gpointer user_data)
 {
-       WSGuiApp* ws_gui_app=(WSGuiApp*)user_data;
-       osso_rpc_t osss_data;
-       osss_data = g_array_index (words, osso_rpc_t, 0);
-       double progress = osss_data.value.d;
-       if (ws_gui_app->caching_flag == TRUE)
-       {
-       hildon_banner_set_fraction(HILDON_BANNER(ws_gui_app->ws_gui_banner_caching), progress); 
-       }
+        WSGuiApp* ws_gui_app=(WSGuiApp*)user_data;
+        osso_rpc_t osss_data;
+        osss_data = g_array_index (words, osso_rpc_t, 0);
+        double progress = osss_data.value.d;
+        if (ws_gui_app->caching_flag == TRUE)
+        {
+                hildon_banner_set_fraction(
+                               HILDON_BANNER(ws_gui_app->ws_gui_banner_caching),
+                               progress);                      
+        }
 }
 
-/** this function handles signal from dbus and transfer recived (found in a dictionary) words to the words list
+/** this function handles signal from dbus and transfer recived 
+(found in a dictionary) words to the words list
  *
  * @param error - error message recived from DBUS
  * @param words - array with recived data structure
@@ -202,60 +250,66 @@ void ws_dbus_progress_bar(GError *error, GArray *words, gpointer user_data)
  */
 void ws_gui_dbus_return_words (GError *error, GArray *words, gpointer user_data)
 {
-       timer(TIMER_START, (gchar*)__FUNCTION__);
-       guint i;
-       osso_rpc_t data;
-       //char *data;
-
-       WSGuiApp* ws_gui_app=(WSGuiApp*)user_data;
-       
-       GArray *tmp;
-       tmp = g_array_new(TRUE, TRUE, sizeof(gchar*));
-       gchar *tmp_word;
-
-       for (i=0;i<words->len;++i)
-       {
-               data = g_array_index (words, osso_rpc_t, i);
-               tmp_word = g_strconcat(data.value.s,NULL);
-               g_array_append_val(tmp, tmp_word);
-               
-       }
-       
-       gtk_widget_destroy(GTK_WIDGET(ws_gui_app->ws_gui_banner));
-       ws_gui_app->ws_gui_banner_flag = FALSE;
-       gtk_widget_set_sensitive(GTK_WIDGET(ws_gui_app->ws_gui_toobar_button_stop), FALSE);
-       gtk_widget_set_sensitive(GTK_WIDGET(ws_gui_app->ws_gui_menu->ws_gui_menu_stop), FALSE);
-       gtk_list_store_clear(ws_gui_app->ws_gui_w_list->ws_gui_store);
-
-       ws_gui_app->ws_gui_w_list->ws_gui_model = create_and_fill_model(tmp, ws_gui_app);
-       //gtk_html_set_editable(GTK_HTML(ws_gui_app->ws_gui_html), TRUE);
-       
-       if (tmp->len == 0)
-       {
-               gtk_infoprint(GTK_WINDOW(ws_gui_app->ws_gui_hildon_window), "No words found" );
-       }
-       timer(TIMER_STOP, (gchar*)__FUNCTION__);
-}
-
-/** this function handles signal from dbus and send recived data to the translation area
+        timer(TIMER_START, (gchar*)__FUNCTION__);
+        guint i;
+        osso_rpc_t data;
+        
+        WSGuiApp* ws_gui_app=(WSGuiApp*)user_data;
+                     
+        GArray *tmp;
+        tmp = g_array_new(TRUE, TRUE, sizeof(gchar*));
+        gchar *tmp_word;
+
+        for (i=0;i<words->len;++i)
+        {
+                data = g_array_index (words, osso_rpc_t, i);
+                tmp_word = g_strconcat(data.value.s,NULL);
+                g_array_append_val(tmp, tmp_word);
+        }
+                      
+        gtk_widget_destroy(GTK_WIDGET(ws_gui_app->ws_gui_banner));
+        ws_gui_app->ws_gui_banner_flag = FALSE;
+        gtk_widget_set_sensitive(
+                              GTK_WIDGET(ws_gui_app->ws_gui_toobar_button_stop),
+                              FALSE);
+        gtk_widget_set_sensitive(
+                          GTK_WIDGET(ws_gui_app->ws_gui_menu->ws_gui_menu_stop),
+                          FALSE);
+        gtk_list_store_clear(ws_gui_app->ws_gui_w_list->ws_gui_store);
+
+        ws_gui_app->ws_gui_w_list->ws_gui_model = 
+                                         create_and_fill_model(tmp, ws_gui_app);
+        
+        if (tmp->len == 0)
+        {
+                gtk_infoprint(GTK_WINDOW(ws_gui_app->ws_gui_hildon_window),
+                              "No words found" );
+        }
+        timer(TIMER_STOP, (gchar*)__FUNCTION__);
+}
+
+/** this function handles signal from dbus and send recived data to 
+the translation area
  *
  * @param error - error message recived from DBUS
  * @param words - array with recived data structure
  * @param user_data - pointer to data structure
  * @return
  */
-void ws_gui_dbus_return_translation (GError *error, GArray *words, gpointer user_data)
+void ws_gui_dbus_return_translation (GError *error,
+                                     GArray *words,
+                                     gpointer user_data)
 {
-       timer(TIMER_START, (gchar*)__FUNCTION__);       
-       WSGuiApp* ws_gui_app=(WSGuiApp*)user_data;
-       
-       osso_rpc_t data;
-       
-               data = g_array_index (words, osso_rpc_t, 0);
-               gtk_html_zoom_reset(GTK_HTML(ws_gui_app->ws_gui_html));
-               ws_gui_fill_html(format_html(data.value.s), ws_gui_app);
-       
-       timer(TIMER_STOP, (gchar*)__FUNCTION__);
+        timer(TIMER_START, (gchar*)__FUNCTION__);                      
+        WSGuiApp* ws_gui_app=(WSGuiApp*)user_data;
+                      
+        osso_rpc_t data;
+                      
+        data = g_array_index (words, osso_rpc_t, 0);
+        gtk_html_zoom_reset(GTK_HTML(ws_gui_app->ws_gui_html));
+        ws_gui_fill_html(format_html(data.value.s), ws_gui_app);
+                      
+        timer(TIMER_STOP, (gchar*)__FUNCTION__);
 }
 
 /**
@@ -265,12 +319,12 @@ void ws_gui_dbus_return_translation (GError *error, GArray *words, gpointer user
 */
 void ws_gui_free_memory(gpointer user_data)
 {
-       WSGuiApp* ws_gui_app=(WSGuiApp*)user_data;
-       g_array_free(ws_gui_app->ws_gui_history, TRUE);
-       pango_font_description_free(ws_gui_app->p);
-       g_free(ws_gui_app->ws_gui_w_list);
-       g_free(ws_gui_app->ws_gui_menu);
-       g_free(ws_gui_app);
+        WSGuiApp* ws_gui_app=(WSGuiApp*)user_data;
+        g_array_free(ws_gui_app->ws_gui_history, TRUE);
+        pango_font_description_free(ws_gui_app->p);
+        g_free(ws_gui_app->ws_gui_w_list);
+        g_free(ws_gui_app->ws_gui_menu);
+        g_free(ws_gui_app);
 }
 
 /** this function handle press signals (keyboard)
@@ -278,87 +332,120 @@ void ws_gui_free_memory(gpointer user_data)
  * @param widget
  * @param keyevent
  * @param user_data - ponter to data structure
- * @return TRUE to stop other handlers from being invoked for the event. FALSE to propagate the event further.
- */
-gboolean hildon_key_press_listener (GtkWidget * widget, GdkEventKey * keyevent, gpointer user_data)
-{
-WSGuiApp* ws_gui_app=(WSGuiApp*)user_data;
-//g_printf("\nKey code: Enter=%d, passede=%d", GDK_Return,(keyevent->keyval));
-switch ((guint)(keyevent->keyval)) {
-       case GDK_Up: //up
-       {
-       gtk_container_set_focus_vadjustment(GTK_CONTAINER(ws_gui_app->ws_gui_scrolledwindow_left), gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(ws_gui_app->ws_gui_scrolledwindow_left)));
-       ws_gui_app->v_new_value = gtk_adjustment_get_value(GTK_ADJUSTMENT(ws_gui_app->ws_gui_vadj)) - ws_gui_app->v_delta;
-       if (ws_gui_app->v_new_value > ws_gui_app->ws_gui_vadj->lower) 
-       {
-       gtk_adjustment_set_value(GTK_ADJUSTMENT(ws_gui_app->ws_gui_vadj), ws_gui_app->v_new_value);
-       }
-       break;
-       }
-       
-       case GDK_Down: //down
-       {
-       gtk_container_set_focus_vadjustment(GTK_CONTAINER(ws_gui_app->ws_gui_scrolledwindow_left), gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(ws_gui_app->ws_gui_scrolledwindow_left)));
-       ws_gui_app->v_new_value = gtk_adjustment_get_value(GTK_ADJUSTMENT(ws_gui_app->ws_gui_vadj)) + ws_gui_app->v_delta;
-       if (ws_gui_app->v_new_value < (ws_gui_app->ws_gui_vadj->upper - ws_gui_app->ws_gui_vadj->page_size)) 
-       {
-       gtk_adjustment_set_value(GTK_ADJUSTMENT(ws_gui_app->ws_gui_vadj), ws_gui_app->v_new_value);
-       }
-       break;
-       }
-       
-       case GDK_Left: //left
-       {
-       gtk_container_set_focus_hadjustment(GTK_CONTAINER(ws_gui_app->ws_gui_scrolledwindow_left), gtk_scrolled_window_get_hadjustment(GTK_SCROLLED_WINDOW(ws_gui_app->ws_gui_scrolledwindow_left)));
-       ws_gui_app->h_new_value = gtk_adjustment_get_value(GTK_ADJUSTMENT(ws_gui_app->ws_gui_hadj)) - ws_gui_app->h_delta;
-       if (ws_gui_app->h_new_value > ws_gui_app->ws_gui_hadj->lower) 
-       {
-       gtk_adjustment_set_value(GTK_ADJUSTMENT(ws_gui_app->ws_gui_hadj), ws_gui_app->h_new_value);
-       }
-       }
-       break;
-       
-       case GDK_Right: //right
-       {
-       gtk_container_set_focus_hadjustment(GTK_CONTAINER(ws_gui_app->ws_gui_scrolledwindow_left), gtk_scrolled_window_get_hadjustment(GTK_SCROLLED_WINDOW(ws_gui_app->ws_gui_scrolledwindow_left)));
-       ws_gui_app->h_new_value = gtk_adjustment_get_value(GTK_ADJUSTMENT(ws_gui_app->ws_gui_hadj)) + ws_gui_app->h_delta;
-       if (ws_gui_app->h_new_value < (ws_gui_app->ws_gui_hadj->upper - ws_gui_app->ws_gui_hadj->page_size)) 
-       {
-       gtk_adjustment_set_value(GTK_ADJUSTMENT(ws_gui_app->ws_gui_hadj), ws_gui_app->h_new_value);
-       }
-       }
-       break;
-       
-       case GDK_Return: /*start search*/
-       //g_log(G_LOG_DOMAIN, G_LOG_LEVEL_INFO, ".::GUI::. Return");
-       ws_gui_search(NULL, ws_gui_app);
-       break;
-       
-       case GDK_F6: //FULL SCREEN
-       ws_gui_full_screen(NULL, ws_gui_app);
-       break;
-       
-       case GDK_F7: //zoom in, f7
-       ws_gui_html_zoom_in(NULL, ws_gui_app);
-       break;
-       
-       case GDK_F8://zoom out, f8
-       ws_gui_html_zoom_out(NULL, ws_gui_app);
-       break;
-       
-       case GDK_Escape: //escape
-       ws_gui_search_stop(NULL, ws_gui_app);
-       break;
-
-       case GDK_BackSpace: //backspace
-       return FALSE;
-       break;
-
-       default:
-       return FALSE;
-       break;
-    }
-       return TRUE;
+ * @return TRUE to stop other handlers from being invoked for the event. 
+ FALSE to propagate the event further.
+ */
+gboolean hildon_key_press_listener (GtkWidget * widget,
+                                    GdkEventKey * keyevent,
+                                    gpointer user_data)
+{
+        WSGuiApp* ws_gui_app=(WSGuiApp*)user_data;
+        
+        switch ((guint)(keyevent->keyval)) {
+                case HILDON_HARDKEY_UP: 
+                {
+                        gtk_container_set_focus_vadjustment(
+                          GTK_CONTAINER(ws_gui_app->ws_gui_scrolledwindow_left),
+                          gtk_scrolled_window_get_vadjustment(
+                          GTK_SCROLLED_WINDOW(
+                                      ws_gui_app->ws_gui_scrolledwindow_left)));
+                      ws_gui_app->v_new_value =
+                         gtk_adjustment_get_value(
+                           GTK_ADJUSTMENT(
+                                ws_gui_app->ws_gui_vadj)) - ws_gui_app->v_delta;
+                      if (ws_gui_app->v_new_value > ws_gui_app->ws_gui_vadj->lower) 
+                      {
+                              gtk_adjustment_set_value(
+                                        GTK_ADJUSTMENT(ws_gui_app->ws_gui_vadj),
+                                        ws_gui_app->v_new_value);
+                      }
+                      break;
+                }
+                      
+                case HILDON_HARDKEY_DOWN: 
+                {
+                      gtk_container_set_focus_vadjustment(
+                          GTK_CONTAINER(ws_gui_app->ws_gui_scrolledwindow_left),
+                          gtk_scrolled_window_get_vadjustment(
+                          GTK_SCROLLED_WINDOW(
+                                      ws_gui_app->ws_gui_scrolledwindow_left)));
+                      ws_gui_app->v_new_value = gtk_adjustment_get_value(
+                                        GTK_ADJUSTMENT(ws_gui_app->ws_gui_vadj))
+                                        + ws_gui_app->v_delta;
+
+                      if (ws_gui_app->v_new_value < 
+                                     (ws_gui_app->ws_gui_vadj->upper - 
+                                            ws_gui_app->ws_gui_vadj->page_size)) 
+                      {
+                                gtk_adjustment_set_value(
+                                        GTK_ADJUSTMENT(ws_gui_app->ws_gui_vadj),
+                                        ws_gui_app->v_new_value);
+                      }
+                      break;
+                }
+                      
+                case HILDON_HARDKEY_LEFT:
+                {
+                      gtk_container_set_focus_hadjustment(
+                       GTK_CONTAINER(ws_gui_app->ws_gui_scrolledwindow_left),
+                       gtk_scrolled_window_get_hadjustment(
+                       GTK_SCROLLED_WINDOW(ws_gui_app->ws_gui_scrolledwindow_left)));
+                      ws_gui_app->h_new_value = gtk_adjustment_get_value(
+                       GTK_ADJUSTMENT(ws_gui_app->ws_gui_hadj)) - ws_gui_app->h_delta;
+                      
+                      if (ws_gui_app->h_new_value > ws_gui_app->ws_gui_hadj->lower) 
+                      {
+                                gtk_adjustment_set_value(
+                                        GTK_ADJUSTMENT(ws_gui_app->ws_gui_hadj),
+                                        ws_gui_app->h_new_value);
+                      }
+                }
+                break;
+                      
+                case HILDON_HARDKEY_RIGHT: 
+                {
+                      gtk_container_set_focus_hadjustment(
+                       GTK_CONTAINER(ws_gui_app->ws_gui_scrolledwindow_left),
+                       gtk_scrolled_window_get_hadjustment(
+                       GTK_SCROLLED_WINDOW(ws_gui_app->ws_gui_scrolledwindow_left)));
+                      ws_gui_app->h_new_value = gtk_adjustment_get_value(
+                       GTK_ADJUSTMENT(ws_gui_app->ws_gui_hadj)) + ws_gui_app->h_delta;
+                      if (ws_gui_app->h_new_value < 
+                                (ws_gui_app->ws_gui_hadj->upper - 
+                                        ws_gui_app->ws_gui_hadj->page_size)) 
+                      {
+                      gtk_adjustment_set_value(
+                                        GTK_ADJUSTMENT(ws_gui_app->ws_gui_hadj),
+                                        ws_gui_app->h_new_value);
+                      }
+                 }
+                 break;
+                      
+                 case HILDON_HARDKEY_SELECT: 
+                        ws_gui_search(NULL, ws_gui_app);
+                 break;
+                      
+                 case HILDON_HARDKEY_FULLSCREEN: 
+                      ws_gui_full_screen(NULL, ws_gui_app);
+                 break;
+                      
+                 case HILDON_HARDKEY_INCREASE: 
+                      ws_gui_html_zoom_in(NULL, ws_gui_app);
+                 break;
+                      
+                 case HILDON_HARDKEY_DECREASE:
+                      ws_gui_html_zoom_out(NULL, ws_gui_app);
+                 break;
+                      
+                 case HILDON_HARDKEY_ESC: 
+                      ws_gui_search_stop(NULL, ws_gui_app);
+                 break;
+
+                 default:
+                      return FALSE;
+                 break;
+        }
+        return TRUE;
 }
 
 /** this function allow to hide words list using menu item from application menu
@@ -367,24 +454,35 @@ switch ((guint)(keyevent->keyval)) {
  * @param user_data - user data set when the signal handler was connected
  * @return
  */
-void ws_gui_words_list_hide_from_menu(GtkCheckMenuItem *checkmenuitem, gpointer user_data)
+void ws_gui_words_list_hide_from_menu(GtkCheckMenuItem *checkmenuitem,
+                                      gpointer user_data)
 {
-       WSGuiApp* ws_gui_app = (WSGuiApp *)user_data;
-       if (gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(ws_gui_app->ws_gui_menu->ws_gui_menu_hide_list)))
-       {
-               gtk_widget_hide(ws_gui_app->ws_gui_scrolledwindow_left);
-               gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(ws_gui_app->ws_gui_toobar_button_hide), TRUE);
-               gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(ws_gui_app->ws_gui_menu->ws_gui_menu_hide_list), TRUE);
-       }
-       else 
-       {
-               gtk_widget_show(ws_gui_app->ws_gui_scrolledwindow_left);
-               gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(ws_gui_app->ws_gui_toobar_button_hide), FALSE);
-               gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(ws_gui_app->ws_gui_menu->ws_gui_menu_hide_list), FALSE);
-       }
+        WSGuiApp* ws_gui_app = (WSGuiApp *)user_data;
+        if (gtk_check_menu_item_get_active(
+           GTK_CHECK_MENU_ITEM(ws_gui_app->ws_gui_menu->ws_gui_menu_hide_list)))
+        {
+                gtk_widget_hide(ws_gui_app->ws_gui_scrolledwindow_left);
+                gtk_toggle_tool_button_set_active(
+                  GTK_TOGGLE_TOOL_BUTTON(ws_gui_app->ws_gui_toobar_button_hide),
+                  TRUE);
+                gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(
+                                ws_gui_app->ws_gui_menu->ws_gui_menu_hide_list),
+                                TRUE);
+        }
+        else 
+        {
+                gtk_widget_show(ws_gui_app->ws_gui_scrolledwindow_left);
+                gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(
+                                         ws_gui_app->ws_gui_toobar_button_hide),
+                                         FALSE);
+                gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(
+                                ws_gui_app->ws_gui_menu->ws_gui_menu_hide_list),
+                                FALSE);
+        }
 }
 
-/** this function allow to hide words list using toggle button placed in the find toolbar
+/** this function allow to hide words list using toggle button placed in 
+the find toolbar
  *
  * @param toolbar - the object which received the signal
  * @param user_data - user data set when the signal handler was connected
@@ -392,19 +490,29 @@ void ws_gui_words_list_hide_from_menu(GtkCheckMenuItem *checkmenuitem, gpointer
  */
 void ws_gui_words_list_hide(GtkToggleButton *togglebutton, gpointer user_data)
 {
-       WSGuiApp* ws_gui_app = (WSGuiApp *)user_data;
-       if (gtk_toggle_tool_button_get_active(GTK_TOGGLE_TOOL_BUTTON(ws_gui_app->ws_gui_toobar_button_hide)))
-       {
-               gtk_widget_hide(ws_gui_app->ws_gui_scrolledwindow_left);
-               gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(ws_gui_app->ws_gui_toobar_button_hide), TRUE);
-               gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(ws_gui_app->ws_gui_menu->ws_gui_menu_hide_list), TRUE);
-       }
-       else 
-       {
-               gtk_widget_show(ws_gui_app->ws_gui_scrolledwindow_left);
-               gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(ws_gui_app->ws_gui_toobar_button_hide), FALSE);
-               gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(ws_gui_app->ws_gui_menu->ws_gui_menu_hide_list), FALSE);
-       }
+        WSGuiApp* ws_gui_app = (WSGuiApp *)user_data;
+        
+        if (gtk_toggle_tool_button_get_active(
+                 GTK_TOGGLE_TOOL_BUTTON(ws_gui_app->ws_gui_toobar_button_hide)))
+        {
+                gtk_widget_hide(ws_gui_app->ws_gui_scrolledwindow_left);
+                gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(
+                                         ws_gui_app->ws_gui_toobar_button_hide),
+                                         TRUE);
+                gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(
+                                ws_gui_app->ws_gui_menu->ws_gui_menu_hide_list),
+                                TRUE);
+        }
+        else 
+        {
+                gtk_widget_show(ws_gui_app->ws_gui_scrolledwindow_left);
+                gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(
+                                         ws_gui_app->ws_gui_toobar_button_hide),
+                                         FALSE);
+                gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(
+                                ws_gui_app->ws_gui_menu->ws_gui_menu_hide_list),
+                                FALSE);
+        }
 }
 
 /** add word to the history
@@ -415,37 +523,38 @@ void ws_gui_words_list_hide(GtkToggleButton *togglebutton, gpointer user_data)
  */
 void ws_gui_history_add(char *new_word, gpointer user_data)
 {
-       guint i;
-       WSGuiApp* ws_gui_app = (WSGuiApp *)user_data;
-       gchar *tmp_word;
-       
-       i = ws_gui_app->ws_gui_history_cur_pos + 1;
-       gchar *tmp = g_array_index(ws_gui_app->ws_gui_history, gchar*, i);
-       
-       while (tmp != NULL) 
-       {
-               g_array_remove_index(ws_gui_app->ws_gui_history, i);
-               tmp = g_array_index(ws_gui_app->ws_gui_history, gchar*, i);
-       }
-
-       i = 0;
-       ws_gui_app->ws_gui_history_cur_pos ++;
-       
-       tmp_word = g_strdup(new_word);
-       g_array_append_val(ws_gui_app->ws_gui_history, tmp_word);
-       if(ws_gui_app->ws_gui_history->len > HISTORY_LEN)
-       {
-               g_array_remove_index(ws_gui_app->ws_gui_history, 0);
-               ws_gui_app->ws_gui_history_cur_pos--;
-       }
-       
-       i = 0;
-       tmp = g_array_index(ws_gui_app->ws_gui_history, gchar*, i);
-
-       ws_gui_check_history(ws_gui_app);       
-}
-
-/** display previously choosen word (previous from the history array) if avaible, sets current position in the history array
+        guint i;
+        WSGuiApp* ws_gui_app = (WSGuiApp *)user_data;
+        gchar *tmp_word;
+                      
+        i = ws_gui_app->ws_gui_history_cur_pos + 1;
+        gchar *tmp = g_array_index(ws_gui_app->ws_gui_history, gchar*, i);
+              
+        while (tmp != NULL) 
+        {
+                g_array_remove_index(ws_gui_app->ws_gui_history, i);
+                tmp = g_array_index(ws_gui_app->ws_gui_history, gchar*, i);
+        }
+
+        i = 0;
+        ws_gui_app->ws_gui_history_cur_pos ++;
+                      
+        tmp_word = g_strdup(new_word);
+        g_array_append_val(ws_gui_app->ws_gui_history, tmp_word);
+        if(ws_gui_app->ws_gui_history->len > HISTORY_LEN)
+        {
+                g_array_remove_index(ws_gui_app->ws_gui_history, 0);
+                ws_gui_app->ws_gui_history_cur_pos--;
+        }
+                      
+        i = 0;
+        tmp = g_array_index(ws_gui_app->ws_gui_history, gchar*, i);
+
+        ws_gui_check_history(ws_gui_app);                      
+}
+
+/** display previously choosen word (previous from the history array)
+     if avaible, sets current position in the history array
  *
  * @param button - button which recived a signal
  * @param user_data - user data set when the signal handler was connected
@@ -453,25 +562,35 @@ void ws_gui_history_add(char *new_word, gpointer user_data)
  */
 void ws_gui_history_back(GtkButton *button, gpointer user_data) 
 {
-       WSGuiApp* ws_gui_app = (WSGuiApp *)user_data;
-       
-       if (ws_gui_app->ws_gui_history_cur_pos > 0) {
-                       ws_gui_app->ws_gui_history_cur_pos = ws_gui_app->ws_gui_history_cur_pos - 1;
-                       //ws_dbus_client_find_translation(ws_gui_app->dbus_data, (g_array_index(ws_gui_app->ws_gui_history, gchar*, ws_gui_app->ws_gui_history_cur_pos)));
-                       ws_dbus_client_search_in_history(ws_gui_app->dbus_data, (g_array_index(ws_gui_app->ws_gui_history, gchar*, ws_gui_app->ws_gui_history_cur_pos)));
-       }
-       else 
-       {
-       gtk_infoprint(GTK_WINDOW(ws_gui_app->ws_gui_hildon_window), "no words in the history" );
-       gtk_widget_set_sensitive (GTK_WIDGET(ws_gui_app->ws_gui_toobar_button_back), FALSE);
-       gtk_widget_set_sensitive (GTK_WIDGET(ws_gui_app->ws_gui_menu->ws_gui_menu_find_prev), FALSE);
-       }
-
-       ws_gui_check_history(ws_gui_app);
-       
+        WSGuiApp* ws_gui_app = (WSGuiApp *)user_data;
+                      
+        if (ws_gui_app->ws_gui_history_cur_pos > 0) {
+                ws_gui_app->ws_gui_history_cur_pos = 
+                        ws_gui_app->ws_gui_history_cur_pos - 1;
+                ws_dbus_client_search_in_history(
+                        ws_gui_app->dbus_data,
+                        (g_array_index(ws_gui_app->ws_gui_history,
+                                      gchar*, 
+                                      ws_gui_app->ws_gui_history_cur_pos)));
+        }
+        else 
+        {
+                gtk_infoprint(GTK_WINDOW(ws_gui_app->ws_gui_hildon_window),
+                              "no words in the history" );
+                gtk_widget_set_sensitive (
+                              GTK_WIDGET(ws_gui_app->ws_gui_toobar_button_back),
+                              FALSE);
+                gtk_widget_set_sensitive(
+                     GTK_WIDGET(ws_gui_app->ws_gui_menu->ws_gui_menu_find_prev),
+                     FALSE);
+        }
+
+        ws_gui_check_history(ws_gui_app);
+                      
 }
 
-/** display choosen word, next in the history array (if avaible), sets current position in the history array
+/** display choosen word, next in the history array (if avaible), 
+sets current position in the history array
  *
  * @param button - button which recived a signal
  * @param user_data - user data set when the signal handler was connected
@@ -479,60 +598,91 @@ void ws_gui_history_back(GtkButton *button, gpointer user_data)
  */
 void ws_gui_history_next(GtkButton *button, gpointer user_data) 
 {
-       WSGuiApp* ws_gui_app = (WSGuiApp *)user_data;
-       
-       gchar *tmp = g_array_index(ws_gui_app->ws_gui_history, gchar*, ws_gui_app->ws_gui_history_cur_pos+1);
-       
-       if ((ws_gui_app->ws_gui_history_cur_pos < HISTORY_LEN-1) && (tmp != NULL)) 
-       {
-               ws_gui_app->ws_gui_history_cur_pos = ws_gui_app->ws_gui_history_cur_pos + 1;
-               //ws_dbus_client_find_translation(ws_gui_app->dbus_data, (g_array_index(ws_gui_app->ws_gui_history, gchar*, ws_gui_app->ws_gui_history_cur_pos)));
-               ws_dbus_client_search_in_history(ws_gui_app->dbus_data, (g_array_index(ws_gui_app->ws_gui_history, gchar*, ws_gui_app->ws_gui_history_cur_pos)));
-               
-       }
-       else 
-       {
-       gtk_infoprint(GTK_WINDOW(ws_gui_app->ws_gui_hildon_window), "end of history" );
-       gtk_widget_set_sensitive (GTK_WIDGET(ws_gui_app->ws_gui_toobar_button_forward), FALSE);
-       gtk_widget_set_sensitive (GTK_WIDGET(ws_gui_app->ws_gui_menu->ws_gui_menu_find_next), FALSE);
-       }
-
-       ws_gui_check_history(ws_gui_app);
-}
-
-/** check current position in the history array and sets sensitivity of buttons / menu items, depends on availablity of words in the history
+        WSGuiApp* ws_gui_app = (WSGuiApp *)user_data;
+                      
+                gchar *tmp = g_array_index(ws_gui_app->ws_gui_history,
+                                   gchar*,
+                                   ws_gui_app->ws_gui_history_cur_pos+1);
+                      
+        if ((ws_gui_app->ws_gui_history_cur_pos < HISTORY_LEN-1) && (tmp != NULL)) 
+        {
+                ws_gui_app->ws_gui_history_cur_pos =
+                         ws_gui_app->ws_gui_history_cur_pos + 1;
+                ws_dbus_client_search_in_history(ws_gui_app->dbus_data,
+                                (g_array_index(ws_gui_app->ws_gui_history,
+                                          gchar*,
+                                          ws_gui_app->ws_gui_history_cur_pos)));
+                                            
+        }
+        else 
+        {
+                gtk_infoprint(GTK_WINDOW(ws_gui_app->ws_gui_hildon_window),
+                              "end of history" );
+                gtk_widget_set_sensitive(
+                           GTK_WIDGET(ws_gui_app->ws_gui_toobar_button_forward),
+                           FALSE);
+                gtk_widget_set_sensitive(
+                     GTK_WIDGET(ws_gui_app->ws_gui_menu->ws_gui_menu_find_next),
+                     FALSE);
+        }
+
+        ws_gui_check_history(ws_gui_app);
+}
+
+/** check current position in the history array and sets sensitivity of buttons 
+/ menu items, depends on availablity of words in the history
  *
  * @param user_data - user data set when the signal handler was connected
  * @return 
  */
 void ws_gui_check_history(gpointer user_data) 
 {
-       WSGuiApp* ws_gui_app = (WSGuiApp *)user_data;
-       
-       gchar *tmp = g_array_index(ws_gui_app->ws_gui_history, gchar*, ws_gui_app->ws_gui_history_cur_pos+1);
-       
-       if ((ws_gui_app->ws_gui_history_cur_pos+1 < HISTORY_LEN) && (tmp != NULL))
-       {       
-               gtk_widget_set_sensitive (GTK_WIDGET(ws_gui_app->ws_gui_toobar_button_forward), TRUE);
-               gtk_widget_set_sensitive (GTK_WIDGET(ws_gui_app->ws_gui_menu->ws_gui_menu_find_next), TRUE);
-       }
-       else 
-       {
-               gtk_widget_set_sensitive (GTK_WIDGET(ws_gui_app->ws_gui_toobar_button_forward), FALSE);
-               gtk_widget_set_sensitive (GTK_WIDGET(ws_gui_app->ws_gui_menu->ws_gui_menu_find_next), FALSE);
-       }
-       
-       tmp = g_array_index(ws_gui_app->ws_gui_history, gchar*, ws_gui_app->ws_gui_history_cur_pos-1);
-       if ((ws_gui_app->ws_gui_history_cur_pos > 0) && (tmp != NULL))
-       {
-               gtk_widget_set_sensitive (GTK_WIDGET(ws_gui_app->ws_gui_toobar_button_back), TRUE);
-               gtk_widget_set_sensitive (GTK_WIDGET(ws_gui_app->ws_gui_menu->ws_gui_menu_find_prev), TRUE);
-       }
-       else
-       {
-               gtk_widget_set_sensitive (GTK_WIDGET(ws_gui_app->ws_gui_toobar_button_back), FALSE);
-               gtk_widget_set_sensitive (GTK_WIDGET(ws_gui_app->ws_gui_menu->ws_gui_menu_find_prev), FALSE);
-       }
+        WSGuiApp* ws_gui_app = (WSGuiApp *)user_data;
+                     
+        gchar *tmp = g_array_index(ws_gui_app->ws_gui_history,
+                                   gchar*,
+                                   ws_gui_app->ws_gui_history_cur_pos+1);
+                      
+        if ((ws_gui_app->ws_gui_history_cur_pos+1 < HISTORY_LEN) && (tmp != NULL))
+        {                      
+                gtk_widget_set_sensitive(
+                           GTK_WIDGET(ws_gui_app->ws_gui_toobar_button_forward),
+                           TRUE);
+                gtk_widget_set_sensitive(
+                     GTK_WIDGET(ws_gui_app->ws_gui_menu->ws_gui_menu_find_next),
+                     TRUE);
+        }
+        else 
+        {
+                gtk_widget_set_sensitive(
+                           GTK_WIDGET(ws_gui_app->ws_gui_toobar_button_forward),
+                           FALSE);
+                gtk_widget_set_sensitive(
+                     GTK_WIDGET(ws_gui_app->ws_gui_menu->ws_gui_menu_find_next),
+                     FALSE);
+        }
+                      
+        tmp = g_array_index(ws_gui_app->ws_gui_history,
+                            gchar*,
+                            ws_gui_app->ws_gui_history_cur_pos-1);
+        if ((ws_gui_app->ws_gui_history_cur_pos > 0) && (tmp != NULL))
+        {
+                gtk_widget_set_sensitive(
+                              GTK_WIDGET(ws_gui_app->ws_gui_toobar_button_back),
+                              TRUE);
+                gtk_widget_set_sensitive(
+                     GTK_WIDGET(ws_gui_app->ws_gui_menu->ws_gui_menu_find_prev),
+                     TRUE);
+       }
+       else
+       {
+                gtk_widget_set_sensitive (
+                        GTK_WIDGET(ws_gui_app->ws_gui_toobar_button_back),
+                        FALSE);
+                gtk_widget_set_sensitive(
+                     GTK_WIDGET(ws_gui_app->ws_gui_menu->ws_gui_menu_find_prev),
+                     FALSE);
+       }
 }
 
 /** create TreeView Model, which allows to display words list
@@ -543,32 +693,39 @@ void ws_gui_check_history(gpointer user_data)
  */
 GtkTreeModel * create_and_fill_model (GArray *words_list, gpointer user_data)
 {
-       WSGuiApp* ws_gui_app=(WSGuiApp*)user_data;
-       guint i = 0;
-       gchar *tmp = g_strdup(g_array_index(words_list, gchar*, i));
-       gboolean valid;
-       valid =gtk_tree_model_get_iter_first(GTK_TREE_MODEL(ws_gui_app->ws_gui_w_list->ws_gui_store), &ws_gui_app->ws_gui_w_list->ws_gui_iter);
-       
-        /* Append a row and fill in some data */
-       while (tmp != NULL)
-       {
-       gtk_list_store_append (ws_gui_app->ws_gui_w_list->ws_gui_store, &ws_gui_app->ws_gui_w_list->ws_gui_iter);
-       gtk_list_store_set (ws_gui_app->ws_gui_w_list->ws_gui_store, &ws_gui_app->ws_gui_w_list->ws_gui_iter, COL_WORD, tmp, -1);
-       i=i+1;
-       tmp = g_strdup(g_array_index(words_list, gchar*, i));
-       };
-
-       tmp = g_strdup(g_array_index(words_list, gchar*, 0));
-       if (tmp != NULL)
-       {
-               ws_dbus_client_find_translation(ws_gui_app->dbus_data, tmp);
-               ws_gui_history_add(tmp, ws_gui_app);
-       }
-       
-       return GTK_TREE_MODEL(ws_gui_app->ws_gui_w_list->ws_gui_store);
-}
-
-/** create TreeView and TreeModel using create_and_fill_model() function; it is necessary to display found words in a words list;
+        WSGuiApp* ws_gui_app=(WSGuiApp*)user_data;
+        guint i = 0;
+        gchar *tmp = g_strdup(g_array_index(words_list, gchar*, i));
+        gboolean valid;
+        valid = gtk_tree_model_get_iter_first(
+                        GTK_TREE_MODEL(ws_gui_app->ws_gui_w_list->ws_gui_store),
+                        &ws_gui_app->ws_gui_w_list->ws_gui_iter);
+                      
+                       /* Append a row and fill in some data */
+        while (tmp != NULL)
+        {
+                gtk_list_store_append (ws_gui_app->ws_gui_w_list->ws_gui_store,
+                                       &ws_gui_app->ws_gui_w_list->ws_gui_iter);
+                gtk_list_store_set (ws_gui_app->ws_gui_w_list->ws_gui_store,
+                              &ws_gui_app->ws_gui_w_list->ws_gui_iter, COL_WORD,
+                              tmp,
+                              -1);
+                i=i+1;
+                tmp = g_strdup(g_array_index(words_list, gchar*, i));
+        };
+
+        tmp = g_strdup(g_array_index(words_list, gchar*, 0));
+        if (tmp != NULL)
+        {
+                ws_dbus_client_find_translation(ws_gui_app->dbus_data, tmp);
+                ws_gui_history_add(tmp, ws_gui_app);
+        }
+                      
+        return GTK_TREE_MODEL(ws_gui_app->ws_gui_w_list->ws_gui_store);
+}
+
+/** create TreeView and TreeModel using create_and_fill_model() function;
+ it is necessary to display found words in a words list;
  *
  * @param words_list - array with words(found in a dictionary), recived from DBUS;
  * @param user_data - user data set when the signal handler was connected
@@ -576,43 +733,58 @@ GtkTreeModel * create_and_fill_model (GArray *words_list, gpointer user_data)
  */
 GtkWidget * create_view_and_model (GArray *words_list, gpointer user_data)
 {
-       WSGuiApp* ws_gui_app=(WSGuiApp*)user_data;
-       
-       ws_gui_app->ws_gui_w_list->ws_gui_view = gtk_tree_view_new ();
-
-       ws_gui_app->ws_gui_w_list->ws_gui_renderer = gtk_cell_renderer_text_new ();
-       gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (ws_gui_app->ws_gui_w_list->ws_gui_view), -1,  "Name", ws_gui_app->ws_gui_w_list->ws_gui_renderer, "text", COL_WORD, NULL);
-       
-       ws_gui_app->ws_gui_w_list->ws_gui_model = create_and_fill_model (words_list, ws_gui_app);
-       
-       gtk_tree_view_set_model (GTK_TREE_VIEW (ws_gui_app->ws_gui_w_list->ws_gui_view), ws_gui_app->ws_gui_w_list->ws_gui_model);
-       
-       g_object_unref (ws_gui_app->ws_gui_w_list->ws_gui_model);
-       return ws_gui_app->ws_gui_w_list->ws_gui_view;
+        WSGuiApp* ws_gui_app=(WSGuiApp*)user_data;
+           
+        ws_gui_app->ws_gui_w_list->ws_gui_view = gtk_tree_view_new ();
+
+        ws_gui_app->ws_gui_w_list->ws_gui_renderer=gtk_cell_renderer_text_new();
+        gtk_tree_view_insert_column_with_attributes(
+                         GTK_TREE_VIEW (ws_gui_app->ws_gui_w_list->ws_gui_view),
+                         -1,
+                         "Name",
+                         ws_gui_app->ws_gui_w_list->ws_gui_renderer,
+                         "text",
+                         COL_WORD,
+                         NULL);
+        ws_gui_app->ws_gui_w_list->ws_gui_model = 
+                                create_and_fill_model(words_list, ws_gui_app);
+                      
+        gtk_tree_view_set_model(
+                         GTK_TREE_VIEW (ws_gui_app->ws_gui_w_list->ws_gui_view),
+                         ws_gui_app->ws_gui_w_list->ws_gui_model);
+                      
+        g_object_unref (ws_gui_app->ws_gui_w_list->ws_gui_model);
+        return ws_gui_app->ws_gui_w_list->ws_gui_view;
 }
 
-/** handle signal from words list, get selected word and calls 'find translation' function
+/** handle signal from words list, get selected word and calls 
+'find translation' function
  *
  * @param selection - the object which received the signal
  * @param user_data - user data set when the signal handler was connected
  * @return 
  */
-void ws_gui_tree_selection_changed(GtkTreeSelection *selection, gpointer user_data)
+void ws_gui_tree_selection_changed(GtkTreeSelection *selection,
+                                   gpointer user_data)
 {
-WSGuiApp* ws_gui_app=(WSGuiApp*)user_data;
-gchar *string;
-
-       if (gtk_tree_selection_get_selected (selection, &ws_gui_app->ws_gui_w_list->ws_gui_model,                                                               &ws_gui_app->ws_gui_w_list->ws_gui_iter))
-               {
-                       gtk_tree_model_get (ws_gui_app->ws_gui_w_list->ws_gui_model, &ws_gui_app->ws_gui_w_list->ws_gui_iter, COL_WORD, &string, -1);
-       
-                       ws_dbus_client_find_translation(ws_gui_app->dbus_data, string); 
-               
-                       ws_gui_history_add(string, ws_gui_app);
-       
-                       g_free (string);
-               }
-
+        WSGuiApp* ws_gui_app=(WSGuiApp*)user_data;
+        gchar *string;
+
+        if (gtk_tree_selection_get_selected(selection,
+                                       &ws_gui_app->ws_gui_w_list->ws_gui_model,
+                                       &ws_gui_app->ws_gui_w_list->ws_gui_iter))
+        {
+                gtk_tree_model_get(ws_gui_app->ws_gui_w_list->ws_gui_model,
+                                   &ws_gui_app->ws_gui_w_list->ws_gui_iter,
+                                   COL_WORD,
+                                   &string,
+                                   -1);
+                      
+               ws_dbus_client_find_translation(ws_gui_app->dbus_data, string);
+                                    
+               ws_gui_history_add(string, ws_gui_app);
+               g_free (string);
+        }
 }
 
 /** switch application between fun screen and normal mode
@@ -624,19 +796,58 @@ gchar *string;
 void ws_gui_full_screen(GtkMenuItem *menuitem, gpointer user_data)
 {
 
-       WSGuiApp* ws_gui_app = (WSGuiApp*)user_data;
-       if (ws_gui_app->ws_gui_full_screen_flag == FALSE) {
-       
-       gtk_window_fullscreen(GTK_WINDOW(ws_gui_app->ws_gui_hildon_window));
-       gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(ws_gui_app->ws_gui_menu->ws_gui_menu_full_screen), TRUE);
-       ws_gui_app->ws_gui_full_screen_flag = TRUE;
-       }
-       else 
-       {
-       gtk_window_unfullscreen(GTK_WINDOW(ws_gui_app->ws_gui_hildon_window));
-       gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(ws_gui_app->ws_gui_menu->ws_gui_menu_full_screen), FALSE);
-       ws_gui_app->ws_gui_full_screen_flag = FALSE;
-       }
+        WSGuiApp* ws_gui_app = (WSGuiApp*)user_data;
+        if (ws_gui_app->ws_gui_full_screen_flag == FALSE) {
+                      
+                gtk_window_fullscreen(
+                                  GTK_WINDOW(ws_gui_app->ws_gui_hildon_window));
+                gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(
+                              ws_gui_app->ws_gui_menu->ws_gui_menu_full_screen),
+                              TRUE);
+                ws_gui_app->ws_gui_full_screen_flag = TRUE;
+        }
+        else 
+        {
+                gtk_window_unfullscreen(
+                                  GTK_WINDOW(ws_gui_app->ws_gui_hildon_window));
+                gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(
+                              ws_gui_app->ws_gui_menu->ws_gui_menu_full_screen),
+                              FALSE);
+                ws_gui_app->ws_gui_full_screen_flag = FALSE;
+        }
+}
+
+/** search for selected text in a dictionary
+ *
+ * @param menuitem - object which recived the signal
+ * @param user_data - user data set when the signal handler was connected 
+ * @return
+ */
+void ws_gui_popup_search(GtkMenuItem *menuitem, gpointer user_data)
+{
+        WSGuiApp* ws_gui_app = (WSGuiApp*)user_data;
+        gchar *temp;
+        ws_gui_app->ws_gui_clipboard_primary = 
+                gtk_widget_get_clipboard(ws_gui_app->ws_gui_html,
+                                         GDK_SELECTION_PRIMARY);
+        temp = gtk_clipboard_wait_for_text(ws_gui_app->ws_gui_clipboard_primary);
+        g_log(G_LOG_DOMAIN, G_LOG_LEVEL_INFO,
+              ".::GUI::. in clipboard_primary there is: %s", temp);
+        if (temp != NULL || strcmp(temp, " "))
+        {
+                g_object_set(G_OBJECT(ws_gui_app->ws_gui_hildon_find_toolbar),
+                                      "prefix",
+                                      temp,
+                                      NULL);
+                ws_dbus_client_find_word (ws_gui_app->dbus_data, temp);
+        }
+        else
+        {
+                hildon_banner_show_information(
+                                   GTK_WIDGET(ws_gui_app->ws_gui_hildon_window),
+                                   NULL,
+                                   "No text selected");
+        }
 }
 
 /** select whole text in the translation (html) area
@@ -647,8 +858,8 @@ void ws_gui_full_screen(GtkMenuItem *menuitem, gpointer user_data)
  */
 void ws_gui_html_select_all(GtkMenuItem *menuitem, gpointer user_data) 
 {
-       WSGuiApp* ws_gui_app = (WSGuiApp*)user_data;
-       gtk_html_select_all(GTK_HTML(ws_gui_app->ws_gui_html));
+        WSGuiApp* ws_gui_app = (WSGuiApp*)user_data;
+        gtk_html_select_all(GTK_HTML(ws_gui_app->ws_gui_html));
 }
 
 /** copy selected text to the clipoard from context popup menu
@@ -659,9 +870,8 @@ void ws_gui_html_select_all(GtkMenuItem *menuitem, gpointer user_data)
  */
 void ws_gui_html_copy(GtkMenuItem *menuitem, gpointer user_data) 
 {
-       WSGuiApp* ws_gui_app = (WSGuiApp*)user_data;
-       gtk_html_copy(GTK_HTML(ws_gui_app->ws_gui_html));
-       
+        WSGuiApp* ws_gui_app = (WSGuiApp*)user_data;
+        gtk_html_copy(GTK_HTML(ws_gui_app->ws_gui_html));
 }
 
 /** paste copied text into toolbar entry
@@ -672,16 +882,21 @@ void ws_gui_html_copy(GtkMenuItem *menuitem, gpointer user_data)
  */
 void ws_gui_html_paste(GtkMenuItem *menuitem, gpointer user_data)
 {
-       WSGuiApp* ws_gui_app = (WSGuiApp*)user_data;
-       
-       gchar *temp;
-       gchar *temp2;
-       temp = gtk_clipboard_wait_for_text(ws_gui_app->ws_gui_clipboard);
-       //g_log(G_LOG_DOMAIN, G_LOG_LEVEL_INFO, ".::GUI::. PASTE --- In clipboard we have: \"%s\"", temp);
-       g_object_get(G_OBJECT(ws_gui_app->ws_gui_hildon_find_toolbar), "prefix", &temp2, NULL);
-       temp = g_strconcat(temp2, temp, NULL);
-       temp = g_strdelimit(temp, "\n", ' ');
-       g_object_set(G_OBJECT(ws_gui_app->ws_gui_hildon_find_toolbar), "prefix", temp, NULL);
+        WSGuiApp* ws_gui_app = (WSGuiApp*)user_data;
+                      
+        gchar *temp;
+        gchar *temp2;
+        temp = gtk_clipboard_wait_for_text(ws_gui_app->ws_gui_clipboard);
+        g_object_get(G_OBJECT(ws_gui_app->ws_gui_hildon_find_toolbar),
+                     "prefix",
+                     &temp2,
+                     NULL);
+        temp = g_strconcat(temp2, temp, NULL);
+        temp = g_strdelimit(temp, "\n", ' ');
+        g_object_set(G_OBJECT(ws_gui_app->ws_gui_hildon_find_toolbar),
+                     "prefix",
+                     temp,
+                     NULL);
 }
 
 /** zoom in text in translation (html) area
@@ -692,8 +907,8 @@ void ws_gui_html_paste(GtkMenuItem *menuitem, gpointer user_data)
  */
 void ws_gui_html_zoom_in(GtkMenuItem *menuitem, gpointer user_data)
 {
-       WSGuiApp* ws_gui_app = (WSGuiApp*)user_data;
-       gtk_html_zoom_in(GTK_HTML(ws_gui_app->ws_gui_html));
+        WSGuiApp* ws_gui_app = (WSGuiApp*)user_data;
+        gtk_html_zoom_in(GTK_HTML(ws_gui_app->ws_gui_html));
 }
 
 /** zoom out text in translation (html) area
@@ -704,8 +919,8 @@ void ws_gui_html_zoom_in(GtkMenuItem *menuitem, gpointer user_data)
  */
 void ws_gui_html_zoom_out(GtkMenuItem *menuitem, gpointer user_data)
 {
-       WSGuiApp* ws_gui_app = (WSGuiApp*)user_data;
-       gtk_html_zoom_out(GTK_HTML(ws_gui_app->ws_gui_html));
+        WSGuiApp* ws_gui_app = (WSGuiApp*)user_data;
+        gtk_html_zoom_out(GTK_HTML(ws_gui_app->ws_gui_html));
 }
 
 /** start searching, send typed word to DBUS and query for words
@@ -716,31 +931,43 @@ void ws_gui_html_zoom_out(GtkMenuItem *menuitem, gpointer user_data)
  */
 void ws_gui_search(GtkWidget * widget, gpointer user_data) 
 {
-       WSGuiApp* ws_gui_app = (WSGuiApp*)user_data;
-       gchar* ws_gui_text = NULL;
-       //gchar *empty = " ";
-       
-       if (ws_gui_app->ws_gui_banner_flag == TRUE) {
-       ws_gui_app->ws_gui_banner_flag = FALSE;
-       }
-       
-       g_object_get(G_OBJECT(ws_gui_app->ws_gui_hildon_find_toolbar), "prefix", &ws_gui_text, NULL);
-       //g_log(G_LOG_DOMAIN, G_LOG_LEVEL_INFO, ".::GUI::. W toolbarze mielismy: %s", ws_gui_text);
-       
-       if (strlen(ws_gui_text) != 0) 
-       {
-               ws_gui_app->ws_gui_banner = hildon_banner_show_animation(GTK_WIDGET(ws_gui_app->ws_gui_hildon_window), NULL, "searching ..." );
-
-               gtk_widget_set_sensitive(GTK_WIDGET(ws_gui_app->ws_gui_toobar_button_stop),TRUE);
-               gtk_widget_set_sensitive(GTK_WIDGET(ws_gui_app->ws_gui_menu->ws_gui_menu_stop), TRUE);  
-               
-               ws_gui_app->ws_gui_banner_flag = TRUE;
-               ws_gui_fill_html(" ", ws_gui_app);
-               ws_dbus_client_find_word (ws_gui_app->dbus_data, ws_gui_text);
-       }
-       
-       else gtk_infoprint(GTK_WINDOW(ws_gui_app->ws_gui_hildon_window), "No word typed.");
-       
+        WSGuiApp* ws_gui_app = (WSGuiApp*)user_data;
+        gchar* ws_gui_text = NULL;
+                      
+        if (ws_gui_app->ws_gui_banner_flag == TRUE) {
+                ws_gui_app->ws_gui_banner_flag = FALSE;
+        }
+        
+        g_object_get(G_OBJECT(ws_gui_app->ws_gui_hildon_find_toolbar),
+                     "prefix",
+                     &ws_gui_text,
+                     NULL);
+                       
+       if (strlen(ws_gui_text) != 0) 
+       {
+                ws_gui_app->ws_gui_banner = 
+                        hildon_banner_show_animation(
+                                   GTK_WIDGET(ws_gui_app->ws_gui_hildon_window),
+                                   NULL,
+                                   "searching ..." );
+
+                gtk_widget_set_sensitive(
+                              GTK_WIDGET(ws_gui_app->ws_gui_toobar_button_stop),
+                              TRUE);
+                gtk_widget_set_sensitive(
+                          GTK_WIDGET(ws_gui_app->ws_gui_menu->ws_gui_menu_stop),
+                          TRUE);                      
+                                            
+                ws_gui_app->ws_gui_banner_flag = TRUE;
+                ws_gui_fill_html(" ", ws_gui_app);
+                ws_dbus_client_find_word (ws_gui_app->dbus_data, ws_gui_text);
+       }
+       else 
+       {
+                gtk_infoprint(
+                              GTK_WINDOW(ws_gui_app->ws_gui_hildon_window),
+                              "No word typed.");
+       }
 }
 
 /** stop search process
@@ -751,18 +978,20 @@ void ws_gui_search(GtkWidget * widget, gpointer user_data)
  */
 void ws_gui_search_stop(GtkButton *button, gpointer user_data) 
 {
-       WSGuiApp* ws_gui_app = (WSGuiApp *)user_data;   
-       if (ws_gui_app->ws_gui_banner_flag == TRUE) 
-       {
-       gtk_widget_destroy(GTK_WIDGET(ws_gui_app->ws_gui_banner));
-       ws_gui_app->ws_gui_banner_flag = FALSE;
-       ws_dbus_notify(ws_gui_app->dbus_data, WS_DBUS_INFO_STOP_SEARCH);
-       gtk_infoprint(GTK_WINDOW(ws_gui_app->ws_gui_hildon_window), "Search has been aborted" );
-       }
-       
+        WSGuiApp* ws_gui_app = (WSGuiApp *)user_data;                      
+        if (ws_gui_app->ws_gui_banner_flag == TRUE) 
+        {
+                gtk_widget_destroy(GTK_WIDGET(ws_gui_app->ws_gui_banner));
+                ws_gui_app->ws_gui_banner_flag = FALSE;
+                ws_dbus_notify(ws_gui_app->dbus_data, WS_DBUS_INFO_STOP_SEARCH);
+                gtk_infoprint(
+                              GTK_WINDOW(ws_gui_app->ws_gui_hildon_window),
+                              "Search has been aborted" );
+        }           
 }
 
-/** this function is called just before closing application; it sends signal to DBUS and destroys it; 
+/** this function is called just before closing application; 
+it sends signal to DBUS and destroys it; 
  *
  * @param widget - object which recived the signal
  * @param event - 
@@ -771,16 +1000,16 @@ void ws_gui_search_stop(GtkButton *button, gpointer user_data)
  */
 void ws_gui_on_exit (GtkWidget *widget, GdkEvent *event, gpointer user_data) 
 {
-       WSGuiApp* ws_gui_app = (WSGuiApp *)user_data;   
-       ws_dbus_notify(ws_gui_app->dbus_data, WS_DBUS_INFO_TERMINATE);
-       //g_log(G_LOG_DOMAIN, G_LOG_LEVEL_INFO, "\nClosing WhiteStork Dictionary ... \n\n");
-       ws_dbus_destroy (ws_gui_app->dbus_data);
-       ws_gui_free_memory(ws_gui_app);
-       gtk_main_quit();
-       exit (0);
+        WSGuiApp* ws_gui_app = (WSGuiApp *)user_data;                      
+        ws_dbus_notify(ws_gui_app->dbus_data, WS_DBUS_INFO_TERMINATE);
+        ws_dbus_destroy (ws_gui_app->dbus_data);
+        ws_gui_free_memory(ws_gui_app);
+        gtk_main_quit();
+        exit (0);
 }
 
-/** this function is called just before closing application, from application menu; it sends signal to DBUS and destroys it;
+/** this function is called just before closing application, 
+from application menu; it sends signal to DBUS and destroys it;
  *
  * @param menuitem - object which recived the signal
  * @param user_data - user data set when the signal handler was connected 
@@ -788,14 +1017,13 @@ void ws_gui_on_exit (GtkWidget *widget, GdkEvent *event, gpointer user_data)
  */
 void ws_gui_menu_quit(GtkMenuItem *menuitem, gpointer user_data)
 {
-       WSGuiApp* ws_gui_app = (WSGuiApp *)user_data;   
-       g_timer_destroy(ws_gui_app->timer);
-       ws_dbus_notify(ws_gui_app->dbus_data, WS_DBUS_INFO_TERMINATE);
-       //g_log(G_LOG_DOMAIN, G_LOG_LEVEL_INFO, "\nClosing WhiteStork Dictionary ... \n\n");
-       ws_dbus_destroy (ws_gui_app->dbus_data);
-       ws_gui_free_memory(ws_gui_app);
-       gtk_main_quit();
-       exit (0);
+        WSGuiApp* ws_gui_app = (WSGuiApp *)user_data;                      
+        g_timer_destroy(ws_gui_app->timer);
+        ws_dbus_notify(ws_gui_app->dbus_data, WS_DBUS_INFO_TERMINATE);
+        ws_dbus_destroy (ws_gui_app->dbus_data);
+        ws_gui_free_memory(ws_gui_app);
+        gtk_main_quit();
+        exit (0);
 }
 
 /** fill translation area with text (html) recived from DBUS
@@ -806,33 +1034,44 @@ void ws_gui_menu_quit(GtkMenuItem *menuitem, gpointer user_data)
  */
 void ws_gui_fill_html(char *html_context, gpointer user_data) 
 {
-       WSGuiApp* ws_gui_app = (WSGuiApp*)user_data;
-       gtk_html_set_editable (GTK_HTML(ws_gui_app->ws_gui_html), FALSE);
-       
-       gtk_html_load_from_string (GTK_HTML(ws_gui_app->ws_gui_html), html_context, -1);
-       //gtk_html_set_editable (GTK_HTML(ws_gui_app->ws_gui_html), TRUE);      
+        WSGuiApp* ws_gui_app = (WSGuiApp*)user_data;
+        gtk_html_set_editable (GTK_HTML(ws_gui_app->ws_gui_html), FALSE);
+                      
+        gtk_html_load_from_string(GTK_HTML(ws_gui_app->ws_gui_html),
+                                  html_context,
+                                  -1);
 }
 
-/** read adjustment of left scrollwindow, which is necessary to navigate with arrow keys inside words list
+/** read adjustment of left scrollwindow, which is necessary to navigate with 
+arrow keys inside words list
  *
  * @param user_data - user data set when the signal handler was connected 
  * @return
  */
 void ws_gui_read_adjustment(gpointer user_data)
 {
-       WSGuiApp* ws_gui_app=(WSGuiApp*)user_data;
-       
-       ws_gui_app->ws_gui_hadj = gtk_scrolled_window_get_hadjustment(GTK_SCROLLED_WINDOW(ws_gui_app->ws_gui_scrolledwindow_left));
-
-       ws_gui_app->h_delta = (ws_gui_app->ws_gui_hadj->upper - ws_gui_app->ws_gui_hadj->lower)/SCROLL_STEP_H;
-       
-       ws_gui_app->ws_gui_vadj = gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(ws_gui_app->ws_gui_scrolledwindow_left));
-
-       ws_gui_app->v_delta = (ws_gui_app->ws_gui_vadj->upper - ws_gui_app->ws_gui_vadj->lower)/SCROLL_STEP_V;
-       ws_gui_app->v_new_value = gtk_adjustment_get_value(GTK_ADJUSTMENT(ws_gui_app->ws_gui_vadj)) + ws_gui_app->v_delta;
-               
-       gtk_container_set_focus_vadjustment(GTK_CONTAINER(ws_gui_app->ws_gui_scrolledwindow_left), gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(ws_gui_app->ws_gui_scrolledwindow_left)));
-       
+        WSGuiApp* ws_gui_app=(WSGuiApp*)user_data;
+                     
+        ws_gui_app->ws_gui_hadj = 
+                gtk_scrolled_window_get_hadjustment(
+                    GTK_SCROLLED_WINDOW(ws_gui_app->ws_gui_scrolledwindow_left));
+        ws_gui_app->h_delta = (ws_gui_app->ws_gui_hadj->upper -
+                                  ws_gui_app->ws_gui_hadj->lower)/SCROLL_STEP_H;
+                      
+        ws_gui_app->ws_gui_vadj = gtk_scrolled_window_get_vadjustment(
+        GTK_SCROLLED_WINDOW(ws_gui_app->ws_gui_scrolledwindow_left));
+
+        ws_gui_app->v_delta = (ws_gui_app->ws_gui_vadj->upper -
+                                  ws_gui_app->ws_gui_vadj->lower)/SCROLL_STEP_V;
+        ws_gui_app->v_new_value =
+           gtk_adjustment_get_value(GTK_ADJUSTMENT(ws_gui_app->ws_gui_vadj)) +
+                                                            ws_gui_app->v_delta;
+                                            
+        gtk_container_set_focus_vadjustment(
+               GTK_CONTAINER(ws_gui_app->ws_gui_scrolledwindow_left), 
+               gtk_scrolled_window_get_vadjustment(
+                  GTK_SCROLLED_WINDOW(ws_gui_app->ws_gui_scrolledwindow_left)));
+                      
 }
 
 /** allows to display image in html area
@@ -844,91 +1083,100 @@ void ws_gui_read_adjustment(gpointer user_data)
  */
 void ws_gui_url_requested (GtkHTML *html, const char *url, GtkHTMLStream *stream)
 {
-       int fd;
-
-       if (url && !strncmp (url, "file:", 5)) {
-               url += 5;
-               fd = open (url, O_RDONLY);
-
-               if (fd != -1) {
-                       gchar *buf;
-                       size_t size;
-
-                       buf = alloca (8192);
-                       while ((size = read (fd, buf, 8192)) > 0) {
-                               gtk_html_stream_write (stream, buf, size);
-                       }
-                       gtk_html_stream_close (stream,
-                                              size == -1
-                                              ? GTK_HTML_STREAM_ERROR
-                                              : GTK_HTML_STREAM_OK);
-                       close (fd);
-
-                       return;
-               }
-       }
-
-       gtk_html_stream_close (stream, GTK_HTML_STREAM_ERROR);
+        int fd;
+
+        if (url && !strncmp (url, "file:", 5)) {
+                url += 5;
+                fd = open (url, O_RDONLY);
+                if (fd != -1) {
+                        gchar *buf;
+                        size_t size;
+                        buf = alloca (8192);
+                        while ((size = read (fd, buf, 8192)) > 0) {
+                                gtk_html_stream_write (stream, buf, size);
+                        }
+                       gtk_html_stream_close(stream, size == -1
+                                         ? GTK_HTML_STREAM_ERROR
+                                         : GTK_HTML_STREAM_OK);
+                       close (fd);
+
+                      return;
+                }
+        }
+
+        gtk_html_stream_close (stream, GTK_HTML_STREAM_ERROR);
 }
 
-/** handles button press event and examines what kind of event was it suppose to be
+/** handles button press event and examines what kind of event was it 
+        suppose to be
  *
  * @param widget - object which received a signal
  * @param event - type of event which has been performed
  * @param user_data - user data set when the signal handler was connected 
- * @return TRUE to stop other handlers from being invoked for the event. FALSE to propagate the event further
- */
-gboolean ws_gui_button_press(GtkWidget *widget, GdkEventButton *event, gpointer user_data)
-{
-       WSGuiApp* ws_gui_app=(WSGuiApp*)user_data;
-       if (ws_gui_app->ws_gui_sel_flag == FALSE)
-       {
-               if (event->type == GDK_2BUTTON_PRESS) 
-               {
-                       ws_gui_app->ws_gui_double_click = TRUE;
-                       g_timer_stop(ws_gui_app->timer);
-                       g_timer_reset(ws_gui_app->timer);
-                       return FALSE;
-               }
-               
-               g_signal_stop_emission_by_name(G_OBJECT(ws_gui_app->ws_gui_html), "button-press-event");
-               g_timer_start(ws_gui_app->timer);
-               gtk_timeout_add((guint)(PRESS_TIME*1000), (GtkFunction)(ws_gui_show_popup), ws_gui_app);
-               return FALSE;
-       }
-       else
-       {
-               ws_gui_app->ws_gui_sel_flag = FALSE;
-               return FALSE;
-       }
-       
-}
-
-/** handles button release event and examines whether 'click' or 'tap and hold' event it supposed to be
+ * @return TRUE to stop other handlers from being invoked for the event. 
+ FALSE to propagate the event further
+ */
+gboolean ws_gui_button_press(GtkWidget *widget,
+                             GdkEventButton *event,
+                             gpointer user_data)
+{
+        WSGuiApp* ws_gui_app=(WSGuiApp*)user_data;
+        if (ws_gui_app->ws_gui_sel_flag == FALSE)
+        {
+                if (event->type == GDK_2BUTTON_PRESS) 
+                {
+                        ws_gui_app->ws_gui_double_click = TRUE;
+                        g_timer_stop(ws_gui_app->timer);
+                        g_timer_reset(ws_gui_app->timer);
+                        return FALSE;
+                }
+                                            
+                g_signal_stop_emission_by_name(G_OBJECT(ws_gui_app->ws_gui_html),
+                                               "button-press-event");
+                g_timer_start(ws_gui_app->timer);
+                gtk_timeout_add((guint)(PRESS_TIME*1000),
+                                (GtkFunction)(ws_gui_show_popup),
+                                ws_gui_app);
+                return FALSE;
+        }
+        else
+        {
+                ws_gui_app->ws_gui_sel_flag = FALSE;
+                return FALSE;
+        }
+                      
+}
+
+/** handles button release event and examines whether 'click' or 'tap and hold' 
+event it supposed to be
  *
  * @param widget - object which received a signal
  * @param event - type of event which has been performed
  * @param user_data - user data set when the signal handler was connected 
- * @return TRUE to stop other handlers from being invoked for the event. FALSE to propagate the event further
- */
-gboolean ws_gui_button_release (GtkWidget *widget, GdkEventButton *event, gpointer user_data)
-{
-       WSGuiApp* ws_gui_app=(WSGuiApp*)user_data;
-       gdouble tmp = g_timer_elapsed(ws_gui_app->timer, NULL);
-       g_timer_stop(ws_gui_app->timer);
-       g_timer_reset(ws_gui_app->timer);
-       if (ws_gui_app->ws_gui_double_click == TRUE)
-       {
-               ws_gui_app->ws_gui_double_click = FALSE;
-               return FALSE;
-       }
-       else if (tmp < PRESS_TIME)
-       {
-               struct _GtkHTML *tmp = (struct _GtkHTML *)(ws_gui_app->ws_gui_html);
-               html_engine_unselect_all(tmp->engine);
-               return TRUE;
-       }
-       return FALSE;
+ * @return TRUE to stop other handlers from being invoked for the event. 
+ FALSE to propagate the event further
+ */
+gboolean ws_gui_button_release (GtkWidget *widget,
+                                GdkEventButton *event,
+                                gpointer user_data)
+{
+        WSGuiApp* ws_gui_app=(WSGuiApp*)user_data;
+        gdouble tmp = g_timer_elapsed(ws_gui_app->timer, NULL);
+        g_timer_stop(ws_gui_app->timer);
+        g_timer_reset(ws_gui_app->timer);
+        if (ws_gui_app->ws_gui_double_click == TRUE)
+        {
+                ws_gui_app->ws_gui_double_click = FALSE;
+                return FALSE;
+        }
+        else if (tmp < PRESS_TIME)
+        {
+                struct _GtkHTML *tmp = (struct _GtkHTML *)
+                                        (ws_gui_app->ws_gui_html);
+                html_engine_unselect_all(tmp->engine);
+                return TRUE;
+        }
+                return FALSE;
 }
 
 /** displays popup menu if user holds a stylus more than PRESS_TIME seconds
@@ -938,13 +1186,13 @@ gboolean ws_gui_button_release (GtkWidget *widget, GdkEventButton *event, gpoint
  */
 guint ws_gui_show_popup (gpointer user_data)
 {
-       WSGuiApp* ws_gui_app=(WSGuiApp*)user_data;
-       gdouble tmp = g_timer_elapsed(ws_gui_app->timer, NULL);
-       if (tmp > PRESS_TIME)
-       {
-               ws_gui_create_popup_menu(ws_gui_app);
-       }
-       return (guint)(FALSE);
+        WSGuiApp* ws_gui_app=(WSGuiApp*)user_data;
+        gdouble tmp = g_timer_elapsed(ws_gui_app->timer, NULL);
+        if (tmp > PRESS_TIME)
+        {
+                ws_gui_create_popup_menu(ws_gui_app);
+        }
+        return (guint)(FALSE);
 
 }
 
@@ -956,52 +1204,72 @@ guint ws_gui_show_popup (gpointer user_data)
  */
 void ws_gui_check_clipboard (GtkWidget *widget, gpointer user_data) 
 {
-       WSGuiApp* ws_gui_app=(WSGuiApp*)user_data;
-       if (gtk_clipboard_wait_for_text(ws_gui_app->ws_gui_clipboard) != NULL)
-       {
-       gtk_widget_set_sensitive(GTK_WIDGET(ws_gui_app->ws_gui_menu->ws_gui_menu_paste), TRUE);
-       }
-       else
-       {
-       gtk_widget_set_sensitive(GTK_WIDGET(ws_gui_app->ws_gui_menu->ws_gui_menu_paste), FALSE);
-       }
+        WSGuiApp* ws_gui_app=(WSGuiApp*)user_data;
+        if (gtk_clipboard_wait_for_text(ws_gui_app->ws_gui_clipboard) != NULL)
+        {
+                gtk_widget_set_sensitive(
+                         GTK_WIDGET(ws_gui_app->ws_gui_menu->ws_gui_menu_paste),
+                         TRUE);
+        }
+        else
+        {
+                gtk_widget_set_sensitive(
+                         GTK_WIDGET(ws_gui_app->ws_gui_menu->ws_gui_menu_paste),
+                         FALSE);
+        }
 }
 
 gchar * format_html (gchar * received_string)
 {
-       GString *str_final;
-       str_final = g_string_new(received_string);
-       gchar * tmp;
-       
-       while (strstr(str_final->str, "<PATTERN_OPEN>") != NULL)
-       {
-       tmp = strstr(str_final->str, "<PATTERN_OPEN>");
-       str_final =  g_string_erase (str_final, (long)(tmp - str_final->str), 14);
-       str_final =  g_string_insert (str_final, (long)(tmp - str_final->str), "<html><head></head><body><center><table width=\"95%\"><tr><td><table border=1 width=100%><tr><th background=\"file:/usr/share/pixmaps/ws_top.png\"><img align=left src=\"file:/usr/share/pixmaps/engine_xdxf_icon.png\"><font color=\"#eeeeee\">");     
-       }
-
-       while (strstr(str_final->str, "<PATTERN_CLOSED>") != NULL)
-       {
-       tmp = strstr(str_final->str, "<PATTERN_CLOSED>");
-       str_final =  g_string_erase (str_final, (long)(tmp - str_final->str), 16);
-       str_final =  g_string_insert (str_final, (long)(tmp - str_final->str), "</font></th></tr></table>");
-       }
-
-       while (strstr(str_final->str, "<TRANSLATION_OPEN>") != NULL)
-       {
-       tmp = strstr(str_final->str, "<TRANSLATION_OPEN>");
-       str_final =  g_string_erase (str_final, (long)(tmp - str_final->str), 18);
-       str_final =  g_string_insert (str_final, (long)(tmp - str_final->str), "<table border=1 width=100%><tr><td background=\"file:/usr/share/pixmaps/ws_tra.png\">");
-       }
-
-       while (strstr(str_final->str, "<TRANSLATION_CLOSED>") != NULL)
-       {
-       tmp = strstr(str_final->str, "<TRANSLATION_CLOSED>");
-       str_final =  g_string_erase (str_final, (long)(tmp - str_final->str), 20);
-       str_final =  g_string_insert (str_final, (long)(tmp - str_final->str), "</td></tr></table></center><br>");
-       }
-
-       str_final = g_string_append (str_final, "</td></tr></table></body></html>");
-       g_log(G_LOG_DOMAIN, G_LOG_LEVEL_INFO, ".::GUI::.\nprzeslano do tlumaczenia:\n %s", str_final->str);
-       return str_final->str;
+        GString *str_final;
+        str_final = g_string_new(received_string);
+        gchar * tmp;
+                     
+        while (strstr(str_final->str, "<PATTERN_OPEN>") != NULL)
+        {
+                tmp = strstr(str_final->str, "<PATTERN_OPEN>");
+                str_final =  g_string_erase(str_final,
+                                           (long)(tmp - str_final->str),
+                                           14);
+                str_final =  g_string_insert(str_final,
+                 (long)(tmp - str_final->str),
+                 "<html><head></head><body><center><table width=\"95%\"><tr><td><table border=1 width=100%><tr><th background=\"file:/usr/share/pixmaps/ws_top.png\"><img align=left src=\"file:/usr/share/pixmaps/engine_xdxf_icon.png\"><font color=\"#eeeeee\">");                      
+        }
+        
+        while (strstr(str_final->str, "<PATTERN_CLOSED>") != NULL)
+        {
+                tmp = strstr(str_final->str, "<PATTERN_CLOSED>");
+                str_final =  g_string_erase(str_final,
+                                            (long)(tmp - str_final->str),
+                                            16);
+                str_final =  g_string_insert(str_final,
+                                            (long)(tmp - str_final->str),
+                                            "</font></th></tr></table>");
+        }
+
+        while (strstr(str_final->str, "<TRANSLATION_OPEN>") != NULL)
+        {
+                tmp = strstr(str_final->str, "<TRANSLATION_OPEN>");
+                str_final =  g_string_erase (str_final,
+                                             (long)(tmp - str_final->str),
+                                             18);
+                str_final =  g_string_insert (str_final,
+                (long)(tmp - str_final->str),
+                "<table border=1 width=100%><tr><td background=\"file:/usr/share/pixmaps/ws_tra.png\">");
+        }
+
+        while (strstr(str_final->str, "<TRANSLATION_CLOSED>") != NULL)
+        {
+                tmp = strstr(str_final->str, "<TRANSLATION_CLOSED>");
+                str_final =  g_string_erase(str_final,
+                                            (long)(tmp - str_final->str),
+                                            20);
+                str_final =  g_string_insert(str_final,
+                                             (long)(tmp - str_final->str),
+                                             "</td></tr></table></center><br>");
+        }
+
+        str_final = g_string_append(str_final,
+                                    "</td></tr></table></body></html>");
+        return str_final->str;
 }
index 09dca2e..d015425 100644 (file)
@@ -1,4 +1,4 @@
-/************************************************************************************************
+/*******************************************************************************
 This file is part of WhiteStork.
 
 WhiteStork is free software; you can redistribute it and/or modify
@@ -16,402 +16,740 @@ along with WhiteStork; if not, write to the Free Software
 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
 
 Copyright 2006 ComArch S.A.
-************************************************************************************************/
+*******************************************************************************/
 #include "../../include/ws_gui_layout.h"
 #include "../../include/ws_gui.h"
 #include "../../include/ws_gui_callbacks.h"
 #include "../../include/ws_dbus.h"
 
-
-/** this function creates main window and it components; moreover there are signal connections;
+/** this function creates main window and it components; moreover there are 
+ * signal connections;
  *
  * @param user_data - data set when the signal handler was connected 
  */
 void ws_gui_create_window(gpointer user_data) 
 {
-       WSGuiApp* ws_gui_app=(WSGuiApp*)user_data;
-       
-       ws_gui_app->ws_gui_w_list->ws_gui_list_item_data_string = "<font size=+2><center><br>Welcome to<br><b>WhiteStork</b><br>Dictionary.</font><br><IMG SRC=file:/usr/share/pixmaps/whitestork.png></center>";
-
-       GArray *array_tmp = g_array_new (TRUE, TRUE, sizeof(gchar*));
-
-       ws_gui_app->ws_gui_banner_flag = FALSE;
-       ws_gui_app->ws_gui_full_screen_flag = FALSE;    
-       ws_gui_app->caching_flag = FALSE;
-       ws_gui_app->ws_gui_double_click = FALSE;
-       ws_gui_app->ws_gui_sel_flag = FALSE;
-
-       ws_gui_app->timer = g_timer_new();
-       g_timer_stop(ws_gui_app->timer);
-
-       ws_gui_app->ws_gui_history = g_array_new(TRUE, TRUE, sizeof(gchar*));
-       ws_gui_app->ws_gui_history_cur_pos = -1;
-       ws_gui_app->ws_gui_hildon_program = HILDON_PROGRAM(hildon_program_get_instance());
-       g_set_application_name("WhiteStork");
-       
-       ws_gui_app->ws_gui_hildon_window = HILDON_WINDOW(hildon_window_new());
-       hildon_program_add_window(ws_gui_app->ws_gui_hildon_program, ws_gui_app->ws_gui_hildon_window);
-       
-       ws_gui_create_main_menu(ws_gui_app);
-       ws_gui_create_find_toolbar(ws_gui_app);
+        WSGuiApp* ws_gui_app=(WSGuiApp*)user_data;
+        
+        ws_gui_app->ws_gui_w_list->ws_gui_list_item_data_string = 
+                "<font size=+2><center><br>Welcome to<br><b>WhiteStork</b><br>"
+                "Dictionary.</font><br><IMG SRC=file:/usr/share/pixmaps/whitestork.png>"
+                "</center>";
+
+        GArray *array_tmp = g_array_new (TRUE, TRUE, sizeof(gchar*));
+
+        ws_gui_app->ws_gui_banner_flag = FALSE;
+        ws_gui_app->ws_gui_full_screen_flag = FALSE;                
+        ws_gui_app->caching_flag = FALSE;
+        ws_gui_app->ws_gui_double_click = FALSE;
+        ws_gui_app->ws_gui_sel_flag = FALSE;
+
+        ws_gui_app->timer = g_timer_new();
+        g_timer_stop(ws_gui_app->timer);
+
+        ws_gui_app->ws_gui_history = g_array_new(TRUE, TRUE, sizeof(gchar*));
+        ws_gui_app->ws_gui_history_cur_pos = -1;
+                
+        ws_gui_app->ws_gui_hildon_program = 
+        HILDON_PROGRAM(hildon_program_get_instance());
+                
+        g_set_application_name("WhiteStork");
+                
+        ws_gui_app->ws_gui_hildon_window = HILDON_WINDOW(hildon_window_new());
+                
+        hildon_program_add_window(ws_gui_app->ws_gui_hildon_program,
+                                  ws_gui_app->ws_gui_hildon_window);
+                
+        ws_gui_create_main_menu(ws_gui_app);
+        ws_gui_create_find_toolbar(ws_gui_app);
  
-       ws_gui_app->ws_gui_hpane = gtk_hpaned_new();
+        ws_gui_app->ws_gui_hpane = gtk_hpaned_new();
  
-       ws_gui_app->ws_gui_scrolledwindow_left = gtk_scrolled_window_new (NULL, NULL);
-       gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (ws_gui_app->ws_gui_scrolledwindow_left), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
-       
-       gtk_paned_set_position(GTK_PANED(ws_gui_app->ws_gui_hpane), 100);
-       //gtk_widget_set_size_request (ws_gui_app->ws_gui_scrolledwindow_left, 50, 100);
-       
-       gtk_scrolled_window_set_placement(GTK_SCROLLED_WINDOW(ws_gui_app->ws_gui_scrolledwindow_left), GTK_CORNER_TOP_LEFT);
+        ws_gui_app->ws_gui_scrolledwindow_left = 
+                gtk_scrolled_window_new (NULL, NULL);
+                
+        gtk_scrolled_window_set_policy(
+                GTK_SCROLLED_WINDOW (ws_gui_app->ws_gui_scrolledwindow_left), 
+                GTK_POLICY_AUTOMATIC,
+                GTK_POLICY_AUTOMATIC);
+                
+       gtk_paned_set_position(GTK_PANED(ws_gui_app->ws_gui_hpane), 100);
+                
+       gtk_scrolled_window_set_placement(GTK_SCROLLED_WINDOW
+                                       (ws_gui_app->ws_gui_scrolledwindow_left),
+                                       GTK_CORNER_TOP_LEFT);
  
-       ws_gui_app->ws_gui_scrolledwindow_right = gtk_scrolled_window_new (NULL, NULL);
-       gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (ws_gui_app->ws_gui_scrolledwindow_right), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
-       
-       ws_gui_app->ws_gui_w_list->ws_gui_store = gtk_list_store_new (NUM_COLS, G_TYPE_STRING, G_TYPE_UINT);
-       ws_gui_app->ws_gui_w_list->ws_gui_view = create_view_and_model(array_tmp, ws_gui_app);  
-       gtk_widget_show_all(GTK_WIDGET(ws_gui_app->ws_gui_w_list->ws_gui_view));
-       
-       gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(ws_gui_app->ws_gui_scrolledwindow_left), ws_gui_app->ws_gui_w_list->ws_gui_view);
-
-       ws_gui_app->ws_gui_html = gtk_html_new();
-       
-       ws_gui_app->p = pango_font_description_from_string("Tahoma 12");
-       gtk_widget_modify_font(GTK_WIDGET(ws_gui_app->ws_gui_html), ws_gui_app->p);
-       //ws_gui_app->ws_gui_html = gtk_html_new_from_string(ws_gui_app->ws_gui_w_list->ws_gui_list_item_data_string, strlen(ws_gui_app->ws_gui_w_list->ws_gui_list_item_data_string));
-       
-       g_signal_connect(GTK_OBJECT (ws_gui_app->ws_gui_html), "url_requested", G_CALLBACK(ws_gui_url_requested), ws_gui_app);
-       
-       gtk_html_load_from_string(GTK_HTML(ws_gui_app->ws_gui_html), ws_gui_app->ws_gui_w_list->ws_gui_list_item_data_string, -1);
-
-       gtk_html_set_editable(GTK_HTML(ws_gui_app->ws_gui_html), FALSE); /* editable */
-       gtk_html_allow_selection(GTK_HTML(ws_gui_app->ws_gui_html), TRUE);
-       
-       gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(ws_gui_app->ws_gui_scrolledwindow_right), ws_gui_app->ws_gui_html);
-       gtk_paned_pack1(GTK_PANED(ws_gui_app->ws_gui_hpane), ws_gui_app->ws_gui_scrolledwindow_left,TRUE, TRUE);
-       gtk_paned_pack2(GTK_PANED(ws_gui_app->ws_gui_hpane), ws_gui_app->ws_gui_scrolledwindow_right,TRUE, TRUE);
-
-       gtk_container_add(GTK_CONTAINER(ws_gui_app->ws_gui_hildon_window), ws_gui_app->ws_gui_hpane);
-       gtk_widget_show_all(GTK_WIDGET(ws_gui_app->ws_gui_hildon_window));
-       
-       ws_gui_app->ws_gui_w_list->ws_gui_selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (ws_gui_app->ws_gui_w_list->ws_gui_view));
-       
-       gtk_tree_selection_set_mode (ws_gui_app->ws_gui_w_list->ws_gui_selection, GTK_SELECTION_BROWSE);
+       ws_gui_app->ws_gui_scrolledwindow_right = 
+                gtk_scrolled_window_new (NULL, NULL);
+
+       gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW
+                                     (ws_gui_app->ws_gui_scrolledwindow_right), 
+                                     GTK_POLICY_NEVER,
+                                     GTK_POLICY_AUTOMATIC);
+                
+       ws_gui_app->ws_gui_w_list->ws_gui_store = 
+                gtk_list_store_new (NUM_COLS, G_TYPE_STRING, G_TYPE_UINT);
+                
+       ws_gui_app->ws_gui_w_list->ws_gui_view = 
+                create_view_and_model(array_tmp, ws_gui_app);                
+                
+       gtk_widget_show_all(GTK_WIDGET(ws_gui_app->ws_gui_w_list->ws_gui_view));
+                
+       gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW
+                                       (ws_gui_app->ws_gui_scrolledwindow_left), 
+                                        ws_gui_app->ws_gui_w_list->ws_gui_view);
+
+       ws_gui_app->ws_gui_html = gtk_html_new();
+                
+       ws_gui_app->p = pango_font_description_from_string("Tahoma 12");
+       gtk_widget_modify_font(GTK_WIDGET(ws_gui_app->ws_gui_html),ws_gui_app->p);
+                
+       g_signal_connect(GTK_OBJECT (ws_gui_app->ws_gui_html),
+                                 "url_requested",
+                                 G_CALLBACK(ws_gui_url_requested),
+                                 ws_gui_app);
+                
+       gtk_html_load_from_string(GTK_HTML(ws_gui_app->ws_gui_html),
+                        ws_gui_app->ws_gui_w_list->ws_gui_list_item_data_string,
+                        -1);
+
+       gtk_html_set_editable(GTK_HTML(ws_gui_app->ws_gui_html), FALSE); 
+       gtk_html_allow_selection(GTK_HTML(ws_gui_app->ws_gui_html), TRUE);
+                
+       gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW
+                                      (ws_gui_app->ws_gui_scrolledwindow_right),
+                                       ws_gui_app->ws_gui_html);
+                
+       gtk_paned_pack1(GTK_PANED(ws_gui_app->ws_gui_hpane),
+                       ws_gui_app->ws_gui_scrolledwindow_left,
+                       TRUE,
+                       TRUE);
+       gtk_paned_pack2(GTK_PANED(ws_gui_app->ws_gui_hpane),
+                       ws_gui_app->ws_gui_scrolledwindow_right,
+                       TRUE,
+                       TRUE);
+
+       gtk_container_add(GTK_CONTAINER(ws_gui_app->ws_gui_hildon_window), 
+                        ws_gui_app->ws_gui_hpane);
+
+       gtk_widget_show_all(GTK_WIDGET(ws_gui_app->ws_gui_hildon_window));
+                
+       ws_gui_app->ws_gui_w_list->ws_gui_selection = 
+                gtk_tree_view_get_selection (GTK_TREE_VIEW
+                (ws_gui_app->ws_gui_w_list->ws_gui_view));
+                
+       gtk_tree_selection_set_mode(
+                                   ws_gui_app->ws_gui_w_list->ws_gui_selection,
+                                   GTK_SELECTION_BROWSE);
 
 }
 
-/** this function creates a find toolbar and connects signals to the tollbars components
+/** this function creates a find toolbar and connects signals to the tollbars 
+ * components
  *
  * @param user_data - set when the signal handler was connected
  */
 void ws_gui_create_find_toolbar(gpointer user_data)
 {
-       WSGuiApp* ws_gui_app = (WSGuiApp*)user_data;    
-
-       GtkToolItem *space;
-       ws_gui_app->ws_gui_hildon_find_toolbar = HILDON_FIND_TOOLBAR(hildon_find_toolbar_new("Find: "));
-
-       ws_gui_app->ws_gui_toobar_button_hide = gtk_toggle_tool_button_new_from_stock(GTK_STOCK_GOTO_FIRST);
-       ws_gui_app->ws_gui_toobar_button_back = gtk_tool_button_new_from_stock(GTK_STOCK_GO_BACK);
-       ws_gui_app->ws_gui_toobar_button_forward = gtk_tool_button_new_from_stock(GTK_STOCK_GO_FORWARD);
-       ws_gui_app->ws_gui_toobar_button_stop = gtk_tool_button_new_from_stock(GTK_STOCK_STOP);
-       space = gtk_separator_tool_item_new(); 
-
-       ws_gui_app->ws_gui_toobar_button_close = gtk_toolbar_get_nth_item(GTK_TOOLBAR(ws_gui_app->ws_gui_hildon_find_toolbar), 4);
-       gtk_tool_item_set_visible_horizontal(ws_gui_app->ws_gui_toobar_button_close, FALSE);
-       
-       gtk_toolbar_insert(GTK_TOOLBAR(ws_gui_app->ws_gui_hildon_find_toolbar), ws_gui_app->ws_gui_toobar_button_hide, 0);
-       gtk_toolbar_insert(GTK_TOOLBAR(ws_gui_app->ws_gui_hildon_find_toolbar), ws_gui_app->ws_gui_toobar_button_back, -1);
-       gtk_toolbar_insert(GTK_TOOLBAR(ws_gui_app->ws_gui_hildon_find_toolbar), ws_gui_app->ws_gui_toobar_button_forward, -1);
-       gtk_toolbar_insert(GTK_TOOLBAR(ws_gui_app->ws_gui_hildon_find_toolbar), space, -1);
-       gtk_toolbar_insert(GTK_TOOLBAR(ws_gui_app->ws_gui_hildon_find_toolbar), ws_gui_app->ws_gui_toobar_button_stop, -1);
-    
-       g_signal_connect(G_OBJECT(ws_gui_app->ws_gui_hildon_find_toolbar), "search", G_CALLBACK(ws_gui_search), ws_gui_app);
-       
-       g_signal_connect(G_OBJECT(ws_gui_app->ws_gui_toobar_button_hide), "toggled", G_CALLBACK(ws_gui_words_list_hide), ws_gui_app);
-       g_signal_connect(G_OBJECT(ws_gui_app->ws_gui_toobar_button_back), "clicked", G_CALLBACK(ws_gui_history_back), ws_gui_app);
-       g_signal_connect(G_OBJECT(ws_gui_app->ws_gui_toobar_button_forward), "clicked", G_CALLBACK(ws_gui_history_next), ws_gui_app);
-       g_signal_connect(G_OBJECT(ws_gui_app->ws_gui_toobar_button_stop), "clicked", G_CALLBACK(ws_gui_search_stop), ws_gui_app);
-
-       gtk_widget_set_sensitive (GTK_WIDGET(ws_gui_app->ws_gui_toobar_button_back), FALSE);
-       gtk_widget_set_sensitive (GTK_WIDGET(ws_gui_app->ws_gui_toobar_button_forward), FALSE);
-       gtk_widget_set_sensitive (GTK_WIDGET(ws_gui_app->ws_gui_toobar_button_stop), FALSE);
-       
-       hildon_window_add_toolbar(ws_gui_app->ws_gui_hildon_window, GTK_TOOLBAR(ws_gui_app->ws_gui_hildon_find_toolbar));
+       WSGuiApp* ws_gui_app = (WSGuiApp*)user_data;                
+
+       GtkToolItem *space;
+       ws_gui_app->ws_gui_hildon_find_toolbar = 
+       HILDON_FIND_TOOLBAR(hildon_find_toolbar_new("Find: "));
+
+       ws_gui_app->ws_gui_toobar_button_hide =
+       gtk_toggle_tool_button_new_from_stock(GTK_STOCK_GOTO_FIRST);
+       ws_gui_app->ws_gui_toobar_button_back = 
+       gtk_tool_button_new_from_stock(GTK_STOCK_GO_BACK);
+       ws_gui_app->ws_gui_toobar_button_forward =
+       gtk_tool_button_new_from_stock(GTK_STOCK_GO_FORWARD);
+       ws_gui_app->ws_gui_toobar_button_stop = 
+       gtk_tool_button_new_from_stock(GTK_STOCK_STOP);
+       space = gtk_separator_tool_item_new(); 
+
+       ws_gui_app->ws_gui_toobar_button_close = 
+                gtk_toolbar_get_nth_item(GTK_TOOLBAR(
+                                        ws_gui_app->ws_gui_hildon_find_toolbar),
+                                        4);
+                
+       gtk_tool_item_set_visible_horizontal(
+                                         ws_gui_app->ws_gui_toobar_button_close,
+                                         FALSE);
+                
+       gtk_toolbar_insert(GTK_TOOLBAR(ws_gui_app->ws_gui_hildon_find_toolbar),
+                          ws_gui_app->ws_gui_toobar_button_hide,
+                          0);
+       gtk_toolbar_insert(GTK_TOOLBAR(ws_gui_app->ws_gui_hildon_find_toolbar),
+                          ws_gui_app->ws_gui_toobar_button_back,
+                          -1);
+       gtk_toolbar_insert(GTK_TOOLBAR(ws_gui_app->ws_gui_hildon_find_toolbar),
+                          ws_gui_app->ws_gui_toobar_button_forward,
+                          -1);
+       gtk_toolbar_insert(GTK_TOOLBAR(ws_gui_app->ws_gui_hildon_find_toolbar),
+                          space,
+                          -1);
+       gtk_toolbar_insert(GTK_TOOLBAR(ws_gui_app->ws_gui_hildon_find_toolbar),
+                          ws_gui_app->ws_gui_toobar_button_stop,
+                          -1);
+       g_signal_connect(G_OBJECT(ws_gui_app->ws_gui_hildon_find_toolbar), 
+                        "search",
+                        G_CALLBACK(ws_gui_search),
+                        ws_gui_app);
+                
+       g_signal_connect(G_OBJECT(ws_gui_app->ws_gui_toobar_button_hide), 
+                       "toggled",
+                       G_CALLBACK(ws_gui_words_list_hide),
+                       ws_gui_app);
+                
+       g_signal_connect(G_OBJECT(ws_gui_app->ws_gui_toobar_button_back), 
+                        "clicked",
+                        G_CALLBACK(ws_gui_history_back),
+                        ws_gui_app);
+
+       g_signal_connect(G_OBJECT(ws_gui_app->ws_gui_toobar_button_forward), 
+                        "clicked",
+                        G_CALLBACK(ws_gui_history_next),
+                        ws_gui_app);
+       g_signal_connect(G_OBJECT(ws_gui_app->ws_gui_toobar_button_stop), 
+                         "clicked",
+                         G_CALLBACK(ws_gui_search_stop),
+                         ws_gui_app);
+
+       gtk_widget_set_sensitive(GTK_WIDGET(ws_gui_app->ws_gui_toobar_button_back),
+                                FALSE);
+       gtk_widget_set_sensitive(
+                           GTK_WIDGET(ws_gui_app->ws_gui_toobar_button_forward),
+                           FALSE);
+       gtk_widget_set_sensitive(
+                              GTK_WIDGET(ws_gui_app->ws_gui_toobar_button_stop),
+                              FALSE);
+                
+       hildon_window_add_toolbar(ws_gui_app->ws_gui_hildon_window,
+                           GTK_TOOLBAR(ws_gui_app->ws_gui_hildon_find_toolbar));
 }
 
-/** this function creates application menu and its items and connect signals to them
+/** this function creates application menu and its items and connect signals to 
+ * them
  *
  * @param user_data - set when the signal handler was connected
  */
 void ws_gui_create_main_menu (gpointer user_data) 
 {
-       WSGuiApp* ws_gui_app=(WSGuiApp*)user_data;
-
-       ws_gui_app->ws_gui_menu->ws_gui_submenu_0 = gtk_menu_new();
-       ws_gui_app->ws_gui_menu->ws_gui_submenu_1 = gtk_menu_new();
-       ws_gui_app->ws_gui_menu->ws_gui_submenu_2 = gtk_menu_new();
-       ws_gui_app->ws_gui_menu->ws_gui_submenu_3 = gtk_menu_new();
-       ws_gui_app->ws_gui_menu->ws_gui_main_menu = gtk_menu_new();
+        WSGuiApp* ws_gui_app=(WSGuiApp*)user_data;
+
+        ws_gui_app->ws_gui_menu->ws_gui_submenu_0 = gtk_menu_new();
+        ws_gui_app->ws_gui_menu->ws_gui_submenu_1 = gtk_menu_new();
+        ws_gui_app->ws_gui_menu->ws_gui_submenu_2 = gtk_menu_new();
+        ws_gui_app->ws_gui_menu->ws_gui_submenu_3 = gtk_menu_new();
+        ws_gui_app->ws_gui_menu->ws_gui_main_menu = gtk_menu_new();
+        
+        ws_gui_app->ws_gui_menu->ws_gui_menu_dictionaries =
+                gtk_menu_item_new_with_label("Dictionaries");
+        ws_gui_app->ws_gui_menu->ws_gui_menu_edit = 
+                gtk_menu_item_new_with_label("Edit");
+        ws_gui_app->ws_gui_menu->ws_gui_menu_view = 
+                gtk_menu_item_new_with_label("View");
+        ws_gui_app->ws_gui_menu->ws_gui_menu_search = 
+                gtk_menu_item_new_with_label("Search");
+        ws_gui_app->ws_gui_menu->ws_gui_menu_about = 
+                gtk_menu_item_new_with_label("About...");
+        ws_gui_app->ws_gui_menu->ws_gui_menu_close = 
+                gtk_menu_item_new_with_label("Close");
+        ws_gui_app->ws_gui_menu->ws_gui_separator = 
+                gtk_separator_menu_item_new();
+        ws_gui_app->ws_gui_menu->ws_gui_separator1 = 
+                gtk_separator_menu_item_new();
+
+        ws_gui_app->ws_gui_menu->ws_gui_menu_load_dict = 
+                gtk_menu_item_new_with_label("Load dictionary");
+        ws_gui_app->ws_gui_menu->ws_gui_menu_select_dict = 
+                gtk_menu_item_new_with_label("Select dictionaries ...");
+        ws_gui_app->ws_gui_menu->ws_gui_menu_remove_dict = 
+                gtk_menu_item_new_with_label("Remove dictionaries ...");
+        ws_gui_app->ws_gui_menu->ws_gui_menu_optimize_dict = 
+                gtk_menu_item_new_with_label("Optimize dictionaries ...");
+                
+        gtk_menu_append(ws_gui_app->ws_gui_menu->ws_gui_submenu_0,
+                        ws_gui_app->ws_gui_menu->ws_gui_menu_load_dict);
+        gtk_menu_append(ws_gui_app->ws_gui_menu->ws_gui_submenu_0,
+                        ws_gui_app->ws_gui_menu->ws_gui_menu_select_dict);
+        gtk_menu_append(ws_gui_app->ws_gui_menu->ws_gui_submenu_0,
+                        ws_gui_app->ws_gui_menu->ws_gui_menu_remove_dict);
+                
+        gtk_menu_append(ws_gui_app->ws_gui_menu->ws_gui_submenu_0,
+                        ws_gui_app->ws_gui_menu->ws_gui_menu_optimize_dict);
+        gtk_widget_set_sensitive(GTK_WIDGET(
+                             ws_gui_app->ws_gui_menu->ws_gui_menu_dictionaries),
+                             TRUE);
+
+       ws_gui_app->ws_gui_menu->ws_gui_menu_copy = 
+                gtk_menu_item_new_with_label("Copy");
+       ws_gui_app->ws_gui_menu->ws_gui_menu_paste = 
+                gtk_menu_item_new_with_label("Paste");
+       ws_gui_app->ws_gui_menu->ws_gui_menu_select_all = 
+                gtk_menu_item_new_with_label("Select All");
+       gtk_menu_append(ws_gui_app->ws_gui_menu->ws_gui_submenu_1,
+                       ws_gui_app->ws_gui_menu->ws_gui_menu_copy);
+       gtk_menu_append(ws_gui_app->ws_gui_menu->ws_gui_submenu_1,
+                       ws_gui_app->ws_gui_menu->ws_gui_menu_paste);
+       gtk_menu_append(ws_gui_app->ws_gui_menu->ws_gui_submenu_1,
+                       ws_gui_app->ws_gui_menu->ws_gui_menu_select_all);
+
+       ws_gui_app->ws_gui_menu->ws_gui_menu_hide_list = 
+                gtk_check_menu_item_new_with_label("Hide words list");
+       ws_gui_app->ws_gui_menu->ws_gui_menu_zoom_in = 
+                gtk_menu_item_new_with_label("Zoom in");
+       ws_gui_app->ws_gui_menu->ws_gui_menu_zoom_out = 
+                gtk_menu_item_new_with_label("Zoom out");
+       ws_gui_app->ws_gui_menu->ws_gui_menu_full_screen = 
+                gtk_check_menu_item_new_with_label("Full screen");
+       gtk_menu_append(ws_gui_app->ws_gui_menu->ws_gui_submenu_2,
+                       ws_gui_app->ws_gui_menu->ws_gui_menu_hide_list);
+       gtk_menu_append(ws_gui_app->ws_gui_menu->ws_gui_submenu_2,
+                       ws_gui_app->ws_gui_menu->ws_gui_menu_zoom_in);
+       gtk_menu_append(ws_gui_app->ws_gui_menu->ws_gui_submenu_2,
+                       ws_gui_app->ws_gui_menu->ws_gui_menu_zoom_out);
+       gtk_menu_append(ws_gui_app->ws_gui_menu->ws_gui_submenu_2,
+                       ws_gui_app->ws_gui_menu->ws_gui_menu_full_screen);
+
+       ws_gui_app->ws_gui_menu->ws_gui_menu_find_word = 
+                gtk_menu_item_new_with_label("Find");
+       ws_gui_app->ws_gui_menu->ws_gui_menu_find_next = 
+               gtk_menu_item_new_with_label("Find next");
+       ws_gui_app->ws_gui_menu->ws_gui_menu_find_prev = 
+               gtk_menu_item_new_with_label("Find previous");
+       ws_gui_app->ws_gui_menu->ws_gui_menu_stop = 
+               gtk_menu_item_new_with_label("Stop");
+       gtk_menu_append(ws_gui_app->ws_gui_menu->ws_gui_submenu_3,
+                       ws_gui_app->ws_gui_menu->ws_gui_menu_find_word);
+       gtk_menu_append(ws_gui_app->ws_gui_menu->ws_gui_submenu_3,
+                       ws_gui_app->ws_gui_menu->ws_gui_menu_find_next);
+       gtk_menu_append(ws_gui_app->ws_gui_menu->ws_gui_submenu_3,
+                       ws_gui_app->ws_gui_menu->ws_gui_menu_find_prev);
+       gtk_menu_append(ws_gui_app->ws_gui_menu->ws_gui_submenu_3,
+                       ws_gui_app->ws_gui_menu->ws_gui_menu_stop);
+       gtk_menu_append(ws_gui_app->ws_gui_menu->ws_gui_main_menu,
+                       ws_gui_app->ws_gui_menu->ws_gui_menu_dictionaries);
+        
+       gtk_menu_item_set_submenu(GTK_MENU_ITEM
+                            (ws_gui_app->ws_gui_menu->ws_gui_menu_dictionaries),
+                             ws_gui_app->ws_gui_menu->ws_gui_submenu_0);
+       gtk_menu_append(ws_gui_app->ws_gui_menu->ws_gui_main_menu,
+                       ws_gui_app->ws_gui_menu->ws_gui_separator1);
+
+       gtk_menu_append(ws_gui_app->ws_gui_menu->ws_gui_main_menu,
+                       ws_gui_app->ws_gui_menu->ws_gui_menu_edit);
+       gtk_menu_item_set_submenu(GTK_MENU_ITEM
+                                 (ws_gui_app->ws_gui_menu->ws_gui_menu_edit), 
+                                 ws_gui_app->ws_gui_menu->ws_gui_submenu_1);
+
+        gtk_menu_append(ws_gui_app->ws_gui_menu->ws_gui_main_menu,
+                        ws_gui_app->ws_gui_menu->ws_gui_menu_view);
+        gtk_menu_item_set_submenu(GTK_MENU_ITEM
+                                  (ws_gui_app->ws_gui_menu->ws_gui_menu_view), 
+                                  ws_gui_app->ws_gui_menu->ws_gui_submenu_2);
+
+        gtk_menu_append(ws_gui_app->ws_gui_menu->ws_gui_main_menu,
+                        ws_gui_app->ws_gui_menu->ws_gui_menu_search);
+        gtk_menu_item_set_submenu(GTK_MENU_ITEM
+                                  (ws_gui_app->ws_gui_menu->ws_gui_menu_search), 
+                                  ws_gui_app->ws_gui_menu->ws_gui_submenu_3);
+                
+        gtk_menu_append(ws_gui_app->ws_gui_menu->ws_gui_main_menu,
+                        ws_gui_app->ws_gui_menu->ws_gui_separator);
+        gtk_menu_append(ws_gui_app->ws_gui_menu->ws_gui_main_menu,
+                        ws_gui_app->ws_gui_menu->ws_gui_menu_about);
+        gtk_menu_append(ws_gui_app->ws_gui_menu->ws_gui_main_menu,
+                        ws_gui_app->ws_gui_menu->ws_gui_menu_close);
+        
+        g_signal_connect(G_OBJECT
+                         (ws_gui_app->ws_gui_menu->ws_gui_menu_load_dict),
+                         "activate",
+                         G_CALLBACK(ws_gui_dictionary_loader),
+                         ws_gui_app);
+        g_signal_connect(G_OBJECT(
+                         ws_gui_app->ws_gui_menu->ws_gui_menu_select_dict),
+                         "activate",
+                         G_CALLBACK(ws_gui_dictionary_chooser),
+                         ws_gui_app);
+        g_signal_connect(G_OBJECT
+                         (ws_gui_app->ws_gui_menu->ws_gui_menu_remove_dict),
+                         "activate",
+                         G_CALLBACK(ws_gui_dictionary_remover),
+                         ws_gui_app);
+                
+        g_signal_connect(G_OBJECT
+                         (ws_gui_app->ws_gui_menu->ws_gui_menu_optimize_dict),
+                         "activate",
+                         G_CALLBACK(ws_gui_dictionary_optimizer), ws_gui_app);
+        g_signal_connect(G_OBJECT
+                         (ws_gui_app->ws_gui_menu->ws_gui_menu_copy),
+                         "activate", 
+                         GTK_SIGNAL_FUNC(ws_gui_html_copy),
+                         ws_gui_app);
+        g_signal_connect(G_OBJECT
+                         (ws_gui_app->ws_gui_menu->ws_gui_menu_paste),
+                         "activate",
+                         GTK_SIGNAL_FUNC(ws_gui_html_paste),
+                         ws_gui_app);
+        g_signal_connect(G_OBJECT
+                         (ws_gui_app->ws_gui_menu->ws_gui_menu_select_all),
+                         "activate",
+                         GTK_SIGNAL_FUNC(ws_gui_html_select_all),
+                         ws_gui_app);
+        g_signal_connect(G_OBJECT
+                        (ws_gui_app->ws_gui_menu->ws_gui_menu_hide_list),
+                         "activate",
+                         GTK_SIGNAL_FUNC(ws_gui_words_list_hide_from_menu),
+                         ws_gui_app);
+        g_signal_connect(G_OBJECT
+                         (ws_gui_app->ws_gui_menu->ws_gui_menu_zoom_in),
+                         "activate",
+                         G_CALLBACK(ws_gui_html_zoom_in),
+                         ws_gui_app);
+        g_signal_connect(G_OBJECT
+                         (ws_gui_app->ws_gui_menu->ws_gui_menu_zoom_out),
+                         "activate",
+                         G_CALLBACK(ws_gui_html_zoom_out),
+                         ws_gui_app);
+        g_signal_connect(G_OBJECT
+                         (ws_gui_app->ws_gui_menu->ws_gui_menu_full_screen),
+                         "activate",
+                         GTK_SIGNAL_FUNC(ws_gui_full_screen),
+                         ws_gui_app);
+        g_signal_connect(G_OBJECT
+                         (ws_gui_app->ws_gui_menu->ws_gui_menu_find_word),
+                         "activate",
+                         GTK_SIGNAL_FUNC(ws_gui_search),
+                         ws_gui_app);
+        g_signal_connect(G_OBJECT
+                         (ws_gui_app->ws_gui_menu->ws_gui_menu_find_next),
+                         "activate",
+                         GTK_SIGNAL_FUNC(ws_gui_history_next),
+                         ws_gui_app);
+        g_signal_connect(G_OBJECT
+                         (ws_gui_app->ws_gui_menu->ws_gui_menu_find_prev),
+                         "activate",
+                         GTK_SIGNAL_FUNC(ws_gui_history_back),
+                         ws_gui_app);
+        g_signal_connect(G_OBJECT
+                         (ws_gui_app->ws_gui_menu->ws_gui_menu_stop),
+                         "activate",
+                         GTK_SIGNAL_FUNC(ws_gui_search_stop),
+                         ws_gui_app);
+        g_signal_connect(G_OBJECT
+                         (ws_gui_app->ws_gui_menu->ws_gui_menu_about), "activate",
+                         G_CALLBACK(ws_gui_about_application),
+                         ws_gui_app);
+        g_signal_connect(G_OBJECT
+                         (ws_gui_app->ws_gui_menu->ws_gui_menu_close),
+                         "activate", 
+                         G_CALLBACK(ws_gui_menu_quit),
+                         ws_gui_app);
+
+        g_signal_connect(G_OBJECT
+                         (ws_gui_app->ws_gui_menu->ws_gui_menu_edit),
+                         "activate",
+                         GTK_SIGNAL_FUNC(ws_gui_check_clipboard),
+                         ws_gui_app);
  
-       ws_gui_app->ws_gui_menu->ws_gui_menu_dictionaries = gtk_menu_item_new_with_label("Dictionaries");
-       ws_gui_app->ws_gui_menu->ws_gui_menu_edit = gtk_menu_item_new_with_label("Edit");
-       ws_gui_app->ws_gui_menu->ws_gui_menu_view = gtk_menu_item_new_with_label("View");
-       ws_gui_app->ws_gui_menu->ws_gui_menu_search = gtk_menu_item_new_with_label("Search");
-       ws_gui_app->ws_gui_menu->ws_gui_menu_about = gtk_menu_item_new_with_label("About...");
-       ws_gui_app->ws_gui_menu->ws_gui_menu_close = gtk_menu_item_new_with_label("Close");
-       ws_gui_app->ws_gui_menu->ws_gui_separator = gtk_separator_menu_item_new();
-       ws_gui_app->ws_gui_menu->ws_gui_separator1 = gtk_separator_menu_item_new();
-
-       ws_gui_app->ws_gui_menu->ws_gui_menu_load_dict = gtk_menu_item_new_with_label("Load dictionary");
-       ws_gui_app->ws_gui_menu->ws_gui_menu_select_dict = gtk_menu_item_new_with_label("Select dictionaries ...");
-       ws_gui_app->ws_gui_menu->ws_gui_menu_remove_dict = gtk_menu_item_new_with_label("Remove dictionaries ...");
-       //added by me
-       ws_gui_app->ws_gui_menu->ws_gui_menu_optimize_dict = gtk_menu_item_new_with_label("Optimize dictionaries ...");
-       gtk_menu_append(ws_gui_app->ws_gui_menu->ws_gui_submenu_0, ws_gui_app->ws_gui_menu->ws_gui_menu_load_dict);
-       gtk_menu_append(ws_gui_app->ws_gui_menu->ws_gui_submenu_0, ws_gui_app->ws_gui_menu->ws_gui_menu_select_dict);
-       gtk_menu_append(ws_gui_app->ws_gui_menu->ws_gui_submenu_0, ws_gui_app->ws_gui_menu->ws_gui_menu_remove_dict);
-       //added by me
-       gtk_menu_append(ws_gui_app->ws_gui_menu->ws_gui_submenu_0, ws_gui_app->ws_gui_menu->ws_gui_menu_optimize_dict);
-       gtk_widget_set_sensitive(GTK_WIDGET(ws_gui_app->ws_gui_menu->ws_gui_menu_dictionaries), TRUE);
-
-       ws_gui_app->ws_gui_menu->ws_gui_menu_copy = gtk_menu_item_new_with_label("Copy");
-       ws_gui_app->ws_gui_menu->ws_gui_menu_paste = gtk_menu_item_new_with_label("Paste");
-        ws_gui_app->ws_gui_menu->ws_gui_menu_select_all = gtk_menu_item_new_with_label("Select All");
-        gtk_menu_append(ws_gui_app->ws_gui_menu->ws_gui_submenu_1, ws_gui_app->ws_gui_menu->ws_gui_menu_copy);
-       gtk_menu_append(ws_gui_app->ws_gui_menu->ws_gui_submenu_1, ws_gui_app->ws_gui_menu->ws_gui_menu_paste);
-        gtk_menu_append(ws_gui_app->ws_gui_menu->ws_gui_submenu_1, ws_gui_app->ws_gui_menu->ws_gui_menu_select_all);
-
-        ws_gui_app->ws_gui_menu->ws_gui_menu_hide_list = gtk_check_menu_item_new_with_label("Hide words list");
-        ws_gui_app->ws_gui_menu->ws_gui_menu_zoom_in = gtk_menu_item_new_with_label("Zoom in");
-        ws_gui_app->ws_gui_menu->ws_gui_menu_zoom_out = gtk_menu_item_new_with_label("Zoom out");
-        ws_gui_app->ws_gui_menu->ws_gui_menu_full_screen = gtk_check_menu_item_new_with_label("Full screen");
-        gtk_menu_append(ws_gui_app->ws_gui_menu->ws_gui_submenu_2, ws_gui_app->ws_gui_menu->ws_gui_menu_hide_list);
-       gtk_menu_append(ws_gui_app->ws_gui_menu->ws_gui_submenu_2, ws_gui_app->ws_gui_menu->ws_gui_menu_zoom_in);
-       gtk_menu_append(ws_gui_app->ws_gui_menu->ws_gui_submenu_2, ws_gui_app->ws_gui_menu->ws_gui_menu_zoom_out);
-        gtk_menu_append(ws_gui_app->ws_gui_menu->ws_gui_submenu_2, ws_gui_app->ws_gui_menu->ws_gui_menu_full_screen);
-
-        ws_gui_app->ws_gui_menu->ws_gui_menu_find_word = gtk_menu_item_new_with_label("Find");
-        ws_gui_app->ws_gui_menu->ws_gui_menu_find_next = gtk_menu_item_new_with_label("Find next");
-        ws_gui_app->ws_gui_menu->ws_gui_menu_find_prev = gtk_menu_item_new_with_label("Find previous");
-        ws_gui_app->ws_gui_menu->ws_gui_menu_stop = gtk_menu_item_new_with_label("Stop");
-        gtk_menu_append(ws_gui_app->ws_gui_menu->ws_gui_submenu_3, ws_gui_app->ws_gui_menu->ws_gui_menu_find_word);
-        gtk_menu_append(ws_gui_app->ws_gui_menu->ws_gui_submenu_3, ws_gui_app->ws_gui_menu->ws_gui_menu_find_next);
-        gtk_menu_append(ws_gui_app->ws_gui_menu->ws_gui_submenu_3, ws_gui_app->ws_gui_menu->ws_gui_menu_find_prev);
-        gtk_menu_append(ws_gui_app->ws_gui_menu->ws_gui_submenu_3, ws_gui_app->ws_gui_menu->ws_gui_menu_stop);
-       
-        gtk_menu_append(ws_gui_app->ws_gui_menu->ws_gui_main_menu, ws_gui_app->ws_gui_menu->ws_gui_menu_dictionaries);
-        gtk_menu_item_set_submenu(GTK_MENU_ITEM(ws_gui_app->ws_gui_menu->ws_gui_menu_dictionaries), ws_gui_app->ws_gui_menu->ws_gui_submenu_0);
-       gtk_menu_append(ws_gui_app->ws_gui_menu->ws_gui_main_menu, ws_gui_app->ws_gui_menu->ws_gui_separator1);
-
-       gtk_menu_append(ws_gui_app->ws_gui_menu->ws_gui_main_menu, ws_gui_app->ws_gui_menu->ws_gui_menu_edit);
-        gtk_menu_item_set_submenu(GTK_MENU_ITEM(ws_gui_app->ws_gui_menu->ws_gui_menu_edit), ws_gui_app->ws_gui_menu->ws_gui_submenu_1);
-        gtk_menu_append(ws_gui_app->ws_gui_menu->ws_gui_main_menu, ws_gui_app->ws_gui_menu->ws_gui_menu_view);
-        gtk_menu_item_set_submenu(GTK_MENU_ITEM(ws_gui_app->ws_gui_menu->ws_gui_menu_view), ws_gui_app->ws_gui_menu->ws_gui_submenu_2);
-        gtk_menu_append(ws_gui_app->ws_gui_menu->ws_gui_main_menu, ws_gui_app->ws_gui_menu->ws_gui_menu_search);
-        gtk_menu_item_set_submenu(GTK_MENU_ITEM(ws_gui_app->ws_gui_menu->ws_gui_menu_search), ws_gui_app->ws_gui_menu->ws_gui_submenu_3);
-       gtk_menu_append(ws_gui_app->ws_gui_menu->ws_gui_main_menu, ws_gui_app->ws_gui_menu->ws_gui_separator);
-       gtk_menu_append(ws_gui_app->ws_gui_menu->ws_gui_main_menu, ws_gui_app->ws_gui_menu->ws_gui_menu_about);
-       gtk_menu_append(ws_gui_app->ws_gui_menu->ws_gui_main_menu, ws_gui_app->ws_gui_menu->ws_gui_menu_close);
-
-       g_signal_connect(G_OBJECT(ws_gui_app->ws_gui_menu->ws_gui_menu_load_dict), "activate", G_CALLBACK(ws_gui_dictionary_loader), ws_gui_app);
-       g_signal_connect(G_OBJECT(ws_gui_app->ws_gui_menu->ws_gui_menu_select_dict), "activate", G_CALLBACK(ws_gui_dictionary_chooser), ws_gui_app);
-       g_signal_connect(G_OBJECT(ws_gui_app->ws_gui_menu->ws_gui_menu_remove_dict), "activate", G_CALLBACK(ws_gui_dictionary_remover), ws_gui_app);
-       //added by me 
-       g_signal_connect(G_OBJECT(ws_gui_app->ws_gui_menu->ws_gui_menu_optimize_dict), "activate", G_CALLBACK(ws_gui_dictionary_optimizer), ws_gui_app);
-       g_signal_connect(G_OBJECT(ws_gui_app->ws_gui_menu->ws_gui_menu_copy), "activate", GTK_SIGNAL_FUNC(ws_gui_html_copy), ws_gui_app);
-       g_signal_connect(G_OBJECT(ws_gui_app->ws_gui_menu->ws_gui_menu_paste), "activate", GTK_SIGNAL_FUNC(ws_gui_html_paste), ws_gui_app);
-       g_signal_connect(G_OBJECT(ws_gui_app->ws_gui_menu->ws_gui_menu_select_all), "activate", GTK_SIGNAL_FUNC(ws_gui_html_select_all), ws_gui_app);
-       g_signal_connect(G_OBJECT(ws_gui_app->ws_gui_menu->ws_gui_menu_hide_list), "activate", GTK_SIGNAL_FUNC(ws_gui_words_list_hide_from_menu), ws_gui_app);
-       g_signal_connect(G_OBJECT(ws_gui_app->ws_gui_menu->ws_gui_menu_zoom_in), "activate", G_CALLBACK(ws_gui_html_zoom_in), ws_gui_app);
-       g_signal_connect(G_OBJECT(ws_gui_app->ws_gui_menu->ws_gui_menu_zoom_out), "activate", G_CALLBACK(ws_gui_html_zoom_out), ws_gui_app);
-       g_signal_connect(G_OBJECT(ws_gui_app->ws_gui_menu->ws_gui_menu_full_screen), "activate", GTK_SIGNAL_FUNC(ws_gui_full_screen), ws_gui_app);
-       g_signal_connect(G_OBJECT(ws_gui_app->ws_gui_menu->ws_gui_menu_find_word), "activate", GTK_SIGNAL_FUNC(ws_gui_search), ws_gui_app);
-       g_signal_connect(G_OBJECT(ws_gui_app->ws_gui_menu->ws_gui_menu_find_next), "activate", GTK_SIGNAL_FUNC(ws_gui_history_next), ws_gui_app);
-       g_signal_connect(G_OBJECT(ws_gui_app->ws_gui_menu->ws_gui_menu_find_prev), "activate", GTK_SIGNAL_FUNC(ws_gui_history_back), ws_gui_app);
-       g_signal_connect(G_OBJECT(ws_gui_app->ws_gui_menu->ws_gui_menu_stop), "activate", GTK_SIGNAL_FUNC(ws_gui_search_stop), ws_gui_app);
-       g_signal_connect(G_OBJECT(ws_gui_app->ws_gui_menu->ws_gui_menu_about), "activate", G_CALLBACK(ws_gui_about_application), ws_gui_app);
-       g_signal_connect(G_OBJECT(ws_gui_app->ws_gui_menu->ws_gui_menu_close), "activate", G_CALLBACK(ws_gui_menu_quit), ws_gui_app);
-
-       g_signal_connect(G_OBJECT(ws_gui_app->ws_gui_menu->ws_gui_menu_edit), "activate", GTK_SIGNAL_FUNC(ws_gui_check_clipboard), ws_gui_app);
-       hildon_window_set_menu(HILDON_WINDOW(ws_gui_app->ws_gui_hildon_window), GTK_MENU(ws_gui_app->ws_gui_menu->ws_gui_main_menu));
-       
-       gtk_widget_set_sensitive(GTK_WIDGET(ws_gui_app->ws_gui_menu->ws_gui_menu_stop), FALSE);
-       gtk_widget_set_sensitive(GTK_WIDGET(ws_gui_app->ws_gui_menu->ws_gui_menu_find_next), FALSE);
-       gtk_widget_set_sensitive(GTK_WIDGET(ws_gui_app->ws_gui_menu->ws_gui_menu_find_prev), FALSE);
-
-       gtk_widget_show_all(ws_gui_app->ws_gui_menu->ws_gui_main_menu);
+        hildon_window_set_menu(HILDON_WINDOW(ws_gui_app->ws_gui_hildon_window),
+                               GTK_MENU(
+                                    ws_gui_app->ws_gui_menu->ws_gui_main_menu));
+                
+        gtk_widget_set_sensitive(GTK_WIDGET
+                                 (ws_gui_app->ws_gui_menu->ws_gui_menu_stop),
+                                 FALSE);
+        gtk_widget_set_sensitive(GTK_WIDGET
+                               (ws_gui_app->ws_gui_menu->ws_gui_menu_find_next),
+                               FALSE);
+        gtk_widget_set_sensitive(GTK_WIDGET
+                               (ws_gui_app->ws_gui_menu->ws_gui_menu_find_prev),
+                               FALSE);
+
+        gtk_widget_show_all(ws_gui_app->ws_gui_menu->ws_gui_main_menu);
 }
 
 
-/** this function creates contex popup menu and its items and connect signals to them
+/** this function creates contex popup menu and its items and connect signals to 
+ * them
  *
  * @param user_data - set when the signal handler was connected
  */
 void ws_gui_create_popup_menu (gpointer user_data)
 {
-       WSGuiApp* ws_gui_app=(WSGuiApp*)user_data;
-       
-       ws_gui_app->ws_gui_menu->ws_gui_popup_menu = gtk_menu_new();
-       ws_gui_app->ws_gui_menu->ws_gui_popup_submenu = gtk_menu_new();
-       ws_gui_app->ws_gui_menu->ws_gui_separator = gtk_separator_menu_item_new();
-       
-       ws_gui_app->ws_gui_menu->ws_gui_popup_copy = gtk_menu_item_new_with_label("Copy");
-       gtk_menu_append((ws_gui_app->ws_gui_menu->ws_gui_popup_submenu), ws_gui_app->ws_gui_menu->ws_gui_popup_copy);
-
-       ws_gui_app->ws_gui_menu->ws_gui_popup_paste = gtk_menu_item_new_with_label("Paste");
-       gtk_menu_append((ws_gui_app->ws_gui_menu->ws_gui_popup_submenu), ws_gui_app->ws_gui_menu->ws_gui_popup_paste);
-
-       ws_gui_app->ws_gui_menu->ws_gui_popup_select_all = gtk_menu_item_new_with_label("Select All");
-       gtk_menu_append((ws_gui_app->ws_gui_menu->ws_gui_popup_submenu), ws_gui_app->ws_gui_menu->ws_gui_popup_select_all);
-       gtk_widget_show_all(ws_gui_app->ws_gui_menu->ws_gui_popup_submenu);
-       
-       ws_gui_app->ws_gui_menu->ws_gui_popup_edit = gtk_menu_item_new_with_label ("Edit");
-       gtk_menu_append ((ws_gui_app->ws_gui_menu->ws_gui_popup_menu), ws_gui_app->ws_gui_menu->ws_gui_popup_edit);
-
-       gtk_menu_append ((ws_gui_app->ws_gui_menu->ws_gui_popup_menu), ws_gui_app->ws_gui_menu->ws_gui_separator);
-
-       ws_gui_app->ws_gui_menu->ws_gui_popup_zoom_in = gtk_menu_item_new_with_label ("Zoom in");
-       gtk_menu_append ((ws_gui_app->ws_gui_menu->ws_gui_popup_menu), ws_gui_app->ws_gui_menu->ws_gui_popup_zoom_in);
-
-       ws_gui_app->ws_gui_menu->ws_gui_popup_zoom_out = gtk_menu_item_new_with_label ("Zoom out");
-       gtk_menu_append ((ws_gui_app->ws_gui_menu->ws_gui_popup_menu), ws_gui_app->ws_gui_menu->ws_gui_popup_zoom_out);
-
-       gtk_widget_show_all(ws_gui_app->ws_gui_menu->ws_gui_popup_menu);
-       gtk_menu_item_set_submenu(GTK_MENU_ITEM(ws_gui_app->ws_gui_menu->ws_gui_popup_edit), ws_gui_app->ws_gui_menu->ws_gui_popup_submenu);
-
-       g_signal_connect(G_OBJECT(ws_gui_app->ws_gui_menu->ws_gui_popup_copy), "activate", G_CALLBACK(ws_gui_html_copy), ws_gui_app);
-       g_signal_connect(G_OBJECT(ws_gui_app->ws_gui_menu->ws_gui_popup_paste), "activate", G_CALLBACK(ws_gui_html_paste), ws_gui_app);
-       g_signal_connect(G_OBJECT(ws_gui_app->ws_gui_menu->ws_gui_popup_select_all), "activate", G_CALLBACK(ws_gui_html_select_all), ws_gui_app);
-       g_signal_connect(G_OBJECT(ws_gui_app->ws_gui_menu->ws_gui_popup_zoom_in), "activate", G_CALLBACK(ws_gui_html_zoom_in), ws_gui_app);
-       g_signal_connect(G_OBJECT(ws_gui_app->ws_gui_menu->ws_gui_popup_zoom_out), "activate", G_CALLBACK(ws_gui_html_zoom_out), ws_gui_app);
-       
-       if (gtk_clipboard_wait_for_text(ws_gui_app->ws_gui_clipboard) != NULL)
-       {
-               gtk_widget_set_sensitive(GTK_WIDGET(ws_gui_app->ws_gui_menu->ws_gui_popup_paste), TRUE);
-       }
-       else
-       {
-               gtk_widget_set_sensitive(GTK_WIDGET(ws_gui_app->ws_gui_menu->ws_gui_popup_paste), FALSE);
-       }
-
-       gtk_menu_popup(GTK_MENU(ws_gui_app->ws_gui_menu->ws_gui_popup_menu), NULL, NULL, NULL, ws_gui_app, 0, 0);
+       WSGuiApp* ws_gui_app=(WSGuiApp*)user_data;
+           
+       ws_gui_app->ws_gui_menu->ws_gui_popup_menu = gtk_menu_new();
+       ws_gui_app->ws_gui_menu->ws_gui_popup_submenu = gtk_menu_new();
+       ws_gui_app->ws_gui_menu->ws_gui_separator = gtk_separator_menu_item_new();
+              
+       struct _GtkHTML *tmp = (struct _GtkHTML *)(ws_gui_app->ws_gui_html);
+                
+       ws_gui_app->ws_gui_menu->ws_gui_popup_search = 
+                gtk_menu_item_new_with_label("Search");
+       gtk_menu_append((ws_gui_app->ws_gui_menu->ws_gui_popup_menu),
+                       ws_gui_app->ws_gui_menu->ws_gui_popup_search);
+       gtk_menu_append ((ws_gui_app->ws_gui_menu->ws_gui_popup_menu),
+                        gtk_separator_menu_item_new());
+                
+       if (html_engine_is_selection_active(tmp->engine) == TRUE)
+       {
+               gtk_widget_set_sensitive(GTK_WIDGET
+                                 (ws_gui_app->ws_gui_menu->ws_gui_popup_search),
+                                 TRUE);
+       }
+       else 
+       {
+               gtk_widget_set_sensitive(GTK_WIDGET
+                                 (ws_gui_app->ws_gui_menu->ws_gui_popup_search),
+                                 FALSE);
+       }
+
+       ws_gui_app->ws_gui_menu->ws_gui_popup_copy = 
+                gtk_menu_item_new_with_label("Copy");
+       gtk_menu_append((ws_gui_app->ws_gui_menu->ws_gui_popup_submenu),
+                       ws_gui_app->ws_gui_menu->ws_gui_popup_copy);
+
+       ws_gui_app->ws_gui_menu->ws_gui_popup_paste = 
+                gtk_menu_item_new_with_label("Paste");
+       gtk_menu_append((ws_gui_app->ws_gui_menu->ws_gui_popup_submenu),
+                       ws_gui_app->ws_gui_menu->ws_gui_popup_paste);
+
+       ws_gui_app->ws_gui_menu->ws_gui_popup_select_all = 
+                gtk_menu_item_new_with_label("Select All");
+       gtk_menu_append((ws_gui_app->ws_gui_menu->ws_gui_popup_submenu),
+                       ws_gui_app->ws_gui_menu->ws_gui_popup_select_all);
+
+       gtk_widget_show_all(ws_gui_app->ws_gui_menu->ws_gui_popup_submenu);
+                
+                ws_gui_app->ws_gui_menu->ws_gui_popup_edit = 
+                gtk_menu_item_new_with_label ("Edit");
+       gtk_menu_append ((ws_gui_app->ws_gui_menu->ws_gui_popup_menu),
+                        ws_gui_app->ws_gui_menu->ws_gui_popup_edit);
+
+       gtk_menu_append ((ws_gui_app->ws_gui_menu->ws_gui_popup_menu),
+                        ws_gui_app->ws_gui_menu->ws_gui_separator);
+                
+       ws_gui_app->ws_gui_menu->ws_gui_popup_zoom_in = 
+                gtk_menu_item_new_with_label ("Zoom in");
+       gtk_menu_append ((ws_gui_app->ws_gui_menu->ws_gui_popup_menu),
+                        ws_gui_app->ws_gui_menu->ws_gui_popup_zoom_in);
+
+       ws_gui_app->ws_gui_menu->ws_gui_popup_zoom_out =
+                gtk_menu_item_new_with_label ("Zoom out");
+       gtk_menu_append ((ws_gui_app->ws_gui_menu->ws_gui_popup_menu),
+                        ws_gui_app->ws_gui_menu->ws_gui_popup_zoom_out);
+
+       gtk_widget_show_all(ws_gui_app->ws_gui_menu->ws_gui_popup_menu);
+       gtk_menu_item_set_submenu(GTK_MENU_ITEM
+                                 (ws_gui_app->ws_gui_menu->ws_gui_popup_edit),
+                                 ws_gui_app->ws_gui_menu->ws_gui_popup_submenu);
+
+       g_signal_connect(G_OBJECT
+                        (ws_gui_app->ws_gui_menu->ws_gui_popup_search),
+                        "activate",
+                        G_CALLBACK(ws_gui_popup_search),
+                        ws_gui_app);
+       g_signal_connect(G_OBJECT
+                        (ws_gui_app->ws_gui_menu->ws_gui_popup_copy),
+                        "activate", 
+                        G_CALLBACK(ws_gui_html_copy),
+                        ws_gui_app);
+       g_signal_connect(G_OBJECT
+                        (ws_gui_app->ws_gui_menu->ws_gui_popup_paste),
+                        "activate",
+                        G_CALLBACK(ws_gui_html_paste),
+                        ws_gui_app);
+       g_signal_connect(G_OBJECT
+                        (ws_gui_app->ws_gui_menu->ws_gui_popup_select_all),
+                        "activate",
+                        G_CALLBACK(ws_gui_html_select_all),
+                        ws_gui_app);
+       g_signal_connect(G_OBJECT
+                        (ws_gui_app->ws_gui_menu->ws_gui_popup_zoom_in),
+                        "activate",
+                        G_CALLBACK(ws_gui_html_zoom_in), ws_gui_app);
+      g_signal_connect(G_OBJECT
+                       (ws_gui_app->ws_gui_menu->ws_gui_popup_zoom_out),
+                       "activate",
+                       G_CALLBACK(ws_gui_html_zoom_out),
+                       ws_gui_app);
+                
+      if (gtk_clipboard_wait_for_text(ws_gui_app->ws_gui_clipboard) != NULL)
+      {
+               gtk_widget_set_sensitive(GTK_WIDGET
+                                  (ws_gui_app->ws_gui_menu->ws_gui_popup_paste),
+                                  TRUE);
+      }
+      else
+      {
+               gtk_widget_set_sensitive(GTK_WIDGET
+                                  (ws_gui_app->ws_gui_menu->ws_gui_popup_paste),
+                                  FALSE);
+      }
+
+      gtk_menu_popup(GTK_MENU(ws_gui_app->ws_gui_menu->ws_gui_popup_menu),
+                     NULL,
+                     NULL,
+                     NULL,
+                     ws_gui_app,
+                     0,
+                     0);
 }
 
-/** this function creates dialog popup window and allows to select dictionaries which user wants to use
+/** this function creates dialog popup window and allows to select dictionaries
+ *  which user wants to use
  *
  * @param menuitem - the object which received the signal
  * @param user_data - set when the signal handler was connected
  */
 void ws_gui_dictionary_chooser(GtkMenuItem *menuitem, gpointer user_data)
 {
-       WSGuiApp* ws_gui_app=(WSGuiApp*)user_data;
-
-       GtkWidget *dialog1;
-       GtkWidget *dialog_vbox1;
-       GtkWidget *scrolledwindow1;
-       GtkWidget *viewport1;
-       GtkWidget *vbox1;
-
-       GtkWidget *checkbutton;
-       GtkWidget *cancel_button;
-       GtkWidget *ok_button;
-       guint i =0;
-       gchar* string;
-       gchar* path;
-       const gchar* name;
-       GArray *checkboxes;
-       
-       checkboxes = g_array_new (TRUE, TRUE, sizeof(GtkWidget*));
-
-       if (gconf_client_dir_exists(ws_gui_app->client, GCONF_PATH, NULL) == TRUE)
-       {
-               ws_gui_app->directories = gconf_client_all_dirs(ws_gui_app->client, GCONF_PATH, NULL);
-       }
-       else 
-       {
-               g_log(G_LOG_DOMAIN, G_LOG_LEVEL_INFO, "\n.::GUI::. /apps/WhiteStork/Dictionaries does not exist!!");
-       }
-
-       dialog1 = gtk_dialog_new ();
-       gtk_window_set_title (GTK_WINDOW (dialog1), ("Choose dictionaries"));
-       gtk_window_set_type_hint (GTK_WINDOW (dialog1), GDK_WINDOW_TYPE_HINT_DIALOG);
-       gtk_window_set_default_size(GTK_WINDOW (dialog1), 300, 200);
-       
-       dialog_vbox1 = GTK_DIALOG (dialog1)->vbox;
-       gtk_widget_show (dialog_vbox1);
-       
-       scrolledwindow1 = gtk_scrolled_window_new (NULL, NULL);
-       gtk_widget_show (scrolledwindow1);
-       gtk_box_pack_start (GTK_BOX (dialog_vbox1), scrolledwindow1, TRUE, TRUE, 0);
-       
-       viewport1 = gtk_viewport_new (NULL, NULL);
-       gtk_widget_show (viewport1);
-       gtk_container_add (GTK_CONTAINER (scrolledwindow1), viewport1);
-       
-       vbox1 = gtk_vbox_new (FALSE, 0);
-       gtk_widget_show (vbox1);
-       gtk_container_add (GTK_CONTAINER (viewport1), vbox1);
-       
-       for (i=0; i< g_slist_length(ws_gui_app->directories);i++)
-       {
-               string = (gchar*)g_slist_nth_data(ws_gui_app->directories, i); 
-               name = g_path_get_basename(string);
-               checkbutton = gtk_check_button_new_with_label(name);
-               path = g_strconcat(string, "/active", NULL);
-               
-               if (gconf_client_get_bool (ws_gui_app->client, path, NULL) == TRUE)
-               {
-                       gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbutton), TRUE);
-               }
-               else 
-               {
-                       gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbutton), FALSE);
-               }
-               
-               g_array_append_val(checkboxes, checkbutton);
-               gtk_box_pack_start (GTK_BOX (vbox1), checkbutton, FALSE, FALSE, 0);
-               gtk_widget_show (checkbutton);
-       }
-       
-       cancel_button = gtk_button_new_from_stock ("cancel");
-       gtk_widget_show (cancel_button);
-       gtk_dialog_add_action_widget (GTK_DIALOG (dialog1), cancel_button, GTK_RESPONSE_CANCEL);
-       
-       ok_button = gtk_button_new_from_stock ("ok");
-       gtk_widget_show (ok_button);
-       gtk_dialog_add_action_widget (GTK_DIALOG (dialog1), ok_button, GTK_RESPONSE_OK);
-       
-       i = gtk_dialog_run(GTK_DIALOG(dialog1));
-
-       if (i == GTK_RESPONSE_OK) 
-       {
-               for(i=0;i<(checkboxes->len);i++)
-               {
-                       if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(g_array_index(checkboxes, GtkWidget *, i))) == TRUE)
-                       {
-                               name = gtk_button_get_label(GTK_BUTTON(g_array_index(checkboxes, GtkWidget *, i)));
-                               path=g_strconcat(GCONF_PATH, "/", name, "/active", NULL);
-                               gconf_client_set_bool (ws_gui_app->client, path, TRUE, NULL);
-                       }
-
-                       if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(g_array_index(checkboxes, GtkWidget *, i))) == FALSE)
-                       {
-                               name = gtk_button_get_label(GTK_BUTTON(g_array_index(checkboxes, GtkWidget *, i)));
-                               path=g_strconcat(GCONF_PATH, "/", name, "/active", NULL);
-                               gconf_client_set_bool(ws_gui_app->client, path, FALSE, NULL);
-                       }
-               }
-       ws_dbus_notify(ws_gui_app->dbus_data, WS_DBUS_INFO_CONFIG_CHANGED);
-       gtk_widget_destroy (dialog1);
-       }
-       else if (i == GTK_RESPONSE_CANCEL) 
-       {
-               gtk_widget_destroy (dialog1);
-       }
-       
-       g_slist_free(ws_gui_app->directories);
+        WSGuiApp* ws_gui_app=(WSGuiApp*)user_data;
+        GtkWidget *dialog1;
+        GtkWidget *dialog_vbox1;
+        GtkWidget *scrolledwindow1;
+        GtkWidget *viewport1;
+        GtkWidget *vbox1;
+        
+        GtkWidget *checkbutton;
+        GtkWidget *cancel_button;
+        GtkWidget *ok_button;
+        guint i =0;
+        gchar* string;
+        gchar* path;
+        const gchar* name;
+        GArray *checkboxes;
+                
+        checkboxes = g_array_new (TRUE, TRUE, sizeof(GtkWidget*));
+
+        if (gconf_client_dir_exists(ws_gui_app->client, GCONF_PATH, NULL) == TRUE)
+        {
+               ws_gui_app->directories = 
+                       gconf_client_all_dirs(ws_gui_app->client,
+                                             GCONF_PATH,
+                                             NULL);
+        }
+        else 
+        {
+               g_log(G_LOG_DOMAIN, G_LOG_LEVEL_INFO,
+                  "\n.::GUI::. /apps/WhiteStork/Dictionaries does not exist!!");
+        }
+
+        dialog1 = gtk_dialog_new ();
+        gtk_window_set_title (GTK_WINDOW (dialog1), ("Choose dictionaries"));
+        gtk_window_set_type_hint (GTK_WINDOW (dialog1),
+                                  GDK_WINDOW_TYPE_HINT_DIALOG);
+        gtk_window_set_default_size(GTK_WINDOW (dialog1), 300, 200);
+                
+        dialog_vbox1 = GTK_DIALOG (dialog1)->vbox;
+        gtk_widget_show (dialog_vbox1);
+                
+        scrolledwindow1 = gtk_scrolled_window_new (NULL, NULL);
+        gtk_widget_show (scrolledwindow1);
+        gtk_box_pack_start (GTK_BOX (dialog_vbox1),
+                            scrolledwindow1,
+                            TRUE,
+                            TRUE,
+                            0);
+                
+        viewport1 = gtk_viewport_new (NULL, NULL);
+        gtk_widget_show (viewport1);
+        gtk_container_add (GTK_CONTAINER (scrolledwindow1), viewport1);
+                
+        vbox1 = gtk_vbox_new (FALSE, 0);
+        gtk_widget_show (vbox1);
+        gtk_container_add (GTK_CONTAINER (viewport1), vbox1);
+              
+        for (i=0; i< g_slist_length(ws_gui_app->directories);i++)
+        {
+               string = (gchar*)g_slist_nth_data(ws_gui_app->directories, i); 
+               name = g_path_get_basename(string);
+               checkbutton = gtk_check_button_new_with_label(name);
+               path = g_strconcat(string, "/active", NULL);
+                                
+               if (gconf_client_get_bool(ws_gui_app->client, path, NULL) == TRUE)
+               {
+                       gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(
+                                                    checkbutton),
+                                                    TRUE);
+               }
+               else 
+               {
+                       gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(
+                                                    checkbutton),
+                                                    FALSE);
+               }
+                                
+               g_array_append_val(checkboxes, checkbutton);
+               gtk_box_pack_start (GTK_BOX (vbox1), checkbutton, FALSE, FALSE, 0);
+               gtk_widget_show (checkbutton);
+       }
+                
+       cancel_button = gtk_button_new_from_stock ("cancel");
+       gtk_widget_show (cancel_button);
+       gtk_dialog_add_action_widget (GTK_DIALOG (dialog1),
+                                     cancel_button,
+                                     GTK_RESPONSE_CANCEL);
+                
+       ok_button = gtk_button_new_from_stock ("ok");
+       gtk_widget_show (ok_button);
+       gtk_dialog_add_action_widget(GTK_DIALOG (dialog1),
+                                    ok_button,
+                                    GTK_RESPONSE_OK);
+                
+       i = gtk_dialog_run(GTK_DIALOG(dialog1));
+
+       if (i == GTK_RESPONSE_OK) 
+       {
+               for(i=0;i<(checkboxes->len);i++)
+               {
+                       if (gtk_toggle_button_get_active(
+                                GTK_TOGGLE_BUTTON(g_array_index(checkboxes,
+                                                  GtkWidget *, i))) == TRUE)
+                       {
+                               name = gtk_button_get_label(GTK_BUTTON(
+                                    g_array_index(checkboxes, GtkWidget *, i)));
+                               path=g_strconcat(GCONF_PATH,
+                                                "/",
+                                                name,
+                                                "/active",
+                                                NULL);
+                               gconf_client_set_bool(ws_gui_app->client,
+                                                      path,
+                                                      TRUE,
+                                                      NULL);
+                       }
+
+                       if (gtk_toggle_button_get_active(
+                               GTK_TOGGLE_BUTTON(g_array_index(checkboxes,
+                                                     GtkWidget *, i))) == FALSE)
+                       {
+                               name = gtk_button_get_label(GTK_BUTTON(
+                                    g_array_index(checkboxes, GtkWidget *, i)));
+                               path=g_strconcat(GCONF_PATH,
+                                                "/",
+                                                name,
+                                                "/active",
+                                                NULL);
+                               gconf_client_set_bool(ws_gui_app->client,
+                                                     path,
+                                                     FALSE,
+                                                     NULL);
+                       }
+               }
+                
+               ws_dbus_notify(ws_gui_app->dbus_data, WS_DBUS_INFO_CONFIG_CHANGED);
+               gtk_widget_destroy (dialog1);
+       }
+       else if (i == GTK_RESPONSE_CANCEL) 
+       {
+               gtk_widget_destroy (dialog1);
+       }
+                
+       g_slist_free(ws_gui_app->directories);
 }
 
 /** this function creates dialog popup window and allows optimize dictionaries
@@ -421,462 +759,579 @@ void ws_gui_dictionary_chooser(GtkMenuItem *menuitem, gpointer user_data)
  */
 void ws_gui_dictionary_optimizer(GtkMenuItem *menuitem, gpointer user_data)
 {
-       WSGuiApp* ws_gui_app=(WSGuiApp*)user_data;
-
-       GtkWidget *dialog1;
-       GtkWidget *dialog_vbox1;
-       GtkWidget *scrolledwindow1;
-       GtkWidget *viewport1;
-       GtkWidget *vbox1;
-
-       GtkWidget *checkbutton;
-       GtkWidget *cancel_button;
-       GtkWidget *ok_button;
-       guint i =0;
-       gchar* string;
-       gchar* path;
-       const gchar* name;
-       GArray *checkboxes;
-       
-       checkboxes = g_array_new (TRUE, TRUE, sizeof(GtkWidget*));
-
-       if (gconf_client_dir_exists(ws_gui_app->client, GCONF_PATH, NULL) == TRUE)
-       {
-               ws_gui_app->directories = gconf_client_all_dirs(ws_gui_app->client, GCONF_PATH, NULL);
-       }
-       else 
-       {
-               g_log(G_LOG_DOMAIN, G_LOG_LEVEL_INFO, "\n.::GUI::. /apps/WhiteStork/Dictionaries does not exist!!");
-       }
-
-       for (i=0; i< g_slist_length(ws_gui_app->directories);i++)
-       {
-               string = (gchar*)g_slist_nth_data(ws_gui_app->directories, i); 
-               name = g_path_get_basename(string);
-               
-               path = g_strconcat(string, "/optimized", NULL);
-               if (gconf_client_get_bool (ws_gui_app->client, path, NULL) == FALSE)
-               {
-                       checkbutton = gtk_check_button_new_with_label(name);
-                       g_array_append_val(checkboxes, checkbutton);
-               }
-       }
-       if (checkboxes->len <= 0)
-       {
-               ws_gui_app->ws_message_dialog = gtk_message_dialog_new (GTK_WINDOW(ws_gui_app->ws_gui_hildon_window),
-                                  GTK_DIALOG_DESTROY_WITH_PARENT,
-                                  GTK_MESSAGE_ERROR,
-                                  GTK_BUTTONS_OK,
-                                  "There are no dictionaries to optimize");
-               gtk_widget_show_all(ws_gui_app->ws_message_dialog);
-               if (gtk_dialog_run (GTK_DIALOG (ws_gui_app->ws_message_dialog)) == GTK_RESPONSE_OK)
-               {
-                       gtk_widget_destroy(ws_gui_app->ws_message_dialog);
-               }       
-       }
-       
-       else
-       {
-       dialog1 = gtk_dialog_new ();
-       gtk_window_set_title (GTK_WINDOW (dialog1), ("Choose dictionaries"));
-       gtk_window_set_type_hint (GTK_WINDOW (dialog1), GDK_WINDOW_TYPE_HINT_DIALOG);
-       gtk_window_set_default_size(GTK_WINDOW (dialog1), 300, 200);
-       
-       dialog_vbox1 = GTK_DIALOG (dialog1)->vbox;
-       gtk_widget_show (dialog_vbox1);
-       
-       scrolledwindow1 = gtk_scrolled_window_new (NULL, NULL);
-       gtk_widget_show (scrolledwindow1);
-       gtk_box_pack_start (GTK_BOX (dialog_vbox1), scrolledwindow1, TRUE, TRUE, 0);
-       
-       viewport1 = gtk_viewport_new (NULL, NULL);
-       gtk_widget_show (viewport1);
-       gtk_container_add (GTK_CONTAINER (scrolledwindow1), viewport1);
-       
-       vbox1 = gtk_vbox_new (FALSE, 0);
-       gtk_widget_show (vbox1);
-       gtk_container_add (GTK_CONTAINER (viewport1), vbox1);
-       for (i=0; i<checkboxes->len; i++)
-       {
-               gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(g_array_index(checkboxes, GtkWidget*, i)), FALSE);
-               gtk_box_pack_start (GTK_BOX (vbox1), g_array_index(checkboxes, GtkWidget*, i), FALSE, FALSE, 0);
-               gtk_widget_show (g_array_index(checkboxes, GtkWidget*, i));
-       }
-       cancel_button = gtk_button_new_from_stock ("cancel");
-       gtk_widget_show (cancel_button);
-       gtk_dialog_add_action_widget (GTK_DIALOG (dialog1), cancel_button, GTK_RESPONSE_CANCEL);
-       ok_button = gtk_button_new_from_stock ("ok");
-       gtk_widget_show (ok_button);
-       gtk_dialog_add_action_widget (GTK_DIALOG (dialog1), ok_button, GTK_RESPONSE_OK);
-       i = gtk_dialog_run(GTK_DIALOG(dialog1));
-       if (i == GTK_RESPONSE_OK) 
-       {
-               for(i=0;i<(checkboxes->len);i++)
-               {
-                       if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(g_array_index(checkboxes, GtkWidget *, i))) == TRUE)
-                       {
-                               name = gtk_button_get_label(GTK_BUTTON(g_array_index(checkboxes, GtkWidget *, i)));
-                               path=g_strconcat(GCONF_PATH, "/", name, "/optimized", NULL);
-                               gconf_client_set_bool (ws_gui_app->client, path, TRUE, NULL);
-                       }
-                       if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(g_array_index(checkboxes, GtkWidget *, i))) == FALSE)
-                       {
-                               name = gtk_button_get_label(GTK_BUTTON(g_array_index(checkboxes, GtkWidget *, i)));
-                               path=g_strconcat(GCONF_PATH, "/", name, "/optimized", NULL);
-                               gconf_client_set_bool(ws_gui_app->client, path, FALSE, NULL);
-                       }
-               }
-               ws_dbus_notify(ws_gui_app->dbus_data, WS_DBUS_INFO_CONFIG_CHANGED);
-               gtk_widget_destroy (dialog1);
-       }
-       else if (i == GTK_RESPONSE_CANCEL) 
-       {
-               gtk_widget_destroy (dialog1);
-       }
-       }
-       g_slist_free(ws_gui_app->directories);
+        WSGuiApp* ws_gui_app=(WSGuiApp*)user_data;
+
+        GtkWidget *dialog1;
+        GtkWidget *dialog_vbox1;
+        GtkWidget *scrolledwindow1;
+        GtkWidget *viewport1;
+        GtkWidget *vbox1;
+
+        GtkWidget *checkbutton;
+        GtkWidget *cancel_button;
+        GtkWidget *ok_button;
+        guint i =0;
+        gchar* string;
+        gchar* path;
+        const gchar* name;
+        GArray *checkboxes;
+                
+        checkboxes = g_array_new (TRUE, TRUE, sizeof(GtkWidget*));
+
+        if (gconf_client_dir_exists(ws_gui_app->client, GCONF_PATH, NULL) == TRUE)
+        {
+                ws_gui_app->directories = 
+                    gconf_client_all_dirs(ws_gui_app->client, GCONF_PATH, NULL);
+        }
+        else 
+        {
+                g_log(G_LOG_DOMAIN, G_LOG_LEVEL_INFO,
+                  "\n.::GUI::. /apps/WhiteStork/Dictionaries does not exist!!");
+        }
+
+        for (i=0; i< g_slist_length(ws_gui_app->directories);i++)
+        {
+                string = (gchar*)g_slist_nth_data(ws_gui_app->directories, i); 
+                name = g_path_get_basename(string);
+                                
+                path = g_strconcat(string, "/optimized", NULL);
+                if (gconf_client_get_bool (ws_gui_app->client, path, NULL) == FALSE)
+                {
+                        checkbutton = gtk_check_button_new_with_label(name);
+                        g_array_append_val(checkboxes, checkbutton);
+                }
+        }
+        if (checkboxes->len <= 0)
+        {
+                ws_gui_app->ws_message_dialog = gtk_message_dialog_new(
+                                   GTK_WINDOW(ws_gui_app->ws_gui_hildon_window),
+                                   GTK_DIALOG_DESTROY_WITH_PARENT,
+                                   GTK_MESSAGE_ERROR,
+                                   GTK_BUTTONS_OK,
+                                   "There are no dictionaries to optimize");
+               gtk_widget_show_all(ws_gui_app->ws_message_dialog);
+               if (gtk_dialog_run (GTK_DIALOG (
+                        ws_gui_app->ws_message_dialog)) == GTK_RESPONSE_OK)
+               {
+                        gtk_widget_destroy(ws_gui_app->ws_message_dialog);
+               }                
+       }            
+       else
+       {
+                dialog1 = gtk_dialog_new ();
+                gtk_window_set_title(GTK_WINDOW (dialog1),
+                                     ("Choose dictionaries"));
+                gtk_window_set_type_hint(GTK_WINDOW (dialog1),
+                                         GDK_WINDOW_TYPE_HINT_DIALOG);
+                gtk_window_set_default_size(GTK_WINDOW (dialog1), 300, 200);
+                
+                dialog_vbox1 = GTK_DIALOG (dialog1)->vbox;
+                gtk_widget_show (dialog_vbox1);
+                
+                scrolledwindow1 = gtk_scrolled_window_new (NULL, NULL);
+                gtk_widget_show (scrolledwindow1);
+                gtk_box_pack_start(GTK_BOX (dialog_vbox1),
+                                   scrolledwindow1,
+                                   TRUE,
+                                   TRUE,
+                                   0);
+                
+                viewport1 = gtk_viewport_new (NULL, NULL);
+                gtk_widget_show (viewport1);
+                gtk_container_add (GTK_CONTAINER (scrolledwindow1), viewport1);
+                
+                vbox1 = gtk_vbox_new (FALSE, 0);
+                gtk_widget_show (vbox1);
+                gtk_container_add (GTK_CONTAINER (viewport1), vbox1);
+                for (i=0; i<checkboxes->len; i++)
+                {
+                        gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(
+                                      g_array_index(checkboxes, GtkWidget*, i)),
+                                      FALSE);
+                        gtk_box_pack_start(GTK_BOX (vbox1),
+                                       g_array_index(checkboxes, GtkWidget*, i),
+                                       FALSE,
+                                       FALSE,
+                                       0);
+                        gtk_widget_show(g_array_index(checkboxes, GtkWidget*, i));
+                }
+                cancel_button = gtk_button_new_from_stock ("cancel");
+                gtk_widget_show (cancel_button);
+                gtk_dialog_add_action_widget(GTK_DIALOG (dialog1),
+                                             cancel_button,
+                                             GTK_RESPONSE_CANCEL);
+                ok_button = gtk_button_new_from_stock ("ok");
+                gtk_widget_show (ok_button);
+                gtk_dialog_add_action_widget(GTK_DIALOG (dialog1),
+                                             ok_button,
+                                             GTK_RESPONSE_OK);
+                i = gtk_dialog_run(GTK_DIALOG(dialog1));
+                if (i == GTK_RESPONSE_OK) 
+                {
+                        for(i=0;i<(checkboxes->len);i++)
+                        {
+                                if (gtk_toggle_button_get_active(
+                                    GTK_TOGGLE_BUTTON(
+                                        g_array_index(checkboxes,
+                                                GtkWidget *, i))) == TRUE)
+                                {
+                                        name = gtk_button_get_label(GTK_BUTTON(
+                                                g_array_index(checkboxes,
+                                                              GtkWidget *,
+                                                              i)));
+                                        path=g_strconcat(GCONF_PATH,
+                                                         "/",
+                                                         name,
+                                                         "/optimized",
+                                                         NULL);
+                                        gconf_client_set_bool(ws_gui_app->client,
+                                                               path,
+                                                               TRUE,
+                                                               NULL);
+                                }
+                                if (gtk_toggle_button_get_active(
+                                     GTK_TOGGLE_BUTTON(
+                                       g_array_index(checkboxes,
+                                                     GtkWidget *, i))) == FALSE)
+                                {
+                                        name = gtk_button_get_label(GTK_BUTTON
+                                                      (g_array_index(checkboxes,
+                                                                     GtkWidget *,
+                                                                     i)));
+                                        path=g_strconcat(GCONF_PATH,
+                                                         "/",
+                                                         name,
+                                                         "/optimized",
+                                                         NULL);
+                                        gconf_client_set_bool(ws_gui_app->client,
+                                                              path,
+                                                              FALSE,
+                                                              NULL);
+                                }
+                        }
+                        ws_dbus_notify(ws_gui_app->dbus_data,
+                                       WS_DBUS_INFO_CONFIG_CHANGED);
+                        gtk_widget_destroy (dialog1);
+                }
+                else if (i == GTK_RESPONSE_CANCEL) 
+                {
+                        gtk_widget_destroy (dialog1);
+                }
+        }
+        g_slist_free(ws_gui_app->directories);
 }
 
-/** this function creates dialog popup window which allows to load a new dictionary file into application
+/** this function creates dialog popup window which allows to load a new
+ *dictionary file into application
  *
  * @param menuitem - the object which received the signal
  * @param user_data - set when the signal handler was connected
  */
 void ws_gui_dictionary_loader(GtkMenuItem *menuitem, gpointer user_data)
 {
-       WSGuiApp* ws_gui_app=(WSGuiApp*)user_data;
-               
-       GtkWidget *dialog;
-       GtkWidget *dialog2;
-
-       dialog = gtk_file_chooser_dialog_new("Load dictionary", GTK_WINDOW(ws_gui_app->ws_gui_hildon_window), GTK_FILE_CHOOSER_ACTION_SAVE, GTK_STOCK_OK, GTK_RESPONSE_ACCEPT, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, NULL);
-       gtk_window_set_default_size(GTK_WINDOW (dialog), 300, 300);
-       gtk_file_chooser_set_local_only (GTK_FILE_CHOOSER(dialog), TRUE);
-       
-       gtk_widget_show_all(GTK_WIDGET(dialog));
-       
-       
-       if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT)
-       { 
-               char *filename;
-               char *name;
-               char *path;
-               int len;
-               char *filepath;
-
-               gchar* tmp;
-       
-               filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER (dialog));
-               name = g_path_get_basename(filename);
-               len = strlen(filename) - strlen(name) -1;
-               tmp = g_strndup (filename, len);
-               tmp = g_path_get_basename(tmp);
-               
-               if (g_str_has_suffix(name, ".xdxf"))
-               {
-                       len = strlen(filename) - strlen(name) -1;
-                       filepath = g_strndup (filename, len);
-                       path = g_strconcat(GCONF_PATH, "/", tmp, "/path", NULL);
-                       gconf_client_set_string(ws_gui_app->client, path, filepath , NULL);
-                       g_free(path); path = NULL;
-                       path = g_strconcat(GCONF_PATH, "/", tmp, "/active", NULL);
-                       gtk_widget_destroy (dialog);
-                       
-                       dialog2 = gtk_message_dialog_new (GTK_WINDOW(ws_gui_app->ws_gui_hildon_window),
-                                       GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_QUESTION,
-                                       GTK_BUTTONS_YES_NO,
-                                       "Would you like to activate this dictionary for use from now?");
-                       gtk_widget_show_all(GTK_WIDGET(dialog2));
-       
-                       if (gtk_dialog_run (GTK_DIALOG (dialog2)) == GTK_RESPONSE_YES)
-                       {
-                               gconf_client_set_bool(ws_gui_app->client, path, TRUE , NULL);
-                       }
-                       else 
-                       {
-                               gconf_client_set_bool(ws_gui_app->client, path, FALSE , NULL);
-                       }
-                       gtk_widget_destroy (dialog2);
-                       g_free(path); path = NULL;
-       
-       
-                       path = g_strconcat(GCONF_PATH, "/", tmp, "/optimized", NULL);           
-                       dialog2 = gtk_message_dialog_new (GTK_WINDOW(ws_gui_app->ws_gui_hildon_window),
-                                       GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_QUESTION,
-                                       GTK_BUTTONS_YES_NO,
-                                       "Would you like to optimize this dictionary to make it faster to search within?");
-                       gtk_widget_show_all(GTK_WIDGET(dialog2));
-
-                       if (gtk_dialog_run (GTK_DIALOG (dialog2)) == GTK_RESPONSE_YES)
-                       {
-                               gconf_client_set_bool(ws_gui_app->client, path, TRUE , NULL);                   
-                       }
-                       else 
-                       {
-                               gconf_client_set_bool(ws_gui_app->client, path, FALSE , NULL);
-                       }
-                       gtk_widget_destroy (dialog2);
-                       
-       
-                       ws_dbus_notify(ws_gui_app->dbus_data, WS_DBUS_INFO_CONFIG_CHANGED);
-                       gtk_infoprint(GTK_WINDOW(ws_gui_app->ws_gui_hildon_window), "New dictionary has been added");
-               }
-               else
-               {
-                       gtk_widget_destroy (dialog);
-                       gtk_infoprint(GTK_WINDOW(ws_gui_app->ws_gui_hildon_window), "Wrong dictionary file");
-               }
-               
-               
-       }
-       else 
-       {
-               gtk_widget_destroy (dialog);
-       }
+        WSGuiApp* ws_gui_app=(WSGuiApp*)user_data;
+                               
+        GtkWidget *dialog;
+        GtkWidget *dialog2;
+
+        dialog = gtk_file_chooser_dialog_new("Load dictionary",
+                                   GTK_WINDOW(ws_gui_app->ws_gui_hildon_window),
+                                   GTK_FILE_CHOOSER_ACTION_SAVE, GTK_STOCK_OK,
+                                   GTK_RESPONSE_ACCEPT,
+                                   GTK_STOCK_CANCEL,
+                                   GTK_RESPONSE_CANCEL,
+                                   NULL);
+        gtk_window_set_default_size(GTK_WINDOW (dialog), 300, 300);
+        gtk_file_chooser_set_local_only (GTK_FILE_CHOOSER(dialog), TRUE);
+                
+        gtk_widget_show_all(GTK_WIDGET(dialog));
+                
+                
+        if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT)
+        { 
+                gchar *filename;
+                gchar *name;
+                gchar *path;
+                gint len;
+                gchar *filepath;
+
+                gchar* tmp;
+                
+                filename = gtk_file_chooser_get_filename(
+                                                     GTK_FILE_CHOOSER (dialog));
+                name = g_path_get_basename(filename);
+                len = strlen(filename) - strlen(name) -1;
+                tmp = g_strndup (filename, len);
+                tmp = g_path_get_basename(tmp);
+                                
+                if (g_str_has_suffix(name, ".xdxf"))
+                {
+                        len = strlen(filename) - strlen(name) -1;
+                        filepath = g_strndup (filename, len);
+                        path = g_strconcat(GCONF_PATH, "/", tmp, "/path", NULL);
+                        gconf_client_set_string(ws_gui_app->client,
+                                                path,
+                                                filepath,
+                                                NULL);
+                        g_free(path); path = NULL;
+                        path = g_strconcat(GCONF_PATH,
+                                           "/",
+                                           tmp,
+                                           "/active",
+                                           NULL);
+                        gtk_widget_destroy (dialog);
+                                                
+                        dialog2 = gtk_message_dialog_new(GTK_WINDOW(
+                                              ws_gui_app->ws_gui_hildon_window),
+                                              GTK_DIALOG_DESTROY_WITH_PARENT,
+                                              GTK_MESSAGE_QUESTION,
+                                              GTK_BUTTONS_YES_NO,
+                "Would you like to activate this dictionary for use from now?");
+                        gtk_widget_show_all(GTK_WIDGET(dialog2));
+                
+                        if (gtk_dialog_run (GTK_DIALOG (dialog2)) ==
+                                 GTK_RESPONSE_YES)
+                        {
+                                gconf_client_set_bool(ws_gui_app->client,
+                                                      path,
+                                                      TRUE,
+                                                      NULL);
+                        }
+                        else 
+                        {
+                                gconf_client_set_bool(ws_gui_app->client,
+                                                      path,
+                                                      FALSE,
+                                                      NULL);
+                        }
+                        gtk_widget_destroy (dialog2);
+                        g_free(path); path = NULL;               
+                        
+                        path = g_strconcat(GCONF_PATH,
+                                           "/",
+                                           tmp,
+                                           "/optimized",
+                                            NULL);                                
+                        dialog2 = gtk_message_dialog_new(
+                                   GTK_WINDOW(ws_gui_app->ws_gui_hildon_window),
+                                   GTK_DIALOG_DESTROY_WITH_PARENT,
+                                   GTK_MESSAGE_QUESTION,
+                                   GTK_BUTTONS_YES_NO,
+                                   "Would you like to optimize this dictionary to make it faster to search within?");
+                        gtk_widget_show_all(GTK_WIDGET(dialog2));
+
+                        if (gtk_dialog_run (GTK_DIALOG (dialog2)) 
+                                                            == GTK_RESPONSE_YES)
+                        {
+                           gconf_client_set_bool(ws_gui_app->client,
+                                                 path,
+                                                 TRUE,
+                                                 NULL);
+                        }
+                        else 
+                        {
+                                gconf_client_set_bool(ws_gui_app->client,
+                                                      path,
+                                                      FALSE,
+                                                      NULL);
+                        }
+                        gtk_widget_destroy (dialog2);
+                        
+                        ws_dbus_notify(ws_gui_app->dbus_data,
+                                       WS_DBUS_INFO_CONFIG_CHANGED);
+                        gtk_infoprint(GTK_WINDOW(
+                                      ws_gui_app->ws_gui_hildon_window),
+                                      "New dictionary has been added");
+                }
+                else
+                {
+                        gtk_widget_destroy (dialog);
+                        gtk_infoprint(GTK_WINDOW(
+                                      ws_gui_app->ws_gui_hildon_window),
+                                      "Wrong dictionary file");
+                }
+                                
+                                
+       }
+       else 
+       {
+                gtk_widget_destroy (dialog);
+       }
 
 }
 
-/** this function creates dialog popup window which allows to remove dictionary which is no longer used
+/** this function creates dialog popup window which allows to remove dictionary
+ *  which is no longer used
  *
  * @param menuitem - the object which received the signal
  * @param user_data - set when the signal handler was connected
  */
 void ws_gui_dictionary_remover(GtkMenuItem *menuitem, gpointer user_data)
 {
-WSGuiApp* ws_gui_app=(WSGuiApp*)user_data;
-
-       GtkWidget *dialog1;
-       GtkWidget *dialog_vbox1;
-       GtkWidget *scrolledwindow1;
-       GtkWidget *viewport1;
-       GtkWidget *vbox1;
-
-       GtkWidget *checkbutton;
-       GtkWidget *cancel_button;
-       GtkWidget *ok_button;
-       guint i =0;
-       gchar* string;
-       gchar* path;
-       const gchar* name;
-       GArray *checkboxes;
-       
-       checkboxes = g_array_new (TRUE, TRUE, sizeof(GtkWidget*));
-
-       if (gconf_client_dir_exists(ws_gui_app->client, GCONF_PATH, NULL) == TRUE)
-       {
-               ws_gui_app->directories = gconf_client_all_dirs(ws_gui_app->client, GCONF_PATH, NULL);
-       }
-       else 
-       {
-               g_log(G_LOG_DOMAIN, G_LOG_LEVEL_INFO, "\n.::GUI::. /apps/WhiteStork/Dictionaries does not exist!!");
-       }
-
-       dialog1 = gtk_dialog_new ();
-       gtk_window_set_title (GTK_WINDOW (dialog1), ("Remove dictionaries"));
-       gtk_window_set_type_hint (GTK_WINDOW (dialog1), GDK_WINDOW_TYPE_HINT_DIALOG);
-       gtk_window_set_default_size(GTK_WINDOW (dialog1), 300, 200);
-       
-       dialog_vbox1 = GTK_DIALOG (dialog1)->vbox;
-       gtk_widget_show (dialog_vbox1);
-       
-       scrolledwindow1 = gtk_scrolled_window_new (NULL, NULL);
-       gtk_widget_show (scrolledwindow1);
-       gtk_box_pack_start (GTK_BOX (dialog_vbox1), scrolledwindow1, TRUE, TRUE, 0);
-       
-       viewport1 = gtk_viewport_new (NULL, NULL);
-       gtk_widget_show (viewport1);
-       gtk_container_add (GTK_CONTAINER (scrolledwindow1), viewport1);
-       
-       vbox1 = gtk_vbox_new (FALSE, 0);
-       gtk_widget_show (vbox1);
-       gtk_container_add (GTK_CONTAINER (viewport1), vbox1);
-       
-       for (i=0; i< g_slist_length(ws_gui_app->directories);i++)
-       {
-               string = (gchar*)g_slist_nth_data(ws_gui_app->directories, i); 
-               name = g_path_get_basename(string);
-               checkbutton = gtk_check_button_new_with_label(name);
-               
-               g_array_append_val(checkboxes, checkbutton);
-               gtk_box_pack_start (GTK_BOX (vbox1), checkbutton, FALSE, FALSE, 0);
-               gtk_widget_show (checkbutton);
-       }
-       
-       cancel_button = gtk_button_new_from_stock ("cancel");
-       gtk_widget_show (cancel_button);
-       gtk_dialog_add_action_widget (GTK_DIALOG (dialog1), cancel_button, GTK_RESPONSE_CANCEL);
-       
-       ok_button = gtk_button_new_from_stock ("remove selected");
-       gtk_widget_show (ok_button);
-       gtk_dialog_add_action_widget (GTK_DIALOG (dialog1), ok_button, GTK_RESPONSE_OK);
-       
-       i = gtk_dialog_run(GTK_DIALOG(dialog1));
-
-       if (i == GTK_RESPONSE_OK) 
-       {
-               for(i=0;i<(checkboxes->len);i++)
-               {
-                       if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(g_array_index(checkboxes, GtkWidget *, i))) == TRUE)
-                       {
-                               name = gtk_button_get_label(GTK_BUTTON(g_array_index(checkboxes, GtkWidget *, i)));
-                               path=g_strconcat(GCONF_PATH, "/", name, NULL);
-                               gconf_client_recursive_unset(ws_gui_app->client, path, GCONF_UNSET_INCLUDING_SCHEMA_NAMES, NULL);
-                       }
-               }
-       ws_dbus_notify(ws_gui_app->dbus_data, WS_DBUS_INFO_CONFIG_CHANGED);
-       gtk_widget_destroy (dialog1);
-       }
-       else if (i == GTK_RESPONSE_CANCEL) 
-       {
-               gtk_widget_destroy (dialog1);
-       }
-       
-       g_slist_free(ws_gui_app->directories);
+        WSGuiApp* ws_gui_app=(WSGuiApp*)user_data;
+
+        GtkWidget *dialog1;
+        GtkWidget *dialog_vbox1;
+        GtkWidget *scrolledwindow1;
+        GtkWidget *viewport1;
+        GtkWidget *vbox1;
+        GtkWidget *checkbutton;
+        GtkWidget *cancel_button;
+        GtkWidget *ok_button;
+        guint i =0;
+        gchar* string;
+        gchar* path;
+        const gchar* name;
+        GArray *checkboxes;
+                
+        checkboxes = g_array_new (TRUE, TRUE, sizeof(GtkWidget*));
+
+        if (gconf_client_dir_exists(ws_gui_app->client, GCONF_PATH, NULL) == TRUE)
+        {
+                ws_gui_app->directories = gconf_client_all_dirs(
+                                                             ws_gui_app->client,
+                                                             GCONF_PATH,
+                                                             NULL);
+        }
+        else 
+        {
+                g_log(G_LOG_DOMAIN, G_LOG_LEVEL_INFO,
+                  "\n.::GUI::. /apps/WhiteStork/Dictionaries does not exist!!");
+        }
+
+        dialog1 = gtk_dialog_new ();
+        gtk_window_set_title (GTK_WINDOW (dialog1), ("Remove dictionaries"));
+        gtk_window_set_type_hint (GTK_WINDOW (dialog1),
+                                  GDK_WINDOW_TYPE_HINT_DIALOG);
+        gtk_window_set_default_size(GTK_WINDOW (dialog1), 300, 200);
+                
+        dialog_vbox1 = GTK_DIALOG (dialog1)->vbox;
+        gtk_widget_show (dialog_vbox1);
+                
+        scrolledwindow1 = gtk_scrolled_window_new (NULL, NULL);
+        gtk_widget_show (scrolledwindow1);
+        gtk_box_pack_start (GTK_BOX (dialog_vbox1),
+                            scrolledwindow1,
+                            TRUE,
+                            TRUE,
+                            0);
+                
+        viewport1 = gtk_viewport_new (NULL, NULL);
+        gtk_widget_show (viewport1);
+        gtk_container_add (GTK_CONTAINER (scrolledwindow1), viewport1);
+                
+        vbox1 = gtk_vbox_new (FALSE, 0);
+        gtk_widget_show (vbox1);
+        gtk_container_add (GTK_CONTAINER (viewport1), vbox1);
+              
+        for (i=0; i< g_slist_length(ws_gui_app->directories);i++)
+        {
+                string = (gchar*)g_slist_nth_data(ws_gui_app->directories, i); 
+                name = g_path_get_basename(string);
+                checkbutton = gtk_check_button_new_with_label(name);
+                 
+                g_array_append_val(checkboxes, checkbutton);
+                gtk_box_pack_start (GTK_BOX (vbox1),
+                                    checkbutton,
+                                    FALSE,
+                                    FALSE,
+                                    0);
+                gtk_widget_show (checkbutton);
+        }
+                
+        cancel_button = gtk_button_new_from_stock ("cancel");
+        gtk_widget_show (cancel_button);
+        gtk_dialog_add_action_widget (GTK_DIALOG (dialog1),
+                                      cancel_button,
+                                      GTK_RESPONSE_CANCEL);
+                
+        ok_button = gtk_button_new_from_stock ("remove selected");
+        gtk_widget_show (ok_button);
+        gtk_dialog_add_action_widget(GTK_DIALOG (dialog1),
+                                     ok_button,
+                                     GTK_RESPONSE_OK);
+                
+        i = gtk_dialog_run(GTK_DIALOG(dialog1));
+
+        if (i == GTK_RESPONSE_OK) 
+        {
+                for(i=0;i<(checkboxes->len);i++)
+                {
+                        if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(
+                            g_array_index(checkboxes, GtkWidget *, i))) == TRUE)
+                        {
+                
+                                name = gtk_button_get_label(GTK_BUTTON(
+                                    g_array_index(checkboxes, GtkWidget *, i)));
+                                path=g_strconcat(GCONF_PATH, "/", name, NULL);
+                                gconf_client_recursive_unset(ws_gui_app->client,
+                                             path,
+                                             GCONF_UNSET_INCLUDING_SCHEMA_NAMES,
+                                             NULL);
+                        } 
+                 }
+                
+                ws_dbus_notify(ws_gui_app->dbus_data, WS_DBUS_INFO_CONFIG_CHANGED);
+                gtk_widget_destroy (dialog1);
+        }
+        else if (i == GTK_RESPONSE_CANCEL) 
+        {
+                gtk_widget_destroy (dialog1);
+        }
+                
+        g_slist_free(ws_gui_app->directories);
 }
 
-/** this function creates dialog popup window which displays information about application (about window)
+/** this function creates dialog popup window which displays information about
+ * application (about window)
  *
  * @param menuitem - the object which received the signal
  * @param user_data - set when the signal handler was connected
  */
 void ws_gui_about_application(GtkMenuItem *menuitem, gpointer user_data)
 {
-       WSGuiApp* ws_gui_app=(WSGuiApp*)user_data;
-
-       gtk_widget_set_sensitive (GTK_WIDGET(ws_gui_app->ws_gui_hildon_find_toolbar), FALSE);
-       
-       GtkWidget *about_dialog;
-       GtkWidget *dialog_vbox1;
-       GtkWidget *vbox1;
-       GtkWidget *image;
-       GtkWidget *label2;
-       GtkWidget *label3;
-       GtkWidget *label4;
-       GtkWidget *scrolledwindow;
-       GtkWidget *textview;
-       GtkWidget *button1;
-
-       about_dialog = gtk_dialog_new ();
-       gtk_window_set_title (GTK_WINDOW (about_dialog), "About");
-       gtk_window_set_default_size(GTK_WINDOW (about_dialog), 350, 200);
-       
-       dialog_vbox1 = GTK_DIALOG (about_dialog)->vbox;
-       gtk_widget_show (dialog_vbox1);
-       
-       vbox1 = gtk_vbox_new (FALSE, 0);
-       gtk_widget_show (vbox1);
-       gtk_box_pack_start (GTK_BOX (dialog_vbox1), vbox1, TRUE, TRUE, 0);
-       
-       image = gtk_image_new_from_file ("/usr/share/pixmaps/whitestork.png");
-       gtk_box_pack_start (GTK_BOX (vbox1), image, TRUE, TRUE, 0);
-       
-       label2 = gtk_label_new ("WhiteStork");
-       ws_gui_app->p = pango_font_description_from_string("Tahoma 18");
-       gtk_widget_modify_font(GTK_WIDGET(label2), ws_gui_app->p);
-       gtk_label_set_pattern (GTK_LABEL(label2), "__________");
-       gtk_box_pack_start (GTK_BOX (vbox1), label2, FALSE, FALSE, 5);
-       
-       label3 = gtk_label_new ("Maemo Multilingual Dictionary");
-       ws_gui_app->p = pango_font_description_from_string("Tahoma 12");
-       gtk_widget_modify_font(GTK_WIDGET(label3), ws_gui_app->p);
-       gtk_box_pack_start (GTK_BOX (vbox1), label3, FALSE, FALSE, 5);
-       
-       label4 = gtk_label_new ("Copyright 2006, ComArch S.A\nAll rights reserved");
-       ws_gui_app->p = pango_font_description_from_string("Tahoma 12");
-       gtk_widget_modify_font(GTK_WIDGET(label4), ws_gui_app->p);
-       gtk_box_pack_start (GTK_BOX (vbox1), label4, FALSE, FALSE, 5);
-       gtk_label_set_justify (GTK_LABEL (label4), GTK_JUSTIFY_CENTER);
-
-       scrolledwindow = gtk_scrolled_window_new (NULL, NULL);
-       gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolledwindow), GTK_SHADOW_ETCHED_OUT);
-       gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
-       gtk_box_pack_start (GTK_BOX (vbox1), scrolledwindow, TRUE, TRUE, 0);
-
-       textview = gtk_text_view_new ();
-       ws_gui_app->p = pango_font_description_from_string("Tahoma 10");
-       gtk_widget_modify_font(GTK_WIDGET(textview), ws_gui_app->p);
-       gtk_text_view_set_editable(GTK_TEXT_VIEW(textview), FALSE);
-       gtk_text_view_set_left_margin(GTK_TEXT_VIEW(textview), 10);
-       gtk_text_view_set_right_margin(GTK_TEXT_VIEW(textview), 10);
-       gtk_container_add (GTK_CONTAINER (scrolledwindow), textview);
-       gtk_text_buffer_set_text (gtk_text_view_get_buffer (GTK_TEXT_VIEW (textview)), "The following third party\ncomponents may be\nincluded depending \non your system configuration:\n\nD-BUS - License information:\nhttp://opensource.org/licenses/academic.php", -1);
-
-       button1 = gtk_button_new_from_stock(GTK_STOCK_CLOSE);
-       gtk_dialog_add_action_widget (GTK_DIALOG(about_dialog), button1, GTK_RESPONSE_CLOSE);
-       
-       //button2 = gtk_button_new_with_label("License");
-       //gtk_dialog_add_action_widget (GTK_DIALOG (about_dialog), button2, GTK_RESPONSE_OK);
-       gtk_widget_show_all (GTK_WIDGET(about_dialog));
-
-       if (gtk_dialog_run(GTK_DIALOG(about_dialog)) == GTK_RESPONSE_CLOSE)
-       {
-               gtk_widget_destroy(GTK_WIDGET(about_dialog));
-       }
-       
-       gtk_widget_set_sensitive (GTK_WIDGET(ws_gui_app->ws_gui_hildon_find_toolbar), TRUE);
-       
-
-       /*GtkWidget *about_dialog;
-       gtk_widget_set_sensitive (GTK_WIDGET(ws_gui_app->ws_gui_hildon_find_toolbar), FALSE);
-
-       if (gtk_window_set_default_icon_from_file("/usr/share/pixmaps/icon.png", NULL))
-       {
-       g_log(G_LOG_DOMAIN, G_LOG_LEVEL_INFO, "Default icon set");
-       }
-       about_dialog = gtk_about_dialog_new();
-       gtk_about_dialog_set_name (GTK_ABOUT_DIALOG(about_dialog), "WhiteStork");
-       gtk_about_dialog_set_copyright(GTK_ABOUT_DIALOG(about_dialog), "Copyright 2006, ComArch S.A\nAll rights reserved");
-       //gtk_about_dialog_set_logo_icon_name(GTK_ABOUT_DIALOG(about_dialog),"whitestork.png");
-       gtk_about_dialog_set_comments(GTK_ABOUT_DIALOG(about_dialog), "Maemo Multilingual Dictionary");
-       
-       gtk_about_dialog_set_license(GTK_ABOUT_DIALOG(about_dialog), license);
-       //LGPL: http://www.gnu.org/licenses/lgpl.html 
-       //GPL: http://www.gnu.org/licenses/gpl.txt
-       //gtk_show_about_dialog(GTK_WINDOW(ws_gui_app->ws_gui_hildon_window), NULL);
-       */
-
+        WSGuiApp* ws_gui_app=(WSGuiApp*)user_data;
+
+        gtk_widget_set_sensitive(GTK_WIDGET
+                                 (ws_gui_app->ws_gui_hildon_find_toolbar),
+                                 FALSE);
+                
+        GtkWidget *about_dialog;
+        GtkWidget *dialog_vbox1;
+        GtkWidget *vbox1;
+        GtkWidget *image;
+        GtkWidget *label2;
+        GtkWidget *label3;
+        GtkWidget *label4;
+        GtkWidget *scrolledwindow;
+        GtkWidget *textview;
+        GtkWidget *button1;
+
+        about_dialog = gtk_dialog_new ();
+        gtk_window_set_title (GTK_WINDOW (about_dialog), "About");
+        gtk_window_set_default_size(GTK_WINDOW (about_dialog), 350, 200);
+                
+        dialog_vbox1 = GTK_DIALOG (about_dialog)->vbox;
+        gtk_widget_show (dialog_vbox1);
+                
+        vbox1 = gtk_vbox_new (FALSE, 0);
+        gtk_widget_show (vbox1);
+        gtk_box_pack_start (GTK_BOX (dialog_vbox1), vbox1, TRUE, TRUE, 0);
+                
+        image = gtk_image_new_from_file ("/usr/share/pixmaps/whitestork.png");
+        gtk_box_pack_start (GTK_BOX (vbox1), image, TRUE, TRUE, 0);
+                
+        label2 = gtk_label_new ("WhiteStork");
+        ws_gui_app->p = pango_font_description_from_string("Tahoma 18");
+        gtk_widget_modify_font(GTK_WIDGET(label2), ws_gui_app->p);
+        gtk_label_set_pattern (GTK_LABEL(label2), "__________");
+        gtk_box_pack_start (GTK_BOX (vbox1), label2, FALSE, FALSE, 5);
+                
+        label3 = gtk_label_new ("Maemo Multilingual Dictionary\nver. 0.5");
+        ws_gui_app->p = pango_font_description_from_string("Tahoma 12");
+        gtk_widget_modify_font(GTK_WIDGET(label3), ws_gui_app->p);
+        gtk_box_pack_start (GTK_BOX (vbox1), label3, FALSE, FALSE, 5);
+        gtk_label_set_justify (GTK_LABEL (label3), GTK_JUSTIFY_CENTER);
+             
+        label4 = gtk_label_new ("Copyright 2006, ComArch S.A\nAll rights reserved");
+        ws_gui_app->p = pango_font_description_from_string("Tahoma 12");
+        gtk_widget_modify_font(GTK_WIDGET(label4), ws_gui_app->p);
+        gtk_box_pack_start (GTK_BOX (vbox1), label4, FALSE, FALSE, 5);
+        gtk_label_set_justify (GTK_LABEL (label4), GTK_JUSTIFY_CENTER);
+
+        scrolledwindow = gtk_scrolled_window_new (NULL, NULL);
+        gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW
+                                             (scrolledwindow),
+                                             GTK_SHADOW_ETCHED_OUT);
+        gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW
+                                        (scrolledwindow),
+                                        GTK_POLICY_AUTOMATIC,
+                                        GTK_POLICY_AUTOMATIC);
+        gtk_box_pack_start (GTK_BOX (vbox1),
+                            scrolledwindow,
+                            TRUE,
+                            TRUE,
+                            0);
+
+        textview = gtk_text_view_new ();
+        ws_gui_app->p = pango_font_description_from_string("Tahoma 10");
+        gtk_widget_modify_font(GTK_WIDGET(textview), ws_gui_app->p);
+        gtk_text_view_set_editable(GTK_TEXT_VIEW(textview), FALSE);
+        gtk_text_view_set_left_margin(GTK_TEXT_VIEW(textview), 10);
+        gtk_text_view_set_right_margin(GTK_TEXT_VIEW(textview), 10);
+        gtk_container_add (GTK_CONTAINER (scrolledwindow), textview);
+        gtk_text_buffer_set_text(
+                        gtk_text_view_get_buffer(GTK_TEXT_VIEW (textview)),
+                        "The following third party\ncomponents may be\nincluded depending \non your system configuration:\n\nD-BUS - License information:\nhttp://opensource.org/licenses/academic.php",
+                        -1);
+
+        button1 = gtk_button_new_from_stock(GTK_STOCK_CLOSE);
+        gtk_dialog_add_action_widget(GTK_DIALOG(about_dialog),
+                                     button1,
+                                     GTK_RESPONSE_CLOSE);
+        
+        gtk_widget_show_all (GTK_WIDGET(about_dialog));
+        
+        if (gtk_dialog_run(GTK_DIALOG(about_dialog)) == GTK_RESPONSE_CLOSE)
+        {
+                gtk_widget_destroy(GTK_WIDGET(about_dialog));
+        }
+                
+        gtk_widget_set_sensitive(
+                             GTK_WIDGET(ws_gui_app->ws_gui_hildon_find_toolbar),
+                             TRUE);
 }
 
-/** this function creates dialog popup window (displays if user did not accept a license during instalation procedure) with question about license
+/** this function creates dialog popup window (displays if user did not accept a
+ license during instalation procedure) with question about license
  *
  * @param user_data - set when the signal handler was connected
  */
 GtkWidget* licence_dialog(gpointer user_data)
 {
-       WSGuiApp* ws_gui_app=(WSGuiApp*)user_data;
-       GtkWidget *license_dialog;
-       
-       GtkWidget *license_vbox1;
-       GtkWidget *scrolledwindow1;
-       GtkWidget *textview1;
-       GtkWidget *button1;
-       GtkWidget *button2;
-
-       license_dialog = gtk_dialog_new ();
-       gtk_window_set_title (GTK_WINDOW (license_dialog), "Licence");
-       gtk_window_set_default_size(GTK_WINDOW (license_dialog), 500, 300);
-       
-       license_vbox1 = GTK_DIALOG (license_dialog)->vbox;
-       gtk_widget_show(license_vbox1);
-       
-       scrolledwindow1 = gtk_scrolled_window_new (NULL, NULL);
-       gtk_box_pack_start (GTK_BOX (license_vbox1), scrolledwindow1, TRUE, TRUE, 0);
-       gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolledwindow1), GTK_SHADOW_IN);
-       
-       textview1 = gtk_text_view_new ();
-       ws_gui_app->p = pango_font_description_from_string("Tahoma 10");
-       gtk_widget_modify_font(GTK_WIDGET(textview1), ws_gui_app->p);
-       gtk_container_add (GTK_CONTAINER (scrolledwindow1), textview1);
-       gtk_text_buffer_set_text (gtk_text_view_get_buffer (GTK_TEXT_VIEW (textview1)), "Terms of use\n\nREAD THE TERMS OF USE CAREFULLY BEFORE INSTALALTION OF THIS SOFTWARE. BY\nINSTALALTION OF THIS SOFTWARE, YOU AGREE TO THE FOLLOWING TERMS OF USE.\n\n1. LICENSE TO USE. ComArch grants you a non-exclusive and non-transferable\nlicense for the internal use only of the accompanying software and\ndocumentation and any error corrections provided by ComArch (collectively \"Software\"), by the one user.\n\n2. RESTRICTIONS. Software is confidential and copyrighted. Title to Software\nand all associated intellectual property rights is retained by ComArch\nand/or its licensors. Unless enforcement is prohibited by applicable law,\nyou may not modify, decompile, or reverse engineer Software. You acknowledge\nthat Software is not designed, licensed or intended for use in the design,\nconstruction, operation or maintenance of any nuclear facility. Sun ComArch\ndisclaims any express or implied warranty of fitness for such uses. No\nright, title or interest in or to any trademark, service mark, logo or trade\nname of ComArch or its licensors is granted under this terms of use.\n\n3. DISCLAIMER OF WARRANTY. UNLESS SPECIFIED IN THIS AGREEMENT TERMS OF USE,\nALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING\nANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR\nNON-INFRINGEMENT ARE DISCLAIMED, EXCEPT TO THE EXTENT THAT THESE DISCLAIMERS\nARE HELD TO BE LEGALLY INVALID.\n\n4. LIMITATION OF LIABILITY. TO THE EXTENT NOT PROHIBITED BY LAW, IN NO EVENT\nWILL COMARCH OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR\nDATA, OR FOR SPECIAL, INDIRECT, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE\nDAMAGES, HOWEVER CAUSED REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT\nOF OR RELATED TO THE USE OF OR INABILITY TO USE SOFTWARE, EVEN IF COMARCH\nHAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. In no event will\nComArch's liability to you, whether in contract, tort (including\nnegligence), or otherwise, exceed []. The foregoing limitations will apply\neven if the above stated warranty fails of its essential purpose.\n\n5. Termination. This license is effective until terminated. You may\nterminate this license at any time by destroying all\ncopies of Software.\nThis license will terminate immediately without notice from ComArch if you\nfail to comply with any provision of this license. Upon Termination, you\nmust destroy all copies of Software.\n\n6. Export Regulations. All Software and technical data delivered under this\nterms of use are subject to Polish export control laws and may be subject to\nexport or import regulations in other countries. You agree to comply\nstrictly with all such laws and regulations and acknowledge that you have\nthe responsibility to obtain such licenses to export, re-export, or import\nas may be required after delivery to you.\n\n7. Governing Law. Any action related to this license will be governed by\nPolish Law.\n\n8. Severability. If any provision of this terms of use is held to be\nunenforceable, this terms of use will remain in effect with the provision\nomitted, unless omission would frustrate the intent of the parties, in which\ncase this terms of use will immediately terminate.\n\n9. Integration. This document is the entire  agreement between you and\nComArch relating to its subject matter. It supersedes all prior or\ncontemporaneous oral or written communications, proposals, representations\nand warranties and prevails over any conflicting or additional\nterms of any\nquote, order, acknowledgment, or other communication between the parties\nrelating to its subject matter during the term of these terms of use. No\nmodification of this Agreement will be binding, unless in writing and signed\nby an authorized representative of each party.", -1);
-       
-       button1 = gtk_button_new_with_label("Agree");
-       gtk_dialog_add_action_widget (GTK_DIALOG (license_dialog), button1, GTK_RESPONSE_OK);
-       
-       
-       button2 = gtk_button_new_with_label("Disagree");
-       gtk_dialog_add_action_widget (GTK_DIALOG (license_dialog), button2, GTK_RESPONSE_CLOSE);
-
-       gtk_widget_show_all(license_dialog);
-       return license_dialog;
+        WSGuiApp* ws_gui_app=(WSGuiApp*)user_data;
+        GtkWidget *license_dialog;
+                
+        GtkWidget *license_vbox1;
+        GtkWidget *scrolledwindow1;
+        GtkWidget *textview1;
+        GtkWidget *button1;
+        GtkWidget *button2;
+
+        license_dialog = gtk_dialog_new ();
+        gtk_window_set_title (GTK_WINDOW (license_dialog), "Licence");
+        gtk_window_set_default_size(GTK_WINDOW (license_dialog), 500, 300);
+                
+        license_vbox1 = GTK_DIALOG (license_dialog)->vbox;
+        gtk_widget_show(license_vbox1);
+                
+        scrolledwindow1 = gtk_scrolled_window_new (NULL, NULL);
+        gtk_box_pack_start(GTK_BOX (license_vbox1),
+                           scrolledwindow1,
+                           TRUE,
+                           TRUE,
+                           0);
+        gtk_scrolled_window_set_shadow_type(
+                                          GTK_SCROLLED_WINDOW (scrolledwindow1),
+                                          GTK_SHADOW_IN);
+                
+        textview1 = gtk_text_view_new ();
+        ws_gui_app->p = pango_font_description_from_string("Tahoma 10");
+        gtk_widget_modify_font(GTK_WIDGET(textview1), ws_gui_app->p);
+        gtk_container_add (GTK_CONTAINER (scrolledwindow1), textview1);
+        gtk_text_buffer_set_text (gtk_text_view_get_buffer(GTK_TEXT_VIEW (textview1)), "Terms of use\n\nREAD THE TERMS OF USE CAREFULLY BEFORE INSTALALTION OF THIS SOFTWARE. BY\nINSTALALTION OF THIS SOFTWARE, YOU AGREE TO THE FOLLOWING TERMS OF USE.\n\n1. LICENSE TO USE. ComArch grants you a non-exclusive and non-transferable\nlicense for the internal use only of the accompanying software and\ndocumentation and any error corrections provided by ComArch (collectively \"Software\"), by the one user.\n\n2. RESTRICTIONS. Software is confidential and copyrighted. Title to Software\nand all associated intellectual property rights is retained by ComArch\nand/or its licensors. Unless enforcement is prohibited by applicable law,\nyou may not modify, decompile, or reverse engineer Software. You acknowledge\nthat Software is not designed, licensed or intended for use in the design,\nconstruction, operation or maintenance of any nuclear facility. Sun ComArch\ndisclaims any express or implied warranty of fitness for such uses. No\nright, title or interest in or to any trademark, service mark, logo or trade\nname of ComArch or its licensors is granted under this terms of use.\n\n3. DISCLAIMER OF WARRANTY. UNLESS SPECIFIED IN THIS AGREEMENT TERMS OF USE,\nALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING\nANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR\nNON-INFRINGEMENT ARE DISCLAIMED, EXCEPT TO THE EXTENT THAT THESE DISCLAIMERS\nARE HELD TO BE LEGALLY INVALID.\n\n4. LIMITATION OF LIABILITY. TO THE EXTENT NOT PROHIBITED BY LAW, IN NO EVENT\nWILL COMARCH OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR\nDATA, OR FOR SPECIAL, INDIRECT, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE\nDAMAGES, HOWEVER CAUSED REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT\nOF OR RELATED TO THE USE OF OR INABILITY TO USE SOFTWARE, EVEN IF COMARCH\nHAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. In no event will\nComArch's liability to you, whether in contract, tort (including\nnegligence), or otherwise, exceed []. The foregoing limitations will apply\neven if the above stated warranty fails of its essential purpose.\n\n5. Termination. This license is effective until terminated. You may\nterminate this license at any time by destroying all\ncopies of Software.\nThis license will terminate immediately without notice from ComArch if you\nfail to comply with any provision of this license. Upon Termination, you\nmust destroy all copies of Software.\n\n6. Export Regulations. All Software and technical data delivered under this\nterms of use are subject to Polish export control laws and may be subject to\nexport or import regulations in other countries. You agree to comply\nstrictly with all such laws and regulations and acknowledge that you have\nthe responsibility to obtain such licenses to export, re-export, or import\nas may be required after delivery to you.\n\n7. Governing Law. Any action related to this license will be governed by\nPolish Law.\n\n8. Severability. If any provision of this terms of use is held to be\nunenforceable, this terms of use will remain in effect with the provision\nomitted, unless omission would frustrate the intent of the parties, in which\ncase this terms of use will immediately terminate.\n\n9. Integration. This document is the entire  agreement between you and\nComArch relating to its subject matter. It supersedes all prior or\ncontemporaneous oral or written communications, proposals, representations\nand warranties and prevails over any conflicting or additional\nterms of any\nquote, order, acknowledgment, or other communication between the parties\nrelating to its subject matter during the term of these terms of use. No\nmodification of this Agreement will be binding, unless in writing and signed\nby an authorized representative of each party.", -1);
+                
+        button1 = gtk_button_new_with_label("Agree");
+        gtk_dialog_add_action_widget(GTK_DIALOG (license_dialog),
+                                     button1,
+                                     GTK_RESPONSE_OK);
+               
+        button2 = gtk_button_new_with_label("Disagree");
+        gtk_dialog_add_action_widget(GTK_DIALOG (license_dialog),
+                                     button2,
+                                     GTK_RESPONSE_CLOSE);
+
+        gtk_widget_show_all(license_dialog);
+        return license_dialog;
 
 }
index bead108..4ea2279 100644 (file)
@@ -34,15 +34,19 @@ extern "C" {
 *
 *@param error - pointer to a GError structure. Currently not used
 *@param words - GArray of osso_rpc_t structures containing sent data
-*@param user_data - data passed by user while setting the callback function with ::ws_dbus_set_cb
+*@param user_data - data passed by user while setting the callback 
+function with ::ws_dbus_set_cb
 *\sa ws_dbus_set_cb
 */
 typedef void (* ws_dbus_cb) (GError *error, GArray *words, gpointer user_data); 
 
 /**\brief This structure contains data vital for DBUS communication.
 *
-* These are for example both the local and remote addresses of the applications which are supposed to communicate. In this case they are the <I>GUI</I> and the <I>MANAGER</I>
-* The fields shouldn't be modified directly. It should be done by ws_dbus_config function
+* These are for example both the local and remote addresses of the applications 
+which are supposed to communicate. In this case they are the <I>GUI</I> and the 
+<I>MANAGER</I>
+* The fields shouldn't be modified directly. It should be done by ws_dbus_config
+ function
 *\sa ws_dbus_config
 */
 struct _WSDBusData 
@@ -96,7 +100,8 @@ typedef enum
 /**
 *\brief This structure is used for specifying the field of WSDBusData structure one would like to modify.
 *
-*It is used in the ws_dbus_config function. Its main purpose is to clarify D-BUS configuration.
+*It is used in the ws_dbus_config function. Its main purpose is to clarify D-BUS
+ configuration.
 */
 typedef enum 
 {
@@ -113,7 +118,8 @@ typedef struct _WSDBusData WSDBusData;
 
 /**\brief First function to be called in every program using this wrapper library
 *
-*This function is used for allocating memory for the WSDBusData structure and setting some basic parameters. 
+*This function is used for allocating memory for the WSDBusData structure and 
+setting some basic parameters. 
 *@param name - name of the application
 *@param version - app's version
 *@return pointer to WSDBusData structure\n
@@ -124,7 +130,8 @@ WSDBusData * ws_dbus_create (gchar *name, gchar *version);
 /**\brief This function is used for setting dbus service/client parameters.
 *
 *These include the addresses of both remote and local apps communicating
-*@param ws_dbus_data - pointer to a structure uniquely identifying the application for DBus. The possible values of 
+*@param ws_dbus_data - pointer to a structure uniquely identifying 
+the application for DBus. The possible values of 
 *this parameter are listed here: ::WSDBusConfig
 *@param field - the name of the variable, this function is supposed to set. 
 *@param value - the value of the variable
@@ -132,14 +139,19 @@ WSDBusData * ws_dbus_create (gchar *name, gchar *version);
 *WS_STATUS_ERROR - on error
 *\sa ::WSDBusConfig
 */
-WSDBusStatus ws_dbus_config (WSDBusData * ws_dbus_data, WSDBusConfig field, gchar *value);
+WSDBusStatus ws_dbus_config (WSDBusData * ws_dbus_data,
+                             WSDBusConfig field,
+                             gchar *value);
 
 /**
 *\brief Initialize D-BUS communication.
 *
-*It should be the called after <B>ws_dbus_create</B> and after setting all D-BUS parameters with the <B>ws_dbus_config</B> function. 
-*The structure it returns is necessary to call out every function implemented in this wrapper library.
-*@param ws_dbus_data - it's a structure containing the unique paths to objects and interfaces to be registered in the DBus session daemon
+*It should be the called after <B>ws_dbus_create</B> and after setting all D-BUS
+ parameters with the <B>ws_dbus_config</B> function. 
+*The structure it returns is necessary to call out every function implemented in
+ this wrapper library.
+*@param ws_dbus_data - it's a structure containing the unique paths to objects 
+and interfaces to be registered in the DBus session daemon
 *@return WS_STATUS_OK - on success \n
 *WS_STATUS_ERROR - on error
 *\sa ::WSDBusConfig, ws_dbus_create, ws_dbus_config
@@ -149,7 +161,8 @@ WSDBusStatus ws_dbus_connect (WSDBusData * ws_dbus_data);
 /**\brief Function deinitializing D-BUS wrapper library
 *
 *Before the program exits, all memory allocated by D-BUS should be freed.
-@param ws_dbus_data - pointer to a structure uniquely identifying the application for DBus
+@param ws_dbus_data - pointer to a structure uniquely identifying the 
+application for DBus
 *@return WS_STATUS_OK - on success \n
 *WS_STATUS_ERROR - on error
 */
@@ -158,25 +171,33 @@ void ws_dbus_destroy (WSDBusData * ws_dbus_data);
 
 /**\brief This function is used for setting a callback function for some predefined signals. 
 *
-*Some of the signals should be used only by the <I>GUI</I>, others by the <I>MANAGER</I>.
+*Some of the signals should be used only by the <I>GUI</I>, others by the 
+<I>MANAGER</I>.
 *
-*@param ws_dbus_data - pointer to a structure uniquely identifying the application for D-BUS
-*@param detailed_signal - string containing the signal name which will trigger the function passed in 
+*@param ws_dbus_data - pointer to a structure uniquely identifying the 
+application for D-BUS
+*@param detailed_signal - string containing the signal name which will trigger 
+the function passed in 
 *the c_func parameter.
 *@param c_func - is a pointer to the signal handling function.
 *@param        user_data - is the data passed directly to the signal handling function
 *      
 *The predefined signal values for the GUI part are:
 *
-*      - <I>"return_words"</I> - used for receiving a list of words found by the <I>MANAGER</I>
-*      - <I>"return_translations"</I> - used for receiving a list of translations found by the <I>MANAGER</I>
-*      - <I>"signal"</I> - used for handling signals from the <I>MANAGER</I>. In this case they are mainly error signals.
+*      - <I>"return_words"</I> - used for receiving a list of words found by 
+the <I>MANAGER</I>
+*      - <I>"return_translations"</I> - used for receiving a list of 
+translations found by the <I>MANAGER</I>
+*      - <I>"signal"</I> - used for handling signals from the <I>MANAGER</I>. 
+In this case they are mainly error signals.
 *
 *The predefined signal values for the MANAGER part are:
 *
 *      - <I>"find_word"</I> - used for receiving the word a user is looking for
-*      - <I>"find_translation"</I> - used for receiving the word a user needs to translate
-*      - <I>"signal"</I> - used for handling signals from the <I>GUI</I>. In this case they are termination and stop search signals.
+*      - <I>"find_translation"</I> - used for receiving the word a user needs 
+to translate
+*      - <I>"signal"</I> - used for handling signals from the <I>GUI</I>. 
+In this case they are termination and stop search signals.
 *
 *@return WS_STATUS_OK - on success \n
 *WS_STATUS_ERROR - on error
@@ -184,24 +205,32 @@ void ws_dbus_destroy (WSDBusData * ws_dbus_data);
 *#ws_dbus_cb
 */
 
-WSDBusStatus ws_dbus_set_cb (WSDBusData * ws_dbus_data, gchar * detailed_signal, gpointer c_func, gpointer user_data);
+WSDBusStatus ws_dbus_set_cb (WSDBusData * ws_dbus_data,
+                             gchar * detailed_signal,
+                             gpointer c_func,
+                             gpointer user_data);
 
 /**\brief Send signal to the remote application
 *
 *A purpose of this function is to send signals between both ends.
-*@param ws_dbus_data - pointer to a structure uniquely identifying the application for D-BUS
+*@param ws_dbus_data - pointer to a structure uniquely identifying the 
+application for D-BUS
 *@param ws_dbus_info - the command or information to send to the other side.
 *\sa #WSDBusNotify
 */
 
-WSDBusStatus ws_dbus_notify (WSDBusData * ws_dbus_data, WSDBusNotify ws_dbus_info);
+WSDBusStatus ws_dbus_notify (WSDBusData * ws_dbus_data,
+                             WSDBusNotify ws_dbus_info);
 
 /**\brief Find a word in the dictionary
 *
-*This is run by <I>GUI</I>. This function is used for finding a word, the user is searching for. It should be 
-*called after the user enters a word in the text field and presses the search button.
+*This is run by <I>GUI</I>. This function is used for finding a word, the user 
+is searching for. It should be 
+*called after the user enters a word in the text field and presses the search 
+button.
 *
-*@param ws_dbus_data - pointer to a structure uniquely identifying the application for DBus
+*@param ws_dbus_data - pointer to a structure uniquely identifying the 
+application for DBus
 *@param word - the word, user is looking for
 *@return WS_STATUS_OK - on success \n
 *WS_STATUS_ERROR - on error
@@ -211,35 +240,42 @@ WSDBusStatus ws_dbus_client_find_word (WSDBusData * ws_dbus_data, gchar * word);
 
 /**\brief Find translation of a word
 *
-*This is run by <I>GUI</I>. When a user selects a word from the words list, this function is called in order 
+*This is run by <I>GUI</I>. When a user selects a word from the words list, 
+this function is called in order 
 *to find the translation of the selected word. 
 *
-*@param ws_dbus_data - pointer to a structure uniquely identifying the application for DBus
+*@param ws_dbus_data - pointer to a structure uniquely identifying the 
+application for DBus
 *@param word - a word, for which the user wishes to find the translation
 *@return WS_STATUS_OK - on success \n
 *WS_STATUS_ERROR - on error
 */
 
-WSDBusStatus ws_dbus_client_find_translation (WSDBusData * ws_dbus_data, gchar * word);
+WSDBusStatus ws_dbus_client_find_translation (WSDBusData * ws_dbus_data,
+                                              gchar * word);
 
 /**\brief Return a list of words
 *
 *Transmits a list of words found by the parsing engine/engines
 *
-*@param ws_dbus_data - pointer to a structure uniquely identifying the application for DBus
+*@param ws_dbus_data - pointer to a structure uniquely identifying the 
+application for DBus
 *@param words - a GArray of words, the engine thread returned
 *@return WS_STATUS_OK - on success \n
 *WS_STATUS_ERROR - on error
 */
 
-WSDBusStatus ws_dbus_server_return_words  (WSDBusData * ws_dbus_data, GArray * words);
+WSDBusStatus ws_dbus_server_return_words  (WSDBusData * ws_dbus_data,
+                                           GArray * words);
 
 /**
 *This function is used for returning the list of words the parsing thread has 
-*found. It should be run after the last thread finishes the search, because it also 
+*found. It should be run after the last thread finishes the search, because it 
+also 
 *signalizes the GUI that the search has finished.
 *
-*@param ws_dbus_data - pointer to a structure uniquely identifying the application for DBus
+*@param ws_dbus_data - pointer to a structure uniquely identifying the 
+application for DBus
 *@param words - a GArray of words, the engine thread returned
 *@return WS_STATUS_OK - on success \n
 *WS_STATUS_ERROR - on error
@@ -249,22 +285,27 @@ WSDBusStatus ws_dbus_server_return_words  (WSDBusData * ws_dbus_data, GArray * w
 
 /**\brief Return a translation of a given word
 *
-*This is run by the <I>MANAGER</I>. It returns a translation of a previously sent word
+*This is run by the <I>MANAGER</I>. It returns a translation of a 
+previously sent word
 *
-*@param ws_dbus_data - pointer to a structure uniquely identifying the application for DBus
+*@param ws_dbus_data - pointer to a structure uniquely identifying the 
+application for DBus
 *@param translation - a string containing the word's translation
 *@return WS_STATUS_OK - on success \n
 *WS_STATUS_ERROR - on error
 */
 
-WSDBusStatus ws_dbus_server_return_translations (WSDBusData * ws_dbus_data, gchar * translation);
+WSDBusStatus ws_dbus_server_return_translations (WSDBusData * ws_dbus_data,
+                                                 gchar * translation);
 
 /**
 *This function is used for returning the list of translations the parsing thread       
-*finds. It should be ran after the *last thread finishes the search, because it also   
+*finds. It should be ran after the *last thread finishes the search, because it 
+also   
 *signalizes the GUI that the search has finished.
 *
-*@param ws_dbus_data - pointer to a structure uniquely identifying the application for DBus
+*@param ws_dbus_data - pointer to a structure uniquely identifying the 
+application for DBus
 *@param translation - a string containing the word's translation
 *@return WS_STATUS_OK - on success \n
 *WS_STATUS_ERROR - on error
@@ -274,21 +315,27 @@ WSDBusStatus ws_dbus_server_return_translations (WSDBusData * ws_dbus_data, gcha
 
 /**\brief Sends an address of data to transmit
 *
-*Function used in order to increase the speed of data transmission. For now it's been added just for testing purposes.
-*The goal is to use the main advantage of threads, that is memory sharing. If <I>GUI</I> and <I>MANAGER</I> are in the
+*Function used in order to increase the speed of data transmission. 
+For now it's been added just for testing purposes.
+*The goal is to use the main advantage of threads, that is memory sharing. 
+If <I>GUI</I> and <I>MANAGER</I> are in the
 *same memory area, the data pointers also stay in the same memory area.
-*@param ws_dbus_data - pointer to a structure uniquely identifying the application for DBus
+*@param ws_dbus_data - pointer to a structure uniquely identifying the 
+application for DBus
 *@param method - name of the method of the remote object to call
 *@param data_address - address of the data
 *@return WS_STATUS_OK - on success \n
 *WS_STATUS_ERROR - on error
 */
 
-WSDBusStatus ws_dbus_send_ptrtodata (WSDBusData * ws_dbus_data, gchar *method, gulong data_address);
+WSDBusStatus ws_dbus_send_ptrtodata (WSDBusData * ws_dbus_data,
+                                     gchar *method,
+                                     gulong data_address);
 
 /**\brief Splits the data from buffer generated by ::ws_dbus_concat_data
 *
-*Function used in order to increase the speed of data transmission. For now it's been added just for testing purposes.
+*Function used in order to increase the speed of data transmission. 
+For now it's been added just for testing purposes.
 *It ommits the limit of D-BUS message fields in one message.
 *@param buffer - pointer to strings concatenated by ws_dbus_concat_data
 *@return GArray of strings
@@ -298,7 +345,8 @@ GArray * ws_dbus_split_data (gpointer buffer);
 
 /**\brief Concatenates data from a GArray to one long buffer ::ws_dbus_split_data
 *
-*Function used in order to increase the speed of data transmission. For now it's been added just for testing purposes.
+*Function used in order to increase the speed of data transmission. 
+For now it's been added just for testing purposes.
 *It ommits the limit of D-BUS message fields in one message.
 *@param garray - a GArray to be concatenated
 *@return pointer to a buffer
@@ -306,9 +354,11 @@ GArray * ws_dbus_split_data (gpointer buffer);
 
 gpointer ws_dbus_concat_data (GArray *garray);
 
-WSDBusStatus ws_dbus_update_progressbar (WSDBusData * ws_dbus_data, double progress);
-//added by me
-WSDBusStatus ws_dbus_client_search_in_history (WSDBusData * ws_dbus_data, gchar * word);
+WSDBusStatus ws_dbus_update_progressbar (WSDBusData * ws_dbus_data,
+                                         double progress);
+
+WSDBusStatus ws_dbus_client_search_in_history (WSDBusData * ws_dbus_data,
+                                               gchar * word);
 
 #ifdef __cplusplus
 }
index ac1d877..331e1d7 100644 (file)
@@ -1,4 +1,4 @@
-/************************************************************************************************
+/*******************************************************************************
 This file is part of WhiteStork.
 
 WhiteStork is free software; you can redistribute it and/or modify
@@ -16,8 +16,7 @@ along with WhiteStork; if not, write to the Free Software
 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
 
 Copyright 2006 ComArch S.A.
-************************************************************************************************/
-
+*******************************************************************************/
 #ifndef _WS_GUI
 #define _WS_GUI 
 
@@ -61,7 +60,9 @@ extern "C" {
 #define GCONF_CONF "/apps/maemo/WhiteStork/configuration"
 
 void html_engine_unselect_all(HTMLEngine   *e);
-void      html_engine_block_selection                (HTMLEngine   *e);
+void html_engine_block_selection (HTMLEngine   *e);
+gboolean html_engine_is_selection_active (HTMLEngine *e);
+
 typedef struct WSGuiAppData WSGuiApp;
 
 enum
@@ -93,50 +94,51 @@ gchar *td_font_color;
  * here are placed all components of application menu and popup menu
  */
 struct WSGuiMenu {
-       /*application menu*/
-       GtkWidget *ws_gui_main_menu; ///< application submenu
-       GtkWidget *ws_gui_menu_dictionaries; ///< dictionaries submenu(managing with the dictionary files)
-               GtkWidget *ws_gui_menu_load_dict; ///<menuitem in dictionaries submenu; load new dictionary file into application
-               GtkWidget *ws_gui_menu_select_dict; ///<menuitem in dictionaries submenu; allow to select which dictionaries are used
-               GtkWidget *ws_gui_menu_remove_dict; ///<menuitem in dictionaries submenu; remove dictionary files which are no longer used
-               //added by me 
-               GtkWidget* ws_gui_menu_optimize_dict;
-       GtkWidget *ws_gui_menu_edit; ///< edit submenu(connected with text editing)
-               GtkWidget *ws_gui_menu_copy; ///< menuitem in edit submenu; copy selected text to the clipboard
-               GtkWidget *ws_gui_menu_paste; ///< menuitem in edit submenu; paste content of the clipboard into find toolbar entry
-               GtkWidget *ws_gui_menu_select_all; ///< menuitem in edit submenu; select whole text in the translation (html) area 
-       GtkWidget *ws_gui_menu_view; ///< view submenu
-               GtkWidget *ws_gui_menu_hide_list; ///< menuitem which allows to hide/show words list
-               GtkWidget *ws_gui_menu_zoom_in; ///< menuitem which allows to zoom in text in the translation area
-               GtkWidget *ws_gui_menu_zoom_out; ///< menuitem which allows to zoom out text in the translation area
-               GtkWidget *ws_gui_menu_full_screen; ///< menuitem which allows to switch between fullscreen and normal mode
-       GtkWidget *ws_gui_menu_search; ///< search submenu (connected with searching)
-               GtkWidget *ws_gui_menu_find_word; ///< menuitem which allows to start searching
-               GtkWidget *ws_gui_menu_find_prev; ///< menuitem which allows to find previous word from the history
-               GtkWidget *ws_gui_menu_find_next; ///< menuitem which allows to find next word in the history 
-               GtkWidget *ws_gui_menu_stop; ///< menuitem which stops search
-       GtkWidget *ws_gui_menu_about; ///< menuitem which opens 'about application' dialog window
-       GtkWidget *ws_gui_menu_close; ///< menuitem which closes the application
-
-       GtkWidget *ws_gui_submenu_0; ///< submenu which is necessaty to build dictionaries submenu
-       GtkWidget *ws_gui_submenu_1; ///< submenu which is necessary to build edit submenu
-       GtkWidget *ws_gui_submenu_2; ///< submenu which is necessary to build view submenu
-       GtkWidget *ws_gui_submenu_3; ///< submenu which is necessary to build search submenu
-       GtkWidget *ws_gui_separator; ///< separator, it is used to provide nice layout
-
-       /*ws_gui_menu popup*/
-       GtkWidget *ws_gui_popup_menu;  ///< popup menu
-       GtkWidget *ws_gui_popup_edit; ///< edit submenu
-       GtkWidget *ws_gui_popup_submenu; ///< submenu (necessary to create edit submenu)
-       GtkWidget *ws_gui_popup_copy; ///< menuitem which allows to copy selected to the clipboard
-       GtkWidget *ws_gui_popup_paste; ///< menuitem which allows to paste content of the clipboard into find toolbar entry
-       GtkWidget *ws_gui_popup_select_all; ///<menuitem which allows to select whole text in translation area
-       GtkWidget *ws_gui_popup_zoom_in; ///< menuitem which allows to zoom in text in translation area
-       GtkWidget *ws_gui_popup_zoom_out; ///< menuitem which allows to zoom in text in translation area
-
-       GtkWidget *ws_gui_separator1; ///< separator, it is used to provide nice layout
-       GtkWidget *ws_gui_separator2; ///< separator, it is used to provide nice layout
-       
+         /*application menu*/
+       GtkWidget *ws_gui_main_menu; ///< application submenu
+       GtkWidget *ws_gui_menu_dictionaries; ///< dictionaries submenu(managing with the dictionary files)
+       GtkWidget *ws_gui_menu_load_dict; ///<menuitem in dictionaries submenu; load new dictionary file into application
+       GtkWidget *ws_gui_menu_select_dict; ///<menuitem in dictionaries submenu; allow to select which dictionaries are used
+       GtkWidget *ws_gui_menu_remove_dict; ///<menuitem in dictionaries submenu; remove dictionary files which are no longer used
+                  //added by me 
+       GtkWidget* ws_gui_menu_optimize_dict;
+       GtkWidget *ws_gui_menu_edit; ///< edit submenu(connected with text editing)
+       GtkWidget *ws_gui_menu_copy; ///< menuitem in edit submenu; copy selected text to the clipboard
+       GtkWidget *ws_gui_menu_paste; ///< menuitem in edit submenu; paste content of the clipboard into find toolbar entry
+       GtkWidget *ws_gui_menu_select_all; ///< menuitem in edit submenu; select whole text in the translation (html) area 
+       GtkWidget *ws_gui_menu_view; ///< view submenu
+       GtkWidget *ws_gui_menu_hide_list; ///< menuitem which allows to hide/show words list
+       GtkWidget *ws_gui_menu_zoom_in; ///< menuitem which allows to zoom in text in the translation area
+       GtkWidget *ws_gui_menu_zoom_out; ///< menuitem which allows to zoom out text in the translation area
+       GtkWidget *ws_gui_menu_full_screen; ///< menuitem which allows to switch between fullscreen and normal mode
+       GtkWidget *ws_gui_menu_search; ///< search submenu (connected with searching)
+       GtkWidget *ws_gui_menu_find_word; ///< menuitem which allows to start searching
+       GtkWidget *ws_gui_menu_find_prev; ///< menuitem which allows to find previous word from the history
+       GtkWidget *ws_gui_menu_find_next; ///< menuitem which allows to find next word in the history 
+       GtkWidget *ws_gui_menu_stop; ///< menuitem which stops search
+       GtkWidget *ws_gui_menu_about; ///< menuitem which opens 'about application' dialog window
+       GtkWidget *ws_gui_menu_close; ///< menuitem which closes the application
+
+       GtkWidget *ws_gui_submenu_0; ///< submenu which is necessaty to build dictionaries submenu
+       GtkWidget *ws_gui_submenu_1; ///< submenu which is necessary to build edit submenu
+       GtkWidget *ws_gui_submenu_2; ///< submenu which is necessary to build view submenu
+       GtkWidget *ws_gui_submenu_3; ///< submenu which is necessary to build search submenu
+       GtkWidget *ws_gui_separator; ///< separator, it is used to provide nice layout
+
+         /*ws_gui_menu popup*/
+       GtkWidget *ws_gui_popup_menu;  ///< popup menu
+       GtkWidget *ws_gui_popup_search;///< search option, allow to search selected text
+       GtkWidget *ws_gui_popup_edit; ///< edit submenu
+       GtkWidget *ws_gui_popup_submenu; ///< submenu (necessary to create edit submenu)
+       GtkWidget *ws_gui_popup_copy; ///< menuitem which allows to copy selected to the clipboard
+       GtkWidget *ws_gui_popup_paste; ///< menuitem which allows to paste content of the clipboard into find toolbar entry
+       GtkWidget *ws_gui_popup_select_all; ///<menuitem which allows to select whole text in translation area
+       GtkWidget *ws_gui_popup_zoom_in; ///< menuitem which allows to zoom in text in translation area
+       GtkWidget *ws_gui_popup_zoom_out; ///< menuitem which allows to zoom in text in translation area
+
+       GtkWidget *ws_gui_separator1; ///< separator, it is used to provide nice layout
+       GtkWidget *ws_gui_separator2; ///< separator, it is used to provide nice layout
+         
 };
 
 /** \brief struct which contains components of words list
@@ -144,20 +146,20 @@ struct WSGuiMenu {
  * here are placed all components of words list (inside left scrollwindow)
  */
 struct WSGuiList {
-       GtkWidget       *ws_gui_list; ///< list which contains words
-       GtkWidget       *ws_gui_list_item; ///< item in words list (each word)
-       GtkWidget       *ws_gui_list_label; ///< label, necessary to place word in words list
-       
-       GtkObject       *ws_gui_list_item_object; ///< object which stores data of selected item (from words list)
-        gchar           *ws_gui_list_item_data_string; ///< variable which stores translation of word (html content)
-       GList           *ws_gui_dlist; ///< variable, which is necessary to get selected item (from words list)
-
-       GtkListStore  *ws_gui_store; ///< list necessary to present words list
-       GtkTreeIter    ws_gui_iter; ///< variable necessary to present words list
-       GtkCellRenderer     *ws_gui_renderer; ///< variable necessary to draw GtkTree 
-       GtkTreeModel        *ws_gui_model; ///< model of GtkTree
-       GtkWidget           *ws_gui_view; ///< variable responsible for view of GtkTree
-       GtkTreeSelection    *ws_gui_selection; ///< variable necessary to read selection (from words list)
+       GtkWidget* ws_gui_list; ///< list which contains words
+       GtkWidget* ws_gui_list_item; ///< item in words list (each word)
+       GtkWidget* ws_gui_list_label; ///< label, necessary to place word in words list
+         
+       GtkObject* ws_gui_list_item_object; ///< object which stores data of selected item (from words list)
+       gchar* ws_gui_list_item_data_string; ///< variable which stores translation of word (html content)
+       GList* ws_gui_dlist; ///< variable, which is necessary to get selected item (from words list)
+
+       GtkListStore* ws_gui_store; ///< list necessary to present words list
+       GtkTreeIter ws_gui_iter; ///< variable necessary to present words list
+       GtkCellRenderer* ws_gui_renderer; ///< variable necessary to draw GtkTree 
+       GtkTreeModel* ws_gui_model; ///< model of GtkTree
+       GtkWidget* ws_gui_view; ///< variable responsible for view of GtkTree
+       GtkTreeSelection* ws_gui_selection; ///< variable necessary to read selection (from words list)
 
 };
 
@@ -166,55 +168,56 @@ struct WSGuiList {
  * here are placed all components of main window, toolbar, structures responsible for menus and variables responsible for adjustments, words history, banners, message dialogs and everything what user can see and use
  */
 struct WSGuiAppData {
-       HildonProgram *ws_gui_hildon_program; ///< handle to hildon program
-       HildonWindow *ws_gui_hildon_window; ///< handle to hildon window
-       GtkWidget *ws_gui_html; ///< translation (html) area 
-       GtkWidget *ws_gui_hpane; ///< pane; it allows to divide window into two separate panels
-       HildonFindToolbar *ws_gui_hildon_find_toolbar; ///< find toolbar (placed at the bottom of the window)
-       GtkToolItem *ws_gui_toobar_button_close; ///< close button at the find toolbar
-       GtkToolItem *ws_gui_toobar_button_back; ///< back button at the find toolbar (history navigator)
-       GtkToolItem *ws_gui_toobar_button_forward; ///< next button at the find toolbar (history navigator)
-       GtkToolItem *ws_gui_toobar_button_stop; ///< stop butoon at the find toolbar (allows to stop searching)
-       GtkWidget *ws_gui_banner; ///< banner, displays message that searching is in progress
-       GtkWidget *ws_gui_banner_caching; ///< banner, displays message that caching is in progress
-       gboolean caching_flag; ///< flag; used when caching is being performed
-       GtkToolItem *ws_gui_toobar_button_hide; ///< button hide, allows to hide/show words list with button placed at find toolbar
-       GtkWidget *ws_gui_scrolledwindow_right; ///< right scrolledwindow (placed in right pane), necessary to provide scrollbars)
-       GtkWidget *ws_gui_scrolledwindow_left; ///< scrollwindow (placed in left pane), necessary to provide scrollbars)
-       gchar *ws_gui_html_source; ///< string which contains html content (translation of word)
-
-       GtkAdjustment* ws_gui_vadj; ///< vertical adjustment of left scrolledwindow (necessary to provide navigation (kardware keys) inside words list)
-       GtkAdjustment* ws_gui_hadj; ///< horizontal adjustment of left scrolledwindow (necessary to provide navigation (kardware keys) inside words list)
-       gdouble v_delta; ///< variable used for moving vertical scrollbar in words list
-       gdouble v_new_value; ///< variable used for moving vertical scrollbar in words list
-       gdouble h_delta; ///< variable used for moving horizontal scrollbar in words list
-       gdouble h_new_value; ///< variable used for moving horizontal scrollbar in words list
-       gdouble cur_vadj; ///< current vertical adjustment of vertical scrollbar in words list
-       gdouble prev_vadj; ///< previous vertical adjustment of vertical scrollbar in words list
-       gdouble cur_hadj; ///< current vertical adjustment of horizontal scrollbar in words list
-       gdouble prev_hadj; ///< previous vertical adjustment of horizontal scrollbar in words list
-
-       GArray *ws_gui_history; ///< words history
-       gint ws_gui_history_cur_pos; ///< current position in words history array 
-       struct WSGuiMenu *ws_gui_menu; ///< structure responsible for menus
-       struct WSGuiList *ws_gui_w_list; ///< structure responsible for words list
-       
-       gboolean ws_gui_banner_flag; ///< flag; used for notifing if searching is in progress and banner has to be displaying
-       gboolean ws_gui_full_screen_flag; ///< flag; used for informing if fullscreen mode is active
-       gboolean ws_gui_double_click; ///< flag; necessary to recognize double click
-       gboolean ws_gui_sel_flag; ///< flag; used to identify selected text
-       
-       WSDBusData *dbus_data; ///< DBUS declaration
-
-       GtkWidget* ws_message_dialog; ///< message dialogs; used for informing user about errors
-
-       GSList *directories; ///< list consist of directories previously read from gconf
-       GConfClient *client; ///< variable necessary to read from gconf
-       GtkClipboard *ws_gui_clipboard; ///< application clipboard (available outside the application as well)
-       PangoFontDescription* p; ///< schema, which allows to format text on widgets
-       GtkWidget *licence_dialog; ///< variable necessary to create license dialog
-       GTimer *timer; ///< timer, counts how long user press button (stylus)
-       
+       HildonProgram *ws_gui_hildon_program; ///< handle to hildon program
+       HildonWindow *ws_gui_hildon_window; ///< handle to hildon window
+       GtkWidget *ws_gui_html; ///< translation (html) area 
+       GtkWidget *ws_gui_hpane; ///< pane; it allows to divide window into two separate panels
+       HildonFindToolbar *ws_gui_hildon_find_toolbar; ///< find toolbar (placed at the bottom of the window)
+       GtkToolItem *ws_gui_toobar_button_close; ///< close button at the find toolbar
+       GtkToolItem *ws_gui_toobar_button_back; ///< back button at the find toolbar (history navigator)
+       GtkToolItem *ws_gui_toobar_button_forward; ///< next button at the find toolbar (history navigator)
+       GtkToolItem *ws_gui_toobar_button_stop; ///< stop butoon at the find toolbar (allows to stop searching)
+       GtkWidget *ws_gui_banner; ///< banner, displays message that searching is in progress
+       GtkWidget *ws_gui_banner_caching; ///< banner, displays message that caching is in progress
+       gboolean caching_flag; ///< flag; used when caching is being performed
+       GtkToolItem *ws_gui_toobar_button_hide; ///< button hide, allows to hide/show words list with button placed at find toolbar
+       GtkWidget *ws_gui_scrolledwindow_right; ///< right scrolledwindow (placed in right pane), necessary to provide scrollbars)
+       GtkWidget *ws_gui_scrolledwindow_left; ///< scrollwindow (placed in left pane), necessary to provide scrollbars)
+       gchar *ws_gui_html_source; ///< string which contains html content (translation of word)
+
+       GtkAdjustment* ws_gui_vadj; ///< vertical adjustment of left scrolledwindow (necessary to provide navigation (kardware keys) inside words list)
+       GtkAdjustment* ws_gui_hadj; ///< horizontal adjustment of left scrolledwindow (necessary to provide navigation (kardware keys) inside words list)
+       gdouble v_delta; ///< variable used for moving vertical scrollbar in words list
+       gdouble v_new_value; ///< variable used for moving vertical scrollbar in words list
+       gdouble h_delta; ///< variable used for moving horizontal scrollbar in words list
+       gdouble h_new_value; ///< variable used for moving horizontal scrollbar in words list
+       gdouble cur_vadj; ///< current vertical adjustment of vertical scrollbar in words list
+       gdouble prev_vadj; ///< previous vertical adjustment of vertical scrollbar in words list
+       gdouble cur_hadj; ///< current vertical adjustment of horizontal scrollbar in words list
+       gdouble prev_hadj; ///< previous vertical adjustment of horizontal scrollbar in words list
+
+       GArray *ws_gui_history; ///< words history
+       gint ws_gui_history_cur_pos; ///< current position in words history array 
+       struct WSGuiMenu *ws_gui_menu; ///< structure responsible for menus
+       struct WSGuiList *ws_gui_w_list; ///< structure responsible for words list
+         
+       gboolean ws_gui_banner_flag; ///< flag; used for notifing if searching is in progress and banner has to be displaying
+       gboolean ws_gui_full_screen_flag; ///< flag; used for informing if fullscreen mode is active
+       gboolean ws_gui_double_click; ///< flag; necessary to recognize double click
+       gboolean ws_gui_sel_flag; ///< flag; used to identify selected text
+         
+       WSDBusData *dbus_data; ///< DBUS declaration
+
+       GtkWidget* ws_message_dialog; ///< message dialogs; used for informing user about errors
+
+       GSList *directories; ///< list consist of directories previously read from gconf
+       GConfClient *client; ///< variable necessary to read from gconf
+       GtkClipboard *ws_gui_clipboard; ///< application clipboard (available outside the application as well)
+       GtkClipboard *ws_gui_clipboard_primary;
+       PangoFontDescription* p; ///< schema, which allows to format text on widgets
+       GtkWidget *licence_dialog; ///< variable necessary to create license dialog
+       GTimer *timer; ///< timer, counts how long user press button (stylus)
+         
 };
 
 #ifdef __cplusplus
index 6299ce1..9d82da9 100644 (file)
@@ -1,4 +1,4 @@
-/************************************************************************************************
+/*******************************************************************************
 This file is part of WhiteStork.
 
 WhiteStork is free software; you can redistribute it and/or modify
@@ -16,8 +16,7 @@ along with WhiteStork; if not, write to the Free Software
 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
 
 Copyright 2006 ComArch S.A.
-************************************************************************************************/
-
+*******************************************************************************/
 #ifndef _WS_GUI_CALLBACKS
 #define _WS_GUI_CALLBACKS 
 
@@ -57,7 +56,9 @@ void ws_gui_dbus_return_words (GError *error, GArray *words, gpointer user_data)
 /** \brief handle dbus signal and convert message into readable text (translation of the word)
  *
  */
-void ws_gui_dbus_return_translation (GError *error, GArray *words, gpointer user_data);
+void ws_gui_dbus_return_translation (GError *error, 
+                                     GArray *words,
+                                     gpointer user_data);
 
 
 /**  \brief is used to free memory, which was allocated
@@ -68,12 +69,15 @@ void ws_gui_free_memory(gpointer user_data);
 /**  \brief handle keys press signals (hardware keys in device)
 *
 */
-gboolean hildon_key_press_listener (GtkWidget * widget, GdkEventKey * keyevent, gpointer user_data);
+gboolean hildon_key_press_listener (GtkWidget * widget,
+                                    GdkEventKey * keyevent,
+                                    gpointer user_data);
 
 /**  \brief allow to hide words list from menu
 *
 */
-void ws_gui_words_list_hide_from_menu(GtkCheckMenuItem *checkmenuitem, gpointer user_data);
+void ws_gui_words_list_hide_from_menu(GtkCheckMenuItem *checkmenuitem,
+                                      gpointer user_data);
 
 /**  \brief allow to hide words list from toolbar
 *
@@ -113,13 +117,19 @@ GtkTreeModel * create_and_fill_model (GArray *words_list, gpointer user_data);
 /** \brief handles a signal when user highlight a word from the words list
  *
  */
-void ws_gui_tree_selection_changed(GtkTreeSelection *selection, gpointer user_data);
+void ws_gui_tree_selection_changed(GtkTreeSelection *selection,
+                                   gpointer user_data);
 
 /**  \brief switch view between full screen and normal mode 
 *
 */
 void ws_gui_full_screen(GtkMenuItem *menuitem, gpointer user_data);
 
+/**  \brief search for selected text in a dictionary
+*
+*/
+void ws_gui_popup_search(GtkMenuItem *menuitem, gpointer user_data);
+
 /**  \brief allows to select whole text in translation (html) area
 *
 */
@@ -178,17 +188,22 @@ void ws_gui_read_adjustment(gpointer user_data);
 /** \brief necessary to load images into translation (html) area
  *
  */
-void ws_gui_url_requested (GtkHTML *html, const char *url, GtkHTMLStream *stream);
+void ws_gui_url_requested (GtkHTML *html, const char *url,
+                           GtkHTMLStream *stream);
 
 /** \brief handles button press event
  *
  */
-gboolean ws_gui_button_press (GtkWidget *widget, GdkEventButton *event, gpointer user_data);
+gboolean ws_gui_button_press (GtkWidget *widget,
+                              GdkEventButton *event,
+                              gpointer user_data);
 
 /** \brief handles button release event
  *
  */
-gboolean ws_gui_button_release (GtkWidget *widget, GdkEventButton *event, gpointer user_data);
+gboolean ws_gui_button_release (GtkWidget *widget,
+                                GdkEventButton *event,
+                                gpointer user_data);
 
 /** \brief shows popup when user clicks and holds
  *
index 9e5cdfd..793b61d 100644 (file)
@@ -1,4 +1,4 @@
-/************************************************************************************************
+/*******************************************************************************
 This file is part of WhiteStork.
 
 WhiteStork is free software; you can redistribute it and/or modify
@@ -16,8 +16,7 @@ along with WhiteStork; if not, write to the Free Software
 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
 
 Copyright 2006 ComArch S.A.
-************************************************************************************************/
-
+*******************************************************************************/
 #ifndef _WS_GUI_LAYOUT
 #define _WS_GUI_LAYOUT
 
index aa4b586..c5f71ab 100644 (file)
@@ -1,4 +1,4 @@
-/************************************************************************************************
+/*******************************************************************************
 This file is part of WhiteStork.
 
 WhiteStork is free software; you can redistribute it and/or modify
@@ -16,7 +16,7 @@ along with WhiteStork; if not, write to the Free Software
 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
 
 Copyright 2006 ComArch S.A.
-************************************************************************************************/
+*******************************************************************************/
 #ifndef _WS_MANAGER
 #define _WS_MANAGER
 
@@ -34,19 +34,19 @@ Copyright 2006 ComArch S.A.
 
 struct _WSMngSearchData
 {
-       GArray* dict; ///< pointer to GArray structure which stores pointers to fuction used to service dictionaries 
-       GArray* modules; ///< pointer to GArray structure which stores pointers to fuction used to service modules loading
-       gchar* word; ///< word which will be used to search a dictionaries
-       //pthread_mutex_t a_mutex ///< mutex used to  synchronize threads
-       pthread_t p_thread; ///< a thread in which we serching 
-       WSDBusData* dbus_data; ///< a pointer DBUS data
-       GMainLoop* loop; ///< pointer to main loop
-       GModule* library; ///< library used to load modules
-       GArray* word_list; ///< searched word list
-       gchar* trans; ///< searched translation
-       gint returned_results; ///< count of returned results
-       gchar* last_search; ///< last searched word
-       gboolean search_in_history; ///< flag signalig when search in hisory is commieted
+        GArray* dict; ///< pointer to GArray structure which stores pointers to fuction used to service dictionaries 
+        GArray* modules; ///< pointer to GArray structure which stores pointers to fuction used to service modules loading
+        gchar* word; ///< word which will be used to search a dictionaries
+        pthread_t p_thread; ///< a thread in which we serching 
+        WSDBusData* dbus_data; ///< a pointer DBUS data
+        GMainLoop* loop; ///< pointer to main loop
+        GModule* library; ///< library used to load modules
+        GArray* word_list; ///< searched word list
+        gchar* trans; ///< searched translation
+        gint returned_results; ///< count of returned results
+        gchar* last_search; ///< last searched word
+        gboolean search_in_history; ///< flag signalig when search in hisory is commieted
+        GArray* libraries; ///<tabele used for storing modules libraries
 };
 
 typedef struct _WSMngSearchData WSMngSearchData;
@@ -59,23 +59,29 @@ void ws_mng_init_dbus (WSMngSearchData *data);
 /**
 * \brief Function used to initialize user interface
 *
-* In this function new process is spawned and in this process user interfece is started.
+* In this function new process is spawned and in this process user interfece is 
+started.
 */
 void ws_mng_init_gui ();
 
 /**
 * \brief Function used to initialize manager
 *
-* Fuction loads from modules pointers to functions used to service searching in dictionaries and stores them in WSMngSearchData structure
-*@param data pointer to structure WSMngSearchData which stores variables needed to service manager
+* Fuction loads from modules pointers to functions used to service searching 
+in dictionaries and stores them in WSMngSearchData structure
+*@param data pointer to structure WSMngSearchData which stores variables needed 
+to service manager
 */
 void ws_mng_init (WSMngSearchData *data);
 
 /**
 * \brief Function is used for set active configuration of dictionaries chosen by user.
 *
-* When changes in GConf configuration occurs function clean structure which store pointers to functions used to service searching in dictionaries and fills it again. The dictionaries are omitted when it they are not selected by user.
-*@param data pointer to a structure holding pointers to functions used to service searching in dictionaries
+* When changes in GConf configuration occurs function clean structure which 
+store pointers to functions used to service searching in dictionaries and fills 
+it again. The dictionaries are omitted when it they are not selected by user.
+*@param data pointer to a structure holding pointers to functions used to 
+service searching in dictionaries
 */
 void ws_mng_set_active_dict (WSMngSearchData *data);
 
@@ -104,7 +110,9 @@ gpointer ws_mng_search_word (gpointer data);
 * @param error error messages
 * @param user_data user data passed to function
 */
-void ws_mng_on_search_translation (GError *error, GArray *word, gpointer user_data);
+void ws_mng_on_search_translation (GError *error,
+                                   GArray *word,
+                                   gpointer user_data);
 
 /**
 * \brief Function used to run search for transaltion of word engine in threads
@@ -122,7 +130,10 @@ gpointer ws_mng_search_translation (gpointer data);
 * @param user_data data passed to function
 * @param error engine status information
 */
-void ws_mng_on_found_word (GArray* list, gchar* pattern, gpointer user_data, EngineStatus error);
+void ws_mng_on_found_word (GArray* list,
+                           gchar* pattern,
+                           gpointer user_data,
+                           EngineStatus error);
 
 /**
 * \brief Used to return results of transaltion from threads
@@ -133,12 +144,16 @@ void ws_mng_on_found_word (GArray* list, gchar* pattern, gpointer user_data, Eng
 * @param error engine status information
 */
 
-void ws_mng_on_found_translation (gchar* translation, gchar* pattern, gpointer user_data, EngineStatus error);
+void ws_mng_on_found_translation (gchar* translation,
+                                  gchar* pattern,
+                                  gpointer user_data,
+                                  EngineStatus error);
 
 /**
 * \brief Function used to close dictionaries and modules
 *
-* @param data structure holds pointers to data which need to be freed from memory
+* @param data structure holds pointers to data which need to be freed 
+from memory
 */
 void ws_mng_close (WSMngSearchData *data);
 
index 62ad29a..457d9cb 100644 (file)
@@ -1,4 +1,4 @@
-/************************************************************************************************
+/*******************************************************************************
 This file is part of WhiteStork.
 
 WhiteStork is free software; you can redistribute it and/or modify
@@ -16,7 +16,7 @@ along with WhiteStork; if not, write to the Free Software
 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
 
 Copyright 2006 ComArch S.A.
-************************************************************************************************/
+*******************************************************************************/
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -27,57 +27,54 @@ extern "C" {
 
 void ws_mng_on_search_word (GError *error, GArray *word, gpointer user_data)
 {
-       WSMngSearchData *data = (WSMngSearchData *) user_data;
-       osso_rpc_t* osso_data = NULL;
-       gint i = 0; 
-       
-       osso_data = &g_array_index (word, osso_rpc_t, 0); //get the word 
-       g_debug("\n\tIn %s() - zwalniam last_search\n", __FUNCTION__);
-       g_free(data->last_search);//free last searched word
-       g_debug("\n\tIn %s() - zwolnilem last_search\n", __FUNCTION__);
-       data->last_search = g_strdup(osso_data->value.s);//get new searched word         
-       
-       g_debug("\n\tIn %s() - zwalniam word\n", __FUNCTION__);
-       g_free(data->word);
-       g_debug("\n\tIn %s() - zwolnilem word\n", __FUNCTION__);
-       data->word = g_strdup(osso_data->value.s); //get new current word
-       data->returned_results = data->dict->len; //set new number of number of finished searchings
-       
-       for (i=0; i<data->word_list->len; i++)
-       {
-               g_debug("\n\tIn %s() - zwalniam word_list element \n", __FUNCTION__);
-               g_free(g_array_index(data->word_list,gchar* ,i));       
-               g_debug("\n\tIn %s() - zwolnilem word_list element\n", __FUNCTION__);
-       }
-       //data->word_list->len = 0;
-       g_debug("\n\tIn %s() - zwalniam word_list\n", __FUNCTION__);
-       g_array_free(data->word_list, TRUE);
-       g_debug("\n\tIn %s() - zwolnilem word_list\n", __FUNCTION__);
-       data->word_list = g_array_new(TRUE, TRUE, sizeof(gchar*));
-       g_debug("\n\tIn %s() - zwalniam osso\n", __FUNCTION__);
-       osso_rpc_free_val(osso_data);
-       g_debug("\n\tIn %s() - zwolnilem osso\n", __FUNCTION__);
-       //g_array_free(word, TRUE);
-       pthread_create (&data->p_thread, 
-                       NULL, 
-                       ws_mng_search_word, 
-                       data);   //create thread and run search
+        WSMngSearchData *data = (WSMngSearchData *) user_data;
+        osso_rpc_t* osso_data = NULL;
+        gint i = 0; 
+        
+        //get the word passed by dbus 
+        osso_data = &g_array_index (word, osso_rpc_t, 0); 
+        //free memory used by last searched word
+        g_free(data->last_search);
+        //set last searched word to word passed by dbus
+        data->last_search = g_strdup(osso_data->value.s);
+        //free memory used by word currently searched
+        g_free(data->word);
+        //set word to search 
+        data->word = g_strdup(osso_data->value.s); 
+        //set new number of number of finished searchings
+        data->returned_results = data->dict->len; 
+        //free memory used by each word from word list
+        for (i=0; i<data->word_list->len; i++)
+        {
+                g_free(g_array_index(data->word_list,gchar* ,i));        
+        }
+        //free memory used by GArray 
+        g_array_free(data->word_list, TRUE);
+        //creating new GArray for word list
+        data->word_list = g_array_new(TRUE, TRUE, sizeof(gchar*));
+        //free memory sended by dbus
+        osso_rpc_free_val(osso_data);
+        pthread_create (&data->p_thread, 
+                        NULL, 
+                        ws_mng_search_word, 
+                        data);   //create thread and run search                
 }
 
 gpointer ws_mng_search_word (gpointer data)
 {
-       WSMngSearchData *search = (WSMngSearchData *) data;
-       gint i = 0;
-               
-       pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); // set cancel type for thread
-       pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, NULL);// set cancel type for thread
-       
-       for (i=0; i<search->dict->len; i++)
-       {
-               dict_eng_search_word_list(g_array_index (search->dict, Engine *, i), search->word);              //search for word in dictionaries
-       }
-       
-       return NULL;
+        WSMngSearchData *search = (WSMngSearchData *) data;
+        gint i = 0;
+        // set cancel type for thread        
+        pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); 
+        pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, NULL);
+        //search for word in dictionaries each dictionary
+        for (i=0; i<search->dict->len; i++)
+        {
+                dict_eng_search_word_list(
+                                 g_array_index (search->dict, Engine *, i),
+                                 search->word);
+        }
+        return NULL;
 }
 
 /**
@@ -85,533 +82,580 @@ gpointer ws_mng_search_word (gpointer data)
 *
 *@param a first argument to compere
 *@param b second argument to compere
-*@return result of compare <0 if the second is greater than first 0 if the strings are the same >0 if the first string is greater than second  
+*@return result of compare <0 if the second is greater than first 0 if the 
+        strings are the same >0 if the first string is greater than second  
 */
 static gint ws_mng_compare_strings (gconstpointer a, gconstpointer b)
 {
-       gchar** str1 = (gchar**)(a);
-       gchar** str2 = (gchar**)(b);
-       gchar* stra = g_utf8_casefold(str1[0], -1);
-       gchar* strb = g_utf8_casefold(str2[0], -1);
-       gint result = g_utf8_collate(stra, strb);
-       g_free(stra); 
-       g_free(strb);
-       return result;
+        //gets the parameters to compare
+        gchar** str1 = (gchar**)(a);
+        gchar** str2 = (gchar**)(b);
+        //converts a string into a form that is independent of case
+        gchar* stra = g_utf8_casefold(str1[0], -1);
+        gchar* strb = g_utf8_casefold(str2[0], -1);
+        //compare two string
+        gint result = g_utf8_collate(stra, strb);
+        //free memory used by converted strings
+        g_free(stra); 
+        g_free(strb);
+        //return compare result 
+        return result;
 }
 
 
-void ws_mng_on_found_word (GArray* list, gchar* pattern, gpointer user_data, EngineStatus error)
+void ws_mng_on_found_word (GArray* list,
+                           gchar* pattern,
+                           gpointer user_data,
+                           EngineStatus error)
 {
-       WSMngSearchData *data = (WSMngSearchData *) user_data;
-       data->returned_results--;
-       gint i = 0;
-       for (i=0; i<list->len; i++)
-       {
-               g_debug("\n\tIn %s()\n Word list: %d - %s \n",__FUNCTION__, i, g_array_index(list, gchar*, i));
-               gchar* new_word = g_strdup(g_array_index(list, gchar*, i));
-               g_array_append_val(data->word_list, new_word);
-               g_free(g_array_index(list, gchar*, i));
-       }
-       g_array_free(list, TRUE);
-       //g_free(pattern);
-       if (data->returned_results <= 0)
-       {
-               int j = 0;
-               g_array_sort (data->word_list, ws_mng_compare_strings); //sort list of words
-               for (i = 0; i<data->word_list->len; i++)
-               {
-                       //gchar* stra = g_utf8_casefold(g_array_index(data->word_list, gchar*, i), -1);
-                       for (j =0; j<data->word_list->len; j++)
-                       {
-                               //gchar* strb = g_utf8_casefold(g_array_index(data->word_list, gchar*, j), -1);
-                               //gint result = g_utf8_collate(stra, strb);
-                               gint result = g_utf8_collate(
-                                               g_array_index(data->word_list, gchar*, i),
-                                               g_array_index(data->word_list, gchar*, j)
-                                               );
-                               if (result == 0 && i != j)
-                               {
-                                       g_array_remove_index(data->word_list, j);
-                               }
-                               //g_free(strb);
-                       }
-                       //g_free(stra);
-               }
-               ws_dbus_server_return_words(data->dbus_data, data->word_list); //send words via dbus to gui
-       }
+        WSMngSearchData *data = (WSMngSearchData *) user_data;
+        gint i = 0;
+        //decrement returned results count 
+        data->returned_results--;
+        
+        for (i=0; i<list->len; i++)
+        {
+                //copy word found by search engine
+                gchar* new_word = g_strdup(g_array_index(list, gchar*, i));
+                //add word to word list
+                g_array_append_val(data->word_list, new_word);
+                //free memory used by found words
+                g_free(g_array_index(list, gchar*, i));
+        }
+        //free memory used by GArray
+        g_array_free(list, TRUE);
+        if (data->returned_results <= 0)
+        {
+                int j = 0;
+                //sort list of words
+                g_array_sort (data->word_list, ws_mng_compare_strings); 
+                for (i = 0; i<data->word_list->len; i++)
+                {
+                        for (j =0; j<data->word_list->len; j++)
+                        {
+                                //search if there is a word on word list
+                                gint result = g_utf8_collate(
+                                        g_array_index(data->word_list,
+                                                      gchar*,
+                                                      i),
+                                        g_array_index(data->word_list,
+                                                      gchar*, j)
+                                        );
+                                //if there is a word on the word list 
+                                //remove that word
+                                if (result == 0 && i != j)
+                                {
+                                        g_array_remove_index(data->word_list, j);
+                                }
+                        }
+                }
+                 //send words via dbus to gui
+                ws_dbus_server_return_words(data->dbus_data, data->word_list);
+        }
 }
 
-
-
-void ws_mng_on_search_translation (GError *error, GArray *word, gpointer user_data)
+void ws_mng_on_search_translation (GError *error, GArray *word,
+                                   gpointer user_data)
 {
-       WSMngSearchData *data = (WSMngSearchData *) user_data;
-       osso_rpc_t *osso_data;
-       
-       osso_data = &g_array_index (word, osso_rpc_t, 0); 
-       data->word = g_strdup(osso_data->value.s);  //get the word
-       data->returned_results = data->dict->len;//setting how many dictionaries to search
-       data->trans = NULL;
-       osso_rpc_free_val(osso_data);//added
-       pthread_create (&data->p_thread, 
-                       NULL, 
-                       (gpointer) ws_mng_search_translation, 
-                       (gpointer) data); //create thread
+        WSMngSearchData *data = (WSMngSearchData *) user_data;
+        osso_rpc_t *osso_data;
+        //get the data sended by dbus
+        osso_data = &g_array_index (word, osso_rpc_t, 0); 
+        //get the word sended by dbus
+        data->word = g_strdup(osso_data->value.s);
+        //set how many dictionaries to search
+        data->returned_results = data->dict->len;
+        data->trans = NULL;
+        //free data sended by dbus
+        osso_rpc_free_val(osso_data);
+        //create thread 
+        pthread_create (&data->p_thread, 
+                        NULL, 
+                        (gpointer) ws_mng_search_translation, 
+                        (gpointer) data); 
 }
 
-void ws_mng_on_search_in_history (GError *error, GArray *word, gpointer user_data)
+void ws_mng_on_search_in_history (GError *error, GArray *word, 
+                                  gpointer user_data)
 {
-       WSMngSearchData *data = (WSMngSearchData *) user_data;
-       osso_rpc_t *osso_data;
-       data->search_in_history = TRUE;
-       osso_data = &g_array_index (word, osso_rpc_t, 0); 
-       data->word = g_strdup(osso_data->value.s);  //get the word
-       data->returned_results = data->dict->len;//setting how many dictionaries to search
-       data->trans = NULL;
-       osso_rpc_free_val(osso_data);//added
-       pthread_create (&data->p_thread, 
-                       NULL, 
-                       (gpointer) ws_mng_search_translation, 
-                       (gpointer) data); //create thread
+        WSMngSearchData *data = (WSMngSearchData *) user_data;
+        osso_rpc_t *osso_data;
+        //set the falg used to signaling 
+        data->search_in_history = TRUE;
+        //get data sended by dbus
+        osso_data = &g_array_index (word, osso_rpc_t, 0); 
+        //copy the word sended by dbus
+        data->word = g_strdup(osso_data->value.s);  
+        //set how many dictionaries to search
+        data->returned_results = data->dict->len;
+        data->trans = NULL;
+        //free memory sended by dbus
+        osso_rpc_free_val(osso_data);
+         //create thread
+        pthread_create (&data->p_thread, 
+                        NULL, 
+                        (gpointer) ws_mng_search_translation, 
+                        (gpointer) data);
 }
 
 gpointer ws_mng_search_translation (gpointer data)
 {
-       
-       WSMngSearchData *search = (WSMngSearchData *) data;
-       gint i = 0;
-       pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); // set cancel type for thread
-       pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, NULL);// set cancel type for thread
-       
-       for (i=0; i<search->dict->len; i++)
-       {
-               dict_eng_search_word_translation(g_array_index (search->dict, Engine*, i),
-                                                search->word); //search for translation
-       }
-       return NULL;
+        WSMngSearchData *search = (WSMngSearchData *) data;
+        gint i = 0;
+        // set cancel type for thread
+        pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); 
+        pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, NULL);
+        //run search for translation for evry dictionary
+        for (i=0; i<search->dict->len; i++)
+        {
+                 dict_eng_search_word_translation(g_array_index(
+                                                               search->dict, 
+                                                               Engine*,
+                                                               i),
+                                                 search->word);
+        }
+        return NULL;
 }
 
-
-void ws_mng_on_found_translation (gchar* translation, gchar* pattern, gpointer user_data, EngineStatus error)
+void ws_mng_on_found_translation (gchar* translation,
+                                  gchar* pattern,
+                                  gpointer user_data,
+                                  EngineStatus error
+                                 )
 {
-       WSMngSearchData *data = (WSMngSearchData *) user_data;
-       
-       data->returned_results--;
-               
-       if(translation != NULL)
-       {
-               if(data->trans == NULL)
-               {
-                       data->trans = g_strconcat("<PATTERN_OPEN>",pattern,"<PATTERN_CLOSED><TRANSLATION_OPEN>",translation, "<TRANSLATION_CLOSED>",NULL);
-               }
-               else 
-               {
-                       if(data->returned_results >= 0)
-                       {
-                               gchar* tmp = g_strconcat(data->trans,"<TRANSLATION_OPEN>",translation,"<TRANSLATION_CLOSED>",NULL);
-                               g_free(data->trans);
-                               data->trans = tmp; //g_strdup(tmp);
-                               tmp = NULL;
-                               //g_free(tmp);
-                       }
-               }
-       }
-       
-       if(data->returned_results <= 0)
-       {
-               if (data->search_in_history == TRUE && data->trans == NULL)
-               {
-                       ws_dbus_notify(data->dbus_data, WS_DBUS_ERROR_DICTIONARY_NOT_LOAD);
-                       data->search_in_history = FALSE;
-                       return;
-               }
-               gchar* tmp = g_strconcat(data->trans, NULL);
-//  = g_strconcat(data->trans,"</td></tr></table></body></html>", NULL);
-               g_free(data->trans);
-               data->trans = tmp; //added
-               tmp = NULL;                //added
-               //data->trans = g_strdup(tmp);
-               //g_free(tmp);          
-               data->search_in_history = FALSE;
-               ws_dbus_server_return_translations(data->dbus_data, data->trans);               
-       }
-       //g_free(translation);
-       //g_free(pattern);
+        WSMngSearchData *data = (WSMngSearchData *) user_data;
+        //decrement returned results count
+        data->returned_results--;
+        //if there is returned translation        
+        if(translation != NULL)
+        {
+                if(data->trans == NULL)
+                {
+                        //concatenate tags and searched word and translation
+                        data->trans = g_strconcat("<PATTERN_OPEN>",
+                                          pattern,
+                                          "<PATTERN_CLOSED><TRANSLATION_OPEN>",
+                                          translation,
+                                          "<TRANSLATION_CLOSED>",
+                                          NULL);
+                }
+                else //if thre was stored trnasloation 
+                {
+                        if(data->returned_results >= 0)
+                        {
+                                //copy stored trnasloation to temporery variable
+                                gchar* tmp = g_strconcat(data->trans,
+                                                        "<TRANSLATION_OPEN>",
+                                                        translation,
+                                                        "<TRANSLATION_CLOSED>",
+                                                        NULL);
+                                //free memory used by stored translation
+                                g_free(data->trans);
+                                data->trans = tmp; 
+                                tmp = NULL;                         
+                        }
+                }
+        }
+        //if there will be no more returned translations
+        if(data->returned_results <= 0)
+        {
+                //if serching for history record is done 
+                //and thre is no translation
+                if (data->search_in_history == TRUE && data->trans == NULL)
+                {
+                        //notify gui about event
+                        ws_dbus_notify(data->dbus_data,
+                                       WS_DBUS_ERROR_DICTIONARY_NOT_LOAD
+                                      );
+                        data->search_in_history = FALSE;
+                }
+                else
+                {
+                        //copy translation to temporery variable
+                        gchar* tmp = g_strdup(data->trans);
+                        //free memory used by stored translation
+                        g_free(data->trans);
+                        data->trans = tmp; 
+                        tmp = NULL;        
+                        data->search_in_history = FALSE;
+                        //send translation to gui
+                        ws_dbus_server_return_translations(data->dbus_data, data->trans);
+                }                
+        }    
 }
 
 
 void ws_mng_init_dbus (WSMngSearchData *data)
 {
-       data->dbus_data = ws_dbus_create ("WhiteStorkManager", "v1.0"); 
-       
-       ws_dbus_config(data->dbus_data, 
-                       WS_DBUS_CONFIG_SERVICE,
-                       "org.maemo.WhiteStorkManager");
-       ws_dbus_config(data->dbus_data, 
-                       WS_DBUS_CONFIG_OBJECT, 
-                       "/org/maemo/WhiteStorkManager");
-       ws_dbus_config(data->dbus_data, 
-                       WS_DBUS_CONFIG_IFACE, 
-                       "org.maemo.WhiteStorkManager");
-       ws_dbus_config(data->dbus_data, 
-                       WS_DBUS_CONFIG_REMOTE_SERVICE, 
-                       "org.maemo.WhiteStorkGui");
-       ws_dbus_config(data->dbus_data, 
-                       WS_DBUS_CONFIG_REMOTE_OBJECT, 
-                       "/org/maemo/WhiteStorkGui");
-       ws_dbus_config(data->dbus_data, 
-                       WS_DBUS_CONFIG_REMOTE_IFACE, 
-                       "org.maemo.WhiteStorkGui");
-       
-       ws_dbus_connect(data->dbus_data);
-       
-       ws_dbus_set_cb(data->dbus_data, 
-                       "find_word", 
-                       ws_mng_on_search_word,
-                       data);// setting callback for find word signal
-       ws_dbus_set_cb(data->dbus_data,
-                       "find_translation",
-                       ws_mng_on_search_translation,
-                       data); //setting callback for find translation signal
-       ws_dbus_set_cb(data->dbus_data,
-                       "signal",
-                       ws_mng_signal_handling,
-                       data); //setting callback for close program signal
-       ws_dbus_set_cb(data->dbus_data, "search_in_history", ws_mng_on_search_in_history, data);
+        //create data structure needed to comunicate with dbus wrapper
+        data->dbus_data = ws_dbus_create ("WhiteStorkManager", "v1.0"); 
+        //set data used to comunicate with gui
+        ws_dbus_config(data->dbus_data, 
+                       WS_DBUS_CONFIG_SERVICE,
+                       "org.maemo.WhiteStorkManager");
+        ws_dbus_config(data->dbus_data, 
+                        WS_DBUS_CONFIG_OBJECT, 
+                        "/org/maemo/WhiteStorkManager");
+        ws_dbus_config(data->dbus_data, 
+                        WS_DBUS_CONFIG_IFACE, 
+                        "org.maemo.WhiteStorkManager");
+        ws_dbus_config(data->dbus_data, 
+                        WS_DBUS_CONFIG_REMOTE_SERVICE, 
+                        "org.maemo.WhiteStorkGui");
+        ws_dbus_config(data->dbus_data, 
+                        WS_DBUS_CONFIG_REMOTE_OBJECT, 
+                        "/org/maemo/WhiteStorkGui");
+        ws_dbus_config(data->dbus_data, 
+                        WS_DBUS_CONFIG_REMOTE_IFACE, 
+                        "org.maemo.WhiteStorkGui");
+        
+        ws_dbus_connect(data->dbus_data);
+        
+        ws_dbus_set_cb(data->dbus_data, 
+                      "find_word", 
+                      ws_mng_on_search_word,
+                      data);// set callback for find word signal
+         ws_dbus_set_cb(data->dbus_data,
+                       "find_translation",
+                       ws_mng_on_search_translation,
+                       data); //set callback for find translation signal
+        ws_dbus_set_cb(data->dbus_data,
+                       "signal",
+                       ws_mng_signal_handling,
+                       data); //set callback for close program signal
+        ws_dbus_set_cb(data->dbus_data,
+                      "search_in_history",
+                      ws_mng_on_search_in_history,
+                      data);//set callback for search in history signal
 }
 
 static GArray* ws_mng_read_gconf()
 {
-       g_type_init();
-       GConfClient* client = NULL;
-       GArray* path_to_dir = g_array_new(TRUE, TRUE, sizeof(gchar *));
-       gchar* path = NULL;
-       //gchar* key_value = NULL;
-       gboolean key_active = FALSE;
-       gint i = 0;
-       
-       
-       client = gconf_client_get_default();
-       GSList* list = gconf_client_all_dirs(client, GCONF_KEY, NULL);
-       for (i=0; i<g_slist_length(list); i++)
-       {
-               //path = g_strdup((gchar *) g_slist_nth_data(list, i));
-               path = (gchar* ) g_slist_nth_data(list, i);
-               gchar* new_path = g_strconcat(path, "/path",NULL);
-               gchar* new_acitve = g_strconcat(path, "/active",NULL);
-               gchar* new_optimized = g_strconcat(path, "/optimized",NULL);
-               gchar* tmp = NULL;
-               gchar* key_value = gconf_client_get_string(client, new_path, NULL);
-               key_active = gconf_client_get_bool(client, new_acitve, NULL);
-               tmp = g_strconcat(key_value, "/dict.xdxf", NULL);
-               if (g_file_test(tmp, G_FILE_TEST_EXISTS) == TRUE && key_active == TRUE)
-               {
-                       g_array_append_val(path_to_dir, key_value);
-               }
-               g_free(tmp);
-               g_free(new_path);
-               g_free(new_acitve);
-               g_free(new_optimized);
-               
-       }
-       for (i=0; i<g_slist_length(list); i++)
-       {
-               g_free(g_slist_nth_data(list, i));
-       }
-       g_slist_free(list);
-       g_object_unref (client);
-       return path_to_dir;
+        g_type_init();
+        GConfClient* client = NULL;
+        GArray* path_to_dir = g_array_new(TRUE, TRUE, sizeof(gchar *));
+        gchar* path = NULL;
+        //gchar* key_value = NULL;
+        gboolean key_active = FALSE;
+        gint i = 0;
+        
+        
+        client = gconf_client_get_default();
+        GSList* list = gconf_client_all_dirs(client, GCONF_KEY, NULL);
+        for (i=0; i<g_slist_length(list); i++)
+        {
+                //path = g_strdup((gchar *) g_slist_nth_data(list, i));
+                path = (gchar* ) g_slist_nth_data(list, i);
+                gchar* new_path = g_strconcat(path, "/path",NULL);
+                gchar* new_acitve = g_strconcat(path, "/active",NULL);
+                gchar* new_optimized = g_strconcat(path, "/optimized",NULL);
+                gchar* tmp = NULL;
+                gchar* key_value = gconf_client_get_string(client,
+                                                           new_path,
+                                                           NULL);
+                key_active = gconf_client_get_bool(client, new_acitve, NULL);
+                tmp = g_strconcat(key_value, "/dict.xdxf", NULL);
+                if (g_file_test(tmp, G_FILE_TEST_EXISTS) == TRUE &&
+                    key_active == TRUE)
+                {
+                        g_array_append_val(path_to_dir, key_value);
+                }
+                g_free(tmp);
+                g_free(new_path);
+                g_free(new_acitve);
+                g_free(new_optimized);            
+        }
+        for (i=0; i<g_slist_length(list); i++)
+        {
+                g_free(g_slist_nth_data(list, i));
+        }
+        g_slist_free(list);
+        g_object_unref (client);
+        return path_to_dir;
 }
 
-
-
-void ws_mng_init_gui ()
+void ws_mng_progress_bar(double progress,
+                         gpointer user_data,
+                         EngineStatus error
+                        )
 {
-       
-       
-       gchar* current_directory = g_get_current_dir(); //get the current directory
-       gchar* library_to_path = g_strconcat(current_directory, "usr/bin/gui", NULL); //set path to gui binary file
-
-       printf ("GUI current directory: %s\n", current_directory);
-       printf ("GUI library to path: %s\n", library_to_path);
-       
-       if (g_file_test(library_to_path, G_FILE_TEST_EXISTS) == FALSE)
-       {
-               g_printf("Can`t find gui file. Terminating program\n");
-               exit(0);
-       }
-       
-       int pid = fork ();
-       switch (pid)
-       {
-               case -1:
-                       g_printf("Error ! Can not spwan user interface process");
-                       exit(0);
-               break;
-               
-               case 0:
-                       execl(library_to_path,0); //run the gui program
-               break;
-               
-               default:
-               break;
-       }
-       
-       g_free(current_directory);
-       g_free(library_to_path);
-}
-
-void ws_mng_progress_bar(double progress, gpointer user_data, EngineStatus error)
-{
-       WSMngSearchData *data = (WSMngSearchData *) user_data;
-       ws_dbus_update_progressbar(data->dbus_data, progress); //return progress of cacheing to user interface
+        WSMngSearchData *data = (WSMngSearchData *) user_data;
+        //return progress of cacheing to user interface
+        ws_dbus_update_progressbar(data->dbus_data, progress); 
 }
 
 static gboolean ws_mng_if_optimized(gchar* dict)
 {
-       GConfClient* client;
-
-       gchar* path = NULL;
-       //gchar* key_value = NULL;
-       gboolean key_optimized = FALSE;
-       gint i = 0;
-       g_type_init();
-       
-       client = gconf_client_get_default();
-       GSList* list = gconf_client_all_dirs(client, GCONF_KEY, NULL);
-       for (i=0; i<g_slist_length(list); i++)
-       {
-               path = (gchar *) g_slist_nth_data(list, i);
-               gchar* new_path = g_strconcat(path, "/path",NULL);
-               gchar* new_optimized = g_strconcat(path, "/optimized",NULL);
-               gchar* key_value = gconf_client_get_string(client, new_path, NULL);             
-               //g_strcasecmp(key_value,dict)==0 deprecated
-               if (g_ascii_strcasecmp(key_value, dict)==0)
-               {
-                       key_optimized = gconf_client_get_bool(client, new_optimized, NULL);
-               }
-               g_free(new_path);
-               g_free(new_optimized);
-               g_free(key_value);
-       }
-       for (i=0; i<g_slist_length(list); i++)
-       {
-               g_free(g_slist_nth_data(list, i));
-       }
-//     g_free(path);
-       
-       g_slist_free(list);
-       g_object_unref (client);
-       return key_optimized;
+        GConfClient* client;
+
+        gchar* path = NULL;
+        //gchar* key_value = NULL;
+        gboolean key_optimized = FALSE;
+        gint i = 0;
+        g_type_init();
+        
+        client = gconf_client_get_default();
+        GSList* list = gconf_client_all_dirs(client, GCONF_KEY, NULL);
+        for (i=0; i<g_slist_length(list); i++)
+        {
+                path = (gchar *) g_slist_nth_data(list, i);
+                gchar* new_path = g_strconcat(path, "/path",NULL);
+                gchar* new_optimized = g_strconcat(path, "/optimized",NULL);
+                gchar* key_value = gconf_client_get_string(client,
+                                                           new_path,
+                                                           NULL
+                                                          );       
+                if (g_ascii_strcasecmp(key_value, dict)==0)
+                {
+                        key_optimized = gconf_client_get_bool(client,
+                                                              new_optimized,
+                                                              NULL
+                                                             );
+                }
+                g_free(new_path);
+                g_free(new_optimized);
+                g_free(key_value);
+        }
+        for (i=0; i<g_slist_length(list); i++)
+        {
+                g_free(g_slist_nth_data(list, i));
+        }
+        g_slist_free(list);
+        g_object_unref (client);
+        return key_optimized;
 }
 
 static void ws_mng_load_dict(GArray* dict_directory, WSMngSearchData* data)
 {
-       //gchar* current_directory = NULL;
-       gint i = 0;
-       gint j = 0;
-       Engine* xdxf = NULL;
-       
-       for (i =0; i<dict_directory->len; i++)
-       {
-               gchar* current_directory = strdup(g_array_index(dict_directory, gchar*, i));
-               
-               for (j=0; j<data->modules->len; j++)//only one module in current version
-               {
-                       if (dict_eng_module_check (g_array_index(data->modules, EngineModule, j), current_directory) == TRUE)
-                       {
-                               
-                               
-                               if(ws_mng_if_optimized(current_directory))
-                               {
-                                       xdxf = dict_eng_module_create_ext(g_array_index(data->modules, EngineModule, j), current_directory, ENGINE_CREATE, ws_mng_progress_bar, data, 0.02); //create engine module 
-                               }
-                               else
-                               {
-                                       xdxf = dict_eng_module_create_ext(g_array_index(data->modules, EngineModule, j), current_directory, ENGINE_NO, ws_mng_progress_bar, data, 0.02); //create engine module 
-                               }
-
-                               dict_eng_set_callback(xdxf, ENGINE_WORD_LIST_SIGNAL,
-                                                     ws_mng_on_found_word,
-                                                     data);//set callback for return words list function
-                               dict_eng_set_callback(xdxf, ENGINE_WORD_TRANSLATION_SIGNAL,
-                                                     ws_mng_on_found_translation,
-                                                     data);//set callback for return translation
-
-                               g_array_append_val (data->dict, xdxf);//adding newly created engine to Garray
-                               g_free(current_directory);
-                       }
-               }
-       }
+        gint i = 0;
+        gint j = 0;
+        Engine* xdxf = NULL;
+        
+        for (i =0; i<dict_directory->len; i++)
+        {
+                gchar* current_directory = strdup(g_array_index(dict_directory,
+                                                                gchar*,
+                                                                i)
+                                                 );            
+                for (j=0; j<data->modules->len; j++)
+                {
+                        if (dict_eng_module_check (g_array_index(data->modules,
+                                                                 EngineModule,
+                                                                 j),
+                                                   current_directory) == TRUE)
+                        {               
+                               if(ws_mng_if_optimized(current_directory))
+                               {
+                                        xdxf = dict_eng_module_create_ext(
+                                                g_array_index(data->modules,
+                                                              EngineModule,
+                                                              j),
+                                               current_directory,
+                                               ENGINE_CREATE,
+                                               ws_mng_progress_bar,
+                                               data,
+                                               0.02); //create engine module 
+                               }
+                               else
+                               {
+                                        xdxf = dict_eng_module_create_ext(
+                                                g_array_index(data->modules,
+                                                             EngineModule,
+                                                             j),
+                                               current_directory,
+                                               ENGINE_NO, ws_mng_progress_bar,
+                                               data,
+                                               0.02); //create engine module 
+                               }
+                                //set callback for return words list function
+                                dict_eng_set_callback(xdxf,
+                                                      ENGINE_WORD_LIST_SIGNAL,
+                                                      ws_mng_on_found_word,
+                                                      data);
+                                //set callback for return translation
+                                dict_eng_set_callback(xdxf,
+                                                 ENGINE_WORD_TRANSLATION_SIGNAL,
+                                                 ws_mng_on_found_translation,
+                                                 data);
+                                //adding newly created engine to Garray
+                                g_array_append_val (data->dict, xdxf);
+                                g_free(current_directory);
+                        }
+                }
+        }
 }
 void ws_mng_init (WSMngSearchData *data)
 {
-       
-       data->dict = g_array_new(TRUE, TRUE, sizeof(Engine *));
-       data->modules = g_array_new(TRUE, TRUE, sizeof(EngineModule));
-       data->word_list = g_array_new(TRUE, TRUE, sizeof(gchar*));
-       data->library = NULL;
-       data->last_search = NULL;
-       data->trans = NULL;
-       data->search_in_history = FALSE;
-       
-       GArray *dict_directory = ws_mng_read_gconf(); //paths to dictionaries
-       gint i = 0;
-       
-       data->returned_results = dict_directory->len;
-               
-       gchar* library_to_path = "/usr/lib/WhiteStork/engine_xdxf.so";
-       //g_strdup("/usr/lib/WhiteStork/engine_xdxf.so"); //the name of module lo load
-       
-       data->library = g_module_open(library_to_path, G_MODULE_BIND_LAZY); //load the engine function
-       
-       getting_additional get_functions = NULL;
-       
-       g_module_symbol(data->library, "engine_global_functions", (gpointer)&get_functions);
-       
-       if (get_functions == NULL) //check if function was loaded
-       {
-               g_printf("Loading module function failed\n");
-               ws_dbus_notify(data->dbus_data, WS_DBUS_ERROR_ENGINE_NOT_FOUND);
-               for (i=0; i<dict_directory->len; i++)
-               {
-                       g_free(g_array_index(dict_directory, gchar*, i));
-               }
-               g_array_free(dict_directory, TRUE);
-               //g_free(library_to_path);      
-               ws_mng_close(data);
-               exit(0); //exit program
-       }
-       
-       EngineModule module = get_functions();
-       g_array_append_val (data->modules, module);//adding newly created module to Garray 
-       
-       //Engine* xdxf;
-       //current_directory = g_strdup("/media/mmc1/dict");
-       if (dict_directory->len > 0)
-       {
-               ws_dbus_notify(data->dbus_data, WS_DBUS_INFO_CACHING);
-               
-               ws_mng_load_dict(dict_directory, data);
-               
-               ws_dbus_notify(data->dbus_data, WS_DBUS_INFO_CACHING_FINISHED);
-       }
-       else
-       {
-               //g_printf("Dictionary file not found");
-               ws_dbus_notify(data->dbus_data, WS_DBUS_ERROR_FILE_NOT_FOUND);
-       }
-               
-       for (i=0; i<dict_directory->len; i++)
-       {
-               g_free(g_array_index(dict_directory, gchar*, i));
-       }
-       g_array_free(dict_directory, TRUE);
-       //g_free(library_to_path);
-}      
+        
+        data->dict = g_array_new(TRUE, TRUE, sizeof(Engine *));
+        data->modules = g_array_new(TRUE, TRUE, sizeof(EngineModule));
+        data->word_list = g_array_new(TRUE, TRUE, sizeof(gchar*));
+        data->library = NULL;
+        data->last_search = NULL;
+        data->trans = NULL;
+        data->search_in_history = FALSE;
+        
+        GArray *dict_directory = ws_mng_read_gconf(); //paths to dictionaries
+        gint i = 0;     
+        
+        data->returned_results = dict_directory->len;           
+        gchar* library_to_path = "/usr/lib/WhiteStork/engine_xdxf.so";        
+        //load the engine function
+        data->library = g_module_open(library_to_path, G_MODULE_BIND_LAZY); 
+        
+        getting_additional get_functions = NULL;
+        
+        g_module_symbol(data->library,
+                        "engine_global_functions",
+                        (gpointer)&get_functions);
+        
+        if (get_functions == NULL) //check if function was loaded
+        {
+                g_printf("Loading module function failed\n");
+                ws_dbus_notify(data->dbus_data, WS_DBUS_ERROR_ENGINE_NOT_FOUND);
+                for (i=0; i<dict_directory->len; i++)
+                {
+                        g_free(g_array_index(dict_directory, gchar*, i));
+                }
+                g_array_free(dict_directory, TRUE);
+                ws_mng_close(data);
+                exit(0); //exit program
+        }
+        
+        EngineModule module = get_functions();
+        //adding newly created module to Garray 
+        g_array_append_val (data->modules, module);
+        if (dict_directory->len > 0)
+        {
+                ws_dbus_notify(data->dbus_data, WS_DBUS_INFO_CACHING);             
+                ws_mng_load_dict(dict_directory, data);                
+                ws_dbus_notify(data->dbus_data, WS_DBUS_INFO_CACHING_FINISHED);
+        }
+        else
+        {
+                ws_dbus_notify(data->dbus_data, WS_DBUS_ERROR_FILE_NOT_FOUND);
+        }            
+        
+        for (i=0; i<dict_directory->len; i++)
+        {
+                g_free(g_array_index(dict_directory, gchar*, i));
+        }
+        g_array_free(dict_directory, TRUE);
+        
+}        
 
 void ws_mng_signal_handling (GError *error, GArray *signal, gpointer user_data)
 {
-       //printf("---->%s", __FUNCTION__);
-       osso_rpc_t osss_data;
-       osss_data = g_array_index (signal, osso_rpc_t, 0);// get the signal kind
-       WSMngSearchData *data = (WSMngSearchData *) user_data;
-       gint i = 0;
-       switch(osss_data.value.i)
-       {
-               case WS_DBUS_INFO_TERMINATE:
-                       g_printf("\nTerminating program\n");
-                       g_main_loop_quit (data->loop);
-               break;
-               
-               case WS_DBUS_INFO_STOP_SEARCH:
-                       pthread_cancel(data->p_thread);
-               break;
-               
-               case WS_DBUS_INFO_CONFIG_CHANGED:
-                       ws_dbus_notify(data->dbus_data, WS_DBUS_INFO_CACHING); 
-                       
-                       for (i=0; i<data->dict->len; i++)
-                       {
-                               g_free(g_array_index(data->dict, Engine*, i));//deallocates memory
-                       }
-                       g_array_free(data->dict, TRUE);
-                       
-                       data->dict = g_array_new (TRUE, TRUE, sizeof(Engine*));
-                       //g_array_remove_range(data->dict, 0, data->dict->len);//cleaning GArray dict holding dictionaries
-                       
-                       GArray* dir_array = ws_mng_read_gconf();//paths to directories
-                       ws_mng_load_dict(dir_array, data);//fill the table again with new dicnioraries
-                       
-                       if (data->dict->len <= 0)//if there is no dictionary selected signal this fact to gui
-                       {
-                               ws_dbus_notify(data->dbus_data, WS_DBUS_INFO_CACHING_FINISHED);
-                               ws_dbus_notify(data->dbus_data, WS_DBUS_ERROR_FILE_NOT_FOUND); 
-                       }else
-                       {
-                               data->returned_results = data->dict->len;
-                               //data->trans = NULL;
-                               if (data->last_search != NULL) //if there was typed word
-                               {
-                                       for (i=0; i<data->word_list->len; i++)
-                                       {
-                                               g_free(g_array_index(data->word_list,gchar* ,i));
-                                       }
-                                       g_array_free(data->word_list, TRUE);//freeing old words list
-                                       
-                                       data->word_list = g_array_new(TRUE, TRUE, sizeof(gchar*));//creating new word list
-                                       
-                                       g_free(data->word);
-                                       data->word = g_strdup(data->last_search);
-                                       
-                                       pthread_create (&data->p_thread, 
-                                                       NULL, 
-                                                       ws_mng_search_word, 
-                                                       data);
-                               }
-                               
-                               ws_dbus_notify(data->dbus_data, WS_DBUS_INFO_CACHING_FINISHED);
-                       }
-                       
-                       for (i=0; i<dir_array->len; i++)
-                       {
-                               g_free(g_array_index(dir_array, gchar*, i));//deallocates memory used by dir_array elements
-                       }
-                       g_array_free(dir_array, TRUE);
-               default:
-
-               break;
-       }
+        osso_rpc_t osss_data;
+        osss_data = g_array_index (signal, osso_rpc_t, 0);
+        WSMngSearchData *data = (WSMngSearchData *) user_data;
+        gint i = 0;
+        switch(osss_data.value.i)
+        {
+                case WS_DBUS_INFO_TERMINATE:
+                        g_printf("\nTerminating program\n");
+                        g_main_loop_quit (data->loop);
+                break;
+                
+                case WS_DBUS_INFO_STOP_SEARCH:
+                        pthread_cancel(data->p_thread);
+                break;
+                
+                case WS_DBUS_INFO_CONFIG_CHANGED:
+                        ws_dbus_notify(data->dbus_data, WS_DBUS_INFO_CACHING); 
+                        
+                        for (i=0; i<data->dict->len; i++)
+                        {
+                                g_free(g_array_index(data->dict, Engine*, i));
+                        }
+                        g_array_free(data->dict, TRUE);
+                        
+                        data->dict = g_array_new (TRUE, TRUE, sizeof(Engine*));
+                                              
+                        //paths to directories
+                        GArray* dir_array = ws_mng_read_gconf();
+                        //fill the table again with new dicnioraries
+                        ws_mng_load_dict(dir_array, data);
+                        //if there is no dictionary selected
+                        // signal this fact to gui
+                        if (data->dict->len <= 0)
+                        {
+                                ws_dbus_notify(data->dbus_data,
+                                               WS_DBUS_INFO_CACHING_FINISHED);
+                                ws_dbus_notify(data->dbus_data,
+                                               WS_DBUS_ERROR_FILE_NOT_FOUND); 
+                        }else
+                        {
+                                data->returned_results = data->dict->len;
+                                //if there was typed word search for word list
+                                if (data->last_search != NULL) 
+                                {
+                                        for (i=0; i<data->word_list->len; i++)
+                                        {
+                                                g_free(
+                                                  g_array_index(data->word_list,
+                                                                gchar* ,
+                                                                i));
+                                        }
+                                        //free the old words list
+                                        g_array_free(data->word_list, TRUE);
+                                        
+                                        data->word_list = g_array_new(TRUE, TRUE, sizeof(gchar*));//creating new word list
+                                        
+                                        g_free(data->word);
+                                        data->word = g_strdup(data->last_search);
+                                        //create searching thread
+                                        pthread_create (&data->p_thread, 
+                                                        NULL, 
+                                                        ws_mng_search_word, 
+                                                        data);
+                                }
+                                //signal end of dictionary load to gui
+                                ws_dbus_notify(data->dbus_data,
+                                               WS_DBUS_INFO_CACHING_FINISHED);
+                        }
+                        //free memory
+                        for (i=0; i<dir_array->len; i++)
+                        {
+                                g_free(g_array_index(dir_array, gchar*, i));
+                        }
+                        g_array_free(dir_array, TRUE);
+                default:
+
+                break;
+        }
 }
 
 void ws_mng_close (WSMngSearchData *data)
 {
-       int i = 0;
-       //dict_eng_destroy(g_array_index (data->dict, Engine*,0));
-       ws_dbus_destroy (data->dbus_data); // deinitialization of dbus
-       
-       for (i = 0; i < data->dict->len; i++) 
-       {
-               dict_eng_destroy(g_array_index (data->dict, Engine*,i));//free memory taken by engine
-       }
-       
-       for (i=0; i<data->word_list->len; i++)
-       {
-               g_free(g_array_index(data->word_list, gchar*, i));
-       }
-       g_array_free(data->modules, TRUE); //deallocates memory taken by Garray modules
-       g_array_free(data->dict, TRUE);//deallocates memory taken by Garray dict
-       g_array_free(data->word_list, TRUE);
-       g_free(data->last_search);
-       g_free(data->loop); 
-       g_free(data->word);
-       g_free(data->trans);
-       if (data->library != NULL)
-       {
-               g_module_close (data->library); //close library
-               
-       }
-       
+        int i = 0;
+        ws_dbus_destroy (data->dbus_data); // deinitialization of dbus
+        
+        for (i = 0; i < data->dict->len; i++) 
+        {
+                //free memory taken by engine
+                dict_eng_destroy(g_array_index (data->dict, Engine*,i));
+        }
+        
+        for (i=0; i<data->word_list->len; i++)
+        {
+                g_free(g_array_index(data->word_list, gchar*, i));
+        }
+        //free memory used by modules
+        g_array_free(data->modules, TRUE); 
+        //free memory taken by dictionaries
+        g_array_free(data->dict, TRUE);
+        g_array_free(data->word_list, TRUE);
+        g_free(data->last_search);
+        g_free(data->loop); 
+        g_free(data->word);
+        g_free(data->trans);
+        if (data->library != NULL)
+        {
+                g_module_close (data->library); //close library
+                
+        }
+        
 }
 #ifdef __cplusplus
 }