Updating files to release 0.6.0-1
authormaritus <lucas.pawlik@gmail.com>
Wed, 31 Jan 2007 14:43:03 +0000 (14:43 +0000)
committermaritus <lucas.pawlik@gmail.com>
Wed, 31 Jan 2007 14:43:03 +0000 (14:43 +0000)
git-svn-id: file:///svnroot/mdictionary/trunk@40 5bde0345-f819-0410-ac75-e5045f9217cc

12 files changed:
Makefile
data/dictionaries/bookmarks/ws_bookmarks
data/locale/en_GB.po
include/ws_dbus.h
include/ws_version.h
src/bookmarks/src/engine_bookmark.c
src/gui/include/ws_gui.h
src/gui/src/ws_gui.c
src/gui/src/ws_gui_callbacks.c
src/gui/src/ws_gui_layout.c
src/manager/makefile
src/manager/src/ws_manager.c

index 405a0b6..86a3060 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -68,10 +68,16 @@ GETTEXT_PACKAGE=whitestork
 ALL_LINGUAS="en_GB"
 
 
+#ifeq (${MAKECMDGOALS}, release-package)
+#      APP_VER = ${RELEASE_MAJOR_VER}.${RELEASE_MINOR_VER}.`svn info | grep "Revision:" | awk '{print $$2}'`
+#else
+#      APP_VER = ${MAJOR_VER}.${MINOR_VER}.`svn info | grep "Revision:" | awk '{print $$2}'`
+#endif
+
 ifeq (${MAKECMDGOALS}, release-package)
-       APP_VER = ${RELEASE_MAJOR_VER}.${RELEASE_MINOR_VER}.`svn info | grep "Revision:" | awk '{print $$2}'`
+APP_VER = ${RELEASE_MAJOR_VER}.${RELEASE_MINOR_VER}.${RELEASE_PATCH_VER}
 else
-       APP_VER = ${MAJOR_VER}.${MINOR_VER}.`svn info | grep "Revision:" | awk '{print $$2}'`
+APP_VER = ${MAJOR_VER}.${MINOR_VER}.`svn info | grep "Revision:" | awk '{print $$2}'`
 endif
 
 FILES = ${DATA}/files_debbuild
@@ -404,7 +410,7 @@ display-r: access
 access:
                @fakeroot chmod 0777 /var/run
 
-release-package: clean debs meta-package
+release-package: clean debs 
                @echo "Release package generation successfully completed"
 
 snapshot: tag-version send-last
@@ -442,7 +448,7 @@ meta-package:       meta-package-pack-dirs
 
                @cd ${PACKAGES} && fakeroot dpkg-deb --build ../${META_PACK}_${APP_VER}-${PACK_VER}_${ARCH}.deb >> ../${LOG_DEBS} 2>> ../${LOG_DEBS}
 
-repo:  release-package meta-package
+repo:  release-package 
 
        @rm -rf repo
        @./generate_repo
index 9f81284..183c23b 100644 (file)
Binary files a/data/dictionaries/bookmarks/ws_bookmarks and b/data/dictionaries/bookmarks/ws_bookmarks differ
index 2caa304..6dad29c 100644 (file)
@@ -15,6 +15,10 @@ msgstr ""
 "Content-Type: text/plain; charset=UTF-8\n"
 "Content-Transfer-Encoding: 8bit\n"
 
+#: ../gui/src/qs_gui.c:39
+msgid "ws_check"
+msgstr "OK"
+
 #: ../gui/src/ws_gui_layout.c:42
 msgid "ws_ni_welcome"
 msgstr "Welcome to WhiteStork Dictionary!"
@@ -177,6 +181,10 @@ msgid "ws_mp_search"
 msgstr "Search"
 
 #: ../gui/src/ws_gui_layout.c:580
+msgid "ws_mp_add_bookmark"
+msgstr "Add Bookmark"
+
+#: ../gui/src/ws_gui_layout.c:580
 msgid "ws_mp_edit_copy"
 msgstr "Copy"
 
@@ -413,6 +421,10 @@ msgstr "Caching ..."
 msgid "ws_ni_dictionary_unavailable"
 msgstr "Dictionary unavailable."
 
+#: ../gui/src/ws_gui_callbacks.c:267
+msgid "ws_ni_bookmarks_unavailable"
+msgstr "Bookmarks could not be loaded.\nPlease install libsqlite0 2.8.13-2"
+
 #: ../gui/src/ws_gui_callbacks.c:289
 #: ../gui/src/ws_gui_layout.c:1534
 msgid "ws_ni_no_words_found"
index 194621c..b3d408d 100644 (file)
@@ -97,7 +97,9 @@ typedef enum
         WS_DBUS_BOOKMARKS_ADDED_OK, ///<GUI signal - send if bookmark has been added succesfully
         WS_DBUS_BOOKMARKS_REMOVED_OK, ///<GUI signal - send if bookmark has been removed succesfully
        WS_DBUS_BOOKMARKS_ADDED_FAIL, ///<GUI signal - send if bookmark has not been added succesfully
-        WS_DBUS_BOOKMARKS_REMOVED_FAIL ///<GUI signal - send if bookmark has not been removed succesfully
+        WS_DBUS_BOOKMARKS_REMOVED_FAIL, ///<GUI signal - send if bookmark has not been removed succesfully
+       WS_DBUS_LOAD_BOOKMARK_FAILED, ///<GUI signal - blocks bookmarks
+       WS_DBUS_BOOKMARK_MODE 
 
 } WSDBusNotify;
 
