New xdxf engine and improved ui
[mdictionary] / gui / src / ws_gui_layout.c
index c413eed..09dca2e 100644 (file)
@@ -17,7 +17,6 @@ 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"
@@ -39,7 +38,12 @@ void ws_gui_create_window(gpointer user_data)
        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());
@@ -79,26 +83,21 @@ void ws_gui_create_window(gpointer user_data)
        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_add1(GTK_PANED(ws_gui_app->ws_gui_hpane), ws_gui_app->ws_gui_scrolledwindow_left);
-       //gtk_paned_add2(GTK_PANED(ws_gui_app->ws_gui_hpane), ws_gui_app->ws_gui_scrolledwindow_right);
        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_html_set_editable(GTK_HTML(ws_gui_app->ws_gui_html), FALSE); /* editable */
-       //gtk_html_set_allow_frameset (GTK_HTML(ws_gui_app->ws_gui_html), TRUE);
-       gtk_html_allow_selection(GTK_HTML(ws_gui_app->ws_gui_html), TRUE);
-       //gtk_html_set_blocking(GTK_HTML(ws_gui_app->ws_gui_html), 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
@@ -138,7 +137,6 @@ void ws_gui_create_find_toolbar(gpointer user_data)
        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));
 }
 
@@ -168,19 +166,22 @@ void ws_gui_create_main_menu (gpointer user_data)
        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");
@@ -198,8 +199,6 @@ void ws_gui_create_main_menu (gpointer user_data)
         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);
@@ -218,6 +217,8 @@ void ws_gui_create_main_menu (gpointer user_data)
        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);
@@ -231,15 +232,15 @@ void ws_gui_create_main_menu (gpointer user_data)
        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);
 }
 
@@ -248,17 +249,17 @@ void ws_gui_create_main_menu (gpointer user_data)
  *
  * @param user_data - set when the signal handler was connected
  */
-GtkWidget * ws_gui_create_popup_menu (gpointer user_data)
+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);
 
@@ -280,15 +281,29 @@ GtkWidget * ws_gui_create_popup_menu (gpointer user_data)
        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_popup), 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);
        
-       return (GTK_WIDGET(ws_gui_app->ws_gui_menu->ws_gui_popup_menu));
+       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
+ *
+ * @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;
@@ -305,14 +320,14 @@ void ws_gui_dictionary_chooser(GtkMenuItem *menuitem, gpointer user_data)
        guint i =0;
        gchar* string;
        gchar* path;
-       gchar* name;
+       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);
+               ws_gui_app->directories = gconf_client_all_dirs(ws_gui_app->client, GCONF_PATH, NULL);
        }
        else 
        {
@@ -341,23 +356,23 @@ void ws_gui_dictionary_chooser(GtkMenuItem *menuitem, gpointer user_data)
        
        for (i=0; i< g_slist_length(ws_gui_app->directories);i++)
        {
-       string = (gchar*)g_slist_nth_data(ws_gui_app->directories, i); 
-       //g_log(G_LOG_DOMAIN, G_LOG_LEVEL_INFO, "\n.::GUI::. list item: %s", string);
-       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);
+               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");
@@ -393,13 +408,140 @@ void ws_gui_dictionary_chooser(GtkMenuItem *menuitem, gpointer user_data)
        }
        else if (i == GTK_RESPONSE_CANCEL) 
        {
-       //g_log(G_LOG_DOMAIN, G_LOG_LEVEL_INFO, ".::GUI::. Dictionary selection dialog - CANCEL");
-       gtk_widget_destroy (dialog1);
+               gtk_widget_destroy (dialog1);
+       }
+       
+       g_slist_free(ws_gui_app->directories);
+}
+
+/** this function creates dialog popup window and allows optimize dictionaries
+ *
+ * @param menuitem - the object which received the signal
+ * @param user_data - set when the signal handler was connected
+ */
+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);
 }
 