index 4c50a76..2ecb84f 100644 (file)
@@ -1,5 +1,5 @@
 #ifndef _VERSION_H
 #define _VERSION_H
 
-#define WS_VERSION "0.6.38"
+#define WS_VERSION "0.6.0"
 #endif
index 3287a87..20aabb3 100644 (file)
@@ -349,7 +349,6 @@ Engine* bm_engine_create(gchar* location,
              (guint)auto_cache
             );
         timer(TIMER_START,(gchar*)(gchar*)__FUNCTION__);        
-
         gchar* tmp = g_strdup(location);
         string_to_path(&tmp);
 
@@ -490,7 +489,6 @@ gboolean bm_engine_check(gchar* location)
         gboolean result = TRUE;        
         gchar* filepath = g_strdup(location);
         gchar* tmp = NULL;
-        
         string_to_path(&filepath);
         if (filepath == NULL) {
                 result = FALSE;
@@ -585,9 +583,19 @@ void bm_engine_search_word_list(Engine* engine, gchar* pattern)
         gchar* sql = NULL;
         gchar* tran = NULL;
 
+       //LOGS("::::BOOKMARKS!!!!:::: tmp = %s, int(tmp) = %i", tmp, tmp[0]);
+
 
-        sql = g_strconcat("SELECT word FROM translations WHERE "
+       g_strstrip(tmp);
+       if ((int)(tmp[0]) == 42 && tmp[1] == '\0') //asterix?
+       {
+               sql = g_strconcat("SELECT word FROM translations;", NULL);
+       }
+       else
+       {
+                       sql = g_strconcat("SELECT word FROM translations WHERE "
                           "word LIKE \'",tmp,"\%\';",NULL);
+       }
         LOGS("QUERY: %s\n",sql);
         gint sql_res = 0;
         const gchar* end;
index bdb91f4..c94a40a 100644 (file)
@@ -101,58 +101,58 @@ 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
-       GtkWidget *ws_gui_menu_optimize_dict; ///< menuitem used for optimizing dictionaries
-
-       GtkWidget *ws_gui_menu_bookmarks; ///bookmarks submenu 
-       GtkWidget *ws_gui_menu_open_bookmark; ///menuitem, opens bookmark window
-       GtkWidget *ws_gui_menu_close_bookmark; ///menuitem, closes bookmark window
-       GtkWidget *ws_gui_menu_add_bookmark; ///menuitem used fot adding bookmarks
-       GtkWidget *ws_gui_menu_remove_bookmark; ///menuitem, allows for removing bookmarks
-
-       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_submenu_4; ///< 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_bookmark;///< 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
+       /*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
+       GtkWidget *ws_gui_menu_optimize_dict; ///< menuitem used for optimizing dictionaries
+       
+       GtkWidget *ws_gui_menu_bookmarks; ///bookmarks submenu 
+       GtkWidget *ws_gui_menu_open_bookmark; ///menuitem, opens bookmark window
+       GtkWidget *ws_gui_menu_close_bookmark; ///menuitem, closes bookmark window
+       GtkWidget *ws_gui_menu_add_bookmark; ///menuitem used fot adding bookmarks
+       GtkWidget *ws_gui_menu_remove_bookmark; ///menuitem, allows for removing bookmarks
+       
+       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_submenu_4; ///< 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_bookmark;///< 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
@@ -160,20 +160,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)
 
 };
 
@@ -182,64 +182,67 @@ 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
-       GSList *directories_last; ///< 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)
-       GArray *bookmarks_list; ///< array wchich contains bookmarked words
-       gboolean bookmark_on; ///< flag which switch beetween bookmark and normal mode
-       gchar *word_book; ///< word added to the bookmarks
-       gchar *translation_book; ///< translation of the word added to bookmarks
-
-       gboolean bookmark_mode;
-       gchar *last_word;
-       GString *raw_translation;
+       HildonProgram *ws_gui_hildon_program; ///< handle to hildon program
+       HildonWindow *ws_gui_hildon_window; ///< handle to hildon window
+       gchar *welcome_note; ///< welcome note
+       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
+       GSList *directories_last; ///< 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)
+       GArray *bookmarks_list; ///< array wchich contains bookmarked words
+       gboolean bookmark_on; ///< flag which switch beetween bookmark and normal mode
+       gchar *word_book; ///< word added to the bookmarks
+       gchar *translation_book; ///< translation of the word added to bookmarks
+       
+       gboolean bookmark_avail; ///< flag, denpends on availablity of bookmarks module
+       gboolean bookmark_mode; ///< flag, shows either bookmarks mode is on or off
+       gchar *last_word; ///< stores last choosen word on the words list (necessary for bookmarks)
+       GString *raw_translation; ///< stores current translation, if user wants to add it to bookmarks
+       gchar *last_searched;
 
 };
 
index 478c2d3..a345f29 100644 (file)
@@ -37,18 +37,23 @@ int main(int argc, char *argv[])
                g_debug("OK\n");
        }
        
-        setlocale(LC_ALL, "");
-        //bindtextdomain("pl.po", "/var/lib/install/share/locale");
+       
+        gtk_init(&argc, &argv);
+
+       //localization
+       setlocale(LC_ALL, "");
        bindtextdomain("whitestork", "/usr/share/locale");
        bind_textdomain_codeset("whitestork", "UTF-8");
         textdomain("whitestork");
 
-        gtk_init(&argc, &argv);
-
-
-
+       if (strcmp(_("ws_check"), "ws_check") == 0)
+       {
+               setlocale(LC_ALL, "en_GB");
+               bindtextdomain("whitestork", "/usr/share/locale");
+               bind_textdomain_codeset("whitestork", "UTF-8");
+               textdomain("whitestork");
+       }
 
-        //gconf_init(argc, argv, NULL);
 
         WSGuiApp *ws_gui_app;
         ws_gui_app = (WSGuiApp*)g_malloc(sizeof(WSGuiApp)); 
@@ -114,7 +119,7 @@ int main(int argc, char *argv[])
                                           GDK_SELECTION_CLIPBOARD);
 
         //connecting the signals
-        g_signal_connect(G_OBJECT (ws_gui_app->ws_gui_w_list->ws_gui_selection),
+       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);
index 40d1e8f..62ce424 100644 (file)
@@ -251,6 +251,33 @@ void ws_gui_signal_hander (GError *error, GArray *words, gpointer user_data)
                                         _("ws_ni_bookmark_not_removed"));
                break;
                }
+
+               case WS_DBUS_LOAD_BOOKMARK_FAILED:
+               {
+                    gtk_widget_set_sensitive(
+                     GTK_WIDGET(ws_gui_app->ws_gui_menu->ws_gui_menu_bookmarks),
+                     FALSE);
+                    ws_gui_app->bookmark_avail = FALSE;
+                               
+                       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,
+                                   _("ws_ni_bookmarks_unavailable"));
+
+                       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
@@ -321,6 +348,7 @@ void ws_gui_dbus_return_words (GError *error, GArray *words, gpointer user_data)
         {
                 gtk_infoprint(GTK_WINDOW(ws_gui_app->ws_gui_hildon_window),
                               _("ws_ni_no_words_found"));
+               ws_gui_fill_html(" ", ws_gui_app);
                g_free(ws_gui_app->last_word);
                ws_gui_app->last_word = NULL;
         }
@@ -983,7 +1011,7 @@ 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;
+       WSGuiApp* ws_gui_app = (WSGuiApp*)user_data;
         gtk_html_zoom_out(GTK_HTML(ws_gui_app->ws_gui_html));
 }
 
@@ -1007,14 +1035,16 @@ void ws_gui_search(GtkWidget * widget, gpointer user_data)
                      &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,
-                                   _("ws_ab_searching"));
-               */
+       if (ws_gui_app->bookmark_mode == FALSE) 
+       {
+               g_free(ws_gui_app->last_searched);
+               ws_gui_app->last_searched = NULL;
+               ws_gui_app->last_searched = g_strdup(ws_gui_text);
+       }
+       
+       g_strstrip(ws_gui_text);
+               if (strlen(ws_gui_text) != 0) 
+               {
                gtk_widget_show(ws_gui_app->ws_gui_banner);
 
                 gtk_widget_set_sensitive(
@@ -1027,7 +1057,8 @@ void ws_gui_search(GtkWidget * widget, gpointer user_data)
                 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(
@@ -1069,7 +1100,7 @@ it sends signal to DBUS and destroys it;
 void ws_gui_on_exit (GtkWidget *widget, GdkEvent *event, gpointer user_data) 
 {
         WSGuiApp* ws_gui_app = (WSGuiApp *)user_data;
-       //ws_gui_app->bookmark_mode = FALSE;
+       ws_gui_app->bookmark_mode = FALSE;
        ws_gui_set_bookmarks_sensitivity(ws_gui_app);
        g_timer_destroy(ws_gui_app->timer);
         ws_dbus_notify(ws_gui_app->dbus_data, WS_DBUS_INFO_TERMINATE);
@@ -1089,7 +1120,7 @@ from application menu; it sends signal to DBUS and destroys it;
 void ws_gui_menu_quit(GtkMenuItem *menuitem, gpointer user_data)
 {
         WSGuiApp* ws_gui_app = (WSGuiApp *)user_data;
-       //ws_gui_app->bookmark_mode = FALSE;
+       ws_gui_app->bookmark_mode = FALSE;
        ws_gui_set_bookmarks_sensitivity(ws_gui_app);
         g_timer_destroy(ws_gui_app->timer);
         ws_dbus_notify(ws_gui_app->dbus_data, WS_DBUS_INFO_TERMINATE);
@@ -1107,7 +1138,7 @@ 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;
+       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),
@@ -1125,7 +1156,7 @@ void ws_gui_read_adjustment(gpointer user_data)
 {
         WSGuiApp* ws_gui_app=(WSGuiApp*)user_data;
 
-        ws_gui_app->ws_gui_hadj = 
+       ws_gui_app->ws_gui_hadj = 
                 gtk_scrolled_window_get_hadjustment(
                 GTK_SCROLLED_WINDOW(
                ws_gui_app->ws_gui_scrolledwindow_left));
@@ -1198,7 +1229,7 @@ gboolean ws_gui_button_press(GtkWidget *widget,
                              GdkEventButton *event,
                              gpointer user_data)
 {
-        WSGuiApp* ws_gui_app=(WSGuiApp*)user_data;
+       WSGuiApp* ws_gui_app=(WSGuiApp*)user_data;
         if (ws_gui_app->ws_gui_sel_flag == FALSE)
         {
                 if (event->type == GDK_2BUTTON_PRESS) 
@@ -1267,7 +1298,7 @@ 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)
+       if (tmp > PRESS_TIME)
         {
                 ws_gui_create_popup_menu(ws_gui_app);
         }
@@ -1322,7 +1353,6 @@ gchar * format_html (gchar * received_string, gpointer user_data)
         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);
@@ -1333,11 +1363,16 @@ gchar * format_html (gchar * received_string, gpointer user_data)
                 "<th background=\"file:/usr/share/pixmaps/ws_top.png\">"
                 "<img align=left src=\"file:/usr/share/pixmaps/"
                 "engine_xdxf_icon.png\"><font color=\"#eeeeee\">");
-
+               
+               g_debug("\n\nws_gui_app->last_word %s", ws_gui_app->last_word);
                tmp2 = strstr(str_tmp->str, "<PATTERN_OPEN>");
-               str_tmp =  g_string_erase(str_tmp,
+               if (ws_gui_app->last_word != NULL)
+               {
+                       str_tmp =  g_string_erase(str_tmp,
                                            (long)(tmp2 - str_tmp->str),
-                                           14);
+                                           14 + strlen(ws_gui_app->last_word));
+               }
+               //str_tmp = g_string_insert(str_tmp, "<br>", 0);
         }
 
         while (strstr(str_final->str, "<PATTERN_CLOSED>") != NULL)
@@ -1352,8 +1387,8 @@ gchar * format_html (gchar * received_string, gpointer user_data)
 
                tmp2 = strstr(str_tmp->str, "<PATTERN_CLOSED>");
                str_tmp =  g_string_erase(str_tmp,
-                                           (long)(tmp2 - str_tmp->str),
-                                           16);
+                                          (long)(tmp2 - str_tmp->str),
+                                          16);
         }
 
         while (strstr(str_final->str, "<TRANSLATION_OPEN>") != NULL)
@@ -1385,31 +1420,27 @@ gchar * format_html (gchar * received_string, gpointer user_data)
                                             20);
                 str_final =  g_string_insert(str_final,
                                              (long)(tmp - str_final->str),
-                                             "</td></tr></table></center><br>");
+                                             "</td></tr></table></center>");
 
                tmp2 = strstr(str_tmp->str, "<TRANSLATION_CLOSED>");
                str_tmp =  g_string_erase(str_tmp,
                                           (long)(tmp2 - str_tmp->str),
                                          20);
-               
+                               
         }
 
         str_final = g_string_append(str_final,
                                     "</td></tr></table></body></html>");
 