+/** 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;
@@ -425,66 +567,80 @@ void ws_gui_dictionary_loader(GtkMenuItem *menuitem, gpointer user_data)
                gchar* tmp;
        
                filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER (dialog));
-               //g_log(G_LOG_DOMAIN, G_LOG_LEVEL_INFO, ".::GUI::. File name: %s\n", filename);
                name = g_path_get_basename(filename);
-               //tmp2 = g_strsplit(filename, "/", 1);
                len = strlen(filename) - strlen(name) -1;
                tmp = g_strndup (filename, len);
                tmp = g_path_get_basename(tmp);
-               //g_log(G_LOG_DOMAIN, G_LOG_LEVEL_INFO, ".::GUI::. Nazwa folderu: %s", tmp);
-               
-               //g_log(G_LOG_DOMAIN, G_LOG_LEVEL_INFO, "\n.::GUI::. extension: %s", tmp[0]);
                
                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);
-               g_log(G_LOG_DOMAIN, G_LOG_LEVEL_INFO, ".::GUI::. filename: %s", filename);
-               g_log(G_LOG_DOMAIN, G_LOG_LEVEL_INFO, ".::GUI::. name: %s", name);
-               g_log(G_LOG_DOMAIN, G_LOG_LEVEL_INFO, ".::GUI::. path: %s", path);
-               g_log(G_LOG_DOMAIN, G_LOG_LEVEL_INFO, ".::GUI::. filepath: %s", filepath);
-               gconf_client_set_string(ws_gui_app->client, path, filepath , NULL);
-               g_log(G_LOG_DOMAIN, G_LOG_LEVEL_INFO, ".::GUI::. OK");
-               path = g_strconcat(GCONF_PATH, "/", tmp, "/active", NULL);
-               //gconf_client_set_bool(ws_gui_app->client, path, FALSE , 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,
-                                  "Do you want to optimize this dictionary now?");
-               gtk_widget_show_all(GTK_WIDGET(dialog2));
+                       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);
-               gtk_widget_destroy (dialog2);
-               }
-               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");
+                       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
                {
-               //g_log(G_LOG_DOMAIN, G_LOG_LEVEL_INFO, "\n.::GUI::. Bad dictionary file extension.");
-               gtk_widget_destroy (dialog);
-               gtk_infoprint(GTK_WINDOW(ws_gui_app->ws_gui_hildon_window), "Wrong dictionary file");
+                       gtk_widget_destroy (dialog);
+                       gtk_infoprint(GTK_WINDOW(ws_gui_app->ws_gui_hildon_window), "Wrong dictionary file");
                }
                
                
        }
        else 
        {
-       gtk_widget_destroy (dialog);
+               gtk_widget_destroy (dialog);
        }
 
 }
 
+/** 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;
@@ -501,14 +657,14 @@ WSGuiApp* ws_gui_app=(WSGuiApp*)user_data;
        guint i =0;
        gchar* string;
        gchar* path;
-       gchar* name;
+       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);
+               ws_gui_app->directories = gconf_client_all_dirs(ws_gui_app->client, GCONF_PATH, NULL);
        }
        else 
        {
@@ -537,14 +693,13 @@ WSGuiApp* ws_gui_app=(WSGuiApp*)user_data;
        
        for (i=0; i< g_slist_length(ws_gui_app->directories);i++)
        {
-       string = (gchar*)g_slist_nth_data(ws_gui_app->directories, i); 
-       //g_log(G_LOG_DOMAIN, G_LOG_LEVEL_INFO, "\n.::GUI::. list item: %s", string);
-       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);
+               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");
@@ -565,9 +720,7 @@ WSGuiApp* ws_gui_app=(WSGuiApp*)user_data;
                        {
                                name = gtk_button_get_label(GTK_BUTTON(g_array_index(checkboxes, GtkWidget *, i)));
                                path=g_strconcat(GCONF_PATH, "/", name, NULL);
-                               g_log(G_LOG_DOMAIN, G_LOG_LEVEL_INFO, "do usuniecia: %s", path);
                                gconf_client_recursive_unset(ws_gui_app->client, path, GCONF_UNSET_INCLUDING_SCHEMA_NAMES, NULL);
-                               //gconf_client_remove_dir (ws_gui_app->client, path, NULL);
                        }
                }
        ws_dbus_notify(ws_gui_app->dbus_data, WS_DBUS_INFO_CONFIG_CHANGED);
@@ -575,21 +728,24 @@ WSGuiApp* ws_gui_app=(WSGuiApp*)user_data;
        }
        else if (i == GTK_RESPONSE_CANCEL) 
        {
-       //g_log(G_LOG_DOMAIN, G_LOG_LEVEL_INFO, ".::GUI::. Dictionary selection dialog - CANCEL");
-       gtk_widget_destroy (dialog1);
+               gtk_widget_destroy (dialog1);
        }
        
        g_slist_free(ws_gui_app->directories);
 }
 
+/** 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;
-       
-       //gchar *license = "User Interface\nCopyright 2006, ComArch S.A\nAll rights reserved\n\n\nDBUS wrapper\nCopyright (C) 1991,\n1999 Free Software Foundation, Inc. \n51 Franklin Street, Fifth Floor,\nBoston, MA  02110-1301 USA\nEveryone is permitted to copy \nand distribute verbatim copies \nof this license document,\nbut changing it is not allowed.\n\nhttp://www.gnu.org/licenses/lgpl.html \n\n\nEngine\nCopyright (C) 1989,\n1991 Free Software Foundation, Inc., \n51 Franklin Street, Fifth Floor, \nBoston, MA 02110-1301 USA \nEveryone is permitted to copy \nand distribute verbatim copies \nof this license document,\nbut changing it is not allowed.\n\nhttp://www.gnu.org/licenses/gpl.txt\n";
 
-       GtkWidget *about_dialog;
        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;
@@ -599,7 +755,6 @@ void ws_gui_about_application(GtkMenuItem *menuitem, gpointer user_data)
        GtkWidget *scrolledwindow;
        GtkWidget *textview;
        GtkWidget *button1;
-       //GtkWidget *button2;
 
        about_dialog = gtk_dialog_new ();
        gtk_window_set_title (GTK_WINDOW (about_dialog), "About");
@@ -616,7 +771,7 @@ void ws_gui_about_application(GtkMenuItem *menuitem, gpointer user_data)
        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 16");
+       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);
@@ -655,12 +810,7 @@ void ws_gui_about_application(GtkMenuItem *menuitem, gpointer user_data)
 
        if (gtk_dialog_run(GTK_DIALOG(about_dialog)) == GTK_RESPONSE_CLOSE)
        {
-       //g_log(G_LOG_DOMAIN, G_LOG_LEVEL_INFO, "About...");
-       gtk_widget_destroy(GTK_WIDGET(about_dialog));
-       }
-       else if (gtk_dialog_run(GTK_DIALOG(about_dialog)) == GTK_RESPONSE_OK)
-       {
-
+               gtk_widget_destroy(GTK_WIDGET(about_dialog));
        }
        
        gtk_widget_set_sensitive (GTK_WIDGET(ws_gui_app->ws_gui_hildon_find_toolbar), TRUE);
@@ -687,6 +837,10 @@ void ws_gui_about_application(GtkMenuItem *menuitem, gpointer user_data)
 
 }
 
+/** 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;
@@ -725,4 +879,4 @@ GtkWidget* licence_dialog(gpointer user_data)
        gtk_widget_show_all(license_dialog);
        return license_dialog;
 
-}
\ No newline at end of file
+}