-       //g_log(G_LOG_DOMAIN, G_LOG_LEVEL_INFO, ".::GUI::. Zawartosc stringa to: \"%s\"", str_tmp->str);
-       
        ws_gui_app->raw_translation = g_string_insert(
                                                ws_gui_app->raw_translation,
                                                0,
                                                str_tmp->str);
        
+       
        //ws_gui_app->raw_translation = g_string_append(str_final, "<br>");
 
-
-       //g_log(G_LOG_DOMAIN, G_LOG_LEVEL_INFO, ".::GUI::. Zawartosc RAW to: \"%s\"", ws_gui_app->raw_translation->str);
-
-        return str_final->str;
+       return str_final->str;
 }
 
 /** open bookmarks database 
@@ -1429,9 +1460,15 @@ void ws_gui_dictionary_open_bookmark(GtkMenuItem *menuitem, gpointer user_data)
 
        ws_gui_app->bookmark_mode = TRUE;
        ws_gui_set_bookmarks_sensitivity(ws_gui_app);
-       ws_gui_fill_html(" ", ws_gui_app);
-       ws_dbus_notify(ws_gui_app->dbus_data, WS_DBUS_INFO_CONFIG_CHANGED);
+       g_object_set(G_OBJECT(ws_gui_app->ws_gui_hildon_find_toolbar),
+                                     "prefix",
+                                      "*",
+                                      NULL);
+       ws_dbus_notify(ws_gui_app->dbus_data, WS_DBUS_BOOKMARK_MODE);
        
+       ws_gui_fill_html(" ", ws_gui_app);
+       ws_dbus_client_find_word(ws_gui_app->dbus_data, "*");
+       //ws_gui_search(NULL, ws_gui_app);
        
 }
 
@@ -1451,16 +1488,28 @@ void ws_gui_dictionary_close_bookmark(GtkMenuItem *menuitem, gpointer user_data)
        ws_gui_app->last_word = NULL;
 
         ws_gui_app->bookmark_mode = FALSE;
-       ws_gui_set_bookmarks_sensitivity(ws_gui_app);
-       ws_dbus_notify(ws_gui_app->dbus_data, WS_DBUS_INFO_CONFIG_CHANGED);
-       
-       /*gchar *temp;
+       ws_gui_set_bookmarks_sensitivity(ws_gui_app);   
+       ws_dbus_notify(ws_gui_app->dbus_data, WS_DBUS_BOOKMARK_MODE);
+       ws_gui_fill_html(" ", ws_gui_app);
+       g_strstrip(ws_gui_app->last_searched);
+       if (ws_gui_app->last_searched != NULL) 
+       {
        g_object_set(G_OBJECT(ws_gui_app->ws_gui_hildon_find_toolbar),
-                                      "prefix",
-                                      temp,
+                                     "prefix",
+                                      ws_gui_app->last_searched,
+                                      NULL);
+       //ws_dbus_client_find_word(ws_gui_app->dbus_data, ws_gui_app->last_searched);
+       ws_gui_search(NULL, ws_gui_app);
+       }
+       else
+       {
+               g_object_set(G_OBJECT(ws_gui_app->ws_gui_hildon_find_toolbar),
+                                     "prefix",
+                                      "\0",
                                       NULL);
-        ws_dbus_client_find_word (ws_gui_app->dbus_data, temp);
-       */
+               //ws_dbus_client_find_word(ws_gui_app->dbus_data, ws_gui_app->last_searched);
+               ws_gui_search(NULL, ws_gui_app);        
+       }
 }
 
 /** adds bookmark to bookmarks database 
@@ -1472,15 +1521,9 @@ void ws_gui_dictionary_close_bookmark(GtkMenuItem *menuitem, gpointer user_data)
 void ws_gui_dictionary_add_bookmark(GtkMenuItem *menuitem, gpointer user_data)
 {
        WSGuiApp* ws_gui_app=(WSGuiApp*)user_data;
-       
-       /*g_log(G_LOG_DOMAIN, 
-              G_LOG_LEVEL_INFO, 
-              ".::GUI::. LAST_WORD: \"%s\"", 
-             ws_gui_app->last_word);*/
 
        if (ws_gui_app->last_word != NULL)
        {
-               //ws_gui_set_bookmarks_sensitivity(ws_gui_app);
                ws_gui_add_bookmark_dialog(ws_gui_app);
        }
        else
@@ -1503,15 +1546,9 @@ void ws_gui_dictionary_remove_bookmark(GtkMenuItem *menuitem,
                                       gpointer user_data)
 {
        WSGuiApp* ws_gui_app=(WSGuiApp*)user_data;
-       
-       g_log(G_LOG_DOMAIN, 
-             G_LOG_LEVEL_INFO, 
-             ".::GUI::. LAST_WORD: \"%s\"", 
-             ws_gui_app->last_word);
 
                if (ws_gui_app->last_word != NULL)
        {
-               //ws_gui_set_bookmarks_sensitivity(ws_gui_app);
                ws_gui_remove_bookmark_dialog(ws_gui_app);
 
                gchar *temp;
@@ -1592,7 +1629,6 @@ void ws_gui_set_bookmarks_sensitivity(gpointer user_data)
        int i;
        gchar *string;
        gchar *name;
-       //static gchar *bookmarks_path = g_strconcat(GCONF_PATH, "/bookmarks/active", NULL);
 
        if (ws_gui_app->bookmark_mode == TRUE)
        {
@@ -1605,10 +1641,7 @@ void ws_gui_set_bookmarks_sensitivity(gpointer user_data)
                ws_gui_app->directories = gconf_client_all_dirs(
                                                        ws_gui_app->client, 
                                                        GCONF_PATH, NULL);
-       
-               //ws_gui_app->directories_last = 
-               //                        g_slist_copy(ws_gui_app->directories);
-       
+               
        for (i=0; i<g_slist_length(ws_gui_app->directories); i++)
         {
                string = (gchar*)g_slist_nth_data(ws_gui_app->directories, i);
@@ -1617,7 +1650,9 @@ void ws_gui_set_bookmarks_sensitivity(gpointer user_data)
                
                if (gconf_client_get_bool(ws_gui_app->client, string, NULL) == TRUE) 
                {
-                       ws_gui_app->directories_last = g_slist_append(ws_gui_app->directories_last, string);
+                       ws_gui_app->directories_last = 
+                               g_slist_append(ws_gui_app->directories_last, 
+                                              string);
                }
 
                if (strcmp(name, "bookmarks") == 0)
@@ -1665,13 +1700,15 @@ void ws_gui_set_bookmarks_sensitivity(gpointer user_data)
         {
                string = (gchar*)g_slist_nth_data(ws_gui_app->directories_last, 
                                                  i);
-
+               
                //string = g_strconcat(string, "/active", NULL);
-
+               if (string != NULL)
+               {
                gconf_client_set_bool(ws_gui_app->client, 
                                string, 
                                TRUE, 
                                NULL);
+               }
        }
 
        //setting sensitivity of components
index 7957dfe..7384423 100644 (file)
@@ -31,18 +31,18 @@ Copyright 2006 ComArch S.A.
  */
 void ws_gui_create_window(gpointer user_data) 
 {
-        WSGuiApp* ws_gui_app=(WSGuiApp*)user_data;
+       WSGuiApp* ws_gui_app=(WSGuiApp*)user_data;
        
-       gchar *welcome_note;
-       welcome_note = g_strconcat("<br><br><center><font size=+3>", 
+       ws_gui_app->welcome_note = g_strconcat("<br><br><center><font size=+3>", 
                                   _("ws_ni_welcome"), "<br><IMG SRC=file:/usr/share/pixmaps/whitestork.png>", 
                                   NULL);
 
        ws_gui_app->ws_gui_w_list->ws_gui_list_item_data_string = 
-                                                          (welcome_note);
+                                                    (ws_gui_app->welcome_note);
 
         GArray *array_tmp = g_array_new (TRUE, TRUE, sizeof(gchar*));
        ws_gui_app->raw_translation = g_string_new(" ");
+       ws_gui_app->last_searched = NULL;
 
         ws_gui_app->ws_gui_banner_flag = FALSE;
         ws_gui_app->ws_gui_full_screen_flag = FALSE;
@@ -50,6 +50,7 @@ void ws_gui_create_window(gpointer user_data)
         ws_gui_app->ws_gui_double_click = FALSE;
         ws_gui_app->ws_gui_sel_flag = FALSE;
        ws_gui_app->bookmark_mode = FALSE;
+       ws_gui_app->bookmark_avail = TRUE;
 
         ws_gui_app->timer = g_timer_new();
         g_timer_stop(ws_gui_app->timer);
@@ -169,7 +170,7 @@ void ws_gui_create_window(gpointer user_data)
                                    _("ws_ab_searching"));
        
        gtk_widget_hide(GTK_WIDGET(ws_gui_app->ws_gui_banner));
-       g_free(welcome_note);
+       g_free(ws_gui_app->welcome_note);
 }
 
 /** this function creates a find toolbar and connects signals to the tollbars 
@@ -179,83 +180,83 @@ void ws_gui_create_window(gpointer user_data)
  */
 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(_("ws_me_search_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(_("ws_me_search_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 
@@ -265,7 +266,7 @@ void ws_gui_create_find_toolbar(gpointer user_data)
  */
 void ws_gui_create_main_menu (gpointer user_data) 
 {
-        WSGuiApp* ws_gui_app=(WSGuiApp*)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();
@@ -329,40 +330,40 @@ void ws_gui_create_main_menu (gpointer user_data)
        gtk_menu_append(ws_gui_app->ws_gui_menu->ws_gui_submenu_4,
                         ws_gui_app->ws_gui_menu->ws_gui_menu_remove_bookmark);
 
-       ws_gui_app->ws_gui_menu->ws_gui_menu_copy = 
-                gtk_menu_item_new_with_label(_("ws_me_edit_copy"));
-       ws_gui_app->ws_gui_menu->ws_gui_menu_paste = 
-                gtk_menu_item_new_with_label(_("ws_me_edit_paste"));
-       ws_gui_app->ws_gui_menu->ws_gui_menu_select_all = 
-                gtk_menu_item_new_with_label(_("ws_me_edit_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(_("ws_me_view_hide_words_list"));
-       ws_gui_app->ws_gui_menu->ws_gui_menu_zoom_in = 
-                gtk_menu_item_new_with_label(_("ws_me_view_zoom_in"));
-       ws_gui_app->ws_gui_menu->ws_gui_menu_zoom_out = 
-                gtk_menu_item_new_with_label(_("ws_me_view_zoom_out"));
-       ws_gui_app->ws_gui_menu->ws_gui_menu_full_screen = 
-                gtk_check_menu_item_new_with_label(_("ws_me_view_fullscreen"));
-       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(_("ws_me_search_find"));
-       ws_gui_app->ws_gui_menu->ws_gui_menu_find_next = 
-               gtk_menu_item_new_with_label(_("ws_me_search_find_next"));
+       ws_gui_app->ws_gui_menu->ws_gui_menu_copy = 
+               gtk_menu_item_new_with_label(_("ws_me_edit_copy"));
+       ws_gui_app->ws_gui_menu->ws_gui_menu_paste = 
+               gtk_menu_item_new_with_label(_("ws_me_edit_paste"));
+       ws_gui_app->ws_gui_menu->ws_gui_menu_select_all = 
+               gtk_menu_item_new_with_label(_("ws_me_edit_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(_("ws_me_view_hide_words_list"));
+       ws_gui_app->ws_gui_menu->ws_gui_menu_zoom_in = 
+               gtk_menu_item_new_with_label(_("ws_me_view_zoom_in"));
+       ws_gui_app->ws_gui_menu->ws_gui_menu_zoom_out = 
+               gtk_menu_item_new_with_label(_("ws_me_view_zoom_out"));
+       ws_gui_app->ws_gui_menu->ws_gui_menu_full_screen = 
+               gtk_check_menu_item_new_with_label(_("ws_me_view_fullscreen"));
+       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(_("ws_me_search_find"));
+       ws_gui_app->ws_gui_menu->ws_gui_menu_find_next = 
+               gtk_menu_item_new_with_label(_("ws_me_search_find_next"));
         ws_gui_app->ws_gui_menu->ws_gui_menu_find_prev = 
                gtk_menu_item_new_with_label(_("ws_me_search_find_prev"));
         ws_gui_app->ws_gui_menu->ws_gui_menu_stop = 
@@ -522,7 +523,6 @@ void ws_gui_create_main_menu (gpointer user_data)
                          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",
@@ -566,158 +566,169 @@ void ws_gui_create_main_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();
-
-       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(_("ws_mp_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_bookmark = 
-                gtk_menu_item_new_with_label(_("ws_mp_add_bookmark"));
-       gtk_menu_append ((ws_gui_app->ws_gui_menu->ws_gui_popup_menu),
-                        ws_gui_app->ws_gui_menu->ws_gui_popup_bookmark);
-
-       ws_gui_app->ws_gui_menu->ws_gui_popup_copy = 
-                gtk_menu_item_new_with_label(_("ws_mp_edit_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(_("ws_mp_edit_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(_("ws_mp_edit_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 (_("ws_mp_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 (_("ws_mp_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 (_("ws_mp_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_bookmark),
-                        "activate",
-                        G_CALLBACK(ws_gui_dictionary_add_bookmark),
-                        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);
-      }
-
-      if (ws_gui_app->bookmark_mode == TRUE)
-      {
+       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(_("ws_mp_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_bookmark = 
+               gtk_menu_item_new_with_label(_("ws_mp_add_bookmark"));
+       gtk_menu_append ((ws_gui_app->ws_gui_menu->ws_gui_popup_menu),
+                       ws_gui_app->ws_gui_menu->ws_gui_popup_bookmark);
+       
+       ws_gui_app->ws_gui_menu->ws_gui_popup_copy = 
+               gtk_menu_item_new_with_label(_("ws_mp_edit_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(_("ws_mp_edit_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(_("ws_mp_edit_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 (_("ws_mp_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 (_("ws_mp_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 (_("ws_mp_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_bookmark),
+                       "activate",
+                       G_CALLBACK(ws_gui_dictionary_add_bookmark),
+                       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);
+       }
+       
+       
+       if (ws_gui_app->bookmark_avail == FALSE)
+       {
        gtk_widget_set_sensitive(GTK_WIDGET
-                               (ws_gui_app->ws_gui_menu->ws_gui_popup_bookmark),
-                               FALSE);
-      }
-      else
-      {
+                       (ws_gui_app->ws_gui_menu->ws_gui_popup_bookmark),
+                       FALSE);
+       }
+       
+       else
+       {
+       if (ws_gui_app->bookmark_mode == TRUE)
+       {
+               gtk_widget_set_sensitive(GTK_WIDGET
+                       (ws_gui_app->ws_gui_menu->ws_gui_popup_bookmark),
+                       FALSE);
+       }
+       else
+       {
                if (ws_gui_app->last_word != NULL)
                {
                        gtk_widget_set_sensitive(GTK_WIDGET
-                               (ws_gui_app->ws_gui_menu->ws_gui_popup_bookmark),
-                               TRUE);
+                       (ws_gui_app->ws_gui_menu->ws_gui_popup_bookmark),
+                       TRUE);
                }
                else
                {
                        gtk_widget_set_sensitive(GTK_WIDGET
-                               (ws_gui_app->ws_gui_menu->ws_gui_popup_bookmark),
-                               FALSE);
+                       (ws_gui_app->ws_gui_menu->ws_gui_popup_bookmark),
+                       FALSE);
                }
-      }
-      gtk_menu_popup(GTK_MENU(ws_gui_app->ws_gui_menu->ws_gui_popup_menu),
-                     NULL,
-                     NULL,
-                     NULL,
-                     ws_gui_app,
-                     0,
-                     0);
+       }
+       }
+       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
@@ -808,78 +819,90 @@ void ws_gui_dictionary_chooser(GtkMenuItem *menuitem, gpointer user_data)
                                                     FALSE);
                }
 
-               g_array_append_val(checkboxes, checkbutton);
-               gtk_box_pack_start (GTK_BOX (vbox1), 
+                       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 (_("ws_db_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 (_("ws_db_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);
-                       }
-               }
+               
+               if (strcmp(name, "bookmarks") == 0)
+               {
+                       if (ws_gui_app->bookmark_avail == FALSE) 
+                       {
+                       gtk_widget_set_sensitive(GTK_WIDGET(checkbutton),
+                                                FALSE);
+                       }
+               }
 
-               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);
-       }
+               gtk_widget_show (checkbutton);
+               }
 
-       g_slist_free(ws_gui_app->directories);
+       cancel_button = gtk_button_new_from_stock (_("ws_db_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 (_("ws_db_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
@@ -949,9 +972,9 @@ void ws_gui_dictionary_optimizer(GtkMenuItem *menuitem, gpointer user_data)
                {
                         gtk_widget_destroy(ws_gui_app->ws_message_dialog);
                }
-       }
-       else
-       {
+               }
+               else
+               {
                 dialog1 = gtk_dialog_new ();
                 gtk_window_set_title(GTK_WINDOW (dialog1),
                                      (_("ws_ti_choose_dictionaries_title")));
@@ -1211,11 +1234,11 @@ void ws_gui_dictionary_loader(GtkMenuItem *menuitem, gpointer user_data)
                        gtk_widget_destroy (dialog);
                 }
 
-       }
-       else 
-       {
-                gtk_widget_destroy (dialog);
-       }
+               }
+               else 
+               {
+               gtk_widget_destroy (dialog);
+               }
 
 }
 
@@ -1232,7 +1255,7 @@ void ws_gui_dictionary_remover(GtkMenuItem *menuitem, gpointer user_data)
         GtkWidget *dialog1;
         GtkWidget *dialog_vbox1;
         GtkWidget *scrolledwindow1;
-        GtkWidget *viewport1;
+       GtkWidget *viewport1;
         GtkWidget *vbox1;
         GtkWidget *checkbutton;
         GtkWidget *cancel_button;
index 41a0982..2ef5bb5 100644 (file)
@@ -2,8 +2,8 @@ CC = gcc
 DEBUG = -g -Wall 
 INCLUDE = include
 INCLUDE_DBUS_WRAPPER = ../../include
-LIBS = `pkg-config --libs glib-2.0 gmodule-2.0 libosso gconf-2.0 sqlite` -lpthread
-FLAGS = `pkg-config --cflags glib-2.0 gmodule-2.0 libosso gconf-2.0 sqlite` -I${INCLUDE} -I${INCLUDE_DBUS_WRAPPER}
+LIBS = `pkg-config --libs glib-2.0 gmodule-2.0 libosso gconf-2.0 ` -lpthread
+FLAGS = `pkg-config --cflags glib-2.0 gmodule-2.0 libosso gconf-2.0 ` -I${INCLUDE} -I${INCLUDE_DBUS_WRAPPER}
 SOURCE = src
 BINARY = bin
 MAIN_BINARIES = ../../bin
index f997a10..f9b3765 100644 (file)
@@ -252,9 +252,12 @@ static gpointer ws_mng_search_word (gpointer data)
         //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),
+                if (g_array_index(search->dict, Engine *, i) != NULL)
+               {
+                       dict_eng_search_word_list(
+                                 g_array_index(search->dict, Engine *, i),
                                  search->word);
+               }
         }
         pthread_exit(NULL);
        //g_free(search->word);
@@ -444,11 +447,14 @@ static gpointer ws_mng_search_translation (gpointer data)
         //run search for translation for evry dictionary
         for (i=0; i<search->dict->len; i++)
         {
-                 dict_eng_search_word_translation(g_array_index(
+                if (g_array_index(search->dict, Engine*, i) != NULL) 
+               {
+                       dict_eng_search_word_translation(g_array_index(
                                                                search->dict, 
                                                                Engine*,
                                                                i),
                                                  search->word);
+               }
         }
         pthread_exit(NULL);
 }
@@ -496,7 +502,7 @@ static void ws_mng_on_search_translation (GError *error, GArray *word,
 */
 static void ws_mng_load_dict(GArray* dict_directory, WSMngSearchData* data)
 {
-        
+
         gint i = 0;
         gint j = 0;
         Engine* xdxf = NULL;
@@ -751,6 +757,74 @@ static void ws_mng_signal_handling (GError *error, GArray *signal, gpointer user
                         }
                         g_array_free(dir_array, TRUE);
                 break;
+               case WS_DBUS_BOOKMARK_MODE:
+                       ws_dbus_notify(data->dbus_data, WS_DBUS_INFO_CACHING); 
+                        
+                        for (i=0; i<data->dict->len; i++)
+                        {
+                                if (g_array_index(data->dict, Engine*,i) !=
+                                                                       NULL)
+                               {
+                                       dict_eng_destroy(
+                                               g_array_index(
+                                                       data->dict, Engine*,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*));
+                       //dict_eng_destroy(data->bookmark);
+                       //ws_mng_load_bookmark(data);
+                       //g_debug("bookmark engine at %p", data->bookmark);
+                        //paths to directories
+                        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;
+                               data->returned_trans_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);
+                                        //creating new word list
+                                        data->word_list = g_array_new(TRUE,
+                                                               TRUE,
+                                                               sizeof(gchar*));
+                                                                                
+                                        
+                                }
+                                //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);
+               break;
 
         }
         g_debug("<-%s", __FUNCTION__);
@@ -772,7 +846,7 @@ static void ws_mng_add_bookmark(GError *error, GArray* param,
         gchar* word = NULL;
        gchar* translation = NULL;
         //get the word passed by dbus 
-        if (data->bookmark)
+        if (data->bookmark != NULL)
        {
                g_debug("adding bookmarks...%p locataion", data->bookmark);
                osso_data = &g_array_index (param, osso_rpc_t, 0); 
@@ -799,6 +873,8 @@ static void ws_mng_add_bookmark(GError *error, GArray* param,
        }
        else
        {
+               ws_dbus_notify(data->dbus_data, 
+                                      WS_DBUS_BOOKMARKS_ADDED_FAIL);
                g_debug("-> %s - there is no bookmark engine!\n", __FUNCTION__);
        }
        g_debug("<-%s", __FUNCTION__);
@@ -819,7 +895,7 @@ static void ws_mng_remove_bookmark(GError *error, GArray* param,
         osso_rpc_t* osso_data = NULL;
         gchar* word = NULL;
        //get the word passed by dbus 
-        if (data->bookmark)
+        if (data->bookmark != NULL)
        {
                g_debug("removing bookmarks...");
                osso_data = &g_array_index(param, osso_rpc_t, 0); 
@@ -839,6 +915,12 @@ static void ws_mng_remove_bookmark(GError *error, GArray* param,
                g_free(word);
                osso_rpc_free_val(osso_data);
        }
+       else
+       {       
+               ws_dbus_notify(data->dbus_data, 
+                                      WS_DBUS_BOOKMARKS_ADDED_FAIL);
+               g_debug("-> %s - there is no bookmark engine!\n", __FUNCTION__);
+       }
        g_debug("<-%s", __FUNCTION__);
 }
 
@@ -927,9 +1009,38 @@ static GArray* ws_mng_get_engines_location()
                 gchar* key_value = gconf_client_get_string(client,
                                                            new_path,
                                                            NULL);
+               gchar** tmp = g_strsplit(key_value,
+                                         "/",
+                                         -1);
+               guint i = 0;
+               gboolean bookmark_engin = FALSE;
+               while(tmp[i] != NULL)
+               {
+                       g_debug("Comapred string %s", tmp[i]);
+                       if (g_ascii_strcasecmp(tmp[i], "ws_bookmark.so") == 0)
+                       {
+                               bookmark_engin = TRUE;
+                               break;
+                       }
+                       i++;
+               }
+               g_strfreev(tmp);
+               if (bookmark_engin)
+               {
+                       gboolean result = g_file_test(
+                                               "/usr/lib/libsqlite.so.0",
+                                               G_FILE_TEST_EXISTS);
+                       if (result == FALSE)
+                       {
+                               g_debug("sqlite not installed !");
+                               g_free(new_path);
+                               continue;
+                       }
+               }
                if (key_value != NULL)
                {
-                       g_array_append_val(path_to_dir, key_value);
+                       g_debug("Added library path %s", key_value);
+                       g_array_append_val(path_to_dir, key_value);
                }
                 g_free(new_path);
         }
@@ -1014,7 +1125,8 @@ static void ws_mng_load_bookmark(WSMngSearchData* data)
        guint i = 0;
        data->bookmark = NULL;
        gchar* current_directory = ws_mng_get_boomark_location();
-       if (current_directory != NULL)
+       if (current_directory != NULL && 
+               g_file_test("/usr/lib/libsqlite.so.0", G_FILE_TEST_EXISTS))
        {
                for (i=0; i<data->modules->len; i++)
                {
@@ -1056,7 +1168,14 @@ void ws_mng_init (WSMngSearchData *data)
         data->last_search = NULL;
         data->trans = NULL;
         data->search_in_history = FALSE;
+       data->word = NULL;
+       data->bookmark = NULL;
         
+       if (g_file_test("/usr/lib/libsqlite.so.0", 
+                       G_FILE_TEST_EXISTS) == FALSE)
+       {
+               ws_dbus_notify(data->dbus_data, WS_DBUS_LOAD_BOOKMARK_FAILED);
+       }
         GArray* dict_directory = ws_mng_read_gconf(); //paths to dictionaries
         gint i = 0;