GUI


Files

file  ws_gui.h
 Definitions of structures used by ws_gui.c.
file  ws_gui_callbacks.h
 Declaration of structures used by ws_gui_callbacks.c.
file  ws_gui_layout.h
 Definitions of structures used by ws_gui_layout.c.
file  ws_gui.c
 Main GUI file.
file  ws_gui_callbacks.c
 Declaration of GUI callback handler functions.
file  ws_gui_layout.c
 GUI layout definitions.

Data Structures

struct  HtmlLayout
 struct which manage layout of html (translation) area More...
struct  WSGuiMenu
 struct which contains components of menu More...
struct  WSGuiList
 struct which contains components of words list More...
struct  WSGuiAppData
 struct which contains all components of application More...

Defines

#define ZOOM_MIN   1.000000
#define ZOOM_MAX   2.000000
#define ZOOM_STEP   0.100000
#define ZOOM_DEFAULT   1.300000
#define PRESS_TIME   1.0
#define HISTORY_LEN   5
#define SCROLL_STEP_H   50
#define SCROLL_STEP_V   20
#define GCONF_PATH   "/apps/maemo/mdictionary/dictionaries"
#define GCONF_CONF   "/apps/maemo/mdictionary/configuration"
#define _(String)   gettext (String)
#define WS_GUI_ABS(x)   (((x)<0.0)?((-1)*(x)):(x))
#define TIMER_START   TRUE
#define TIMER_STOP   FALSE

Typedefs

typedef WSGuiAppData WSGuiApp

Enumerations

enum  

Functions

void ws_gui_search_home_handler (GError *error, GArray *word, gpointer user_data)
void ws_gui_signal_hander (GError *error, GArray *words, gpointer user_data)
 handle dbus signals
void ws_dbus_progress_bar (GError *error, GArray *words, gpointer user_data)
 handle signal from dbus and updates progress bar(in order to caching)
void ws_gui_clear_list (GtkListStore *list, gpointer user_data)
 clean words list
void ws_gui_dbus_return_words (GError *error, GArray *words, gpointer user_data)
 handle dbus signal and transfer words to the words list
void ws_gui_dbus_return_translation (GError *error, GArray *words, gpointer user_data)
 handle dbus signal and convert message into readable text
void ws_dbus_server_return_extracted_bzip (GError *error, GArray *words, gpointer user_data)
 handle dbus signal and load extracted dictionary
void ws_gui_free_memory (gpointer user_data)
 is used to free memory, which was allocated
gboolean hildon_key_press_listener (GtkWidget *widget, GdkEventKey *keyevent, gpointer user_data)
 handle keys press signals (hardware keys in device)
void ws_gui_words_list_hide_from_menu (GtkCheckMenuItem *checkmenuitem, gpointer user_data)
 allow to hide words list from menu
void ws_gui_words_list_hide (GtkToggleButton *togglebutton, gpointer user_data)
 allow to hide words list from toolbar
void ws_gui_history_add (char *new_word, gpointer user_data)
 add word to the words history
void ws_gui_history_back (GtkButton *button, gpointer user_data)
 display translation of word stored in the history (if available)
void ws_gui_history_next (GtkButton *button, gpointer user_data)
 display translation of word stored in the history (if available)
void ws_gui_check_history (gpointer user_data)
 check history and disable buttons or uncheck checkbuttons
GtkWidget * create_view_and_model (GArray *words_list, gpointer user_data)
 creates model and view of words list
GtkTreeModel * create_and_fill_model (GArray *words_list, gpointer user_data)
 creates words list and fill it with content
void ws_gui_full_screen (GtkMenuItem *menuitem, gpointer user_data)
 switch view between full screen and normal mode
void ws_gui_popup_search (GtkMenuItem *menuitem, gpointer user_data)
 search for selected text in a dictionary
void ws_gui_html_select_all (GtkMenuItem *menuitem, gpointer user_data)
 allows to select whole text in translation (html) area
void ws_gui_html_copy (GtkMenuItem *menuitem, gpointer user_data)
 allows to copy text from translation (html) area into clipboard
void ws_gui_html_paste (GtkMenuItem *menuitem, gpointer user_data)
 allows to paste text from the clipboard into find toolbar entry
void ws_gui_html_zoom_in (GtkMenuItem *menuitem, gpointer user_data)
 magnify translation (html) area
void ws_gui_html_zoom_out (GtkMenuItem *menuitem, gpointer user_data)
 zoom out translation (html) area.
void ws_gui_search (GtkWidget *widget, gpointer user_data)
 start search (sends typed word to the engine)
void ws_gui_search_stop (GtkButton *button, gpointer user_data)
 abort search
void ws_gui_on_exit (GtkWidget *widget, GdkEvent *event, gpointer user_data)
 used when user closes the application
void ws_gui_menu_quit (GtkMenuItem *menuitem, gpointer user_data)
 used when user closes the application from menu
void ws_gui_fill_html (char *html_context, gpointer user_data)
 sets content of translation (html) area
void ws_gui_read_adjustment (gpointer user_data)
 read current adjustment value
void ws_gui_url_requested (GtkHTML *html, const char *url, GtkHTMLStream *stream)
 necessary to load images into translation (html) area
gboolean ws_gui_button_press (GtkWidget *widget, GdkEventButton *event, gpointer user_data)
 handles button press event
gboolean ws_gui_button_release (GtkWidget *widget, GdkEventButton *event, gpointer user_data)
 handles button release event
guint ws_gui_show_popup (gpointer user_data)
 shows popup when user clicks and holds
void ws_gui_check_clipboard (GtkWidget *widget, gpointer user_data)
 checks clipboard content
void ws_gui_dict_availablity (GtkMenuItem *menuitem, gpointer user_data)
 checks dictionaries availablity
gchar * format_html (gchar *received_string, gpointer user_data)
 allows to format html content
void ws_gui_set_bookmarks_sensitivity (gpointer user_data)
 sets sensitivity of Bookmarks menu items
void ws_gui_set_bookmark_menu_items (GtkMenuItem *menuitem, gpointer user_data)
 sets sensitivity of Bookmarks menu items due to selection made
void ws_gui_read_active_dictionaries (gpointer user_data)
 sets sensitivity of menu items due to dictionary mode
void ws_gui_clear_array (GArray *history)
void ws_gui_view_cursor_changed (GtkTreeView *treeview, gpointer user_data)
void ws_gui_set_toolbar_avail (gpointer user_data)
void ws_refresh_search_results (gpointer user_data)
void ws_gui_create_window (gpointer user_data)
 create main window
void ws_gui_create_find_toolbar (gpointer user_data)
 create find toolbar
void ws_gui_create_main_menu (gpointer user_data)
 create application menu
void ws_gui_create_popup_menu (gpointer user_data)
 create popup menu
void ws_gui_dictionary_chooser (GtkMenuItem *menuitem, gpointer user_data)
 select dictionaries to use
void ws_gui_dictionary_loader (GtkMenuItem *menuitem, gpointer user_data)
 load new dictionary files
gboolean ws_gui_load_dict (gchar *filename, gpointer user_data)
 load dictionary file using given filename
void ws_gui_dictionary_remover (GtkMenuItem *menuitem, gpointer user_data)
 remove dictionary from application
void ws_gui_dictionary_optimizer (GtkMenuItem *menuitem, gpointer user_data)
 optimize dictionaries
void ws_gui_dictionary_open_bookmark (GtkMenuItem *menuitem, gpointer user_data)
 open bookmark window
void ws_gui_dictionary_close_bookmark (GtkMenuItem *menuitem, gpointer user_data)
 close bookmark window
void ws_gui_dictionary_add_bookmark (GtkMenuItem *menuitem, gpointer user_data)
 add bookmark to bookmarks database
void ws_gui_dictionary_remove_bookmark (GtkMenuItem *menuitem, gpointer user_data)
 remove bookmark from database
void ws_gui_about_application (GtkMenuItem *menuitem, gpointer user_data)
 display information about application
void ws_gui_add_bookmark_dialog (gpointer user_data)
 creates Add Bookmark dialog window
void ws_gui_remove_bookmark_dialog (gpointer user_data)
 creates Remove Bookmark dialog window
void ws_gui_list_full_dialog (GtkWidget *widget, GdkEventButton *event, gpointer user_data)
int main (int argc, char *argv[])
static double timer (gboolean start, gchar *message)
 show how much time did take a callback of another function

Variables

gchar * HtmlLayout::bg_image
gchar * HtmlLayout::bg_font_color
gchar * HtmlLayout::th_color
gchar * HtmlLayout::th_image
gchar * HtmlLayout::th_font_color
gchar * HtmlLayout::td_color
gchar * HtmlLayout::td_image
gchar * HtmlLayout::td_font_color
GtkWidget * WSGuiMenu::ws_gui_menu_dictionaries
 dictionaries submenu (managing with the dictionary files)
GtkWidget * WSGuiMenu::ws_gui_menu_load_dict
 menuitem in dictionaries submenu; load new dictionary file into application
GtkWidget * WSGuiMenu::ws_gui_menu_select_dict
 menuitem in dictionaries submenu; allow to select which dictionaries are used
GtkWidget * WSGuiMenu::ws_gui_menu_remove_dict
 menuitem in dictionaries submenu; remove dictionary files which are no longer used
GtkWidget * WSGuiMenu::ws_gui_menu_optimize_dict
 menuitem used for optimizing dictionaries
GtkWidget * WSGuiMenu::ws_gui_menu_bookmarks
GtkWidget * WSGuiMenu::ws_gui_menu_open_bookmark
 bookmarks submenu
GtkWidget * WSGuiMenu::ws_gui_menu_close_bookmark
 menuitem, opens bookmark window
GtkWidget * WSGuiMenu::ws_gui_menu_add_bookmark
 menuitem, closes bookmark window
GtkWidget * WSGuiMenu::ws_gui_menu_remove_bookmark
 menuitem used fot adding bookmarks
GtkWidget * WSGuiMenu::ws_gui_menu_edit
 menuitem, allows for removing bookmarks edit submenu(connected with text editing)
GtkWidget * WSGuiMenu::ws_gui_menu_copy
 menuitem in edit submenu; copy selected text to the clipboard
GtkWidget * WSGuiMenu::ws_gui_menu_paste
 menuitem in edit submenu; paste content of the clipboard into find toolbar entry
GtkWidget * WSGuiMenu::ws_gui_menu_select_all
 menuitem in edit submenu; select whole text in the translation (html) area
GtkWidget * WSGuiMenu::ws_gui_menu_view
 view submenu
GtkWidget * WSGuiMenu::ws_gui_menu_hide_list
 menuitem which allows to hide/show words list
GtkWidget * WSGuiMenu::ws_gui_menu_zoom_in
 menuitem which allows to zoom in text in the translation area
GtkWidget * WSGuiMenu::ws_gui_menu_zoom_out
 menuitem which allows to zoom out text in the translation area
GtkWidget * WSGuiMenu::ws_gui_menu_full_screen
 menuitem which allows to switch between fullscreen and normal mode
GtkWidget * WSGuiMenu::ws_gui_menu_search
 search submenu (connected with searching)
GtkWidget * WSGuiMenu::ws_gui_menu_find_word
 menuitem which allows to start searching
GtkWidget * WSGuiMenu::ws_gui_menu_find_prev
 menuitem which allows to find previous word from the history
GtkWidget * WSGuiMenu::ws_gui_menu_find_next
 menuitem which allows to find next word in the history
GtkWidget * WSGuiMenu::ws_gui_menu_stop
 menuitem which stops search
GtkWidget * WSGuiMenu::ws_gui_menu_about
 menuitem which opens 'about application' dialog window
GtkWidget * WSGuiMenu::ws_gui_menu_close
 menuitem which closes the application
GtkWidget * WSGuiMenu::ws_gui_submenu_0
 submenu which is necessaty to build dictionaries submenu
GtkWidget * WSGuiMenu::ws_gui_submenu_1
 submenu which is necessary to build edit submenu
GtkWidget * WSGuiMenu::ws_gui_submenu_2
 submenu which is necessary to build view submenu
GtkWidget * WSGuiMenu::ws_gui_submenu_3
 submenu which is necessary to build search submenu
GtkWidget * WSGuiMenu::ws_gui_submenu_4
 submenu which is necessary to build search submenu
GtkWidget * WSGuiMenu::ws_gui_separator
 separator, it is used to provide nice layout
GtkWidget * WSGuiMenu::ws_gui_popup_menu
 popup menu
GtkWidget * WSGuiMenu::ws_gui_popup_search
 search option, allow to search selected text
GtkWidget * WSGuiMenu::ws_gui_popup_bookmark
 search option, allow to search selected text
GtkWidget * WSGuiMenu::ws_gui_popup_edit
 edit submenu
GtkWidget * WSGuiMenu::ws_gui_popup_submenu
 submenu (necessary to create edit submenu)
GtkWidget * WSGuiMenu::ws_gui_popup_copy
 menuitem which allows to copy selected to the clipboard
GtkWidget * WSGuiMenu::ws_gui_popup_paste
 menuitem which allows to paste content of the clipboard into find toolbar entry
GtkWidget * WSGuiMenu::ws_gui_popup_select_all
 menuitem which allows to select whole text in translation area
GtkWidget * WSGuiMenu::ws_gui_popup_zoom_in
 menuitem which allows to zoom in text in translation area
GtkWidget * WSGuiMenu::ws_gui_popup_zoom_out
 menuitem which allows to zoom in text in translation area
GtkWidget * WSGuiMenu::ws_gui_separator1
 separator, it is used to provide nice layout
GtkWidget * WSGuiMenu::ws_gui_separator2
 separator, it is used to provide nice layout
GtkWidget * WSGuiList::ws_gui_list_item
 item in words list (each word)
GtkWidget * WSGuiList::ws_gui_list_label
 label, necessary to place word in words list
GtkObject * WSGuiList::ws_gui_list_item_object
 object which stores data of selected item (from words list)
GtkListStore * WSGuiList::ws_gui_store
 list necessary to present words list
GtkTreeIter WSGuiList::ws_gui_iter
 variable necessary to present words list
GtkCellRenderer * WSGuiList::ws_gui_renderer
 variable necessary to draw GtkTree
GtkTreeModel * WSGuiList::ws_gui_model
 model of GtkTree
GtkWidget * WSGuiList::ws_gui_view
 variable responsible for view of GtkTree
GtkTreeSelection * WSGuiList::ws_gui_selection
 variable necessary to read selection (from words list)
HildonWindow * WSGuiAppData::ws_gui_hildon_window
 handle to hildon window
gchar * WSGuiAppData::welcome_note
 welcome note
GtkWidget * WSGuiAppData::ws_gui_html
 translation (html) area
GtkWidget * WSGuiAppData::ws_gui_hpane
 pane; it allows to divide window into two separate panels
HildonFindToolbar * WSGuiAppData::ws_gui_hildon_find_toolbar
 find toolbar (placed at the bottom of the window)
GtkToolItem * WSGuiAppData::ws_gui_toobar_button_close
 close button at the find toolbar
GtkToolItem * WSGuiAppData::ws_gui_toobar_button_back
 back button at the find toolbar (history navigator)
GtkToolItem * WSGuiAppData::ws_gui_toobar_button_forward
 next button at the find toolbar (history navigator)
GtkToolItem * WSGuiAppData::ws_gui_toobar_button_stop
 stop butoon at the find toolbar (allows to stop searching)
GtkToolItem * WSGuiAppData::ws_gui_toobar_button_start
 stop butoon at the find toolbar (allows to stop searching)
GtkWidget * WSGuiAppData::ws_gui_banner_list_searching
 banner, displays message that searching is in progress
GtkWidget * WSGuiAppData::ws_gui_banner_caching
 banner, displays message that caching is in progress
GtkWidget * WSGuiAppData::ws_gui_banner_translation_loading
 banner, displays message that translation is loading
gboolean WSGuiAppData::caching_flag
 flag; used when caching is being performed
gboolean WSGuiAppData::loading
gboolean WSGuiAppData::stop_clicked
GtkWidget * WSGuiAppData::ws_gui_banner_extracting
GtkToolItem * WSGuiAppData::ws_gui_toobar_button_hide
 button hide, allows to hide/show words list with button placed at find toolbar
GtkWidget * WSGuiAppData::ws_gui_scrolledwindow_right
 right scrolledwindow (placed in right pane), necessary to provide scrollbars)
GtkWidget * WSGuiAppData::ws_gui_scrolledwindow_left
 scrollwindow (placed in left pane), necessary to provide scrollbars)
GtkWidget * WSGuiAppData::ws_gui_list_vbox
GtkWidget * WSGuiAppData::ws_gui_list_hbox
GtkWidget * WSGuiAppData::ws_gui_list_label
GtkWidget * WSGuiAppData::ws_gui_list_eventbox
GtkWidget * WSGuiAppData::ws_gui_list_image
gchar * WSGuiAppData::ws_gui_html_source
 string which contains html content (translation of word)
GtkAdjustment * WSGuiAppData::ws_gui_vadj
 vertical adjustment of left scrolledwindow (necessary to provide navigation (kardware keys) inside words list)
GtkAdjustment * WSGuiAppData::ws_gui_hadj
 horizontal adjustment of left scrolledwindow (necessary to provide navigation (kardware keys) inside words list)
gdouble WSGuiAppData::v_delta
 variable used for moving vertical scrollbar in words list
gdouble WSGuiAppData::v_new_value
 variable used for moving vertical scrollbar in words list
gdouble WSGuiAppData::h_delta
 variable used for moving horizontal scrollbar in words list
gdouble WSGuiAppData::h_new_value
 variable used for moving horizontal scrollbar in words list
gdouble WSGuiAppData::cur_vadj
 current vertical adjustment of vertical scrollbar in words list
gdouble WSGuiAppData::prev_vadj
 previous vertical adjustment of vertical scrollbar in words list
gdouble WSGuiAppData::cur_hadj
 current vertical adjustment of horizontal scrollbar in words list
gdouble WSGuiAppData::prev_hadj
 previous vertical adjustment of horizontal scrollbar in words list
GArray * WSGuiAppData::ws_gui_history
 words history
GArray * WSGuiAppData::ws_gui_history_list
GArray * WSGuiAppData::ws_gui_history_iter
GArray * WSGuiAppData::ws_gui_history_bookmarks
gboolean WSGuiAppData::history_flag
gint WSGuiAppData::ws_gui_history_cur_pos
 current position in words history array
WSGuiMenuWSGuiAppData::ws_gui_menu
 structure responsible for menus
WSGuiListWSGuiAppData::ws_gui_w_list
 structure responsible for words list
gboolean WSGuiAppData::ws_gui_banner_flag
 flag; used for notifing if searching is in progress and banner has to be displaying
gboolean WSGuiAppData::ws_gui_full_screen_flag
 flag; used for informing if fullscreen mode is active
gboolean WSGuiAppData::ws_gui_double_click
 flag; necessary to recognize double click
gboolean WSGuiAppData::ws_gui_sel_flag
 flag; used to identify selected text
WSDBusDataWSGuiAppData::dbus_data
 DBUS declaration.
GtkWidget * WSGuiAppData::ws_message_dialog
 message dialogs; used for informing user about errors
GSList * WSGuiAppData::directories
 list consist of directories previously read from gconf
GSList * WSGuiAppData::directories_last
 list consist of directories previously read from gconf
GConfClient * WSGuiAppData::client
 variable necessary to read from gconf
GtkClipboard * WSGuiAppData::ws_gui_clipboard
 application clipboard (available outside the application as well)
GtkClipboard * WSGuiAppData::ws_gui_clipboard_primary
PangoFontDescription * WSGuiAppData::p
 schema, which allows to format text on widgets
GtkWidget * WSGuiAppData::licence_dialog
 variable necessary to create license dialog
GTimer * WSGuiAppData::timer
 timer, counts how long user press button (stylus)
GArray * WSGuiAppData::bookmarks_list
 array wchich contains bookmarked words
gboolean WSGuiAppData::bookmark_on
 flag which switch beetween bookmark and normal mode
gchar * WSGuiAppData::word_book
 word added to the bookmarks
gchar * WSGuiAppData::translation_book
 translation of the word added to bookmarks
gboolean WSGuiAppData::bookmark_avail
 flag, denpends on availablity of bookmarks module
gboolean WSGuiAppData::bookmark_mode
 flag, shows either bookmarks mode is on or off
gchar * WSGuiAppData::last_word
 stores last choosen word on the words list (necessary for bookmarks)
GString * WSGuiAppData::raw_translation
 stores current translation, if user wants to add it to bookmarks
gchar * WSGuiAppData::last_searched
gchar * WSGuiAppData::last_searched_in_book
gdouble WSGuiAppData::zoom
gboolean WSGuiAppData::html_flag
gboolean WSGuiAppData::no_words_found
gboolean WSGuiAppData::first_run

Function Documentation

GtkTreeModel * create_and_fill_model ( GArray *  words_list,
gpointer  user_data 
)

creates words list and fill it with content

create TreeView Model, which allows to display words list

Parameters:
words_list - array with words(found in a dictionary), recived from DBUS;
user_data - user data set when the signal handler was connected
Returns:

Definition at line 1207 of file ws_gui_callbacks.c.

References WSGuiAppData::dbus_data, WSGuiAppData::history_flag, WSGuiAppData::last_word, ws_dbus_client_find_translation, ws_gui_clear_list(), ws_gui_history_add(), WSGuiList::ws_gui_iter, WSGuiList::ws_gui_store, WSGuiList::ws_gui_view, ws_gui_view_cursor_changed(), and WSGuiAppData::ws_gui_w_list.

Referenced by create_view_and_model(), ws_gui_dbus_return_words(), and ws_gui_signal_hander().

01208 {
01209         WSGuiApp* ws_gui_app=(WSGuiApp*)user_data;
01210 
01211         g_signal_handlers_block_by_func(G_OBJECT (ws_gui_app->ws_gui_w_list->ws_gui_view),
01212                                         G_CALLBACK (ws_gui_view_cursor_changed), 
01213                                         ws_gui_app);    
01214 
01215         guint i = 0;
01216         gchar *tmp = g_strdup(g_array_index(words_list, gchar*, i));
01217 
01218         if (tmp != NULL)
01219         {
01220                 ws_gui_clear_list(ws_gui_app->ws_gui_w_list->ws_gui_store, ws_gui_app);
01221         }
01222 
01223         gboolean valid;
01224         valid = gtk_tree_model_get_iter_first(
01225                         GTK_TREE_MODEL(ws_gui_app->ws_gui_w_list->ws_gui_store),
01226                         &ws_gui_app->ws_gui_w_list->ws_gui_iter);
01227 
01228         /* Append a row and fill in some data */
01229         while (tmp != NULL)
01230         {
01231                 gtk_list_store_append (ws_gui_app->ws_gui_w_list->ws_gui_store,
01232                                 &ws_gui_app->ws_gui_w_list->ws_gui_iter);
01233 
01234                 gtk_list_store_set (ws_gui_app->ws_gui_w_list->ws_gui_store,
01235                         &ws_gui_app->ws_gui_w_list->ws_gui_iter, 
01236                         COL_WORD, tmp,
01237                         -1);
01238                 i=i+1;
01239                 g_free(tmp);
01240                 tmp = NULL;
01241                 tmp = g_strdup(g_array_index(words_list, gchar*, i));
01242         };
01243 
01244         g_free(tmp);
01245         tmp = NULL;
01246         tmp = g_strdup(g_array_index(words_list, gchar*, 0));
01247 
01248                 
01249         if (ws_gui_app->history_flag == FALSE && tmp != NULL)
01250         {
01251                 //gtk_widget_show(ws_gui_app->ws_gui_banner_translation_loading);
01252                 ws_dbus_client_find_translation(ws_gui_app->dbus_data, tmp);
01253                 ws_gui_history_add(tmp, ws_gui_app);
01254 
01255                 g_free(ws_gui_app->last_word);
01256                 ws_gui_app->last_word = NULL;
01257                 ws_gui_app->last_word = g_strdup (tmp);
01258                 ws_gui_app->history_flag = FALSE;
01259         }
01260 
01261         g_signal_handlers_unblock_by_func(G_OBJECT(
01262                                         ws_gui_app->ws_gui_w_list->ws_gui_view),
01263                                         G_CALLBACK (ws_gui_view_cursor_changed), 
01264                                         ws_gui_app);
01265 
01266         g_free(tmp);
01267         return GTK_TREE_MODEL(ws_gui_app->ws_gui_w_list->ws_gui_store);
01268         
01269 }

GtkWidget * create_view_and_model ( GArray *  words_list,
gpointer  user_data 
)

creates model and view of words list

create TreeView and TreeModel using create_and_fill_model() function; it is necessary to display found words in a words list;

Parameters:
words_list - array with words(found in a dictionary), recived from DBUS;
user_data - user data set when the signal handler was connected
Returns:

Definition at line 1279 of file ws_gui_callbacks.c.

References create_and_fill_model(), WSGuiList::ws_gui_model, WSGuiList::ws_gui_renderer, WSGuiList::ws_gui_view, and WSGuiAppData::ws_gui_w_list.

Referenced by ws_gui_create_window().

01280 {
01281         WSGuiApp* ws_gui_app=(WSGuiApp*)user_data;
01282 
01283         ws_gui_app->ws_gui_w_list->ws_gui_view = gtk_tree_view_new ();
01284 
01285         ws_gui_app->ws_gui_w_list->ws_gui_renderer=gtk_cell_renderer_text_new();
01286         gtk_tree_view_insert_column_with_attributes(
01287                         GTK_TREE_VIEW (ws_gui_app->ws_gui_w_list->ws_gui_view),
01288                         -1,
01289                         "Name",
01290                         ws_gui_app->ws_gui_w_list->ws_gui_renderer,
01291                         "text",
01292                         COL_WORD,
01293                         NULL);
01294         ws_gui_app->ws_gui_w_list->ws_gui_model = 
01295                                 create_and_fill_model(words_list, ws_gui_app);
01296 
01297         gtk_tree_view_set_model(
01298                         GTK_TREE_VIEW (ws_gui_app->ws_gui_w_list->ws_gui_view),
01299                         ws_gui_app->ws_gui_w_list->ws_gui_model);
01300         g_object_unref (ws_gui_app->ws_gui_w_list->ws_gui_model);
01301         
01302         return ws_gui_app->ws_gui_w_list->ws_gui_view;
01303 }

gchar * format_html ( gchar *  received_string,
gpointer  user_data 
)

allows to format html content

gets received string (with translation), formats it and sends it to be displayed

Parameters:
received_string - content received from Manager
user_data - user data set when the function has been called
Returns:

Definition at line 1908 of file ws_gui_callbacks.c.

References WSGuiAppData::last_word, and WSGuiAppData::raw_translation.

Referenced by ws_gui_dbus_return_translation().

01909 {
01910         WSGuiApp* ws_gui_app=(WSGuiApp*)user_data;
01911         GString *str_final;
01912         GString *str_tmp;
01913         str_final = g_string_new(received_string);
01914         str_tmp = g_string_new(received_string);
01915         gchar * tmp;
01916         gchar * tmp2;
01917         gchar * returned_value;
01918         
01919         ws_gui_app->raw_translation=g_string_erase(ws_gui_app->raw_translation, 
01920                                                 0, 
01921                                                 -1);
01922 
01923         while (strstr(str_final->str, "<PATTERN_OPEN>") != NULL)
01924         {
01925                 tmp = strstr(str_final->str, "<PATTERN_OPEN>");
01926                 str_final =  g_string_erase(str_final,
01927                                         (long)(tmp - str_final->str),
01928                                         14);
01929                 str_final =  g_string_insert(str_final,
01930                 (long)(tmp - str_final->str),
01931                 "<html><head></head><body><center><table width=\"95%\"><tr>"
01932                 "<td><table border=1 width=100%><tr>"
01933                 "<th background=\"file:/usr/share/pixmaps/ws_top.png\">"
01934                 "<img align=left src=\"file:/usr/share/pixmaps/"
01935                 "engine_xdxf_icon.png\"><font color=\"#eeeeee\">");
01936                 
01937                 tmp2 = strstr(str_tmp->str, "<PATTERN_OPEN>");
01938                 if (ws_gui_app->last_word != NULL)
01939                 {
01940                         str_tmp =  g_string_erase(str_tmp,
01941                                         (long)(tmp2 - str_tmp->str),
01942                                         14 + strlen(ws_gui_app->last_word));
01943                 }
01944         }
01945 
01946         while (strstr(str_final->str, "<PATTERN_CLOSED>") != NULL)
01947         {
01948                 tmp = strstr(str_final->str, "<PATTERN_CLOSED>");
01949                 str_final =  g_string_erase(str_final,
01950                                         (long)(tmp - str_final->str),
01951                                         16);
01952                 str_final =  g_string_insert(str_final,
01953                                         (long)(tmp - str_final->str),
01954                                         "</font></th></tr></table>");
01955 
01956                 tmp2 = strstr(str_tmp->str, "<PATTERN_CLOSED>");
01957                 str_tmp =  g_string_erase(str_tmp,
01958                                         (long)(tmp2 - str_tmp->str),
01959                                         16);
01960         }
01961 
01962         while (strstr(str_final->str, "<TRANSLATION_OPEN>") != NULL)
01963         {
01964                 tmp = strstr(str_final->str, "<TRANSLATION_OPEN>");
01965                 str_final =  g_string_erase (str_final,
01966                                         (long)(tmp - str_final->str),
01967                                         18);
01968                 str_final =  g_string_insert (str_final,
01969                 (long)(tmp - str_final->str),
01970                 "<table border=1 width=100%><tr><td background=\"file:/usr/"
01971                 "share/pixmaps/ws_tra.png\">");
01972 
01973                 tmp2 = strstr(str_tmp->str, "<TRANSLATION_OPEN>");
01974                 str_tmp =  g_string_erase(str_tmp,
01975                                         (long)(tmp2 - str_tmp->str),
01976                                         18);
01977         }
01978 
01979         while (strstr(str_final->str, "<TRANSLATION_CLOSED>") != NULL)
01980         {
01981                 tmp = strstr(str_final->str, "<TRANSLATION_CLOSED>");
01982                 str_final =  g_string_erase(str_final,
01983                                         (long)(tmp - str_final->str),
01984                                         20);
01985                 str_final =  g_string_insert(str_final,
01986                                         (long)(tmp - str_final->str),
01987                                         "</td></tr></table></center>");
01988 
01989                 tmp2 = strstr(str_tmp->str, "<TRANSLATION_CLOSED>");
01990                 str_tmp =  g_string_erase(str_tmp,
01991                                         (long)(tmp2 - str_tmp->str),
01992                                         20);
01993         }
01994 
01995         str_final = g_string_append(str_final,
01996                                 "</td></tr></table></body></html>");
01997 
01998         ws_gui_app->raw_translation = g_string_insert(
01999                                                 ws_gui_app->raw_translation,
02000                                                 0,
02001                                                 str_tmp->str);
02002         
02003         returned_value = g_strdup(str_final->str);
02004         g_string_free(str_final, TRUE);
02005         g_string_free(str_tmp, TRUE);
02006         return returned_value;
02007 }

gboolean hildon_key_press_listener ( GtkWidget *  widget,
GdkEventKey *  keyevent,
gpointer  user_data 
)

handle keys press signals (hardware keys in device)

this function handle press signals (keyboard)

Parameters:
widget 
keyevent 
user_data - ponter to data structure
Returns:
TRUE to stop other handlers from being invoked for the event. FALSE to propagate the event further.

Definition at line 737 of file ws_gui_callbacks.c.

References WSGuiAppData::h_delta, WSGuiAppData::h_new_value, WSGuiAppData::v_delta, WSGuiAppData::v_new_value, ws_gui_full_screen(), WSGuiAppData::ws_gui_hadj, ws_gui_html_zoom_in(), ws_gui_html_zoom_out(), WSGuiAppData::ws_gui_scrolledwindow_left, ws_gui_search(), ws_gui_search_stop(), and WSGuiAppData::ws_gui_vadj.

Referenced by main().

00740 {
00741         WSGuiApp* ws_gui_app=(WSGuiApp*)user_data;
00742 
00743         switch ((guint)(keyevent->keyval)) {
00744                 case HILDON_HARDKEY_UP: 
00745                 {
00746                         gtk_container_set_focus_vadjustment(
00747                         GTK_CONTAINER(ws_gui_app->ws_gui_scrolledwindow_left),
00748                         gtk_scrolled_window_get_vadjustment(
00749                         GTK_SCROLLED_WINDOW(
00750                                 ws_gui_app->ws_gui_scrolledwindow_left)));
00751                 ws_gui_app->v_new_value =
00752                         gtk_adjustment_get_value(
00753                         GTK_ADJUSTMENT(
00754                                 ws_gui_app->ws_gui_vadj)) - ws_gui_app->v_delta;
00755                 if (ws_gui_app->v_new_value > 
00756                         ws_gui_app->ws_gui_vadj->lower) 
00757                 {
00758                         gtk_adjustment_set_value(
00759                                         GTK_ADJUSTMENT(ws_gui_app->ws_gui_vadj),
00760                                         ws_gui_app->v_new_value);
00761                 }
00762                         
00763                         break;
00764                 }
00765 
00766                 case HILDON_HARDKEY_DOWN: 
00767                 {
00768                 gtk_container_set_focus_vadjustment(
00769                         GTK_CONTAINER(ws_gui_app->ws_gui_scrolledwindow_left),
00770                         gtk_scrolled_window_get_vadjustment(
00771                         GTK_SCROLLED_WINDOW(
00772                                 ws_gui_app->ws_gui_scrolledwindow_left)));
00773                 ws_gui_app->v_new_value = gtk_adjustment_get_value(
00774                                         GTK_ADJUSTMENT(ws_gui_app->ws_gui_vadj))
00775                                         + ws_gui_app->v_delta;
00776 
00777                 if (ws_gui_app->v_new_value < 
00778                                 (ws_gui_app->ws_gui_vadj->upper - 
00779                                         ws_gui_app->ws_gui_vadj->page_size)) 
00780                 {
00781                                 gtk_adjustment_set_value(
00782                                         GTK_ADJUSTMENT(ws_gui_app->ws_gui_vadj),
00783                                         ws_gui_app->v_new_value);
00784                 }
00785                 break;
00786                 }
00787 
00788                 case HILDON_HARDKEY_LEFT:
00789                 {
00790                 gtk_container_set_focus_hadjustment(
00791                 GTK_CONTAINER(ws_gui_app->ws_gui_scrolledwindow_left),
00792                 gtk_scrolled_window_get_hadjustment(
00793                 GTK_SCROLLED_WINDOW(
00794                                 ws_gui_app->ws_gui_scrolledwindow_left)));
00795 
00796                 ws_gui_app->h_new_value = gtk_adjustment_get_value(
00797                 GTK_ADJUSTMENT(ws_gui_app->ws_gui_hadj)) 
00798                 - ws_gui_app->h_delta;
00799 
00800                 if (ws_gui_app->h_new_value > 
00801                         ws_gui_app->ws_gui_hadj->lower) 
00802                 {
00803                                 gtk_adjustment_set_value(
00804                                         GTK_ADJUSTMENT(ws_gui_app->ws_gui_hadj),
00805                                         ws_gui_app->h_new_value);
00806                 }
00807                 }
00808                 break;
00809 
00810                 case HILDON_HARDKEY_RIGHT: 
00811                 {
00812                 gtk_container_set_focus_hadjustment(
00813                 GTK_CONTAINER(ws_gui_app->ws_gui_scrolledwindow_left),
00814                 gtk_scrolled_window_get_hadjustment(
00815                 GTK_SCROLLED_WINDOW(
00816                 ws_gui_app->ws_gui_scrolledwindow_left)));
00817 
00818                 ws_gui_app->h_new_value = gtk_adjustment_get_value(
00819                 GTK_ADJUSTMENT(ws_gui_app->ws_gui_hadj)) 
00820                 + ws_gui_app->h_delta;
00821 
00822                 if (ws_gui_app->h_new_value < 
00823                                 (ws_gui_app->ws_gui_hadj->upper - 
00824                                         ws_gui_app->ws_gui_hadj->page_size)) 
00825                 {
00826                 gtk_adjustment_set_value(
00827                                         GTK_ADJUSTMENT(ws_gui_app->ws_gui_hadj),
00828                                         ws_gui_app->h_new_value);
00829                 }
00830                 }
00831                 break;
00832 
00833                 case HILDON_HARDKEY_SELECT: 
00834                         ws_gui_search(NULL, ws_gui_app);
00835                 break;
00836 
00837                 case HILDON_HARDKEY_FULLSCREEN: 
00838                 ws_gui_full_screen(NULL, ws_gui_app);
00839                 break;
00840 
00841                 case HILDON_HARDKEY_INCREASE: 
00842                 ws_gui_html_zoom_in(NULL, ws_gui_app);
00843                 break;
00844 
00845                 case HILDON_HARDKEY_DECREASE:
00846                 ws_gui_html_zoom_out(NULL, ws_gui_app);
00847                 break;
00848 
00849                 case HILDON_HARDKEY_ESC: 
00850                 ws_gui_search_stop(NULL, ws_gui_app);
00851                 break;
00852 
00853                 default:
00854                 return FALSE;
00855                 break;
00856         }
00857         return TRUE;
00858 }

static double timer ( gboolean  start,
gchar *  message 
) [static]

show how much time did take a callback of another function

Definition at line 40 of file ws_gui_callbacks.c.

Referenced by ws_gui_dbus_return_words().

00041 {
00042         static GArray* stack = NULL;
00043         static gboolean first_run = TRUE;
00044         static struct timeval actual_time;
00045         static struct timeval last_time;
00046         static struct timeval result;
00047         static double seconds = 0.0;
00048         if(first_run)
00049         {
00050                 first_run = FALSE;
00051                 stack = g_array_new(TRUE, TRUE, sizeof(struct timeval));
00052         };
00053         // things to do on the beggining of function's work
00054         if (start)
00055         {
00056                 g_debug("XDXF->%s() start counting time for function '%s()'.\n",
00057                         __FUNCTION__,message);
00058                 g_array_prepend_val(stack, actual_time);
00059                 gettimeofday(&g_array_index(stack, struct timeval, 0),NULL);
00060                 return -1.0;
00061         }
00062         // we just want to end some timer - print some information 
00063         //about working time;
00064         else {
00065                 gettimeofday(&actual_time,NULL);
00066                 last_time = g_array_index(stack, struct timeval, 0);
00067                 g_array_remove_index(stack, 0);
00068 
00069                 if (actual_time.tv_usec < last_time.tv_usec) {
00070                         int nsec = (last_time.tv_usec - 
00071                                         actual_time.tv_usec) / 1000000 + 1;
00072                         last_time.tv_usec -= 1000000 * nsec;
00073                         last_time.tv_sec += nsec;
00074                 }
00075                 if (actual_time.tv_usec - last_time.tv_usec > 1000000) {
00076                         int nsec = (last_time.tv_usec -
00077                                                 actual_time.tv_usec) / 1000000;
00078                         last_time.tv_usec += 1000000 * nsec;
00079                         last_time.tv_sec -= nsec;
00080                 }
00081                 result.tv_sec = actual_time.tv_sec - last_time.tv_sec;
00082                 result.tv_usec = actual_time.tv_usec - last_time.tv_usec;
00083                 seconds = (((double)(result.tv_usec)) / 1e6) + 
00084                                                 ((double)(result.tv_sec));
00085 
00086                 g_debug("XDXF->%s() function \'%s()\' was working for: %g [s] "
00087                         "or %ld [us].\n",
00088                         __FUNCTION__,
00089                         message,seconds,
00090                         ((long)(result.tv_sec*1e6)+(result.tv_usec)));
00091         // stack is empty so we delete everything
00092         if(stack->len == 0) 
00093         {
00094                         g_array_free(stack, TRUE);
00095                         first_run = TRUE;
00096         }
00097         return seconds;
00098         }
00099         return -2.0;
00100 }

void ws_dbus_progress_bar ( GError *  error,
GArray *  words,
gpointer  user_data 
)

handle signal from dbus and updates progress bar(in order to caching)

this function handles signals from dbus; it is called when progress bar status has been changed

Parameters:
error - error message recived from DBUS
words - array with recived data structure
user_data - pointer to data structure
Returns:

Definition at line 429 of file ws_gui_callbacks.c.

References WSGuiAppData::caching_flag, and WSGuiAppData::ws_gui_banner_caching.

Referenced by main().

00430 {
00431         WSGuiApp* ws_gui_app=(WSGuiApp*)user_data;
00432         osso_rpc_t osss_data;
00433         osss_data = g_array_index (words, osso_rpc_t, 0);
00434         double progress = osss_data.value.d;
00435         if (ws_gui_app->caching_flag == TRUE)
00436         {
00437                 hildon_banner_set_fraction(
00438                         HILDON_BANNER(ws_gui_app->ws_gui_banner_caching),
00439                         progress);
00440         }
00441 }

void ws_dbus_server_return_extracted_bzip ( GError *  error,
GArray *  words,
gpointer  user_data 
)

handle dbus signal and load extracted dictionary

this function handles signal from dbus and send recived data to the translation area

Parameters:
error - error message recived from DBUS
words - array with recived data structure
user_data - pointer to data structure
Returns:

Definition at line 663 of file ws_gui_callbacks.c.

References _, WSGuiAppData::ws_gui_hildon_window, and ws_gui_load_dict().

Referenced by main().

00666 {
00667         WSGuiApp* ws_gui_app=(WSGuiApp*)user_data;
00668 
00669         osso_rpc_t data;
00670 
00671         data = g_array_index (words, osso_rpc_t, 0);
00672 
00673         if (data.value.s[0] == '\0')
00674         {
00675                         hildon_banner_show_information(GTK_WIDGET(
00676                                         ws_gui_app->ws_gui_hildon_window),
00677                                         NULL,
00678                                 _("ws_ni_dictionary_not_added"));
00679         }
00680         else
00681         {
00682         if (ws_gui_load_dict(data.value.s, ws_gui_app) == TRUE)
00683         {
00684                 
00685         }
00686         }
00687 }

void ws_gui_about_application ( GtkMenuItem *  menuitem,
gpointer  user_data 
)

display information about application

this function creates dialog popup window which displays information about application (about window)

Parameters:
menuitem - the object which received the signal
user_data - set when the signal handler was connected

Definition at line 1557 of file ws_gui_layout.c.

References _, WSGuiAppData::p, and WSGuiAppData::ws_gui_hildon_find_toolbar.

Referenced by ws_gui_create_main_menu().

01558 {
01559         WSGuiApp* ws_gui_app=(WSGuiApp*)user_data;
01560 
01561         gtk_widget_set_sensitive(GTK_WIDGET
01562                                 (ws_gui_app->ws_gui_hildon_find_toolbar),
01563                                 FALSE);
01564 
01565         GtkWidget *about_dialog;
01566         GtkWidget *dialog_vbox1;
01567         GtkWidget *vbox1;
01568         GtkWidget *image;
01569         GtkWidget *label2;
01570         GtkWidget *label3;
01571         GtkWidget *label4;
01572         GtkWidget *scrolledwindow;
01573         GtkWidget *textview;
01574         GtkWidget *button1;
01575 
01576         const gchar *ws_version;
01577 
01578         about_dialog = gtk_dialog_new ();
01579         gtk_window_set_title (GTK_WINDOW (about_dialog), 
01580                         _("ws_ti_about_title"));
01581         gtk_window_set_default_size(GTK_WINDOW (about_dialog), 350, 350);
01582 
01583         dialog_vbox1 = GTK_DIALOG (about_dialog)->vbox;
01584         gtk_widget_show (dialog_vbox1);
01585 
01586         vbox1 = gtk_vbox_new (FALSE, 0);
01587         gtk_widget_show (vbox1);
01588         gtk_box_pack_start (GTK_BOX (dialog_vbox1), vbox1, TRUE, TRUE, 0);
01589 
01590         image = gtk_image_new_from_file ("/usr/share/pixmaps/mdictionary_about.png");
01591         gtk_box_pack_start (GTK_BOX (vbox1), image, TRUE, TRUE, 0);
01592 
01593         label2 = gtk_label_new ("mDictionary");
01594         ws_gui_app->p = pango_font_description_from_string("Tahoma 18");
01595         gtk_widget_modify_font(GTK_WIDGET(label2), ws_gui_app->p);
01596         gtk_label_set_pattern (GTK_LABEL(label2), "__________");
01597         gtk_box_pack_start (GTK_BOX (vbox1), label2, FALSE, FALSE, 5);
01598 
01599         ws_version = g_strconcat("Maemo Multilingual Dictionary\nver. ",
01600                                 WS_VERSION,
01601                                 NULL);
01602         label3 = gtk_label_new_with_mnemonic (_(ws_version));
01603         ws_gui_app->p = pango_font_description_from_string("Tahoma 12");
01604         gtk_widget_modify_font(GTK_WIDGET(label3), ws_gui_app->p);
01605         gtk_box_pack_start (GTK_BOX (vbox1), label3, FALSE, FALSE, 5);
01606         gtk_label_set_justify (GTK_LABEL (label3), GTK_JUSTIFY_CENTER);
01607 
01608         label4 = gtk_label_new ("Copyright 2006 - 2007, ComArch S.A\nAll rights " 
01609                                 "reserved");
01610         ws_gui_app->p = pango_font_description_from_string("Tahoma 12");
01611         gtk_widget_modify_font(GTK_WIDGET(label4), ws_gui_app->p);
01612         gtk_box_pack_start (GTK_BOX (vbox1), label4, FALSE, FALSE, 5);
01613         gtk_label_set_justify (GTK_LABEL (label4), GTK_JUSTIFY_CENTER);
01614 
01615         scrolledwindow = gtk_scrolled_window_new (NULL, NULL);
01616         gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW
01617                                         (scrolledwindow),
01618                                         GTK_SHADOW_ETCHED_OUT);
01619         gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW
01620                                         (scrolledwindow),
01621                                         GTK_POLICY_AUTOMATIC,
01622                                         GTK_POLICY_AUTOMATIC);
01623         gtk_box_pack_start (GTK_BOX (vbox1),
01624                         scrolledwindow,
01625                         TRUE,
01626                         TRUE,
01627                         0);
01628 
01629         textview = gtk_text_view_new ();
01630         ws_gui_app->p = pango_font_description_from_string("Tahoma 10");
01631         gtk_widget_modify_font(GTK_WIDGET(textview), ws_gui_app->p);
01632         gtk_text_view_set_editable(GTK_TEXT_VIEW(textview), FALSE);
01633         gtk_text_view_set_left_margin(GTK_TEXT_VIEW(textview), 10);
01634         gtk_text_view_set_right_margin(GTK_TEXT_VIEW(textview), 10);
01635         gtk_container_add (GTK_CONTAINER (scrolledwindow), textview);
01636         gtk_text_buffer_set_text(
01637                         gtk_text_view_get_buffer(GTK_TEXT_VIEW (textview)),
01638  /*                       "The following third party\ncomponents may be\nincluded"
01639                         " depending \non your system configuration:\n\nD-BUS "
01640                         "- License information:\nhttp://opensource.org/"
01641                         "licenses/academic.php",
01642 */
01643                         "This program is distributed\n"
01644                         " in the hope that it will be\n"
01645                         " useful, but WITHOUT ANY \n"
01646                         " WARRANTY; without even the\n"
01647                         " implied warranty of\n"
01648                         " MERCHANTABILITY or FITNESS\n"
01649                         " FOR A PARTICULAR PURPOSE.\n"
01650                         " See the GNU General Public\n"
01651                         " License for more details.\n"
01652                         
01653                         "The following third party\ncomponents may be\nincluded"
01654                         " depending \non your system configuration:\n\nD-BUS "
01655                         "- License information:\nhttp://opensource.org/"
01656                         " licenses/academic.php\n\n"
01657                         " Finnish-English dictionary -\n"
01658                         " Converted by swaj under GNU\n"
01659                         " Public License, Version: 1.1\n\n"
01660                         " English-Finnish dictionary -\n"
01661                         " Converted by swaj under GNU\n"
01662                         " Public License, Version: 1.0",
01663                         -1);
01664 
01665         button1 = gtk_button_new_from_stock(GTK_STOCK_CLOSE);
01666         gtk_dialog_add_action_widget(GTK_DIALOG(about_dialog),
01667                                 button1,
01668                                 GTK_RESPONSE_CLOSE);
01669 
01670         gtk_widget_show_all (GTK_WIDGET(about_dialog));
01671 
01672         if (gtk_dialog_run(GTK_DIALOG(about_dialog)) == GTK_RESPONSE_CLOSE)
01673         {
01674                 gtk_widget_destroy(GTK_WIDGET(about_dialog));
01675         }
01676 
01677         gtk_widget_set_sensitive(
01678                         GTK_WIDGET(ws_gui_app->ws_gui_hildon_find_toolbar),
01679                         TRUE);
01680 }

void ws_gui_add_bookmark_dialog ( gpointer  user_data  ) 

creates Add Bookmark dialog window

Definition at line 1682 of file ws_gui_layout.c.

References _, WSGuiAppData::dbus_data, WSGuiAppData::last_word, WSGuiAppData::raw_translation, and ws_dbus_client_add_bookmark.

Referenced by ws_gui_dictionary_add_bookmark().

01683 {
01684 
01685         WSGuiApp* ws_gui_app=(WSGuiApp*)user_data;
01686         
01687         GtkWidget *dialog1;
01688         GtkWidget *dialog_vbox1;
01689         GtkWidget *vbox1;
01690         GtkWidget *hbox1;
01691         GtkWidget *entry1;
01692         GtkWidget *label;
01693         GtkWidget *cancelbutton1;
01694         GtkWidget *okbutton1;
01695         
01696         const gchar *book_word;
01697         
01698         dialog1 = gtk_dialog_new ();
01699         gtk_window_set_title (GTK_WINDOW (dialog1), _("ws_ti_add_bookmark"));
01700         gtk_window_set_default_size(GTK_WINDOW (dialog1), 300, 200);
01701         
01702         dialog_vbox1 = GTK_DIALOG (dialog1)->vbox;
01703         gtk_widget_show (dialog_vbox1);
01704         
01705         vbox1 = gtk_vbox_new (FALSE, 0);
01706         gtk_box_pack_start (GTK_BOX (dialog_vbox1), vbox1, TRUE, TRUE, 5);
01707         
01708         hbox1 = gtk_hbox_new (FALSE, 0);
01709         gtk_box_pack_start (GTK_BOX (vbox1), hbox1, TRUE, TRUE, 5);
01710         
01711         label = gtk_label_new(_("ws_ti_bookmarks_add_question"));
01712         gtk_box_pack_start (GTK_BOX (hbox1), label, TRUE, TRUE, 5);
01713         
01714         entry1 = gtk_entry_new ();
01715         gtk_box_pack_start (GTK_BOX (vbox1), entry1, TRUE, TRUE, 5);
01716         gtk_entry_set_text(GTK_ENTRY(entry1), ws_gui_app->last_word);
01717         gtk_entry_set_alignment (GTK_ENTRY(entry1), 0.5);
01718         gtk_entry_set_editable(GTK_ENTRY(entry1), TRUE);
01719         
01720         cancelbutton1 = gtk_button_new_from_stock (_("ws_db_ok"));
01721         gtk_dialog_add_action_widget (GTK_DIALOG (dialog1), 
01722                                       cancelbutton1, 
01723                                       GTK_RESPONSE_OK);
01724         
01725         okbutton1 = gtk_button_new_from_stock (_("ws_db_cancel"));
01726         gtk_dialog_add_action_widget (GTK_DIALOG (dialog1), 
01727                                       okbutton1, 
01728                                       GTK_RESPONSE_CANCEL);
01729         
01730         gtk_widget_show_all (dialog1);
01731         
01732         if (gtk_dialog_run(GTK_DIALOG(dialog1)) == GTK_RESPONSE_OK)
01733         {
01734                 book_word = gtk_entry_get_text(GTK_ENTRY(entry1));
01735                 ws_dbus_client_add_bookmark(ws_gui_app->dbus_data, 
01736                                      (gchar*)book_word, 
01737                                      ws_gui_app->raw_translation->str);
01738                 gtk_widget_destroy(GTK_WIDGET(dialog1));
01739                 
01740         }
01741         else 
01742         {
01743                 gtk_widget_destroy(GTK_WIDGET(dialog1));
01744         }
01745 }

gboolean ws_gui_button_press ( GtkWidget *  widget,
GdkEventButton *  event,
gpointer  user_data 
)

handles button press event

handles button press event and examines what kind of event was it suppose to be

Parameters:
widget - object which received a signal
event - type of event which has been performed
user_data - user data set when the signal handler was connected
Returns:
TRUE to stop other handlers from being invoked for the event. FALSE to propagate the event further

Definition at line 1768 of file ws_gui_callbacks.c.

References PRESS_TIME, WSGuiAppData::timer, WSGuiAppData::ws_gui_double_click, WSGuiAppData::ws_gui_html, WSGuiAppData::ws_gui_sel_flag, and ws_gui_show_popup().

Referenced by main().

01771 {
01772         WSGuiApp* ws_gui_app=(WSGuiApp*)user_data;
01773         if (ws_gui_app->ws_gui_sel_flag == FALSE)
01774         {
01775                 if (event->type == GDK_2BUTTON_PRESS) 
01776                 {
01777                         ws_gui_app->ws_gui_double_click = TRUE;
01778                         g_timer_stop(ws_gui_app->timer);
01779                         g_timer_reset(ws_gui_app->timer);
01780                         return FALSE;
01781                 }
01782 
01783                 g_signal_stop_emission_by_name(G_OBJECT(
01784                                                 ws_gui_app->ws_gui_html),
01785                                         "button-press-event");
01786                 g_timer_start(ws_gui_app->timer);
01787                 gtk_timeout_add((guint)(PRESS_TIME*1000),
01788                                 (GtkFunction)(ws_gui_show_popup),
01789                                 ws_gui_app);
01790                 return FALSE;
01791         }
01792         else
01793         {
01794                 ws_gui_app->ws_gui_sel_flag = FALSE;
01795                 return FALSE;
01796         }
01797 
01798 }

gboolean ws_gui_button_release ( GtkWidget *  widget,
GdkEventButton *  event,
gpointer  user_data 
)

handles button release event

handles button release event and examines whether 'click' or 'tap and hold' event it supposed to be

Parameters:
widget - object which received a signal
event - type of event which has been performed
user_data - user data set when the signal handler was connected
Returns:
TRUE to stop other handlers from being invoked for the event. FALSE to propagate the event further

Definition at line 1809 of file ws_gui_callbacks.c.

References PRESS_TIME, WSGuiAppData::timer, WSGuiAppData::ws_gui_double_click, and WSGuiAppData::ws_gui_html.

Referenced by main().

01812 {
01813         WSGuiApp* ws_gui_app=(WSGuiApp*)user_data;
01814         gdouble tmp = g_timer_elapsed(ws_gui_app->timer, NULL);
01815         g_timer_stop(ws_gui_app->timer);
01816         g_timer_reset(ws_gui_app->timer);
01817         if (ws_gui_app->ws_gui_double_click == TRUE)
01818         {
01819                 ws_gui_app->ws_gui_double_click = FALSE;
01820                 return FALSE;
01821         }
01822         else if (tmp < PRESS_TIME)
01823         {
01824                 struct _GtkHTML *tmp = (struct _GtkHTML *)
01825                                         (ws_gui_app->ws_gui_html);
01826                 html_engine_unselect_all(tmp->engine);
01827                 return TRUE;
01828         }
01829                 return FALSE;
01830 }

void ws_gui_check_clipboard ( GtkWidget *  widget,
gpointer  user_data 
)

checks clipboard content

checks clipboard content and sets sensitivity of widgets

Parameters:
widget - object which recived a signal
user_data - user data set when the signal handler was connected
Returns:

Definition at line 1855 of file ws_gui_callbacks.c.

References WSGuiAppData::html_flag, WSGuiAppData::ws_gui_clipboard, WSGuiAppData::ws_gui_html, WSGuiAppData::ws_gui_menu, WSGuiMenu::ws_gui_menu_copy, WSGuiMenu::ws_gui_menu_paste, and WSGuiMenu::ws_gui_menu_select_all.

Referenced by ws_gui_create_main_menu().

01856 {
01857         WSGuiApp* ws_gui_app=(WSGuiApp*)user_data;
01858         if (gtk_clipboard_wait_for_text(ws_gui_app->ws_gui_clipboard) != NULL)
01859         {
01860                 gtk_widget_set_sensitive(
01861                         GTK_WIDGET(ws_gui_app->ws_gui_menu->ws_gui_menu_paste),
01862                         TRUE);
01863         }
01864         else
01865         {
01866                 gtk_widget_set_sensitive(
01867                         GTK_WIDGET(ws_gui_app->ws_gui_menu->ws_gui_menu_paste),
01868                         FALSE);
01869         }
01870 
01871         struct _GtkHTML *tmp = (struct _GtkHTML *)(ws_gui_app->ws_gui_html);
01872 
01873         if (html_engine_is_selection_active(tmp->engine) == TRUE)
01874         {
01875                 gtk_widget_set_sensitive(GTK_WIDGET
01876                                 (ws_gui_app->ws_gui_menu->ws_gui_menu_copy),
01877                                 TRUE);
01878         }
01879         else 
01880         {
01881                 gtk_widget_set_sensitive(GTK_WIDGET
01882                                 (ws_gui_app->ws_gui_menu->ws_gui_menu_copy),
01883                                 FALSE);
01884         }
01885 
01886         if (ws_gui_app->html_flag == FALSE)
01887         {
01888                 gtk_widget_set_sensitive(GTK_WIDGET
01889                         (ws_gui_app->ws_gui_menu->ws_gui_menu_select_all),
01890                         FALSE);
01891         }
01892         else
01893         {
01894                 gtk_widget_set_sensitive(GTK_WIDGET
01895                         (ws_gui_app->ws_gui_menu->ws_gui_menu_select_all),
01896                         TRUE);
01897         }       
01898 
01899 }

void ws_gui_check_history ( gpointer  user_data  ) 

check history and disable buttons or uncheck checkbuttons

check current position in the history array and sets sensitivity of buttons / menu items, depends on availablity of words in the history

Parameters:
user_data - user data set when the signal handler was connected
Returns:

Definition at line 1140 of file ws_gui_callbacks.c.

References HISTORY_LEN, WSGuiAppData::ws_gui_history, WSGuiAppData::ws_gui_history_cur_pos, WSGuiAppData::ws_gui_menu, WSGuiMenu::ws_gui_menu_find_next, WSGuiMenu::ws_gui_menu_find_prev, WSGuiAppData::ws_gui_toobar_button_back, and WSGuiAppData::ws_gui_toobar_button_forward.

Referenced by ws_gui_dictionary_chooser(), ws_gui_dictionary_close_bookmark(), ws_gui_dictionary_open_bookmark(), ws_gui_dictionary_remover(), ws_gui_history_add(), ws_gui_history_back(), ws_gui_history_next(), and ws_gui_load_dict().

01141 {
01142         WSGuiApp* ws_gui_app = (WSGuiApp *)user_data;
01143 
01144         gchar *tmp = g_array_index(ws_gui_app->ws_gui_history,
01145                                 gchar*,
01146                                 ws_gui_app->ws_gui_history_cur_pos+1);
01147 
01148         if ((ws_gui_app->ws_gui_history_cur_pos+1 < HISTORY_LEN) 
01149         && (tmp != NULL))
01150         {
01151                 /*make forward button active*/
01152                 gtk_widget_set_sensitive(
01153                         GTK_WIDGET(ws_gui_app->ws_gui_toobar_button_forward),
01154                         TRUE);
01155 
01156                 /*make find next button active*/
01157                 gtk_widget_set_sensitive(
01158                 GTK_WIDGET(ws_gui_app->ws_gui_menu->ws_gui_menu_find_next),
01159                 TRUE);
01160         }
01161         else 
01162         {
01163                 /*make forward button inactive*/
01164                 gtk_widget_set_sensitive(
01165                         GTK_WIDGET(ws_gui_app->ws_gui_toobar_button_forward),
01166                         FALSE);
01167 
01168                 /*make find next button inactive*/
01169                 gtk_widget_set_sensitive(
01170                 GTK_WIDGET(ws_gui_app->ws_gui_menu->ws_gui_menu_find_next),
01171                 FALSE);
01172         }
01173 
01174         tmp = g_array_index(ws_gui_app->ws_gui_history,
01175                         gchar*,
01176                         ws_gui_app->ws_gui_history_cur_pos-1);
01177         if ((ws_gui_app->ws_gui_history_cur_pos > 0) && (tmp != NULL))
01178         {
01179                 /*make back button active*/
01180                 gtk_widget_set_sensitive(
01181                         GTK_WIDGET(ws_gui_app->ws_gui_toobar_button_back),
01182                         TRUE);
01183 
01184                 /*make find previous button active*/
01185                 gtk_widget_set_sensitive(
01186                 GTK_WIDGET(ws_gui_app->ws_gui_menu->ws_gui_menu_find_prev),
01187                 TRUE);
01188 }
01189 else
01190 {
01191                 gtk_widget_set_sensitive (
01192                         GTK_WIDGET(ws_gui_app->ws_gui_toobar_button_back),
01193                         FALSE);
01194                 gtk_widget_set_sensitive(
01195                 GTK_WIDGET(ws_gui_app->ws_gui_menu->ws_gui_menu_find_prev),
01196                 FALSE);
01197 }
01198 }

void ws_gui_clear_list ( GtkListStore *  list,
gpointer  user_data 
)

clean words list

this function clean GtkListStore row by row

Parameters:
list - GtkListStore to be remoeved
Returns:

Definition at line 448 of file ws_gui_callbacks.c.

Referenced by create_and_fill_model(), ws_gui_dictionary_open_bookmark(), and ws_gui_dictionary_remove_bookmark().

00449 {
00450         //WSGuiApp* ws_gui_app=(WSGuiApp*)user_data;
00451         GtkTreeIter iter;
00452         gboolean tmp;
00453         
00454         //g_log(G_LOG_DOMAIN, G_LOG_LEVEL_INFO, "\n\nws_gui_clear_list\n\n");   
00455         tmp = gtk_tree_model_get_iter_first(
00456                         GTK_TREE_MODEL(list),
00457                         &iter); 
00458 
00459         while (tmp == TRUE)
00460         {
00461         //      g_log(G_LOG_DOMAIN, G_LOG_LEVEL_INFO, "\n\nws_gui_clear_list2\n\n");
00462                 tmp = gtk_list_store_remove(list, &iter);
00463                 
00464         }
00465 }

void ws_gui_create_find_toolbar ( gpointer  user_data  ) 

create find toolbar

this function creates a find toolbar and connects signals to the tollbars components

Parameters:
user_data - set when the signal handler was connected

Definition at line 268 of file ws_gui_layout.c.

References _, WSGuiAppData::ws_gui_hildon_find_toolbar, WSGuiAppData::ws_gui_hildon_window, ws_gui_history_back(), ws_gui_history_next(), ws_gui_search(), ws_gui_search_stop(), WSGuiAppData::ws_gui_toobar_button_back, WSGuiAppData::ws_gui_toobar_button_close, WSGuiAppData::ws_gui_toobar_button_forward, WSGuiAppData::ws_gui_toobar_button_hide, WSGuiAppData::ws_gui_toobar_button_start, WSGuiAppData::ws_gui_toobar_button_stop, and ws_gui_words_list_hide().

Referenced by ws_gui_create_window().

00269 {
00270         WSGuiApp* ws_gui_app = (WSGuiApp*)user_data;
00271         
00272         GtkToolItem *space;
00273         ws_gui_app->ws_gui_hildon_find_toolbar = 
00274         HILDON_FIND_TOOLBAR(hildon_find_toolbar_new(_("ws_me_search_find")));
00275         
00276         ws_gui_app->ws_gui_toobar_button_hide =
00277         gtk_toggle_tool_button_new_from_stock(GTK_STOCK_GOTO_FIRST);
00278         ws_gui_app->ws_gui_toobar_button_back = 
00279         gtk_tool_button_new_from_stock(GTK_STOCK_GO_BACK);
00280         ws_gui_app->ws_gui_toobar_button_forward =
00281         gtk_tool_button_new_from_stock(GTK_STOCK_GO_FORWARD);
00282         ws_gui_app->ws_gui_toobar_button_stop = 
00283         gtk_tool_button_new_from_stock(GTK_STOCK_STOP);
00284         space = gtk_separator_tool_item_new(); 
00285         
00286         ws_gui_app->ws_gui_toobar_button_close = 
00287                 gtk_toolbar_get_nth_item(GTK_TOOLBAR(
00288                                         ws_gui_app->ws_gui_hildon_find_toolbar),
00289                                         4);
00290 
00291         ws_gui_app->ws_gui_toobar_button_start = gtk_toolbar_get_nth_item(GTK_TOOLBAR(
00292                                         ws_gui_app->ws_gui_hildon_find_toolbar),
00293                                         2);
00294 
00295         gtk_tool_item_set_visible_horizontal(
00296                                 ws_gui_app->ws_gui_toobar_button_close,
00297                                 FALSE);
00298         
00299         gtk_toolbar_insert(GTK_TOOLBAR(ws_gui_app->ws_gui_hildon_find_toolbar),
00300                                 ws_gui_app->ws_gui_toobar_button_hide,
00301                                 0);
00302         gtk_toolbar_insert(GTK_TOOLBAR(ws_gui_app->ws_gui_hildon_find_toolbar),
00303                                 ws_gui_app->ws_gui_toobar_button_back,
00304                                 -1);
00305         gtk_toolbar_insert(GTK_TOOLBAR(ws_gui_app->ws_gui_hildon_find_toolbar),
00306                                 ws_gui_app->ws_gui_toobar_button_forward,
00307                                 -1);
00308         gtk_toolbar_insert(GTK_TOOLBAR(ws_gui_app->ws_gui_hildon_find_toolbar),
00309                                 space,
00310                                 -1);
00311         gtk_toolbar_insert(GTK_TOOLBAR(ws_gui_app->ws_gui_hildon_find_toolbar),
00312                                 ws_gui_app->ws_gui_toobar_button_stop,
00313                                 -1);
00314         
00315         g_signal_connect(G_OBJECT(ws_gui_app->ws_gui_hildon_find_toolbar), 
00316                         "search",
00317                         G_CALLBACK(ws_gui_search),
00318                         ws_gui_app);
00319         
00320         g_signal_connect(G_OBJECT(ws_gui_app->ws_gui_toobar_button_hide), 
00321                         "toggled",
00322                         G_CALLBACK(ws_gui_words_list_hide),
00323                         ws_gui_app);
00324         
00325         g_signal_connect(G_OBJECT(ws_gui_app->ws_gui_toobar_button_back), 
00326                         "clicked",
00327                         G_CALLBACK(ws_gui_history_back),
00328                         ws_gui_app);
00329         
00330         g_signal_connect(G_OBJECT(ws_gui_app->ws_gui_toobar_button_forward), 
00331                         "clicked",
00332                         G_CALLBACK(ws_gui_history_next),
00333                         ws_gui_app);
00334         g_signal_connect(G_OBJECT(ws_gui_app->ws_gui_toobar_button_stop), 
00335                         "clicked",
00336                         G_CALLBACK(ws_gui_search_stop),
00337                         ws_gui_app);
00338         
00339         gtk_widget_set_sensitive(
00340                         GTK_WIDGET(ws_gui_app->ws_gui_toobar_button_back),
00341                         FALSE);
00342         gtk_widget_set_sensitive(
00343                         GTK_WIDGET(ws_gui_app->ws_gui_toobar_button_forward),
00344                         FALSE);
00345         gtk_widget_set_sensitive(
00346                         GTK_WIDGET(ws_gui_app->ws_gui_toobar_button_stop),
00347                         FALSE);
00348         
00349         hildon_find_toolbar_highlight_entry((HildonFindToolbar*)(ws_gui_app->ws_gui_hildon_find_toolbar),
00350                                              FALSE);
00351         //gtk_toolbar_set_tooltips(GTK_TOOLBAR(ws_gui_app->ws_gui_hildon_find_toolbar), TRUE);
00352 
00353         hildon_window_add_toolbar(ws_gui_app->ws_gui_hildon_window,
00354                         GTK_TOOLBAR(ws_gui_app->ws_gui_hildon_find_toolbar));
00355 }

void ws_gui_create_main_menu ( gpointer  user_data  ) 

create application menu

this function creates application menu and its items and connect signals to them

Parameters:
user_data - set when the signal handler was connected

Definition at line 362 of file ws_gui_layout.c.

References _, ws_gui_about_application(), ws_gui_check_clipboard(), ws_gui_dict_availablity(), ws_gui_dictionary_add_bookmark(), ws_gui_dictionary_chooser(), ws_gui_dictionary_close_bookmark(), ws_gui_dictionary_loader(), ws_gui_dictionary_open_bookmark(), ws_gui_dictionary_optimizer(), ws_gui_dictionary_remove_bookmark(), ws_gui_dictionary_remover(), ws_gui_full_screen(), WSGuiAppData::ws_gui_hildon_window, ws_gui_history_back(), ws_gui_history_next(), ws_gui_html_copy(), ws_gui_html_paste(), ws_gui_html_select_all(), ws_gui_html_zoom_in(), ws_gui_html_zoom_out(), WSGuiMenu::ws_gui_main_menu, WSGuiAppData::ws_gui_menu, WSGuiMenu::ws_gui_menu_about, WSGuiMenu::ws_gui_menu_add_bookmark, WSGuiMenu::ws_gui_menu_bookmarks, WSGuiMenu::ws_gui_menu_close, WSGuiMenu::ws_gui_menu_close_bookmark, WSGuiMenu::ws_gui_menu_copy, WSGuiMenu::ws_gui_menu_dictionaries, WSGuiMenu::ws_gui_menu_edit, WSGuiMenu::ws_gui_menu_find_next, WSGuiMenu::ws_gui_menu_find_prev, WSGuiMenu::ws_gui_menu_find_word, WSGuiMenu::ws_gui_menu_full_screen, WSGuiMenu::ws_gui_menu_hide_list, WSGuiMenu::ws_gui_menu_load_dict, WSGuiMenu::ws_gui_menu_open_bookmark, WSGuiMenu::ws_gui_menu_optimize_dict, WSGuiMenu::ws_gui_menu_paste, ws_gui_menu_quit(), WSGuiMenu::ws_gui_menu_remove_bookmark, WSGuiMenu::ws_gui_menu_remove_dict, WSGuiMenu::ws_gui_menu_search, WSGuiMenu::ws_gui_menu_select_all, WSGuiMenu::ws_gui_menu_select_dict, WSGuiMenu::ws_gui_menu_stop, WSGuiMenu::ws_gui_menu_view, WSGuiMenu::ws_gui_menu_zoom_in, WSGuiMenu::ws_gui_menu_zoom_out, ws_gui_search(), ws_gui_search_stop(), WSGuiMenu::ws_gui_separator, WSGuiMenu::ws_gui_separator1, ws_gui_set_bookmark_menu_items(), WSGuiMenu::ws_gui_submenu_0, WSGuiMenu::ws_gui_submenu_1, WSGuiMenu::ws_gui_submenu_2, WSGuiMenu::ws_gui_submenu_3, WSGuiMenu::ws_gui_submenu_4, and ws_gui_words_list_hide_from_menu().

Referenced by ws_gui_create_window().

00363 {
00364         WSGuiApp* ws_gui_app=(WSGuiApp*)user_data;
00365 
00366         ws_gui_app->ws_gui_menu->ws_gui_submenu_0 = gtk_menu_new();
00367         ws_gui_app->ws_gui_menu->ws_gui_submenu_1 = gtk_menu_new();
00368         ws_gui_app->ws_gui_menu->ws_gui_submenu_2 = gtk_menu_new();
00369         ws_gui_app->ws_gui_menu->ws_gui_submenu_3 = gtk_menu_new();
00370         ws_gui_app->ws_gui_menu->ws_gui_submenu_4 = gtk_menu_new();
00371         ws_gui_app->ws_gui_menu->ws_gui_main_menu = gtk_menu_new();
00372 
00373         ws_gui_app->ws_gui_menu->ws_gui_menu_dictionaries =
00374                 gtk_menu_item_new_with_label(_("ws_me_dictionaries"));
00375         ws_gui_app->ws_gui_menu->ws_gui_menu_bookmarks =
00376                 gtk_menu_item_new_with_label(_("ws_me_bookmarks"));
00377         ws_gui_app->ws_gui_menu->ws_gui_menu_edit = 
00378                 gtk_menu_item_new_with_label(_("ws_me_edit"));
00379         ws_gui_app->ws_gui_menu->ws_gui_menu_view = 
00380                 gtk_menu_item_new_with_label(_("ws_me_view"));
00381         ws_gui_app->ws_gui_menu->ws_gui_menu_search = 
00382                 gtk_menu_item_new_with_label(_("ws_me_search"));
00383         ws_gui_app->ws_gui_menu->ws_gui_menu_about = 
00384                 gtk_menu_item_new_with_label(_("ws_me_about"));
00385         ws_gui_app->ws_gui_menu->ws_gui_menu_close = 
00386                 gtk_menu_item_new_with_label(_("ws_me_close"));
00387         ws_gui_app->ws_gui_menu->ws_gui_separator = 
00388                 gtk_separator_menu_item_new();
00389         ws_gui_app->ws_gui_menu->ws_gui_separator1 = 
00390                 gtk_separator_menu_item_new();
00391 
00392         ws_gui_app->ws_gui_menu->ws_gui_menu_load_dict = 
00393                 gtk_menu_item_new_with_label(_("ws_me_dictionaries_load"));
00394         ws_gui_app->ws_gui_menu->ws_gui_menu_select_dict = 
00395                 gtk_menu_item_new_with_label(_("ws_me_dictionaries_select"));
00396         ws_gui_app->ws_gui_menu->ws_gui_menu_remove_dict = 
00397                 gtk_menu_item_new_with_label(_("ws_me_dictionaries_remove"));
00398         ws_gui_app->ws_gui_menu->ws_gui_menu_optimize_dict = 
00399                 gtk_menu_item_new_with_label(_("ws_me_dictionaries_optimize"));
00400 
00401         gtk_menu_append(ws_gui_app->ws_gui_menu->ws_gui_submenu_0,
00402                         ws_gui_app->ws_gui_menu->ws_gui_menu_load_dict);
00403         gtk_menu_append(ws_gui_app->ws_gui_menu->ws_gui_submenu_0,
00404                         ws_gui_app->ws_gui_menu->ws_gui_menu_select_dict);
00405         gtk_menu_append(ws_gui_app->ws_gui_menu->ws_gui_submenu_0,
00406                         ws_gui_app->ws_gui_menu->ws_gui_menu_remove_dict);
00407         gtk_menu_append(ws_gui_app->ws_gui_menu->ws_gui_submenu_0,
00408                         ws_gui_app->ws_gui_menu->ws_gui_menu_optimize_dict);
00409 
00410         ws_gui_app->ws_gui_menu->ws_gui_menu_open_bookmark = 
00411                 gtk_menu_item_new_with_label(_("ws_me_bookmarks_open"));
00412         ws_gui_app->ws_gui_menu->ws_gui_menu_close_bookmark = 
00413                 gtk_menu_item_new_with_label(_("ws_me_bookmarks_close"));
00414         ws_gui_app->ws_gui_menu->ws_gui_menu_add_bookmark = 
00415                 gtk_menu_item_new_with_label(_("ws_me_bookmarks_add"));
00416         ws_gui_app->ws_gui_menu->ws_gui_menu_remove_bookmark = 
00417                 gtk_menu_item_new_with_label(_("ws_me_bookmarks_remove"));
00418 
00419         gtk_menu_append(ws_gui_app->ws_gui_menu->ws_gui_submenu_4,
00420                         ws_gui_app->ws_gui_menu->ws_gui_menu_open_bookmark);
00421         gtk_menu_append(ws_gui_app->ws_gui_menu->ws_gui_submenu_4,
00422                         ws_gui_app->ws_gui_menu->ws_gui_menu_close_bookmark);
00423         gtk_menu_append(ws_gui_app->ws_gui_menu->ws_gui_submenu_4,
00424                         ws_gui_app->ws_gui_menu->ws_gui_menu_add_bookmark);
00425         gtk_menu_append(ws_gui_app->ws_gui_menu->ws_gui_submenu_4,
00426                         ws_gui_app->ws_gui_menu->ws_gui_menu_remove_bookmark);
00427 
00428         ws_gui_app->ws_gui_menu->ws_gui_menu_copy = 
00429                 gtk_menu_item_new_with_label(_("ws_me_edit_copy"));
00430         ws_gui_app->ws_gui_menu->ws_gui_menu_paste = 
00431                 gtk_menu_item_new_with_label(_("ws_me_edit_paste"));
00432         ws_gui_app->ws_gui_menu->ws_gui_menu_select_all = 
00433                 gtk_menu_item_new_with_label(_("ws_me_edit_select_all"));
00434         gtk_menu_append(ws_gui_app->ws_gui_menu->ws_gui_submenu_1,
00435                         ws_gui_app->ws_gui_menu->ws_gui_menu_copy);
00436         gtk_menu_append(ws_gui_app->ws_gui_menu->ws_gui_submenu_1,
00437                         ws_gui_app->ws_gui_menu->ws_gui_menu_paste);
00438         gtk_menu_append(ws_gui_app->ws_gui_menu->ws_gui_submenu_1,
00439                         ws_gui_app->ws_gui_menu->ws_gui_menu_select_all);
00440         
00441         ws_gui_app->ws_gui_menu->ws_gui_menu_hide_list = 
00442         gtk_check_menu_item_new_with_label(_("ws_me_view_hide_words_list"));
00443         ws_gui_app->ws_gui_menu->ws_gui_menu_zoom_in = 
00444                 gtk_menu_item_new_with_label(_("ws_me_view_zoom_in"));
00445         ws_gui_app->ws_gui_menu->ws_gui_menu_zoom_out = 
00446                 gtk_menu_item_new_with_label(_("ws_me_view_zoom_out"));
00447         ws_gui_app->ws_gui_menu->ws_gui_menu_full_screen = 
00448                 gtk_check_menu_item_new_with_label(_("ws_me_view_fullscreen"));
00449         gtk_menu_append(ws_gui_app->ws_gui_menu->ws_gui_submenu_2,
00450                         ws_gui_app->ws_gui_menu->ws_gui_menu_hide_list);
00451         gtk_menu_append(ws_gui_app->ws_gui_menu->ws_gui_submenu_2,
00452                         ws_gui_app->ws_gui_menu->ws_gui_menu_zoom_in);
00453         gtk_menu_append(ws_gui_app->ws_gui_menu->ws_gui_submenu_2,
00454                         ws_gui_app->ws_gui_menu->ws_gui_menu_zoom_out);
00455         gtk_menu_append(ws_gui_app->ws_gui_menu->ws_gui_submenu_2,
00456                         ws_gui_app->ws_gui_menu->ws_gui_menu_full_screen);
00457         
00458         ws_gui_app->ws_gui_menu->ws_gui_menu_find_word = 
00459                 gtk_menu_item_new_with_label(_("ws_me_search_find"));
00460         ws_gui_app->ws_gui_menu->ws_gui_menu_find_next = 
00461                 gtk_menu_item_new_with_label(_("ws_me_search_find_next"));
00462         ws_gui_app->ws_gui_menu->ws_gui_menu_find_prev = 
00463         gtk_menu_item_new_with_label(_("ws_me_search_find_prev"));
00464         ws_gui_app->ws_gui_menu->ws_gui_menu_stop = 
00465         gtk_menu_item_new_with_label(_("ws_me_search_stop"));
00466         gtk_menu_append(ws_gui_app->ws_gui_menu->ws_gui_submenu_3,
00467                 ws_gui_app->ws_gui_menu->ws_gui_menu_find_word);
00468         gtk_menu_append(ws_gui_app->ws_gui_menu->ws_gui_submenu_3,
00469                 ws_gui_app->ws_gui_menu->ws_gui_menu_find_next);
00470         gtk_menu_append(ws_gui_app->ws_gui_menu->ws_gui_submenu_3,
00471                 ws_gui_app->ws_gui_menu->ws_gui_menu_find_prev);
00472         gtk_menu_append(ws_gui_app->ws_gui_menu->ws_gui_submenu_3,
00473                 ws_gui_app->ws_gui_menu->ws_gui_menu_stop);
00474 
00475 
00476         gtk_menu_append(ws_gui_app->ws_gui_menu->ws_gui_main_menu,
00477                 ws_gui_app->ws_gui_menu->ws_gui_menu_dictionaries);
00478         gtk_menu_item_set_submenu(GTK_MENU_ITEM
00479                         (ws_gui_app->ws_gui_menu->ws_gui_menu_dictionaries),
00480                         ws_gui_app->ws_gui_menu->ws_gui_submenu_0);
00481 
00482         gtk_menu_append(ws_gui_app->ws_gui_menu->ws_gui_main_menu,
00483                 ws_gui_app->ws_gui_menu->ws_gui_menu_bookmarks);
00484         gtk_menu_item_set_submenu(GTK_MENU_ITEM
00485                         (ws_gui_app->ws_gui_menu->ws_gui_menu_bookmarks),
00486                         ws_gui_app->ws_gui_menu->ws_gui_submenu_4);
00487 
00488         gtk_menu_append(ws_gui_app->ws_gui_menu->ws_gui_main_menu,
00489                 ws_gui_app->ws_gui_menu->ws_gui_separator1);
00490 
00491         gtk_menu_append(ws_gui_app->ws_gui_menu->ws_gui_main_menu,
00492                 ws_gui_app->ws_gui_menu->ws_gui_menu_edit);
00493         gtk_menu_item_set_submenu(GTK_MENU_ITEM
00494                                 (ws_gui_app->ws_gui_menu->ws_gui_menu_edit), 
00495                                 ws_gui_app->ws_gui_menu->ws_gui_submenu_1);
00496 
00497         gtk_menu_append(ws_gui_app->ws_gui_menu->ws_gui_main_menu,
00498                         ws_gui_app->ws_gui_menu->ws_gui_menu_view);
00499         gtk_menu_item_set_submenu(GTK_MENU_ITEM
00500                                 (ws_gui_app->ws_gui_menu->ws_gui_menu_view), 
00501                                 ws_gui_app->ws_gui_menu->ws_gui_submenu_2);
00502 
00503         gtk_menu_append(ws_gui_app->ws_gui_menu->ws_gui_main_menu,
00504                         ws_gui_app->ws_gui_menu->ws_gui_menu_search);
00505         gtk_menu_item_set_submenu(GTK_MENU_ITEM
00506                                 (ws_gui_app->ws_gui_menu->ws_gui_menu_search), 
00507                                 ws_gui_app->ws_gui_menu->ws_gui_submenu_3);
00508 
00509         gtk_menu_append(ws_gui_app->ws_gui_menu->ws_gui_main_menu,
00510                         ws_gui_app->ws_gui_menu->ws_gui_separator);
00511         gtk_menu_append(ws_gui_app->ws_gui_menu->ws_gui_main_menu,
00512                         ws_gui_app->ws_gui_menu->ws_gui_menu_about);
00513         gtk_menu_append(ws_gui_app->ws_gui_menu->ws_gui_main_menu,
00514                         ws_gui_app->ws_gui_menu->ws_gui_menu_close);
00515 
00516         g_signal_connect(G_OBJECT
00517                         (ws_gui_app->ws_gui_menu->ws_gui_menu_load_dict),
00518                         "activate",
00519                         G_CALLBACK(ws_gui_dictionary_loader),
00520                         ws_gui_app);
00521         g_signal_connect(G_OBJECT(
00522                         ws_gui_app->ws_gui_menu->ws_gui_menu_select_dict),
00523                         "activate",
00524                         G_CALLBACK(ws_gui_dictionary_chooser),
00525                         ws_gui_app);
00526         g_signal_connect(G_OBJECT
00527                         (ws_gui_app->ws_gui_menu->ws_gui_menu_remove_dict),
00528                         "activate",
00529                         G_CALLBACK(ws_gui_dictionary_remover),
00530                         ws_gui_app);
00531         g_signal_connect(G_OBJECT
00532                         (ws_gui_app->ws_gui_menu->ws_gui_menu_optimize_dict),
00533                         "activate",
00534                         G_CALLBACK(ws_gui_dictionary_optimizer), ws_gui_app);
00535         g_signal_connect(G_OBJECT
00536                         (ws_gui_app->ws_gui_menu->ws_gui_menu_open_bookmark),
00537                         "activate",
00538                         G_CALLBACK(ws_gui_dictionary_open_bookmark), 
00539                         ws_gui_app);
00540         g_signal_connect(G_OBJECT
00541                         (ws_gui_app->ws_gui_menu->ws_gui_menu_close_bookmark),
00542                         "activate",
00543                         G_CALLBACK(ws_gui_dictionary_close_bookmark), 
00544                         ws_gui_app);
00545         g_signal_connect(G_OBJECT
00546                         (ws_gui_app->ws_gui_menu->ws_gui_menu_add_bookmark),
00547                         "activate",
00548                         G_CALLBACK(ws_gui_dictionary_add_bookmark), 
00549                         ws_gui_app);
00550         g_signal_connect(G_OBJECT
00551                         (ws_gui_app->ws_gui_menu->ws_gui_menu_remove_bookmark),
00552                         "activate",
00553                         G_CALLBACK(ws_gui_dictionary_remove_bookmark), 
00554                         ws_gui_app);
00555         g_signal_connect(G_OBJECT
00556                         (ws_gui_app->ws_gui_menu->ws_gui_menu_copy),
00557                         "activate", 
00558                         GTK_SIGNAL_FUNC(ws_gui_html_copy),
00559                         ws_gui_app);
00560         g_signal_connect(G_OBJECT
00561                         (ws_gui_app->ws_gui_menu->ws_gui_menu_paste),
00562                         "activate",
00563                         GTK_SIGNAL_FUNC(ws_gui_html_paste),
00564                         ws_gui_app);
00565         g_signal_connect(G_OBJECT
00566                         (ws_gui_app->ws_gui_menu->ws_gui_menu_select_all),
00567                         "activate",
00568                         GTK_SIGNAL_FUNC(ws_gui_html_select_all),
00569                         ws_gui_app);
00570         g_signal_connect(G_OBJECT
00571                         (ws_gui_app->ws_gui_menu->ws_gui_menu_hide_list),
00572                         "activate",
00573                         GTK_SIGNAL_FUNC(ws_gui_words_list_hide_from_menu),
00574                         ws_gui_app);
00575         g_signal_connect(G_OBJECT
00576                         (ws_gui_app->ws_gui_menu->ws_gui_menu_zoom_in),
00577                         "activate",
00578                         G_CALLBACK(ws_gui_html_zoom_in),
00579                         ws_gui_app);
00580         g_signal_connect(G_OBJECT
00581                         (ws_gui_app->ws_gui_menu->ws_gui_menu_zoom_out),
00582                         "activate",
00583                         G_CALLBACK(ws_gui_html_zoom_out),
00584                         ws_gui_app);
00585         g_signal_connect(G_OBJECT
00586                         (ws_gui_app->ws_gui_menu->ws_gui_menu_full_screen),
00587                         "activate",
00588                         GTK_SIGNAL_FUNC(ws_gui_full_screen),
00589                         ws_gui_app);
00590         g_signal_connect(G_OBJECT
00591                         (ws_gui_app->ws_gui_menu->ws_gui_menu_find_word),
00592                         "activate",
00593                         GTK_SIGNAL_FUNC(ws_gui_search),
00594                         ws_gui_app);
00595         g_signal_connect(G_OBJECT
00596                         (ws_gui_app->ws_gui_menu->ws_gui_menu_find_next),
00597                         "activate",
00598                         GTK_SIGNAL_FUNC(ws_gui_history_next),
00599                         ws_gui_app);
00600         g_signal_connect(G_OBJECT
00601                         (ws_gui_app->ws_gui_menu->ws_gui_menu_find_prev),
00602                         "activate",
00603                         GTK_SIGNAL_FUNC(ws_gui_history_back),
00604                         ws_gui_app);
00605         g_signal_connect(G_OBJECT
00606                         (ws_gui_app->ws_gui_menu->ws_gui_menu_stop),
00607                         "activate",
00608                         GTK_SIGNAL_FUNC(ws_gui_search_stop),
00609                         ws_gui_app);
00610         g_signal_connect(G_OBJECT
00611                         (ws_gui_app->ws_gui_menu->ws_gui_menu_about), 
00612                         "activate",
00613                         G_CALLBACK(ws_gui_about_application),
00614                         ws_gui_app);
00615         g_signal_connect(G_OBJECT
00616                         (ws_gui_app->ws_gui_menu->ws_gui_menu_close),
00617                         "activate", 
00618                         G_CALLBACK(ws_gui_menu_quit),
00619                         ws_gui_app);
00620 
00621         g_signal_connect(G_OBJECT
00622                         (ws_gui_app->ws_gui_menu->ws_gui_menu_edit),
00623                         "activate",
00624                         GTK_SIGNAL_FUNC(ws_gui_check_clipboard),
00625                         ws_gui_app);
00626 
00627         g_signal_connect(G_OBJECT
00628                         (ws_gui_app->ws_gui_menu->ws_gui_menu_dictionaries),
00629                         "activate",
00630                         GTK_SIGNAL_FUNC(ws_gui_dict_availablity),
00631                         ws_gui_app);
00632 
00633         g_signal_connect(G_OBJECT
00634                         (ws_gui_app->ws_gui_menu->ws_gui_menu_bookmarks),
00635                         "activate",
00636                         GTK_SIGNAL_FUNC(ws_gui_set_bookmark_menu_items),
00637                         ws_gui_app);
00638 
00639         hildon_window_set_menu(HILDON_WINDOW(ws_gui_app->ws_gui_hildon_window),
00640                         GTK_MENU(
00641                                 ws_gui_app->ws_gui_menu->ws_gui_main_menu));
00642 
00643         gtk_widget_set_sensitive(GTK_WIDGET
00644                                 (ws_gui_app->ws_gui_menu->ws_gui_menu_stop),
00645                                 FALSE);
00646         gtk_widget_set_sensitive(GTK_WIDGET
00647                         (ws_gui_app->ws_gui_menu->ws_gui_menu_find_next),
00648                         FALSE);
00649         gtk_widget_set_sensitive(GTK_WIDGET
00650                         (ws_gui_app->ws_gui_menu->ws_gui_menu_find_prev),
00651                         FALSE);
00652 
00653         
00654         
00655         gtk_widget_show_all(ws_gui_app->ws_gui_menu->ws_gui_main_menu);
00656 }

void ws_gui_create_popup_menu ( gpointer  user_data  ) 

create popup menu

this function creates contex popup menu and its items and connect signals to them

Parameters:
user_data - set when the signal handler was connected

Definition at line 664 of file ws_gui_layout.c.

References _, WSGuiAppData::bookmark_avail, WSGuiAppData::bookmark_mode, WSGuiAppData::html_flag, WSGuiAppData::last_word, WSGuiAppData::ws_gui_clipboard, ws_gui_dictionary_add_bookmark(), WSGuiAppData::ws_gui_html, ws_gui_html_copy(), ws_gui_html_paste(), ws_gui_html_select_all(), ws_gui_html_zoom_in(), ws_gui_html_zoom_out(), WSGuiAppData::ws_gui_menu, WSGuiMenu::ws_gui_popup_bookmark, WSGuiMenu::ws_gui_popup_copy, WSGuiMenu::ws_gui_popup_edit, WSGuiMenu::ws_gui_popup_menu, WSGuiMenu::ws_gui_popup_paste, ws_gui_popup_search(), WSGuiMenu::ws_gui_popup_search, WSGuiMenu::ws_gui_popup_select_all, WSGuiMenu::ws_gui_popup_submenu, WSGuiMenu::ws_gui_popup_zoom_in, WSGuiMenu::ws_gui_popup_zoom_out, and WSGuiMenu::ws_gui_separator.

Referenced by ws_gui_show_popup().

00665 {
00666         WSGuiApp* ws_gui_app=(WSGuiApp*)user_data;
00667         
00668         ws_gui_app->ws_gui_menu->ws_gui_popup_menu = gtk_menu_new();
00669         ws_gui_app->ws_gui_menu->ws_gui_popup_submenu = gtk_menu_new();
00670         ws_gui_app->ws_gui_menu->ws_gui_separator = 
00671                                                 gtk_separator_menu_item_new();
00672         
00673         ws_gui_app->ws_gui_menu->ws_gui_popup_search = 
00674                 gtk_menu_item_new_with_label(_("ws_mp_search"));
00675         gtk_menu_append((ws_gui_app->ws_gui_menu->ws_gui_popup_menu),
00676                         ws_gui_app->ws_gui_menu->ws_gui_popup_search);
00677         gtk_menu_append ((ws_gui_app->ws_gui_menu->ws_gui_popup_menu),
00678                         gtk_separator_menu_item_new());
00679         ws_gui_app->ws_gui_menu->ws_gui_popup_bookmark = 
00680                 gtk_menu_item_new_with_label(_("ws_mp_add_bookmark"));
00681         gtk_menu_append ((ws_gui_app->ws_gui_menu->ws_gui_popup_menu),
00682                         ws_gui_app->ws_gui_menu->ws_gui_popup_bookmark);
00683         
00684         ws_gui_app->ws_gui_menu->ws_gui_popup_copy = 
00685                 gtk_menu_item_new_with_label(_("ws_mp_edit_copy"));
00686         gtk_menu_append((ws_gui_app->ws_gui_menu->ws_gui_popup_submenu),
00687                         ws_gui_app->ws_gui_menu->ws_gui_popup_copy);
00688         
00689         ws_gui_app->ws_gui_menu->ws_gui_popup_paste = 
00690                 gtk_menu_item_new_with_label(_("ws_mp_edit_paste"));
00691         gtk_menu_append((ws_gui_app->ws_gui_menu->ws_gui_popup_submenu),
00692                         ws_gui_app->ws_gui_menu->ws_gui_popup_paste);
00693         
00694         ws_gui_app->ws_gui_menu->ws_gui_popup_select_all = 
00695                 gtk_menu_item_new_with_label(_("ws_mp_edit_select_all"));
00696         gtk_menu_append((ws_gui_app->ws_gui_menu->ws_gui_popup_submenu),
00697                         ws_gui_app->ws_gui_menu->ws_gui_popup_select_all);
00698         
00699         gtk_widget_show_all(ws_gui_app->ws_gui_menu->ws_gui_popup_submenu);
00700         
00701         ws_gui_app->ws_gui_menu->ws_gui_popup_edit = 
00702                         gtk_menu_item_new_with_label (_("ws_mp_edit"));
00703         gtk_menu_append ((ws_gui_app->ws_gui_menu->ws_gui_popup_menu),
00704                         ws_gui_app->ws_gui_menu->ws_gui_popup_edit);
00705         
00706         gtk_menu_append ((ws_gui_app->ws_gui_menu->ws_gui_popup_menu),
00707                         ws_gui_app->ws_gui_menu->ws_gui_separator);
00708         
00709         ws_gui_app->ws_gui_menu->ws_gui_popup_zoom_in = 
00710                 gtk_menu_item_new_with_label (_("ws_mp_zoom_in"));
00711         gtk_menu_append ((ws_gui_app->ws_gui_menu->ws_gui_popup_menu),
00712                         ws_gui_app->ws_gui_menu->ws_gui_popup_zoom_in);
00713         
00714         ws_gui_app->ws_gui_menu->ws_gui_popup_zoom_out =
00715                 gtk_menu_item_new_with_label (_("ws_mp_zoom_out"));
00716         gtk_menu_append ((ws_gui_app->ws_gui_menu->ws_gui_popup_menu),
00717                         ws_gui_app->ws_gui_menu->ws_gui_popup_zoom_out);
00718         
00719         gtk_menu_item_set_submenu(GTK_MENU_ITEM
00720                                 (ws_gui_app->ws_gui_menu->ws_gui_popup_edit),
00721                                 ws_gui_app->ws_gui_menu->ws_gui_popup_submenu);
00722 
00723         struct _GtkHTML *tmp = (struct _GtkHTML *)(ws_gui_app->ws_gui_html);
00724 
00725         if (html_engine_is_selection_active(tmp->engine) == TRUE)
00726         {
00727                 gtk_widget_set_sensitive(GTK_WIDGET
00728                                 (ws_gui_app->ws_gui_menu->ws_gui_popup_search),
00729                                 TRUE);
00730                 gtk_widget_set_sensitive(GTK_WIDGET
00731                                 (ws_gui_app->ws_gui_menu->ws_gui_popup_copy),
00732                                 TRUE);
00733         }
00734         else 
00735         {
00736                 gtk_widget_set_sensitive(GTK_WIDGET
00737                                 (ws_gui_app->ws_gui_menu->ws_gui_popup_search),
00738                                 FALSE);
00739                 gtk_widget_set_sensitive(GTK_WIDGET
00740                                 (ws_gui_app->ws_gui_menu->ws_gui_popup_copy),
00741                                 FALSE);
00742         }
00743         
00744         if (ws_gui_app->html_flag == FALSE)
00745         {
00746                 gtk_widget_set_sensitive(GTK_WIDGET
00747                                 (ws_gui_app->ws_gui_menu->ws_gui_popup_select_all),
00748                                 FALSE);
00749         }
00750         else
00751         {
00752                 gtk_widget_set_sensitive(GTK_WIDGET
00753                                 (ws_gui_app->ws_gui_menu->ws_gui_popup_select_all),
00754                                 TRUE);
00755         }       
00756         
00757         gtk_widget_show_all(ws_gui_app->ws_gui_menu->ws_gui_popup_menu);
00758         
00759         
00760         g_signal_connect(G_OBJECT
00761                         (ws_gui_app->ws_gui_menu->ws_gui_popup_search),
00762                         "activate",
00763                         G_CALLBACK(ws_gui_popup_search),
00764                         ws_gui_app);
00765         
00766         g_signal_connect(G_OBJECT
00767                         (ws_gui_app->ws_gui_menu->ws_gui_popup_bookmark),
00768                         "activate",
00769                         G_CALLBACK(ws_gui_dictionary_add_bookmark),
00770                         ws_gui_app);
00771         
00772         g_signal_connect(G_OBJECT
00773                         (ws_gui_app->ws_gui_menu->ws_gui_popup_copy),
00774                         "activate", 
00775                         G_CALLBACK(ws_gui_html_copy),
00776                         ws_gui_app);
00777         g_signal_connect(G_OBJECT
00778                         (ws_gui_app->ws_gui_menu->ws_gui_popup_paste),
00779                         "activate",
00780                         G_CALLBACK(ws_gui_html_paste),
00781                         ws_gui_app);
00782         g_signal_connect(G_OBJECT
00783                         (ws_gui_app->ws_gui_menu->ws_gui_popup_select_all),
00784                         "activate",
00785                         G_CALLBACK(ws_gui_html_select_all),
00786                         ws_gui_app);
00787         g_signal_connect(G_OBJECT
00788                         (ws_gui_app->ws_gui_menu->ws_gui_popup_zoom_in),
00789                         "activate",
00790                         G_CALLBACK(ws_gui_html_zoom_in), ws_gui_app);
00791         g_signal_connect(G_OBJECT
00792                         (ws_gui_app->ws_gui_menu->ws_gui_popup_zoom_out),
00793                         "activate",
00794                         G_CALLBACK(ws_gui_html_zoom_out),
00795                         ws_gui_app);
00796         
00797         if (gtk_clipboard_wait_for_text(ws_gui_app->ws_gui_clipboard) != NULL)
00798         {
00799                 gtk_widget_set_sensitive(GTK_WIDGET
00800                                 (ws_gui_app->ws_gui_menu->ws_gui_popup_paste),
00801                                 TRUE);
00802         }
00803         else
00804         {
00805                 gtk_widget_set_sensitive(GTK_WIDGET
00806                                 (ws_gui_app->ws_gui_menu->ws_gui_popup_paste),
00807                                 FALSE);
00808         }
00809         
00810         
00811         if (ws_gui_app->bookmark_avail == FALSE)
00812         {
00813         gtk_widget_set_sensitive(GTK_WIDGET
00814                         (ws_gui_app->ws_gui_menu->ws_gui_popup_bookmark),
00815                         FALSE);
00816         }
00817         
00818         else
00819         {
00820         if (ws_gui_app->bookmark_mode == TRUE)
00821         {
00822                 gtk_widget_set_sensitive(GTK_WIDGET
00823                         (ws_gui_app->ws_gui_menu->ws_gui_popup_bookmark),
00824                         FALSE);
00825         }
00826         else
00827         {
00828                 g_strstrip(ws_gui_app->last_word);
00829                 //g_log(G_LOG_DOMAIN, G_LOG_LEVEL_INFO, "\n\nlast_word: %s\n\n", ws_gui_app->last_word);
00830                 
00831                 if (ws_gui_app->last_word == NULL || 
00832                     (ws_gui_app->last_word[0] == '\0'))
00833                 {
00834                         gtk_widget_set_sensitive(GTK_WIDGET
00835                         (ws_gui_app->ws_gui_menu->ws_gui_popup_bookmark),
00836                         FALSE);
00837                 }
00838                 else
00839                 {
00840                         gtk_widget_set_sensitive(GTK_WIDGET
00841                         (ws_gui_app->ws_gui_menu->ws_gui_popup_bookmark),
00842                         TRUE);
00843                 }
00844         }
00845         }
00846         gtk_menu_popup(GTK_MENU(ws_gui_app->ws_gui_menu->ws_gui_popup_menu),
00847                         NULL,
00848                         NULL,
00849                         NULL,
00850                         ws_gui_app,
00851                         0,
00852                         0);
00853 }

void ws_gui_create_window ( gpointer  user_data  ) 

create main window

this function creates main window and it components; moreover there are signal connections;

Parameters:
user_data - data set when the signal handler was connected

Definition at line 44 of file ws_gui_layout.c.

References _, WSGuiAppData::bookmark_avail, WSGuiAppData::bookmark_mode, WSGuiAppData::caching_flag, create_view_and_model(), WSGuiAppData::directories, WSGuiAppData::first_run, WSGuiAppData::history_flag, WSGuiAppData::html_flag, WSGuiAppData::last_searched, WSGuiAppData::last_searched_in_book, WSGuiAppData::last_word, WSGuiAppData::loading, WSGuiAppData::no_words_found, WSGuiAppData::p, WSGuiAppData::raw_translation, WSGuiAppData::stop_clicked, WSGuiAppData::timer, WSGuiAppData::welcome_note, WSGuiAppData::ws_gui_banner_flag, WSGuiAppData::ws_gui_banner_list_searching, WSGuiAppData::ws_gui_banner_translation_loading, ws_gui_create_find_toolbar(), ws_gui_create_main_menu(), WSGuiAppData::ws_gui_double_click, WSGuiAppData::ws_gui_full_screen_flag, WSGuiAppData::ws_gui_hildon_program, WSGuiAppData::ws_gui_hildon_window, WSGuiAppData::ws_gui_history, WSGuiAppData::ws_gui_history_cur_pos, WSGuiAppData::ws_gui_history_iter, WSGuiAppData::ws_gui_history_list, WSGuiAppData::ws_gui_hpane, WSGuiAppData::ws_gui_html, WSGuiAppData::ws_gui_list_eventbox, WSGuiAppData::ws_gui_list_hbox, WSGuiAppData::ws_gui_list_image, WSGuiAppData::ws_gui_list_label, WSGuiAppData::ws_gui_list_vbox, WSGuiAppData::ws_gui_scrolledwindow_left, WSGuiAppData::ws_gui_scrolledwindow_right, WSGuiAppData::ws_gui_sel_flag, WSGuiList::ws_gui_selection, ws_gui_set_bookmarks_sensitivity(), WSGuiList::ws_gui_store, ws_gui_url_requested(), WSGuiList::ws_gui_view, WSGuiAppData::ws_gui_w_list, WSGuiAppData::zoom, and ZOOM_DEFAULT.

Referenced by main().

00045 {
00046         WSGuiApp* ws_gui_app=(WSGuiApp*)user_data;
00047         
00048         ws_gui_app->welcome_note = g_strconcat("<br><br><center><font size=+3>", 
00049                                    _("ws_ni_welcome"), "<br><IMG SRC=file:/usr/share/pixmaps/mdictionary.png>", 
00050                                    NULL);
00051 
00052 /*      ws_gui_app->ws_gui_w_list->ws_gui_list_item_data_string = 
00053                                                      (ws_gui_app->welcome_note);*/
00054 
00055         GArray *array_tmp = g_array_new (TRUE, TRUE, sizeof(gchar*));
00056         ws_gui_app->raw_translation = g_string_new(" ");
00057         ws_gui_app->last_searched = NULL;
00058         ws_gui_app->last_searched_in_book = NULL;
00059         ws_gui_app->last_word = NULL;
00060 
00061         /*indicates that searching banner is displayed*/
00062         ws_gui_app->ws_gui_banner_flag = FALSE;
00063         /*indicates full screen mode*/
00064         ws_gui_app->ws_gui_full_screen_flag = FALSE;
00065         /*indicates that caching is in progress*/
00066         ws_gui_app->caching_flag = FALSE;
00067         /*used for doubleclick recognition*/
00068         ws_gui_app->ws_gui_double_click = FALSE;
00069         /*indicates a that a piece of text is selected*/
00070         ws_gui_app->ws_gui_sel_flag = FALSE;
00071         /*indicates whether bookmark mode is active or not*/
00072         ws_gui_app->bookmark_mode = FALSE;
00073         /*indicates if bookmarks database is available*/
00074         ws_gui_app->bookmark_avail = TRUE;
00075         /*indicates that no translation has been found*/
00076         ws_gui_app->html_flag = TRUE;
00077         /*indicates loading banner is displayed*/
00078         ws_gui_app->loading = FALSE;
00079         /*differentiates between tap and hold and ordinary tap*/
00080         ws_gui_app->stop_clicked = FALSE;
00081         /*if dictionary is just run*/
00082         ws_gui_app->first_run = TRUE; 
00083         /*indicates that no words match a given search pattern*/
00084         ws_gui_app->no_words_found = TRUE;
00085         
00086         ws_gui_app->zoom = ZOOM_DEFAULT;
00087 
00088         ws_gui_app->timer = g_timer_new();
00089         g_timer_stop(ws_gui_app->timer);
00090 
00091         ws_gui_app->ws_gui_history = g_array_new(TRUE, TRUE, sizeof(gchar*));
00092         ws_gui_app->ws_gui_history_list = g_array_new(TRUE, TRUE, sizeof(gchar*));
00093         ws_gui_app->ws_gui_history_iter = g_array_new(TRUE, TRUE, sizeof(gchar*));
00094         ws_gui_app->history_flag = FALSE;
00095         ws_gui_app->ws_gui_history_cur_pos = -1;
00096         
00097         ws_gui_app->ws_gui_hildon_program = 
00098         HILDON_PROGRAM(hildon_program_get_instance());
00099 
00100         g_set_application_name(PACKAGE);
00101 
00102         ws_gui_app->ws_gui_hildon_window = HILDON_WINDOW(hildon_window_new());
00103 
00104         hildon_program_add_window(ws_gui_app->ws_gui_hildon_program,
00105                                 ws_gui_app->ws_gui_hildon_window);
00106 
00107         ws_gui_create_main_menu(ws_gui_app);
00108         ws_gui_create_find_toolbar(ws_gui_app);
00109 
00110         ws_gui_app->ws_gui_hpane = gtk_hpaned_new();
00111 
00112         ws_gui_app->ws_gui_scrolledwindow_left = 
00113                 gtk_scrolled_window_new (NULL, NULL);
00114 
00115         gtk_scrolled_window_set_policy(
00116                 GTK_SCROLLED_WINDOW (ws_gui_app->ws_gui_scrolledwindow_left), 
00117                 GTK_POLICY_AUTOMATIC,
00118                 GTK_POLICY_AUTOMATIC);
00119 
00120         gtk_paned_set_position(GTK_PANED(ws_gui_app->ws_gui_hpane), 100);
00121 
00122         gtk_scrolled_window_set_placement(GTK_SCROLLED_WINDOW
00123                                 (ws_gui_app->ws_gui_scrolledwindow_left),
00124                                 GTK_CORNER_TOP_LEFT);
00125 
00126         ws_gui_app->ws_gui_scrolledwindow_right = 
00127                 gtk_scrolled_window_new (NULL, NULL);
00128 
00129         gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW
00130                                 (ws_gui_app->ws_gui_scrolledwindow_right), 
00131                                 GTK_POLICY_NEVER,
00132                                 GTK_POLICY_AUTOMATIC);
00133 
00134         ws_gui_app->ws_gui_w_list->ws_gui_store = 
00135                 gtk_list_store_new (NUM_COLS, G_TYPE_STRING, G_TYPE_UINT);
00136 
00137         ws_gui_app->ws_gui_w_list->ws_gui_view = 
00138                 create_view_and_model(array_tmp, ws_gui_app);
00139 
00140         g_array_free(array_tmp, TRUE);
00141 
00142         gtk_widget_show_all(GTK_WIDGET(ws_gui_app->ws_gui_w_list->ws_gui_view));
00143 
00144         gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW
00145                                 (ws_gui_app->ws_gui_scrolledwindow_left), 
00146                                         ws_gui_app->ws_gui_w_list->ws_gui_view);
00147 
00148         ws_gui_app->ws_gui_html = gtk_html_new();
00149 
00150         ws_gui_app->p = pango_font_description_from_string("Tahoma 12");
00151         gtk_widget_modify_font(GTK_WIDGET(
00152                                         ws_gui_app->ws_gui_html),ws_gui_app->p);
00153 
00154         g_signal_connect(GTK_OBJECT (ws_gui_app->ws_gui_html),
00155                                 "url_requested",
00156                                 G_CALLBACK(ws_gui_url_requested),
00157                                 ws_gui_app);
00158 
00159         gtk_html_load_from_string(GTK_HTML(ws_gui_app->ws_gui_html),
00160                         ws_gui_app->welcome_note,
00161                         -1);
00162         
00163         gtk_html_set_magnification(GTK_HTML(ws_gui_app->ws_gui_html), 
00164                                 ws_gui_app->zoom);
00165 
00166         gtk_html_set_editable(GTK_HTML(ws_gui_app->ws_gui_html), FALSE); 
00167         gtk_html_allow_selection(GTK_HTML(ws_gui_app->ws_gui_html), TRUE);
00168 
00169         gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW
00170                                 (ws_gui_app->ws_gui_scrolledwindow_right),
00171                                 ws_gui_app->ws_gui_html);
00172 
00173         /*adding vbox & label - used for notifications */
00174 
00175         ws_gui_app->ws_gui_list_image = gtk_image_new_from_file("/usr/share/pixmaps/ws_warning_icon.png");
00176         ws_gui_app->ws_gui_list_eventbox = gtk_event_box_new ();
00177         ws_gui_app->ws_gui_list_vbox = gtk_vbox_new(FALSE, 0);
00178         ws_gui_app->ws_gui_list_hbox = gtk_hbox_new(FALSE, 5);
00179         ws_gui_app->ws_gui_list_label = gtk_label_new(_("ws_ti_list_full"));
00180 
00181         ws_gui_app->p = pango_font_description_from_string("Tahoma 10");
00182         gtk_widget_modify_font(GTK_WIDGET(ws_gui_app->ws_gui_list_label), ws_gui_app->p);
00183 
00184         /*HBox packing ....*/
00185         gtk_box_pack_start(GTK_BOX(ws_gui_app->ws_gui_list_hbox),
00186                         ws_gui_app->ws_gui_list_image,
00187                         FALSE,
00188                         FALSE,
00189                         0);
00190         
00191         gtk_box_pack_start(GTK_BOX(ws_gui_app->ws_gui_list_hbox),
00192                         ws_gui_app->ws_gui_list_label,
00193                         FALSE,
00194                         FALSE,
00195                         0);
00196         
00197         // gtk_widget_set_size_request (ws_gui_app->ws_gui_list_label, 150, -1);
00198 
00199         /*VBox packing ....*/
00200         gtk_box_pack_start(GTK_BOX(ws_gui_app->ws_gui_list_vbox),
00201                         ws_gui_app->ws_gui_scrolledwindow_left,
00202                         TRUE,
00203                         TRUE,
00204                         0);
00205 
00206         gtk_box_pack_end(GTK_BOX(ws_gui_app->ws_gui_list_vbox),
00207                         ws_gui_app->ws_gui_list_eventbox,
00208                         FALSE,
00209                         FALSE,
00210                         0);
00211         
00212         gtk_container_add (GTK_CONTAINER (ws_gui_app->ws_gui_list_eventbox), 
00213                         ws_gui_app->ws_gui_list_hbox);
00214         /************************************************/
00215 
00216 
00217         gtk_paned_pack1(GTK_PANED(ws_gui_app->ws_gui_hpane),
00218                 ws_gui_app->ws_gui_list_vbox,
00219                 TRUE,
00220                 TRUE);
00221         gtk_paned_pack2(GTK_PANED(ws_gui_app->ws_gui_hpane),
00222                 ws_gui_app->ws_gui_scrolledwindow_right,
00223                 TRUE,
00224                 TRUE);
00225 
00226         gtk_container_add(GTK_CONTAINER(ws_gui_app->ws_gui_hildon_window), 
00227                         ws_gui_app->ws_gui_hpane);
00228 
00229         gtk_widget_show_all(GTK_WIDGET(ws_gui_app->ws_gui_hildon_window));
00230 
00231         gtk_widget_hide_all(GTK_WIDGET(ws_gui_app->ws_gui_list_eventbox));
00232         /*gtk_widget_hide_all(GTK_WIDGET(ws_gui_app->ws_gui_list_hbox));*/
00233 
00234         ws_gui_app->ws_gui_w_list->ws_gui_selection = 
00235                 gtk_tree_view_get_selection (GTK_TREE_VIEW
00236                 (ws_gui_app->ws_gui_w_list->ws_gui_view));
00237 
00238         gtk_tree_selection_set_mode(
00239                                 ws_gui_app->ws_gui_w_list->ws_gui_selection,
00240                                 GTK_SELECTION_BROWSE);
00241         
00242         ws_gui_app->directories = g_slist_alloc();
00243         ws_gui_set_bookmarks_sensitivity(ws_gui_app);
00244 
00245         ws_gui_app->ws_gui_banner_list_searching = hildon_banner_show_animation(
00246                                 GTK_WIDGET(ws_gui_app->ws_gui_hildon_window),
00247                                 NULL,
00248                                 _("ws_ab_searching"));
00249 
00250         ws_gui_app->ws_gui_banner_translation_loading = hildon_banner_show_animation(
00251                                 GTK_WIDGET(ws_gui_app->ws_gui_hildon_window),
00252                                 NULL,
00253                                 _("ws_ab_loading"));
00254         
00255 //      gtk_widget_set_sensitive(GTK_WIDGET
00256 //                      (ws_gui_app->ws_gui_menu->ws_gui_popup_bookmark),
00257 //                      FALSE);
00258 
00259         gtk_widget_hide(GTK_WIDGET(ws_gui_app->ws_gui_banner_list_searching));
00260         gtk_widget_hide(GTK_WIDGET(ws_gui_app->ws_gui_banner_translation_loading));
00261 }

void ws_gui_dbus_return_translation ( GError *  error,
GArray *  words,
gpointer  user_data 
)

handle dbus signal and convert message into readable text

this function handles signal from dbus and send recived data to the translation area

Parameters:
error - error message recived from DBUS
words - array with recived data structure
user_data - pointer to data structure
Returns:

Definition at line 634 of file ws_gui_callbacks.c.

References format_html(), WSGuiAppData::html_flag, WSGuiAppData::loading, ws_gui_fill_html(), and ws_gui_set_toolbar_avail().

Referenced by main().

00637 {
00638         WSGuiApp* ws_gui_app=(WSGuiApp*)user_data;
00639         gchar *html_content = NULL;
00640         osso_rpc_t data;
00641 
00642         data = g_array_index (words, osso_rpc_t, 0);
00643 
00644         html_content = format_html(data.value.s, ws_gui_app);
00645         ws_gui_fill_html(html_content, ws_gui_app);
00646         g_free(html_content);
00647         ws_gui_app->html_flag = TRUE;
00648         
00649         //gtk_widget_hide(ws_gui_app->ws_gui_banner_translation_loading);
00650         ws_gui_app->loading = FALSE;
00651         ws_gui_set_toolbar_avail(ws_gui_app);
00652 
00653 }

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

handle dbus signal and transfer words to the words list

this function handles signal from dbus and transfer recived (found in a dictionary) words to the words list

Parameters:
error - error message recived from DBUS
words - array with recived data structure
user_data - pointer to data structure
Returns:

Definition at line 476 of file ws_gui_callbacks.c.

References _, create_and_fill_model(), WSGuiAppData::dbus_data, WSGuiAppData::history_flag, WSGuiAppData::html_flag, WSGuiAppData::last_word, WSGuiAppData::loading, WSGuiAppData::no_words_found, WSGuiAppData::stop_clicked, timer(), TIMER_START, TIMER_STOP, ws_dbus_client_find_translation, WSGuiAppData::ws_gui_hildon_window, WSGuiAppData::ws_gui_history, WSGuiAppData::ws_gui_history_cur_pos, WSGuiAppData::ws_gui_history_iter, WSGuiList::ws_gui_model, WSGuiList::ws_gui_selection, ws_gui_set_toolbar_avail(), WSGuiList::ws_gui_view, ws_gui_view_cursor_changed(), and WSGuiAppData::ws_gui_w_list.

Referenced by main().

00477 {
00478         timer(TIMER_START, (gchar*)__FUNCTION__);
00479         guint i;
00480         osso_rpc_t data;
00481 
00482         WSGuiApp* ws_gui_app=(WSGuiApp*)user_data;
00483         ws_gui_app->no_words_found = FALSE;
00484         
00485         g_signal_handlers_block_by_func(G_OBJECT 
00486                         (ws_gui_app->ws_gui_w_list->ws_gui_view),
00487                         G_CALLBACK (ws_gui_view_cursor_changed), 
00488                         ws_gui_app);    
00489 
00490 
00491         GArray *tmp;
00492         tmp = g_array_new(TRUE, TRUE, sizeof(gchar*));
00493         gchar *tmp_word;
00494 
00495         for (i=0;i<words->len;++i)
00496         {
00497                 data = g_array_index (words, osso_rpc_t, i);
00498                 tmp_word = g_strdup(data.value.s);
00499                 g_array_append_val(tmp, tmp_word);
00500         }
00501         
00502         //g_assert(ws_gui_app->ws_gui_banner_list_searching);
00503         //gtk_widget_hide(GTK_WIDGET(ws_gui_app->ws_gui_banner_list_searching));
00504 
00505         ws_gui_app->loading = FALSE;
00506         ws_gui_set_toolbar_avail(ws_gui_app);
00507 
00508         //ws_gui_app->ws_gui_banner_flag = FALSE;
00509 
00510         //ws_gui_clear_list(ws_gui_app->ws_gui_w_list->ws_gui_store);
00511 
00512 
00513         ws_gui_app->ws_gui_w_list->ws_gui_model = 
00514                                         create_and_fill_model(tmp, ws_gui_app);
00515         
00516         if (ws_gui_app->history_flag == TRUE)
00517         {
00518 
00519         GValue value = { 0, };
00520         GtkTreeIter tmp_iter;
00521         gchar *pattern;
00522         gboolean keep_searching = TRUE;
00523 
00524         if (gtk_tree_model_get_iter_first(GTK_TREE_MODEL(
00525         ws_gui_app->ws_gui_w_list->ws_gui_model), &tmp_iter) == TRUE)
00526         {
00527 
00528                 pattern = strdup(g_array_index(ws_gui_app->ws_gui_history,
00529                                         gchar*, 
00530                                         ws_gui_app->ws_gui_history_cur_pos));
00531                 
00532                 gtk_tree_model_get_value(GTK_TREE_MODEL(
00533                                 ws_gui_app->ws_gui_w_list->ws_gui_model), 
00534                                 &tmp_iter, 
00535                                 COL_WORD, 
00536                                 &value);
00537 
00538                 if ((g_value_get_string (&value) != NULL) &&
00539                                 (strcmp(((gchar *)g_value_get_string (&value)), 
00540                                 pattern) == 0))
00541                 {
00542                         gtk_tree_selection_select_iter(
00543                                 ws_gui_app->ws_gui_w_list->ws_gui_selection,
00544                                 &tmp_iter);
00545 
00546                 }
00547                 else
00548                 {
00549                 while (gtk_tree_model_iter_next(GTK_TREE_MODEL
00550                 (ws_gui_app->ws_gui_w_list->ws_gui_model), 
00551                 &tmp_iter) == TRUE && keep_searching == TRUE)
00552                 {
00553                         gtk_tree_model_get_value(GTK_TREE_MODEL(
00554                                 ws_gui_app->ws_gui_w_list->ws_gui_model), 
00555                                 &tmp_iter, 
00556                                 COL_WORD, 
00557                                 &value);
00558 
00559                         if ((g_value_get_string (&value) != NULL) &&
00560                                 (strcmp(((gchar *)g_value_get_string (&value)), 
00561                                 pattern) == 0))
00562                                 {
00563                                 gtk_tree_model_get_iter_from_string (
00564                                 GTK_TREE_MODEL(
00565                                 ws_gui_app->ws_gui_w_list->ws_gui_model),
00566                                 &tmp_iter,
00567                                 g_array_index(
00568                                 ws_gui_app->ws_gui_history_iter,
00569                                 gchar*, 
00570                                 ws_gui_app->ws_gui_history_cur_pos));
00571 
00572                                 gtk_tree_selection_select_iter(
00573                                 ws_gui_app->ws_gui_w_list->ws_gui_selection,
00574                                 &tmp_iter);
00575                                                                 
00576                                 keep_searching = FALSE;
00577                                 }
00578                         }
00579                 }
00580         }
00581         g_free(pattern);
00582 
00583         ws_gui_app->history_flag = FALSE;
00584         ws_dbus_client_find_translation(ws_gui_app->dbus_data, 
00585                                 g_array_index(ws_gui_app->ws_gui_history,
00586                                 gchar*, 
00587                                 ws_gui_app->ws_gui_history_cur_pos));
00588         
00589         ws_gui_app->html_flag = TRUE;
00590         g_value_unset (&value);
00591         }
00592         
00593         
00594 /*      g_log(G_LOG_DOMAIN, G_LOG_LEVEL_INFO, "Dlugosc tempa to: %d", tmp->len);
00595         g_log(G_LOG_DOMAIN, G_LOG_LEVEL_INFO, "w tempie mamy: %s", tmp_word);*/
00596         //if (&& ws_gui_app->stop_clicked != TRUE )
00597         
00598         if ((tmp->len == 0 || tmp_word == NULL) && ws_gui_app->stop_clicked != TRUE )
00599         {
00600                         hildon_banner_show_information(GTK_WIDGET(
00601                                         ws_gui_app->ws_gui_hildon_window),
00602                                         NULL,
00603                         _("ws_ni_no_words_found"));
00604                 
00605                 //ws_gui_fill_html(" ", ws_gui_app);
00606                 //ws_gui_app->html_flag = FALSE;
00607                 g_free(ws_gui_app->last_word);
00608                 ws_gui_app->last_word = NULL;
00609                 ws_gui_app->no_words_found = TRUE;
00610         }
00611 
00612         g_signal_handlers_unblock_by_func(G_OBJECT(
00613                                         ws_gui_app->ws_gui_w_list->ws_gui_view),
00614                                         G_CALLBACK (ws_gui_view_cursor_changed), 
00615                                         ws_gui_app);    
00616         
00617         for (i=0;i<tmp->len;++i)
00618         {
00619                 g_free(g_array_index(tmp, gchar* , i));
00620         }
00621         g_array_free(tmp, TRUE);
00622 
00623         timer(TIMER_STOP, (gchar*)__FUNCTION__);
00624 }

void ws_gui_dict_availablity ( GtkMenuItem *  menuitem,
gpointer  user_data 
)

checks dictionaries availablity

checks wheather dictionaries are available or not; according to the result dimmes proper menuitem

Parameters:
menuitem - object which recived the signal
user_data - user data set when the signal handler was connected
Returns:

Definition at line 2178 of file ws_gui_callbacks.c.

References WSGuiAppData::client, WSGuiAppData::directories, GCONF_PATH, WSGuiAppData::ws_gui_menu, WSGuiMenu::ws_gui_menu_optimize_dict, WSGuiMenu::ws_gui_menu_remove_dict, and WSGuiMenu::ws_gui_menu_select_dict.

Referenced by ws_gui_create_main_menu().

02179 {
02180         WSGuiApp* ws_gui_app=(WSGuiApp*)user_data;
02181         if (gconf_client_dir_exists(ws_gui_app->client, 
02182                                 GCONF_PATH, NULL) == TRUE)
02183         {
02184                 ws_gui_app->directories = gconf_client_all_dirs(
02185                                                         ws_gui_app->client,
02186                                                         GCONF_PATH,
02187                                                         NULL
02188                                                         );
02189                 
02190         
02191                 if(g_slist_length(ws_gui_app->directories) != 0)
02192                 {
02193                         gtk_widget_set_sensitive(GTK_WIDGET
02194                         (ws_gui_app->ws_gui_menu->ws_gui_menu_remove_dict),
02195                         TRUE);
02196                         gtk_widget_set_sensitive(GTK_WIDGET
02197                         (ws_gui_app->ws_gui_menu->ws_gui_menu_select_dict),
02198                         TRUE);
02199                         gtk_widget_set_sensitive(GTK_WIDGET
02200                         (ws_gui_app->ws_gui_menu->ws_gui_menu_optimize_dict),
02201                         TRUE);
02202                 }
02203 
02204         }
02205         else 
02206         {
02207         gtk_widget_set_sensitive(GTK_WIDGET
02208                         (ws_gui_app->ws_gui_menu->ws_gui_menu_remove_dict),
02209                         FALSE);
02210         gtk_widget_set_sensitive(GTK_WIDGET
02211                         (ws_gui_app->ws_gui_menu->ws_gui_menu_select_dict),
02212                         FALSE);
02213         gtk_widget_set_sensitive(GTK_WIDGET
02214                         (ws_gui_app->ws_gui_menu->ws_gui_menu_optimize_dict),
02215                         FALSE);
02216         }
02217 
02218 }

void ws_gui_dictionary_add_bookmark ( GtkMenuItem *  menuitem,
gpointer  user_data 
)

add bookmark to bookmarks database

adds bookmark to bookmarks database

Parameters:
menuitem - object which recived the signal
user_data - user data set when the signal handler was connected
Returns:

Definition at line 2118 of file ws_gui_callbacks.c.

References _, WSGuiAppData::last_word, ws_gui_add_bookmark_dialog(), and WSGuiAppData::ws_gui_hildon_window.

Referenced by ws_gui_create_main_menu(), and ws_gui_create_popup_menu().

02119 {
02120         WSGuiApp* ws_gui_app=(WSGuiApp*)user_data;
02121 
02122         if (ws_gui_app->last_word != NULL)
02123         {
02124                 ws_gui_add_bookmark_dialog(ws_gui_app);
02125         } 
02126         else
02127         {
02128                 hildon_banner_show_information(GTK_WIDGET(
02129                                 ws_gui_app->ws_gui_hildon_window),
02130                                 NULL,
02131                                 _("ws_ni_select_word_to_add"));
02132         }
02133 }

void ws_gui_dictionary_chooser ( GtkMenuItem *  menuitem,
gpointer  user_data 
)

select dictionaries to use

this function creates dialog popup window and allows to select dictionaries which user wants to use

Parameters:
menuitem - the object which received the signal
user_data - set when the signal handler was connected

Definition at line 861 of file ws_gui_layout.c.

References _, WSGuiAppData::bookmark_avail, WSGuiAppData::client, WSGuiAppData::dbus_data, WSGuiAppData::directories, GCONF_PATH, WS_DBUS_INFO_CONFIG_CHANGED, ws_dbus_notify, ws_gui_check_history(), ws_gui_clear_array(), WSGuiAppData::ws_gui_history, WSGuiAppData::ws_gui_history_cur_pos, WSGuiAppData::ws_gui_history_iter, WSGuiAppData::ws_gui_history_list, and ws_refresh_search_results().

Referenced by ws_gui_create_main_menu().

00862 {
00863         WSGuiApp* ws_gui_app=(WSGuiApp*)user_data;
00864         GtkWidget *dialog1;
00865         GtkWidget *dialog_vbox1;
00866         GtkWidget *scrolledwindow1;
00867         GtkWidget *viewport1;
00868         GtkWidget *vbox1;
00869 
00870         GtkWidget *checkbutton;
00871         GtkWidget *cancel_button;
00872         GtkWidget *ok_button;
00873         guint i =0;
00874         gchar* string;
00875         gchar* path;
00876         const gchar* name;
00877         GArray *checkboxes;
00878 
00879         checkboxes = g_array_new (TRUE, TRUE, sizeof(GtkWidget*));
00880 
00881         if (gconf_client_dir_exists(ws_gui_app->client, 
00882                                 GCONF_PATH, NULL) == TRUE)
00883         {
00884         ws_gui_app->directories = 
00885                 gconf_client_all_dirs(ws_gui_app->client,
00886                                         GCONF_PATH,
00887                                         NULL);
00888         }
00889         else 
00890         {
00891         g_log(G_LOG_DOMAIN, G_LOG_LEVEL_INFO,
00892                 "\n.::GUI::. /apps/mdictionary/dictionaries does not exist!!");
00893         }
00894 
00895         dialog1 = gtk_dialog_new ();
00896         gtk_window_set_title (GTK_WINDOW (dialog1), 
00897                         (_("ws_ti_choose_dictionaries_title")));
00898         gtk_window_set_type_hint (GTK_WINDOW (dialog1),
00899                                 GDK_WINDOW_TYPE_HINT_DIALOG);
00900         gtk_window_set_default_size(GTK_WINDOW (dialog1), 300, 200);
00901 
00902         dialog_vbox1 = GTK_DIALOG (dialog1)->vbox;
00903         gtk_widget_show (dialog_vbox1);
00904 
00905         scrolledwindow1 = gtk_scrolled_window_new (NULL, NULL);
00906         gtk_widget_show (scrolledwindow1);
00907         gtk_box_pack_start (GTK_BOX (dialog_vbox1),
00908                         scrolledwindow1,
00909                         TRUE,
00910                         TRUE,
00911                         0);
00912 
00913         viewport1 = gtk_viewport_new (NULL, NULL);
00914         gtk_widget_show (viewport1);
00915         gtk_container_add (GTK_CONTAINER (scrolledwindow1), viewport1);
00916 
00917         vbox1 = gtk_vbox_new (FALSE, 0);
00918         gtk_widget_show (vbox1);
00919         gtk_container_add (GTK_CONTAINER (viewport1), vbox1);
00920 
00921         for (i=0; i< g_slist_length(ws_gui_app->directories);i++)
00922         {
00923         string = (gchar*)g_slist_nth_data(ws_gui_app->directories, i); 
00924         name = g_path_get_basename(string);
00925         checkbutton = gtk_check_button_new_with_label(name);
00926         path = g_strconcat(string, "/active", NULL);
00927 
00928         if (gconf_client_get_bool(ws_gui_app->client, 
00929                                         path, 
00930                                         NULL) == TRUE)
00931         {
00932                 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(
00933                                                 checkbutton),
00934                                                 TRUE);
00935         }
00936         else 
00937         {
00938                 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(
00939                                                 checkbutton),
00940                                                 FALSE);
00941         }
00942 
00943                 g_array_append_val(checkboxes, checkbutton);
00944                 gtk_box_pack_start (GTK_BOX (vbox1), 
00945                                 checkbutton, 
00946                                 FALSE, 
00947                                 FALSE, 
00948                                 0);
00949                 
00950                 if (strcmp(name, "bookmarks") == 0)
00951                 {
00952                         if (ws_gui_app->bookmark_avail == FALSE) 
00953                         {
00954                         gtk_widget_set_sensitive(GTK_WIDGET(checkbutton),
00955                                                 FALSE);
00956                         }
00957                 }
00958 
00959                 gtk_widget_show (checkbutton);
00960         }
00961 
00962         cancel_button = gtk_button_new_from_stock (_("ws_db_cancel"));
00963         gtk_widget_show (cancel_button);
00964         gtk_dialog_add_action_widget (GTK_DIALOG (dialog1),
00965                                         cancel_button,
00966                                         GTK_RESPONSE_CANCEL);
00967         
00968         ok_button = gtk_button_new_from_stock (_("ws_db_ok"));
00969         gtk_widget_show (ok_button);
00970         gtk_dialog_add_action_widget(GTK_DIALOG (dialog1),
00971                                         ok_button,
00972                                         GTK_RESPONSE_OK);
00973         
00974         i = gtk_dialog_run(GTK_DIALOG(dialog1));
00975         
00976         if (i == GTK_RESPONSE_OK) 
00977         {
00978                 for(i=0;i<(checkboxes->len);i++)
00979                 {
00980                         if (gtk_toggle_button_get_active(
00981                                 GTK_TOGGLE_BUTTON(g_array_index(checkboxes,
00982                                                 GtkWidget *, i))) == TRUE)
00983                         {
00984                                 name = gtk_button_get_label(GTK_BUTTON(
00985                                 g_array_index(checkboxes, GtkWidget *, i)));
00986                                 
00987                                 path=g_strconcat(GCONF_PATH,
00988                                                 "/",
00989                                                 name,
00990                                                 "/active",
00991                                                 NULL);
00992                                 gconf_client_set_bool(ws_gui_app->client,
00993                                                         path,
00994                                                         TRUE,
00995                                                         NULL);
00996                         }
00997         
00998                         if (gtk_toggle_button_get_active(
00999                                 GTK_TOGGLE_BUTTON(g_array_index(checkboxes,
01000                                                 GtkWidget *, i))) == FALSE)
01001                         {
01002                                 name = gtk_button_get_label(GTK_BUTTON(
01003                                 g_array_index(checkboxes, GtkWidget *, i)));
01004                                 
01005                                 path=g_strconcat(GCONF_PATH,
01006                                                 "/",
01007                                                 name,
01008                                                 "/active",
01009                                                 NULL);
01010                                 gconf_client_set_bool(ws_gui_app->client,
01011                                                         path,
01012                                                         FALSE,
01013                                                         NULL);
01014                         }
01015                 }
01016         
01017                 ws_dbus_notify(ws_gui_app->dbus_data, 
01018                                 WS_DBUS_INFO_CONFIG_CHANGED);
01019 
01020                 if(ws_gui_app->ws_gui_history->len >= 0)
01021                 {
01022                 ws_gui_clear_array(ws_gui_app->ws_gui_history);
01023                 ws_gui_clear_array(ws_gui_app->ws_gui_history_list);
01024                 ws_gui_clear_array(ws_gui_app->ws_gui_history_iter);
01025                 ws_gui_app->ws_gui_history_cur_pos = -1;
01026                 }
01027                 ws_gui_check_history(ws_gui_app);
01028         
01029                 gtk_widget_destroy (dialog1);
01030                 ws_refresh_search_results(ws_gui_app); //refreshing words list
01031         }
01032         else if (i == GTK_RESPONSE_CANCEL) 
01033         {
01034                 gtk_widget_destroy (dialog1);
01035         }
01036         
01037         g_slist_free(ws_gui_app->directories);
01038 }

void ws_gui_dictionary_close_bookmark ( GtkMenuItem *  menuitem,
gpointer  user_data 
)

close bookmark window

closes bookmarks database

Parameters:
menuitem - object which recived the signal
user_data - user data set when the signal handler was connected
Returns:

Definition at line 2056 of file ws_gui_callbacks.c.

References WS_DBUS_BOOKMARK_MODE_OFF, ws_dbus_notify, ws_gui_check_history(), ws_gui_clear_array(), ws_gui_fill_html(), ws_gui_read_active_dictionaries(), ws_gui_search(), and ws_gui_set_bookmarks_sensitivity().

Referenced by ws_gui_create_main_menu().

02057 {
02058         WSGuiApp* ws_gui_app=(WSGuiApp*)user_data;
02059 
02060         ws_gui_read_active_dictionaries(ws_gui_app);
02061         
02062         g_free(ws_gui_app->last_word);
02063         ws_gui_app->last_word = NULL;
02064 
02065         ws_gui_app->bookmark_mode = FALSE;
02066         ws_gui_set_bookmarks_sensitivity(ws_gui_app);   
02067         ws_dbus_notify(ws_gui_app->dbus_data, WS_DBUS_BOOKMARK_MODE_OFF);
02068 
02069         if(ws_gui_app->ws_gui_history->len >= 0)
02070         {
02071         ws_gui_clear_array(ws_gui_app->ws_gui_history);
02072         ws_gui_clear_array(ws_gui_app->ws_gui_history_list);
02073         ws_gui_clear_array(ws_gui_app->ws_gui_history_iter);
02074         ws_gui_app->ws_gui_history_cur_pos = -1;
02075         }
02076         ws_gui_check_history(ws_gui_app);
02077 
02078         ws_gui_fill_html(" ", ws_gui_app);
02079         ws_gui_app->html_flag = TRUE;
02080         //g_strstrip(ws_gui_app->last_searched);
02081         if (g_strstrip(ws_gui_app->last_searched) != NULL && ws_gui_app->first_run == FALSE) 
02082         {
02083         g_object_set(G_OBJECT(ws_gui_app->ws_gui_hildon_find_toolbar),
02084                                 "prefix",
02085                                 ws_gui_app->last_searched,
02086                                 NULL);
02087         //ws_dbus_client_find_word(ws_gui_app->dbus_data, ws_gui_app->last_searched);
02088         ws_gui_search(NULL, ws_gui_app);
02089         }
02090         else
02091         {
02092                 gtk_list_store_clear(ws_gui_app->ws_gui_w_list->ws_gui_store);
02093         }
02094 /*      else if (ws_gui_app->first_run == FALSE) 
02095         {
02096                 g_object_set(G_OBJECT(ws_gui_app->ws_gui_hildon_find_toolbar),
02097                                 "prefix",
02098                                 "\0",
02099                                 NULL);
02100                 GArray *tmp;
02101                 tmp = g_array_new(TRUE, TRUE, sizeof(gchar*));
02102                 gtk_list_store_clear(ws_gui_app->ws_gui_w_list->ws_gui_store);
02103                 ws_gui_app->ws_gui_w_list->ws_gui_model = 
02104                                         create_and_fill_model(tmp, ws_gui_app);
02105                 
02106                 ws_dbus_client_find_word(ws_gui_app->dbus_data, ws_gui_app->last_searched);
02107                 gtk_widget_hide(ws_gui_app->ws_gui_list_hbox);
02108                 ws_gui_search(NULL, ws_gui_app);        
02109         }*/
02110 }

void ws_gui_dictionary_loader ( GtkMenuItem *  menuitem,
gpointer  user_data 
)

load new dictionary files

this function creates dialog popup window which allows to load a new dictionary file into application

Parameters:
menuitem - the object which received the signal
user_data - set when the signal handler was connected

Definition at line 1224 of file ws_gui_layout.c.

References _, WSGuiAppData::dbus_data, ws_dbus_client_extract_dictionary, WSGuiAppData::ws_gui_hildon_window, ws_gui_load_dict(), and ws_refresh_search_results().

Referenced by ws_gui_create_main_menu().

01225 {
01226         WSGuiApp* ws_gui_app=(WSGuiApp*)user_data;
01227 
01228         GtkWidget *dialog;
01229 //      GtkWidget *dialog2;     
01230 
01231         dialog = hildon_file_chooser_dialog_new(
01232                                 GTK_WINDOW(ws_gui_app->ws_gui_hildon_window),
01233                                 GTK_FILE_CHOOSER_ACTION_OPEN);
01234 
01235         gtk_window_set_default_size(GTK_WINDOW (dialog), 200, 200);
01236         gtk_file_chooser_set_local_only (GTK_FILE_CHOOSER(dialog), FALSE);
01237 
01238         //gtk_widget_show(GTK_WIDGET(dialog));
01239 
01240         if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_OK)
01241         { 
01242                 gchar *filename;
01243                 gchar *name;
01244         //   gchar *path;
01245                 gint len;
01246         //  gchar *filepath;
01247 
01248                 gchar* tmp;
01249                 
01250                 filename = gtk_file_chooser_get_filename(
01251                                                 GTK_FILE_CHOOSER (dialog));
01252                 name = g_path_get_basename(filename);
01253                 len = strlen(filename) - strlen(name) -1;
01254                 tmp = g_strndup (filename, len);
01255                                 
01256                 
01257                 tmp = g_path_get_basename(tmp);
01258                 
01259                 if (g_str_has_suffix(name, ".xdxf") 
01260                         || g_str_has_suffix(name, ".idx") 
01261                         || g_str_has_suffix(name, ".ifo")
01262                         || g_str_has_suffix(name, ".idx.gz")
01263                         || g_str_has_suffix(name, ".dict")
01264                         || g_str_has_suffix(name, ".dict.dz"))
01265                 {
01266                         g_log(G_LOG_DOMAIN, G_LOG_LEVEL_INFO, "\n:::GUUUUIII GUIII::: check");
01267                         if (ws_gui_load_dict(filename, ws_gui_app) == TRUE)
01268                         {
01269                                 gtk_widget_destroy(dialog);
01270                                 ws_refresh_search_results(ws_gui_app);
01271                                 hildon_banner_show_information(GTK_WIDGET(
01272                                         ws_gui_app->ws_gui_hildon_window),
01273                                         NULL,
01274                                 _("ws_ni_dictionary_added"));
01275                         } 
01276                 }
01277                 else if (g_str_has_suffix(name, ".bz2"))
01278                 {       
01279                         ws_dbus_client_extract_dictionary(ws_gui_app->dbus_data, filename);
01280                         gtk_widget_destroy(dialog);
01281                         ws_refresh_search_results(ws_gui_app);
01282                 }
01283                 else
01284                 {
01285                         gtk_widget_destroy (dialog);
01286                         hildon_banner_show_information(GTK_WIDGET(
01287                                         ws_gui_app->ws_gui_hildon_window),
01288                                         NULL,
01289                                 _("ws_ni_dictionary_wrong_file"));
01290                 }
01291 
01292         }
01293         else 
01294         {
01295                 gtk_widget_destroy (dialog);
01296         }
01297         
01298 }

void ws_gui_dictionary_open_bookmark ( GtkMenuItem *  menuitem,
gpointer  user_data 
)

open bookmark window

open bookmarks database

Parameters:
menuitem - object which recived the signal
user_data - user data set when the signal handler was connected
Returns:

Definition at line 2015 of file ws_gui_callbacks.c.

References WS_DBUS_BOOKMARK_MODE_ON, ws_dbus_client_find_word, ws_dbus_notify, ws_gui_check_history(), ws_gui_clear_array(), ws_gui_clear_list(), ws_gui_fill_html(), ws_gui_read_active_dictionaries(), ws_gui_search(), and ws_gui_set_bookmarks_sensitivity().

Referenced by ws_gui_create_main_menu().

02016 {
02017         WSGuiApp* ws_gui_app=(WSGuiApp*)user_data;
02018 
02019         ws_gui_read_active_dictionaries(ws_gui_app);
02020         
02021         /*list has to be cleared if we're gonna use a completely different dict*/
02022         ws_gui_clear_list(ws_gui_app->ws_gui_w_list->ws_gui_store, ws_gui_app);
02023         g_free(ws_gui_app->last_word);
02024         ws_gui_app->last_word = NULL;
02025 
02026         ws_gui_app->bookmark_mode = TRUE;
02027         ws_gui_set_bookmarks_sensitivity(ws_gui_app);
02028         g_object_set(G_OBJECT(ws_gui_app->ws_gui_hildon_find_toolbar),
02029                                 "prefix",
02030                                 "*",
02031                                 NULL);
02032         ws_dbus_notify(ws_gui_app->dbus_data, WS_DBUS_BOOKMARK_MODE_ON);
02033         
02034         if(ws_gui_app->ws_gui_history->len >= 0)
02035         {
02036         ws_gui_clear_array(ws_gui_app->ws_gui_history);
02037         ws_gui_clear_array(ws_gui_app->ws_gui_history_list);
02038         ws_gui_clear_array(ws_gui_app->ws_gui_history_iter);
02039         ws_gui_app->ws_gui_history_cur_pos = -1;
02040         }
02041         ws_gui_check_history(ws_gui_app);
02042         ws_gui_fill_html(" ", ws_gui_app);
02043         ws_gui_app->html_flag = FALSE;
02044         ws_dbus_client_find_word(ws_gui_app->dbus_data, "*");
02045         gtk_widget_hide(ws_gui_app->ws_gui_list_hbox);
02046         
02047         ws_gui_search(NULL, ws_gui_app);
02048 }

void ws_gui_dictionary_optimizer ( GtkMenuItem *  menuitem,
gpointer  user_data 
)

optimize dictionaries

this function creates dialog popup window and allows optimize dictionaries

Parameters:
menuitem - the object which received the signal
user_data - set when the signal handler was connected

Definition at line 1045 of file ws_gui_layout.c.

References _, WSGuiAppData::client, WSGuiAppData::dbus_data, WSGuiAppData::directories, GCONF_PATH, WS_DBUS_INFO_CONFIG_CHANGED, ws_dbus_notify, WSGuiAppData::ws_gui_hildon_window, and WSGuiAppData::ws_message_dialog.

Referenced by ws_gui_create_main_menu().

01046 {
01047         WSGuiApp* ws_gui_app=(WSGuiApp*)user_data;
01048 
01049         GtkWidget *dialog1;
01050         GtkWidget *dialog_vbox1;
01051         GtkWidget *scrolledwindow1;
01052         GtkWidget *viewport1;
01053         GtkWidget *vbox1;
01054 
01055         GtkWidget *checkbutton;
01056         GtkWidget *cancel_button;
01057         GtkWidget *ok_button;
01058         guint i =0;
01059         gchar* string;
01060         gchar* path;
01061         const gchar* name;
01062         GArray *checkboxes;
01063 
01064         checkboxes = g_array_new (TRUE, TRUE, sizeof(GtkWidget*));
01065 
01066         //check if a gconf directory exists
01067         if (gconf_client_dir_exists(ws_gui_app->client, 
01068                                 GCONF_PATH, 
01069                                 NULL) == TRUE)
01070         {
01071                 ws_gui_app->directories = 
01072                 gconf_client_all_dirs(ws_gui_app->client, GCONF_PATH, NULL);
01073         }
01074         else 
01075         {
01076                 g_log(G_LOG_DOMAIN, G_LOG_LEVEL_INFO,
01077                 "\n.::GUI::. /apps/mdictionary/dictionaries does not exist!!");
01078         }
01079 
01080         for (i=0; i< g_slist_length(ws_gui_app->directories);i++)
01081         {
01082                 string = (gchar*)g_slist_nth_data(ws_gui_app->directories, i); 
01083                 name = g_path_get_basename(string);
01084 
01085                 path = g_strconcat(string, "/optimized", NULL);
01086                 if (gconf_client_get_bool (ws_gui_app->client,
01087                                         path, 
01088                                         NULL) == FALSE)
01089                 {
01090                         checkbutton = gtk_check_button_new_with_label(name);
01091                         g_array_append_val(checkboxes, checkbutton);
01092                 }
01093         }
01094         if (checkboxes->len <= 0)
01095         {
01096                 ws_gui_app->ws_message_dialog = gtk_message_dialog_new(
01097                                 GTK_WINDOW(ws_gui_app->ws_gui_hildon_window),
01098                                 GTK_DIALOG_DESTROY_WITH_PARENT,
01099                                 GTK_MESSAGE_ERROR,
01100                                 GTK_BUTTONS_OK,
01101                                 _("ws_ni_no_dictionaries_to_optimize"));
01102         gtk_widget_show_all(ws_gui_app->ws_message_dialog);
01103         if (gtk_dialog_run (GTK_DIALOG (
01104                         ws_gui_app->ws_message_dialog)) == GTK_RESPONSE_OK)
01105         {
01106                         gtk_widget_destroy(ws_gui_app->ws_message_dialog);
01107         }
01108         }
01109         else
01110         {
01111                 dialog1 = gtk_dialog_new ();
01112                 gtk_window_set_title(GTK_WINDOW (dialog1),
01113                                 (_("ws_ti_choose_dictionaries_title")));
01114                 gtk_window_set_type_hint(GTK_WINDOW (dialog1),
01115                                         GDK_WINDOW_TYPE_HINT_DIALOG);
01116                 gtk_window_set_default_size(GTK_WINDOW (dialog1), 300, 200);
01117 
01118                 dialog_vbox1 = GTK_DIALOG (dialog1)->vbox;
01119                 gtk_widget_show (dialog_vbox1);
01120 
01121                 scrolledwindow1 = gtk_scrolled_window_new (NULL, NULL);
01122                 gtk_widget_show (scrolledwindow1);
01123                 gtk_box_pack_start(GTK_BOX (dialog_vbox1),
01124                                 scrolledwindow1,
01125                                 TRUE,
01126                                 TRUE,
01127                                 0);
01128 
01129                 viewport1 = gtk_viewport_new (NULL, NULL);
01130                 gtk_widget_show (viewport1);
01131                 gtk_container_add (GTK_CONTAINER (scrolledwindow1), viewport1);
01132 
01133                 vbox1 = gtk_vbox_new (FALSE, 0);
01134                 gtk_widget_show (vbox1);
01135                 gtk_container_add (GTK_CONTAINER (viewport1), vbox1);
01136                 for (i=0; i<checkboxes->len; i++)
01137                 {
01138                         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(
01139                                 g_array_index(checkboxes, GtkWidget*, i)),
01140                                 FALSE);
01141                         gtk_box_pack_start(GTK_BOX (vbox1),
01142                                 g_array_index(checkboxes, GtkWidget*, i),
01143                                 FALSE,
01144                                 FALSE,
01145                                 0);
01146                         gtk_widget_show(g_array_index(checkboxes, 
01147                                                 GtkWidget*, 
01148                                                 i));
01149                 }
01150                 cancel_button = gtk_button_new_from_stock (_("ws_db_cancel"));
01151                 gtk_widget_show (cancel_button);
01152                 gtk_dialog_add_action_widget(GTK_DIALOG (dialog1),
01153                                         cancel_button,
01154                                         GTK_RESPONSE_CANCEL);
01155                 ok_button = gtk_button_new_from_stock (_("ws_db_ok"));
01156                 gtk_widget_show (ok_button);
01157                 gtk_dialog_add_action_widget(GTK_DIALOG (dialog1),
01158                                         ok_button,
01159                                         GTK_RESPONSE_OK);
01160                 i = gtk_dialog_run(GTK_DIALOG(dialog1));
01161                 if (i == GTK_RESPONSE_OK) 
01162                 {
01163                         for(i=0;i<(checkboxes->len);i++)
01164                         {
01165                                 if (gtk_toggle_button_get_active(
01166                                 GTK_TOGGLE_BUTTON(
01167                                         g_array_index(checkboxes,
01168                                                 GtkWidget *, i))) == TRUE)
01169                                 {
01170                                         name = gtk_button_get_label(GTK_BUTTON(
01171                                                 g_array_index(checkboxes,
01172                                                         GtkWidget *,
01173                                                         i)));
01174                                         path=g_strconcat(GCONF_PATH,
01175                                                         "/",
01176                                                         name,
01177                                                         "/optimized",
01178                                                         NULL);
01179                                         gconf_client_set_bool(
01180                                                         ws_gui_app->client,
01181                                                         path,
01182                                                         TRUE,
01183                                                         NULL);
01184                                 }
01185                                 if (gtk_toggle_button_get_active(
01186                                 GTK_TOGGLE_BUTTON(
01187                                 g_array_index(checkboxes,
01188                                                 GtkWidget *, i))) == FALSE)
01189                                 {
01190                                         name = gtk_button_get_label(GTK_BUTTON
01191                                                 (g_array_index(checkboxes,
01192                                                                 GtkWidget*,
01193                                                                 i)));
01194                                         path=g_strconcat(GCONF_PATH,
01195                                                         "/",
01196                                                         name,
01197                                                         "/optimized",
01198                                                         NULL);
01199                                         gconf_client_set_bool(
01200                                                         ws_gui_app->client,
01201                                                         path,
01202                                                         FALSE,
01203                                                         NULL);
01204                                 }
01205                         }
01206                         ws_dbus_notify(ws_gui_app->dbus_data,
01207                                 WS_DBUS_INFO_CONFIG_CHANGED);
01208                         gtk_widget_destroy (dialog1);
01209                 }
01210                 else if (i == GTK_RESPONSE_CANCEL) 
01211                 {
01212                         gtk_widget_destroy (dialog1);
01213                 }
01214         }
01215         g_slist_free(ws_gui_app->directories);
01216 }

void ws_gui_dictionary_remove_bookmark ( GtkMenuItem *  menuitem,
gpointer  user_data 
)

remove bookmark from database

removes bookmark from bookmarks database

Parameters:
menuitem - object which recived the signal
user_data - user data set when the signal handler was connected
Returns:

Definition at line 2141 of file ws_gui_callbacks.c.

References _, WSGuiAppData::last_word, ws_dbus_client_find_word, ws_gui_clear_list(), WSGuiAppData::ws_gui_hildon_window, and ws_gui_remove_bookmark_dialog().

Referenced by ws_gui_create_main_menu().

02143 {
02144         WSGuiApp* ws_gui_app=(WSGuiApp*)user_data;
02145 
02146         if (ws_gui_app->last_word != NULL)
02147         {
02148                 ws_gui_remove_bookmark_dialog(ws_gui_app);
02149 
02150                 ws_gui_clear_list(ws_gui_app->ws_gui_w_list->ws_gui_store, ws_gui_app);
02151                 gchar *temp;
02152                 g_object_get(G_OBJECT(ws_gui_app->ws_gui_hildon_find_toolbar),
02153                                 "prefix",
02154                                 &temp,
02155                                 NULL);
02156                 ws_dbus_client_find_word (ws_gui_app->dbus_data, temp);
02157                 //gtk_widget_hide(ws_gui_app->ws_gui_list_hbox);
02158                 
02159         }
02160         else
02161         {
02162                 hildon_banner_show_information(GTK_WIDGET(
02163                                 ws_gui_app->ws_gui_hildon_window),
02164                                 NULL,
02165                         _("ws_ni_select_word_to_remove"));
02166         }
02167         
02168         
02169 }

void ws_gui_dictionary_remover ( GtkMenuItem *  menuitem,
gpointer  user_data 
)

remove dictionary from application

this function creates dialog popup window which allows to remove dictionary which is no longer used

Parameters:
menuitem - the object which received the signal
user_data - set when the signal handler was connected

Definition at line 1410 of file ws_gui_layout.c.

References _, WSGuiAppData::client, WSGuiAppData::dbus_data, WSGuiAppData::directories, GCONF_PATH, WS_DBUS_INFO_CONFIG_CHANGED, ws_dbus_notify, ws_gui_check_history(), ws_gui_clear_array(), WSGuiAppData::ws_gui_hildon_window, WSGuiAppData::ws_gui_history, WSGuiAppData::ws_gui_history_cur_pos, WSGuiAppData::ws_gui_history_iter, WSGuiAppData::ws_gui_history_list, and ws_refresh_search_results().

Referenced by ws_gui_create_main_menu().

01411 {
01412         WSGuiApp* ws_gui_app=(WSGuiApp*)user_data;
01413 
01414         GtkWidget *dialog1;
01415         GtkWidget *dialog_vbox1;
01416         GtkWidget *scrolledwindow1;
01417         GtkWidget *viewport1;
01418         GtkWidget *vbox1;
01419         GtkWidget *checkbutton;
01420         GtkWidget *cancel_button;
01421         GtkWidget *ok_button;
01422         guint i =0;
01423         gchar* string;
01424         gchar* path;
01425         const gchar* name;
01426         GArray *checkboxes;
01427 
01428         checkboxes = g_array_new (TRUE, TRUE, sizeof(GtkWidget*));
01429 
01430         if (gconf_client_dir_exists(ws_gui_app->client, GCONF_PATH, NULL) 
01431                                                                         == TRUE)
01432         {
01433                 ws_gui_app->directories = gconf_client_all_dirs(
01434                                                         ws_gui_app->client,
01435                                                         GCONF_PATH,
01436                                                         NULL);
01437         }
01438         else 
01439         {
01440                 g_log(G_LOG_DOMAIN, G_LOG_LEVEL_INFO,
01441                 "\n.::GUI::. /apps/mdictionary/dictionaries does not exist!!");
01442         }
01443 
01444         dialog1 = gtk_dialog_new ();
01445         gtk_window_set_title (GTK_WINDOW (dialog1), 
01446                         (_("ws_ti_remove_dictionaries_title")));
01447         gtk_window_set_type_hint (GTK_WINDOW (dialog1),
01448                                 GDK_WINDOW_TYPE_HINT_DIALOG);
01449         gtk_window_set_default_size(GTK_WINDOW (dialog1), 300, 200);
01450 
01451         dialog_vbox1 = GTK_DIALOG (dialog1)->vbox;
01452         gtk_widget_show (dialog_vbox1);
01453 
01454         scrolledwindow1 = gtk_scrolled_window_new (NULL, NULL);
01455         gtk_widget_show (scrolledwindow1);
01456         gtk_box_pack_start (GTK_BOX (dialog_vbox1),
01457                         scrolledwindow1,
01458                         TRUE,
01459                         TRUE,
01460                         0);
01461 
01462         viewport1 = gtk_viewport_new (NULL, NULL);
01463         gtk_widget_show (viewport1);
01464         gtk_container_add (GTK_CONTAINER (scrolledwindow1), viewport1);
01465 
01466         vbox1 = gtk_vbox_new (FALSE, 0);
01467         gtk_widget_show (vbox1);
01468         gtk_container_add (GTK_CONTAINER (viewport1), vbox1);
01469 
01470         for (i=0; i< g_slist_length(ws_gui_app->directories);i++)
01471         {
01472                 string = (gchar*)g_slist_nth_data(ws_gui_app->directories, i); 
01473                 name = g_path_get_basename(string);
01474                 checkbutton = gtk_check_button_new_with_label(name);
01475 
01476                 g_array_append_val(checkboxes, checkbutton);
01477                 gtk_box_pack_start (GTK_BOX (vbox1),
01478                                 checkbutton,
01479                                 FALSE,
01480                                 FALSE,
01481                                 0);
01482                 
01483                 if (strcmp(name, "bookmarks") == 0)
01484                 {
01485                 gtk_widget_set_sensitive(GTK_WIDGET(checkbutton), FALSE);
01486                 }
01487                 gtk_widget_show (checkbutton);
01488         }
01489 
01490         cancel_button = gtk_button_new_from_stock (_("ws_db_cancel"));
01491         gtk_widget_show (cancel_button);
01492         gtk_dialog_add_action_widget (GTK_DIALOG (dialog1),
01493                                 cancel_button,
01494                                 GTK_RESPONSE_CANCEL);
01495 
01496         ok_button = gtk_button_new_from_stock 
01497                         (_("ws_bd_remove_dictionaries_remove_selected"));
01498         gtk_widget_show (ok_button);
01499         gtk_dialog_add_action_widget(GTK_DIALOG (dialog1),
01500                                 ok_button,
01501                                 GTK_RESPONSE_OK);
01502 
01503         i = gtk_dialog_run(GTK_DIALOG(dialog1));
01504 
01505         if (i == GTK_RESPONSE_OK) 
01506         {
01507                 for(i=0;i<(checkboxes->len);i++)
01508                 {
01509                         if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(
01510                         g_array_index(checkboxes, GtkWidget *, i))) == TRUE)
01511                         {
01512 
01513                                 name = gtk_button_get_label(GTK_BUTTON(
01514                                 g_array_index(checkboxes, GtkWidget *, i)));
01515                                 path=g_strconcat(GCONF_PATH, "/", name, NULL);
01516                                 gconf_client_recursive_unset(ws_gui_app->client,
01517                                         path,
01518                                         GCONF_UNSET_INCLUDING_SCHEMA_NAMES,
01519                                         NULL);
01520                         } 
01521                 }
01522 
01523                 if(ws_gui_app->ws_gui_history->len >= 0)
01524                 {
01525                         ws_gui_clear_array(ws_gui_app->ws_gui_history);
01526                         ws_gui_clear_array(ws_gui_app->ws_gui_history_list);
01527                         ws_gui_clear_array(ws_gui_app->ws_gui_history_iter);
01528                         ws_gui_app->ws_gui_history_cur_pos = -1;
01529                 }
01530                 ws_gui_check_history(ws_gui_app);               
01531 
01532                 ws_dbus_notify(ws_gui_app->dbus_data, 
01533                         WS_DBUS_INFO_CONFIG_CHANGED);
01534 
01535                 hildon_banner_show_information(GTK_WIDGET(
01536                                 ws_gui_app->ws_gui_hildon_window),
01537                                 NULL,
01538                                 _("ws_ib_dictionary_removed"));
01539 
01540                 gtk_widget_destroy (dialog1);
01541                 ws_refresh_search_results(ws_gui_app);
01542         }
01543         else if (i == GTK_RESPONSE_CANCEL) 
01544         {
01545                 gtk_widget_destroy (dialog1);
01546         }
01547 
01548         g_slist_free(ws_gui_app->directories);
01549 }

void ws_gui_fill_html ( char *  html_context,
gpointer  user_data 
)

sets content of translation (html) area

fill translation area with text (html) recived from DBUS

Parameters:
html_context - text which is going to be displayed; it should be html
user_data - user data set when the function was called
Returns:

Definition at line 1664 of file ws_gui_callbacks.c.

References WSGuiAppData::bookmark_mode, WSGuiAppData::first_run, WSGuiAppData::welcome_note, WSGuiAppData::ws_gui_hildon_find_toolbar, and WSGuiAppData::ws_gui_html.

Referenced by ws_gui_dbus_return_translation(), ws_gui_dictionary_close_bookmark(), ws_gui_dictionary_open_bookmark(), ws_gui_remove_bookmark_dialog(), and ws_gui_signal_hander().

01665 {
01666         WSGuiApp* ws_gui_app = (WSGuiApp*)user_data;
01667         
01668         gtk_html_set_editable (GTK_HTML(ws_gui_app->ws_gui_html), FALSE);
01669 
01670         //Load welcome screen or translation string
01671         if (ws_gui_app->first_run == TRUE && ws_gui_app->bookmark_mode==FALSE)
01672         {
01673         gtk_html_load_from_string(GTK_HTML(ws_gui_app->ws_gui_html),
01674                                 ws_gui_app->welcome_note,
01675                                 -1);
01676         g_object_set(G_OBJECT(ws_gui_app->ws_gui_hildon_find_toolbar),
01677                                 "prefix",
01678                                 "",
01679                                 NULL);
01680         }
01681         else
01682         {
01683         gtk_html_load_from_string(GTK_HTML(ws_gui_app->ws_gui_html),
01684                                 html_context,
01685                                 -1);
01686         }
01687 }

void ws_gui_free_memory ( gpointer  user_data  ) 

is used to free memory, which was allocated

this function allows to free allocated memory

Parameters:
user_data - pointer to data structure

Definition at line 694 of file ws_gui_callbacks.c.

References WSGuiAppData::last_word, WSGuiAppData::p, WSGuiAppData::raw_translation, WSGuiAppData::welcome_note, WSGuiAppData::ws_gui_history, WSGuiAppData::ws_gui_history_iter, WSGuiAppData::ws_gui_history_list, WSGuiAppData::ws_gui_menu, and WSGuiAppData::ws_gui_w_list.

Referenced by ws_gui_menu_quit(), and ws_gui_on_exit().

00695 {
00696         WSGuiApp* ws_gui_app=(WSGuiApp*)user_data;
00697         guint i = 0;
00698         for (i = 0; i<ws_gui_app->ws_gui_history->len; ++i)
00699         {
00700                 g_free(g_array_index(ws_gui_app->ws_gui_history, gchar *, i));
00701         }
00702         g_array_free(ws_gui_app->ws_gui_history, TRUE);
00703 
00704         for (i = 0; i<ws_gui_app->ws_gui_history_list->len; ++i)
00705         {
00706                 g_free(g_array_index(ws_gui_app->ws_gui_history_list, gchar *, i));
00707         }
00708         g_array_free(ws_gui_app->ws_gui_history_list, TRUE);
00709 
00710         for (i = 0; i<ws_gui_app->ws_gui_history_iter->len; ++i)
00711         {
00712                 g_free(g_array_index(ws_gui_app->ws_gui_history_iter, gchar *, i));
00713         }
00714         g_array_free(ws_gui_app->ws_gui_history_iter, TRUE);
00715 
00716 
00717         pango_font_description_free(ws_gui_app->p);
00718 
00719         g_free(ws_gui_app->welcome_note);
00720         ws_gui_app->welcome_note = NULL;
00721 
00722         g_string_free(ws_gui_app->raw_translation, TRUE);
00723         g_free(ws_gui_app->last_word);
00724         g_free(ws_gui_app->ws_gui_w_list);
00725         g_free(ws_gui_app->ws_gui_menu);
00726         g_free(ws_gui_app);
00727 }

void ws_gui_full_screen ( GtkMenuItem *  menuitem,
gpointer  user_data 
)

switch view between full screen and normal mode

switch application between full screen and normal mode

Parameters:
menuitem - object which recived the signal
user_data - user data set when the signal handler was connected
Returns:

Definition at line 1311 of file ws_gui_callbacks.c.

References _, WSGuiAppData::ws_gui_full_screen_flag, WSGuiAppData::ws_gui_hildon_window, WSGuiAppData::ws_gui_menu, and WSGuiMenu::ws_gui_menu_full_screen.

Referenced by hildon_key_press_listener(), and ws_gui_create_main_menu().

01312 {
01313 
01314         WSGuiApp* ws_gui_app = (WSGuiApp*)user_data;
01315         if (ws_gui_app->ws_gui_full_screen_flag == FALSE) {
01316 
01317                 gtk_window_fullscreen(
01318                                 GTK_WINDOW(ws_gui_app->ws_gui_hildon_window));
01319                 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(
01320                         ws_gui_app->ws_gui_menu->ws_gui_menu_full_screen),
01321                         TRUE);
01322                 ws_gui_app->ws_gui_full_screen_flag = TRUE;
01323                 hildon_banner_show_information(GTK_WIDGET(
01324                                 ws_gui_app->ws_gui_hildon_window),
01325                                 NULL,
01326                                 _("ws_ib_fullscreen_on"));
01327         }
01328         else 
01329         {
01330                 gtk_window_unfullscreen(
01331                                 GTK_WINDOW(ws_gui_app->ws_gui_hildon_window));
01332                 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(
01333                         ws_gui_app->ws_gui_menu->ws_gui_menu_full_screen),
01334                         FALSE);
01335                 ws_gui_app->ws_gui_full_screen_flag = FALSE;
01336                         hildon_banner_show_information(GTK_WIDGET(
01337                                         ws_gui_app->ws_gui_hildon_window),
01338                                         NULL,
01339                                 _("ws_ib_fullscreen_off"));
01340         }
01341 }

void ws_gui_history_add ( char *  new_word,
gpointer  user_data 
)

add word to the words history

add word to the history

Parameters:
new_word - word which is going to be append to the history array
user_data - user data set when the signal handler was connected
Returns:

Definition at line 933 of file ws_gui_callbacks.c.

References WSGuiAppData::bookmark_mode, WSGuiAppData::history_flag, HISTORY_LEN, WSGuiAppData::last_searched, WSGuiAppData::last_searched_in_book, ws_gui_check_history(), WSGuiAppData::ws_gui_history, WSGuiAppData::ws_gui_history_cur_pos, WSGuiAppData::ws_gui_history_iter, and WSGuiAppData::ws_gui_history_list.

Referenced by create_and_fill_model(), and ws_gui_view_cursor_changed().

00934 {
00935         WSGuiApp* ws_gui_app = (WSGuiApp *)user_data;
00936 
00937         if (ws_gui_app->history_flag != TRUE)
00938         {
00939 
00940                 guint i;
00941                 gchar *tmp_word;
00942                 gchar *tmp_last_searched;
00943                 gchar *tmp_iter = NULL;
00944                 gchar *previous_word = " ";
00945         
00946                 if (ws_gui_app->ws_gui_history_cur_pos > -1 &&
00947                 g_array_index(ws_gui_app->ws_gui_history, 
00948                                 gchar*, 
00949                                 ws_gui_app->ws_gui_history_cur_pos) != NULL)
00950                 {
00951                         previous_word = NULL;
00952                         previous_word = g_array_index(
00953                                         ws_gui_app->ws_gui_history, 
00954                                         gchar*, 
00955                                         ws_gui_app->ws_gui_history_cur_pos);
00956                 }
00957         
00958                 i = ws_gui_app->ws_gui_history_cur_pos + 1;
00959                 gchar *tmp = g_array_index(ws_gui_app->ws_gui_history, 
00960                                         gchar*, 
00961                                         i);
00962                 //tmp_iter = gtk_tree_model_get_string_from_iter (GTK_TREE_MODEL(ws_gui_app->ws_gui_w_list->ws_gui_model), &ws_gui_app->ws_gui_w_list->ws_gui_iter);
00963         
00964                 if (previous_word != NULL && 
00965                 strcmp(previous_word, new_word) != 0)
00966                 {
00967                         while (tmp != NULL) 
00968                         {
00969                                 g_array_remove_index(
00970                                 ws_gui_app->ws_gui_history_list, 
00971                                 i);
00972                                 g_array_remove_index(
00973                                 ws_gui_app->ws_gui_history_iter, 
00974                                 i);
00975 
00976                                 
00977                                 g_array_remove_index(
00978                                 ws_gui_app->ws_gui_history, 
00979                                 i);
00980                                 
00981                                 tmp = g_array_index(
00982                                 ws_gui_app->ws_gui_history, 
00983                                 gchar*, 
00984                                 i);
00985                         }
00986         
00987                 i = 0;
00988                 ws_gui_app->ws_gui_history_cur_pos ++;
00989         
00990                 if (ws_gui_app->bookmark_mode == FALSE)
00991                 {
00992                         tmp_last_searched = g_strdup(ws_gui_app->last_searched);
00993                 }
00994                 else
00995                 {
00996                 tmp_last_searched = g_strdup(ws_gui_app->last_searched_in_book);
00997                 }
00998 
00999                 g_array_append_val(ws_gui_app->ws_gui_history_list, 
01000                                 tmp_last_searched);
01001                                 
01002                 tmp_word = g_strdup(new_word);
01003                 
01004                 g_array_append_val(ws_gui_app->ws_gui_history, tmp_word);
01005                 g_array_append_val(ws_gui_app->ws_gui_history_iter, tmp_iter);
01006                 
01007         
01008                 if(ws_gui_app->ws_gui_history->len > HISTORY_LEN)
01009                 {
01010                         g_array_remove_index(ws_gui_app->ws_gui_history, 0);
01011                         g_array_remove_index(ws_gui_app->ws_gui_history_list, 
01012                                         0);
01013                         g_array_remove_index(ws_gui_app->ws_gui_history_iter, 
01014                                         0);
01015                         
01016                         ws_gui_app->ws_gui_history_cur_pos--;
01017                 }
01018         
01019                 i = 0;
01020                 
01021                 tmp = g_array_index(ws_gui_app->ws_gui_history, gchar*, i);
01022                 }
01023                 
01024         }
01025 
01026         ws_gui_check_history(ws_gui_app);
01027 }

void ws_gui_history_back ( GtkButton *  button,
gpointer  user_data 
)

display translation of word stored in the history (if available)

display previously choosen word (previous from the history array) if avaible, sets current position in the history array

Parameters:
button - button which recived a signal
user_data - user data set when the signal handler was connected
Returns:

Definition at line 1036 of file ws_gui_callbacks.c.

References WSGuiAppData::dbus_data, WSGuiAppData::history_flag, WSGuiAppData::loading, ws_dbus_client_find_word, ws_gui_check_history(), WSGuiAppData::ws_gui_hildon_find_toolbar, WSGuiAppData::ws_gui_history_cur_pos, WSGuiAppData::ws_gui_history_list, and ws_gui_set_toolbar_avail().

Referenced by ws_gui_create_find_toolbar(), and ws_gui_create_main_menu().

01037 {
01038         WSGuiApp* ws_gui_app = (WSGuiApp *)user_data;
01039         
01040         ws_gui_app->history_flag = TRUE;
01041 
01042         if (ws_gui_app->ws_gui_history_cur_pos > -1) 
01043         {
01044                 ws_gui_app->ws_gui_history_cur_pos = 
01045                                         ws_gui_app->ws_gui_history_cur_pos - 1;
01046 
01047                 //set object's property
01048                 g_object_set(G_OBJECT(ws_gui_app->ws_gui_hildon_find_toolbar),
01049                         "prefix",
01050                         (g_array_index(ws_gui_app->ws_gui_history_list,
01051                         gchar*, 
01052                         ws_gui_app->ws_gui_history_cur_pos)),
01053                         NULL);
01054         
01055                 ws_dbus_client_find_word (ws_gui_app->dbus_data, 
01056                                         g_strstrip(g_array_index(ws_gui_app->ws_gui_history_list,
01057                                         gchar*, 
01058                                         ws_gui_app->ws_gui_history_cur_pos))
01059                                         );
01060                 //gtk_widget_hide(ws_gui_app->ws_gui_list_hbox);
01061                 //gtk_widget_show(ws_gui_app->ws_gui_banner_translation_loading);
01062                 ws_gui_app->loading = TRUE;
01063                 ws_gui_set_toolbar_avail(ws_gui_app);
01064         }
01065         else 
01066         {
01067                 ws_gui_app->loading = FALSE;
01068                 ws_gui_set_toolbar_avail(ws_gui_app);
01069         }
01070 
01071         ws_gui_check_history(ws_gui_app);
01072 }

void ws_gui_history_next ( GtkButton *  button,
gpointer  user_data 
)

display translation of word stored in the history (if available)

display choosen word, next in the history array (if avaible), sets current position in the history array

Parameters:
button - button which recived a signal
user_data - user data set when the signal handler was connected
Returns:

Definition at line 1081 of file ws_gui_callbacks.c.

References WSGuiAppData::dbus_data, WSGuiAppData::history_flag, HISTORY_LEN, WSGuiAppData::loading, ws_dbus_client_find_word, ws_gui_check_history(), WSGuiAppData::ws_gui_hildon_find_toolbar, WSGuiAppData::ws_gui_history, WSGuiAppData::ws_gui_history_cur_pos, WSGuiAppData::ws_gui_history_list, WSGuiAppData::ws_gui_menu, WSGuiMenu::ws_gui_menu_find_next, ws_gui_set_toolbar_avail(), and WSGuiAppData::ws_gui_toobar_button_forward.

Referenced by ws_gui_create_find_toolbar(), and ws_gui_create_main_menu().

01082 {
01083         WSGuiApp* ws_gui_app = (WSGuiApp *)user_data;
01084         
01085         ws_gui_app->history_flag = TRUE;
01086 
01087         gchar *tmp = g_array_index(ws_gui_app->ws_gui_history,
01088                                 gchar*,
01089                                 ws_gui_app->ws_gui_history_cur_pos+1);
01090 
01091         if ((ws_gui_app->ws_gui_history_cur_pos < HISTORY_LEN-1) 
01092         && (tmp != NULL)) 
01093         {
01094                 ws_gui_app->ws_gui_history_cur_pos =
01095                         ws_gui_app->ws_gui_history_cur_pos + 1;
01096 
01097 
01098                 //set object's property
01099                 g_object_set(G_OBJECT(ws_gui_app->ws_gui_hildon_find_toolbar),
01100                         "prefix",
01101                         (g_array_index(ws_gui_app->ws_gui_history_list,
01102                         gchar*, 
01103                         ws_gui_app->ws_gui_history_cur_pos)),
01104                         NULL);
01105         
01106                 
01107                 ws_dbus_client_find_word(ws_gui_app->dbus_data, 
01108                                         g_strstrip(g_array_index(ws_gui_app->ws_gui_history_list,
01109                                         gchar*, 
01110                                         ws_gui_app->ws_gui_history_cur_pos))
01111                                         );
01112                 
01113                 //gtk_widget_hide(ws_gui_app->ws_gui_list_hbox);
01114                 //gtk_widget_show(ws_gui_app->ws_gui_banner_translation_loading);
01115                 ws_gui_app->loading = TRUE;
01116                 ws_gui_set_toolbar_avail(ws_gui_app);
01117         }
01118         else 
01119         {
01120                 //make forward button inactive
01121                 gtk_widget_set_sensitive(
01122                         GTK_WIDGET(ws_gui_app->ws_gui_toobar_button_forward),
01123                         FALSE);
01124 
01125                 //make find next button inactive
01126                 gtk_widget_set_sensitive(
01127                 GTK_WIDGET(ws_gui_app->ws_gui_menu->ws_gui_menu_find_next),
01128                 FALSE);
01129         }
01130 
01131         ws_gui_check_history(ws_gui_app);
01132 }

void ws_gui_html_copy ( GtkMenuItem *  menuitem,
gpointer  user_data 
)

allows to copy text from translation (html) area into clipboard

copy selected text to the clipoard from context popup menu

Parameters:
menuitem - object which recived the signal
user_data - user data set when the signal handler was connected
Returns:

Definition at line 1397 of file ws_gui_callbacks.c.

References _, WSGuiAppData::ws_gui_hildon_window, and WSGuiAppData::ws_gui_html.

Referenced by ws_gui_create_main_menu(), and ws_gui_create_popup_menu().

01398 {
01399         WSGuiApp* ws_gui_app = (WSGuiApp*)user_data;
01400         gtk_html_copy(GTK_HTML(ws_gui_app->ws_gui_html));
01401         hildon_banner_show_information(GTK_WIDGET(
01402                                 ws_gui_app->ws_gui_hildon_window),
01403                                 NULL,
01404                                 _("ws_ib_copied"));
01405 }

void ws_gui_html_paste ( GtkMenuItem *  menuitem,
gpointer  user_data 
)

allows to paste text from the clipboard into find toolbar entry

paste copied text into toolbar entry

Parameters:
menuitem - object which recived the signal
user_data - user data set when the signal handler was connected
Returns:

Definition at line 1413 of file ws_gui_callbacks.c.

References _, WSGuiAppData::ws_gui_clipboard, WSGuiAppData::ws_gui_hildon_find_toolbar, and WSGuiAppData::ws_gui_hildon_window.

Referenced by ws_gui_create_main_menu(), and ws_gui_create_popup_menu().

01414 {
01415         WSGuiApp* ws_gui_app = (WSGuiApp*)user_data;
01416 
01417         gchar *temp;
01418         gchar *temp2;
01419         temp = gtk_clipboard_wait_for_text(ws_gui_app->ws_gui_clipboard);
01420 
01421         /*get object's property value*/
01422         g_object_get(G_OBJECT(ws_gui_app->ws_gui_hildon_find_toolbar),
01423                 "prefix",
01424                 &temp2,
01425                 NULL);
01426 
01427         /*concatenate two strings*/
01428         temp = g_strconcat(temp2, temp, NULL);
01429         /*replace old delimiter with a new delimiter*/
01430         temp = g_strdelimit(temp, "\n", ' ');
01431 
01432         /*set object's property*/
01433         g_object_set(G_OBJECT(ws_gui_app->ws_gui_hildon_find_toolbar),
01434                 "prefix",
01435                 temp,
01436                 NULL);
01437         hildon_banner_show_information(GTK_WIDGET(
01438                         ws_gui_app->ws_gui_hildon_window),
01439                         NULL,
01440                         _("ws_ib_pasted"));
01441 }

void ws_gui_html_select_all ( GtkMenuItem *  menuitem,
gpointer  user_data 
)

allows to select whole text in translation (html) area

select whole text in the translation (html) area

Parameters:
menuitem - object which recived the signal
user_data - user data set when the signal handler was connected
Returns:

Definition at line 1385 of file ws_gui_callbacks.c.

References WSGuiAppData::ws_gui_html.

Referenced by ws_gui_create_main_menu(), and ws_gui_create_popup_menu().

01386 {
01387         WSGuiApp* ws_gui_app = (WSGuiApp*)user_data;
01388         gtk_html_select_all(GTK_HTML(ws_gui_app->ws_gui_html));
01389 }

void ws_gui_html_zoom_in ( GtkMenuItem *  menuitem,
gpointer  user_data 
)

magnify translation (html) area

zoom in text in translation (html) area

Parameters:
menuitem - object which recived the signal
user_data - user data set when the signal handler was connected
Returns:

Definition at line 1449 of file ws_gui_callbacks.c.

References _, WS_GUI_ABS, WSGuiAppData::ws_gui_hildon_window, WSGuiAppData::ws_gui_html, WSGuiAppData::zoom, ZOOM_DEFAULT, ZOOM_MAX, and ZOOM_STEP.

Referenced by hildon_key_press_listener(), ws_gui_create_main_menu(), and ws_gui_create_popup_menu().

01450 {
01451         WSGuiApp* ws_gui_app = (WSGuiApp*)user_data;
01452         ws_gui_app->zoom = ws_gui_app->zoom + ZOOM_STEP;
01453         if (ws_gui_app->zoom > ZOOM_MAX)
01454         {
01455                 ws_gui_app->zoom = ws_gui_app->zoom - ZOOM_STEP;
01456                 hildon_banner_show_information(GTK_WIDGET(
01457                         ws_gui_app->ws_gui_hildon_window),
01458                         NULL,
01459                         _("ws_ib_max_zoom"));
01460         }
01461         else
01462         {
01463                 gtk_html_set_magnification(GTK_HTML(ws_gui_app->ws_gui_html), 
01464                                                 ws_gui_app->zoom);
01465 
01466                 if ((WS_GUI_ABS(ws_gui_app->zoom - ZOOM_DEFAULT)) < 0.000001)
01467                 {
01468                         hildon_banner_show_information(GTK_WIDGET(
01469                                         ws_gui_app->ws_gui_hildon_window),
01470                                         NULL,
01471                                         _("ws_ib_zoom_default"));
01472                 }
01473                 else
01474                 {
01475                         hildon_banner_show_information(GTK_WIDGET(
01476                                         ws_gui_app->ws_gui_hildon_window),
01477                                         NULL,
01478                                         _("ws_ib_zoom_in"));
01479                 }
01480         }
01481 }

void ws_gui_html_zoom_out ( GtkMenuItem *  menuitem,
gpointer  user_data 
)

zoom out translation (html) area.

zoom out text in translation (html) area

Parameters:
menuitem - object which recived the signal
user_data - user data set when the signal handler was connected
Returns:

Definition at line 1489 of file ws_gui_callbacks.c.

References _, WS_GUI_ABS, WSGuiAppData::ws_gui_hildon_window, WSGuiAppData::ws_gui_html, WSGuiAppData::zoom, ZOOM_DEFAULT, ZOOM_MIN, and ZOOM_STEP.

Referenced by hildon_key_press_listener(), ws_gui_create_main_menu(), and ws_gui_create_popup_menu().

01490 {
01491         WSGuiApp* ws_gui_app = (WSGuiApp*)user_data;
01492         ws_gui_app->zoom = ws_gui_app->zoom - ZOOM_STEP;
01493         if (ws_gui_app->zoom < ZOOM_MIN)
01494         {
01495                 ws_gui_app->zoom = ws_gui_app->zoom + ZOOM_STEP;
01496                         hildon_banner_show_information(GTK_WIDGET(
01497                                         ws_gui_app->ws_gui_hildon_window),
01498                                         NULL,
01499                                 _("ws_ib_min_zoom"));
01500         }
01501         else
01502         {
01503                 gtk_html_set_magnification(GTK_HTML(ws_gui_app->ws_gui_html), 
01504                                                 ws_gui_app->zoom);
01505                 
01506                 if ((WS_GUI_ABS(ws_gui_app->zoom - ZOOM_DEFAULT)) < 0.000001)
01507                 {
01508                         hildon_banner_show_information(GTK_WIDGET(
01509                                         ws_gui_app->ws_gui_hildon_window),
01510                                         NULL,
01511                                         _("ws_ib_zoom_default"));
01512                 }
01513                 else
01514                 {
01515                         hildon_banner_show_information(GTK_WIDGET(
01516                                         ws_gui_app->ws_gui_hildon_window),
01517                                         NULL,
01518                                         _("ws_ib_zoom_out"));
01519                 }
01520         }
01521 }

gboolean ws_gui_load_dict ( gchar *  filename,
gpointer  user_data 
)

load dictionary file using given filename

this function creates dialog popup window which allows to load dictionary

Parameters:
filename - the object which received the signal
user_data - set when the signal handler was connected

Definition at line 1305 of file ws_gui_layout.c.

References _, WSGuiAppData::client, WSGuiAppData::dbus_data, GCONF_PATH, WS_DBUS_INFO_CONFIG_CHANGED, ws_dbus_notify, ws_gui_check_history(), ws_gui_clear_array(), WSGuiAppData::ws_gui_hildon_window, WSGuiAppData::ws_gui_history, WSGuiAppData::ws_gui_history_cur_pos, WSGuiAppData::ws_gui_history_iter, and WSGuiAppData::ws_gui_history_list.

Referenced by ws_dbus_server_return_extracted_bzip(), and ws_gui_dictionary_loader().

01306 {
01307         WSGuiApp* ws_gui_app=(WSGuiApp*)user_data;
01308 
01309         GtkWidget *dialog1;
01310         GtkWidget *dialog2;
01311         gchar *name = g_path_get_basename(filename);
01312         gchar *path;
01313         gint len;
01314         gchar *filepath;
01315 
01316         len = strlen(filename) - strlen(name) -1;
01317         gchar *tmp = g_strndup (filename, len);;
01318         tmp = g_path_get_basename(tmp);
01319         
01320 
01321         filepath = g_strndup (filename, len);
01322         path = g_strconcat(GCONF_PATH, "/", tmp, "/path", NULL);
01323         gconf_client_set_string(ws_gui_app->client,
01324                                 path,
01325                                 filepath,
01326                                 NULL);
01327         g_free(path); 
01328         path = NULL;
01329         path = g_strconcat(GCONF_PATH,
01330                                 "/",
01331                                 tmp,
01332                                 "/active",
01333                                 NULL);
01334         
01335         dialog1 = gtk_message_dialog_new(GTK_WINDOW(
01336                                         ws_gui_app->ws_gui_hildon_window),
01337                                         GTK_DIALOG_DESTROY_WITH_PARENT,
01338                                         GTK_MESSAGE_QUESTION,
01339                                         GTK_BUTTONS_YES_NO,
01340                                 _("ws_ni_dictionaries_activation_question"));
01341 
01342         gtk_widget_show_all(GTK_WIDGET(dialog1));
01343 
01344         if (gtk_dialog_run (GTK_DIALOG (dialog1)) == GTK_RESPONSE_YES)
01345         {
01346                 gconf_client_set_bool(ws_gui_app->client,
01347                                         path,
01348                                         TRUE,
01349                                         NULL);
01350         }
01351         else 
01352         {
01353                 gconf_client_set_bool(ws_gui_app->client,
01354                                         path,
01355                                         FALSE,
01356                                         NULL);
01357         }
01358         gtk_widget_destroy (dialog1);
01359         g_free(path); 
01360         path = NULL;
01361 
01362         path = g_strconcat(GCONF_PATH, "/", tmp, "/optimized", NULL);
01363 
01364         dialog2 = gtk_message_dialog_new(
01365                 GTK_WINDOW(ws_gui_app->ws_gui_hildon_window),
01366                 GTK_DIALOG_DESTROY_WITH_PARENT,
01367                 GTK_MESSAGE_QUESTION,
01368                 GTK_BUTTONS_YES_NO,
01369                 _("ws_ni_dictionaries_optimalization_question"));
01370 
01371         gtk_widget_show_all(GTK_WIDGET(dialog2));
01372 
01373         if (gtk_dialog_run (GTK_DIALOG (dialog2)) == GTK_RESPONSE_YES)
01374         {
01375                 gconf_client_set_bool(ws_gui_app->client,
01376                                         path,
01377                                         TRUE,
01378                                         NULL);
01379         }
01380         else 
01381         {
01382                 gconf_client_set_bool(ws_gui_app->client,
01383                                         path,
01384                                         FALSE,
01385                                         NULL);
01386         }
01387         gtk_widget_destroy (dialog2);
01388 
01389         if(ws_gui_app->ws_gui_history->len > 0)
01390         {
01391                 ws_gui_clear_array(ws_gui_app->ws_gui_history);
01392                 ws_gui_clear_array(ws_gui_app->ws_gui_history_list);
01393                 ws_gui_clear_array(ws_gui_app->ws_gui_history_iter);
01394                 ws_gui_app->ws_gui_history_cur_pos = -1;
01395         }
01396         ws_gui_check_history(ws_gui_app);
01397 
01398         ws_dbus_notify(ws_gui_app->dbus_data,
01399                                 WS_DBUS_INFO_CONFIG_CHANGED);
01400         
01401         return TRUE;
01402 }

void ws_gui_menu_quit ( GtkMenuItem *  menuitem,
gpointer  user_data 
)

used when user closes the application from menu

this function is called just before closing application, from application menu; it sends signal to DBUS and destroys it;

Parameters:
menuitem - object which recived the signal
user_data - user data set when the signal handler was connected
Returns:

Definition at line 1645 of file ws_gui_callbacks.c.

References WSGuiAppData::bookmark_mode, WSGuiAppData::dbus_data, WSGuiAppData::timer, ws_dbus_destroy(), WS_DBUS_INFO_TERMINATE, ws_dbus_notify, ws_gui_free_memory(), and ws_gui_set_bookmarks_sensitivity().

Referenced by ws_gui_create_main_menu().

01646 {
01647         WSGuiApp* ws_gui_app = (WSGuiApp *)user_data;
01648         ws_gui_app->bookmark_mode = FALSE;
01649         ws_gui_set_bookmarks_sensitivity(ws_gui_app);
01650         g_timer_destroy(ws_gui_app->timer);
01651         ws_dbus_notify(ws_gui_app->dbus_data, WS_DBUS_INFO_TERMINATE);
01652         ws_dbus_destroy (ws_gui_app->dbus_data);
01653         ws_gui_free_memory(ws_gui_app);
01654         gtk_main_quit();
01655         exit (0);
01656 }

void ws_gui_on_exit ( GtkWidget *  widget,
GdkEvent *  event,
gpointer  user_data 
)

used when user closes the application

this function is called just before closing application; it sends signal to DBUS and destroys it;

Parameters:
widget - object which recived the signal
event -
user_data - user data set when the signal handler was connected
Returns:

Definition at line 1625 of file ws_gui_callbacks.c.

References WSGuiAppData::bookmark_mode, WSGuiAppData::dbus_data, WSGuiAppData::timer, ws_dbus_destroy(), WS_DBUS_INFO_TERMINATE, ws_dbus_notify, ws_gui_free_memory(), and ws_gui_set_bookmarks_sensitivity().

Referenced by main().

01626 {
01627         WSGuiApp* ws_gui_app = (WSGuiApp *)user_data;
01628         ws_gui_app->bookmark_mode = FALSE;
01629         ws_gui_set_bookmarks_sensitivity(ws_gui_app);
01630         g_timer_destroy(ws_gui_app->timer);
01631         ws_dbus_notify(ws_gui_app->dbus_data, WS_DBUS_INFO_TERMINATE);
01632         ws_dbus_destroy (ws_gui_app->dbus_data);
01633         ws_gui_free_memory(ws_gui_app);
01634         gtk_main_quit();
01635         exit (0);
01636 }

void ws_gui_popup_search ( GtkMenuItem *  menuitem,
gpointer  user_data 
)

search for selected text in a dictionary

search for selected text in a dictionary

Parameters:
menuitem - object which recived the signal
user_data - user data set when the signal handler was connected
Returns:

Definition at line 1349 of file ws_gui_callbacks.c.

References _, WSGuiAppData::dbus_data, ws_dbus_client_find_word, WSGuiAppData::ws_gui_clipboard_primary, WSGuiAppData::ws_gui_hildon_find_toolbar, WSGuiAppData::ws_gui_hildon_window, and WSGuiAppData::ws_gui_html.

Referenced by ws_gui_create_popup_menu().

01350 {
01351         WSGuiApp* ws_gui_app = (WSGuiApp*)user_data;
01352         gchar *temp;
01353         ws_gui_app->ws_gui_clipboard_primary = 
01354                 gtk_widget_get_clipboard(ws_gui_app->ws_gui_html,
01355                                         GDK_SELECTION_PRIMARY);
01356         temp = gtk_clipboard_wait_for_text(
01357                                         ws_gui_app->ws_gui_clipboard_primary);
01358         /*strip leading and trailing spaces*/
01359         g_strstrip(temp);
01360         if (temp != NULL || strcmp(temp, " "))
01361         {
01362                 //set object's property
01363                 g_object_set(G_OBJECT(ws_gui_app->ws_gui_hildon_find_toolbar),
01364                                 "prefix",
01365                                 temp,
01366                                 NULL);
01367                 ws_dbus_client_find_word (ws_gui_app->dbus_data, temp);
01368                 //gtk_widget_hide(ws_gui_app->ws_gui_list_hbox);
01369         }
01370         else
01371         {
01372                 hildon_banner_show_information(
01373                                 GTK_WIDGET(ws_gui_app->ws_gui_hildon_window),
01374                                 NULL,
01375                                 _("ws_ni_no_text_selected"));
01376         }
01377 }

void ws_gui_read_active_dictionaries ( gpointer  user_data  ) 

sets sensitivity of menu items due to dictionary mode

reads gconf entries and sets variables with a proper data; it is necessary for changing the bookmarks mode

Parameters:
user_data - user data set when the function was called
Returns:

Definition at line 2376 of file ws_gui_callbacks.c.

References WSGuiAppData::client, WSGuiAppData::directories, and GCONF_PATH.

Referenced by ws_gui_dictionary_close_bookmark(), and ws_gui_dictionary_open_bookmark().

02377 {
02378         WSGuiApp* ws_gui_app=(WSGuiApp*)user_data;
02379 
02380         
02381         ws_gui_app->directories = gconf_client_all_dirs(ws_gui_app->client,
02382                                         GCONF_PATH,
02383                                         NULL);
02384 }

void ws_gui_read_adjustment ( gpointer  user_data  ) 

read current adjustment value

read adjustment of left scrollwindow, which is necessary to navigate with arrow keys inside words list

Parameters:
user_data - user data set when the signal handler was connected
Returns:

Definition at line 1695 of file ws_gui_callbacks.c.

References WSGuiAppData::h_delta, SCROLL_STEP_H, SCROLL_STEP_V, WSGuiAppData::v_delta, WSGuiAppData::v_new_value, WSGuiAppData::ws_gui_hadj, WSGuiAppData::ws_gui_scrolledwindow_left, and WSGuiAppData::ws_gui_vadj.

Referenced by main().

01696 {
01697         WSGuiApp* ws_gui_app=(WSGuiApp*)user_data;
01698 
01699         ws_gui_app->ws_gui_hadj = 
01700                 gtk_scrolled_window_get_hadjustment(
01701                 GTK_SCROLLED_WINDOW(
01702                 ws_gui_app->ws_gui_scrolledwindow_left));
01703 
01704         ws_gui_app->h_delta = (ws_gui_app->ws_gui_hadj->upper -
01705                                 ws_gui_app->ws_gui_hadj->lower)/SCROLL_STEP_H;
01706 
01707         ws_gui_app->ws_gui_vadj = gtk_scrolled_window_get_vadjustment(
01708         GTK_SCROLLED_WINDOW(ws_gui_app->ws_gui_scrolledwindow_left));
01709 
01710         ws_gui_app->v_delta = (ws_gui_app->ws_gui_vadj->upper -
01711                                 ws_gui_app->ws_gui_vadj->lower)/SCROLL_STEP_V;
01712         ws_gui_app->v_new_value =
01713         gtk_adjustment_get_value(GTK_ADJUSTMENT(ws_gui_app->ws_gui_vadj)) +
01714                                                         ws_gui_app->v_delta;
01715 
01716         gtk_container_set_focus_vadjustment(
01717         GTK_CONTAINER(ws_gui_app->ws_gui_scrolledwindow_left), 
01718         gtk_scrolled_window_get_vadjustment(
01719                 GTK_SCROLLED_WINDOW(ws_gui_app->ws_gui_scrolledwindow_left)));
01720 
01721 }

void ws_gui_remove_bookmark_dialog ( gpointer  user_data  ) 

creates Remove Bookmark dialog window

Definition at line 1747 of file ws_gui_layout.c.

References _, WSGuiAppData::dbus_data, WSGuiAppData::last_word, ws_dbus_client_find_word, ws_dbus_client_remove_bookmark, ws_gui_fill_html(), WSGuiAppData::ws_gui_hildon_find_toolbar, WSGuiList::ws_gui_store, and WSGuiAppData::ws_gui_w_list.

Referenced by ws_gui_dictionary_remove_bookmark().

01748 {
01749         WSGuiApp* ws_gui_app=(WSGuiApp*)user_data;
01750         
01751         GtkWidget *dialog1;
01752         GtkWidget *dialog_vbox1;
01753         GtkWidget *vbox1;
01754         GtkWidget *hbox1;
01755         GtkWidget *entry1;
01756         GtkWidget *label;
01757         GtkWidget *cancelbutton1;
01758         GtkWidget *okbutton1;
01759         
01760         dialog1 = gtk_dialog_new ();
01761         gtk_window_set_title (GTK_WINDOW (dialog1), _("ws_ti_remove_bookmark"));
01762         gtk_window_set_default_size(GTK_WINDOW (dialog1), 300, 200);
01763         
01764         dialog_vbox1 = GTK_DIALOG (dialog1)->vbox;
01765         gtk_widget_show (dialog_vbox1);
01766         
01767         vbox1 = gtk_vbox_new (FALSE, 0);
01768         gtk_box_pack_start (GTK_BOX (dialog_vbox1), vbox1, TRUE, TRUE, 5);
01769         
01770         hbox1 = gtk_hbox_new (FALSE, 0);
01771         gtk_box_pack_start (GTK_BOX (vbox1), hbox1, TRUE, TRUE, 5);
01772         
01773         label = gtk_label_new(_("ws_ni_remove_bookmark_question"));
01774         gtk_box_pack_start (GTK_BOX (hbox1), label, TRUE, TRUE, 5);
01775         
01776         entry1 = gtk_entry_new ();
01777         gtk_box_pack_start (GTK_BOX (vbox1), entry1, TRUE, TRUE, 5);
01778         gtk_entry_set_text(GTK_ENTRY(entry1), ws_gui_app->last_word);
01779         gtk_entry_set_alignment (GTK_ENTRY(entry1), 0.5);
01780         gtk_entry_set_editable(GTK_ENTRY(entry1), FALSE);
01781         
01782         cancelbutton1 = gtk_button_new_from_stock (_("ws_db_ok"));
01783         gtk_dialog_add_action_widget (GTK_DIALOG (dialog1), 
01784                                       cancelbutton1, 
01785                                       GTK_RESPONSE_OK);
01786         
01787         okbutton1 = gtk_button_new_from_stock (_("ws_db_cancel"));
01788         gtk_dialog_add_action_widget (GTK_DIALOG (dialog1), 
01789                                       okbutton1, 
01790                                       GTK_RESPONSE_CANCEL);
01791         
01792         gtk_widget_show_all (dialog1);
01793         
01794         if (gtk_dialog_run(GTK_DIALOG(dialog1)) == GTK_RESPONSE_OK)
01795         {
01796                 gtk_widget_destroy(GTK_WIDGET(dialog1));
01797                 gchar* tmp;
01798                 
01799                 ws_dbus_client_remove_bookmark(ws_gui_app->dbus_data, 
01800                                         ws_gui_app->last_word);
01801 
01802                 ws_gui_app->last_word = NULL;
01803 
01804                 ws_gui_fill_html(" ", ws_gui_app);
01805 
01806                 g_object_get(G_OBJECT(ws_gui_app->ws_gui_hildon_find_toolbar),
01807                                 "prefix",
01808                                 &tmp,
01809                                 NULL);
01810                 
01811                 if (strlen(tmp) != 0)
01812                 {
01813                         ws_dbus_client_find_word (ws_gui_app->dbus_data, tmp);
01814                 }
01815                 else 
01816                 {       
01817                         g_log(G_LOG_DOMAIN, G_LOG_LEVEL_INFO, "strlen(tmp)=0");
01818                         gtk_list_store_clear(
01819                                        ws_gui_app->ws_gui_w_list->ws_gui_store);
01820                 }
01821         }
01822         else 
01823         {
01824                 gtk_widget_destroy(GTK_WIDGET(dialog1));
01825         }
01826 }

void ws_gui_search ( GtkWidget *  widget,
gpointer  user_data 
)

start search (sends typed word to the engine)

start searching, send typed word to DBUS and query for words

Parameters:
widget - object which recived the signal
user_data - user data set when the signal handler was connected
Returns:

Definition at line 1529 of file ws_gui_callbacks.c.

References _, WSGuiAppData::bookmark_mode, WSGuiAppData::dbus_data, WSGuiAppData::first_run, WSGuiAppData::last_searched, WSGuiAppData::last_searched_in_book, WSGuiAppData::last_word, WSGuiAppData::loading, WSGuiAppData::stop_clicked, ws_dbus_client_find_word, WSGuiAppData::ws_gui_hildon_find_toolbar, WSGuiAppData::ws_gui_hildon_window, and ws_gui_set_toolbar_avail().

Referenced by hildon_key_press_listener(), ws_gui_create_find_toolbar(), ws_gui_create_main_menu(), ws_gui_dictionary_close_bookmark(), ws_gui_dictionary_open_bookmark(), and ws_gui_search_home_handler().

01530 {
01531         WSGuiApp* ws_gui_app = (WSGuiApp*)user_data;
01532         
01533         ws_gui_app->stop_clicked = FALSE;
01534 
01535 // if (ws_gui_app->ws_gui_banner_flag == FALSE) 
01536         //{
01537         gchar* ws_gui_text = NULL;
01538         g_object_get(G_OBJECT(ws_gui_app->ws_gui_hildon_find_toolbar),
01539                 "prefix",
01540                 &ws_gui_text,
01541                 NULL);
01542 
01543         if (ws_gui_app->bookmark_mode == FALSE) 
01544         {
01545                 if (ws_gui_app->first_run == TRUE)
01546                 {
01547                         ws_gui_app->first_run = FALSE;
01548                 }
01549 
01550                 g_free(ws_gui_app->last_searched);
01551                 ws_gui_app->last_searched = NULL;
01552                 ws_gui_app->last_searched = g_strdup(ws_gui_text);
01553         }
01554         else
01555         {
01556                 g_free(ws_gui_app->last_searched_in_book);
01557                 ws_gui_app->last_searched_in_book = NULL;
01558                 ws_gui_app->last_searched_in_book = g_strdup(ws_gui_text);
01559         }
01560         
01561         g_strstrip(ws_gui_text);
01562         if (strlen(ws_gui_text) != 0) 
01563         {
01564                 //gtk_widget_show(ws_gui_app->ws_gui_banner_list_searching);
01565                 
01566                 ws_gui_app->loading = TRUE;
01567                 ws_gui_set_toolbar_avail(ws_gui_app);
01568 
01569                 //ws_gui_app->ws_gui_banner_flag = TRUE;
01570                 //ws_gui_fill_html(" ", ws_gui_app);
01571                 //ws_gui_app->html_flag = FALSE;
01572                 ws_dbus_client_find_word (ws_gui_app->dbus_data, ws_gui_text);
01573                 //gtk_widget_hide(GTK_WIDGET(ws_gui_app->ws_gui_list_hbox));
01574                 
01575                 g_free(ws_gui_text);
01576         }
01577         else 
01578         {
01579                 hildon_banner_show_information(GTK_WIDGET(
01580                                 ws_gui_app->ws_gui_hildon_window),
01581                                 NULL,
01582                         _("ws_ni_no_word_typed"));
01583         }
01584         g_free(ws_gui_app->last_word);
01585         ws_gui_app->last_word=NULL;
01586         //}
01587 }

void ws_gui_search_stop ( GtkButton *  button,
gpointer  user_data 
)

abort search

stop search process

Parameters:
button - object which recived the signal
user_data - user data set when the signal handler was connected
Returns:

Definition at line 1595 of file ws_gui_callbacks.c.

References _, WSGuiAppData::dbus_data, WSGuiAppData::loading, WSGuiAppData::stop_clicked, WS_DBUS_INFO_STOP_SEARCH, ws_dbus_notify, WSGuiAppData::ws_gui_hildon_window, and ws_gui_set_toolbar_avail().

Referenced by hildon_key_press_listener(), ws_gui_create_find_toolbar(), and ws_gui_create_main_menu().

01596 {
01597         WSGuiApp* ws_gui_app = (WSGuiApp *)user_data;
01598         ws_gui_app->stop_clicked = TRUE;
01599 // if (ws_gui_app->ws_gui_banner_flag == TRUE || ws_gui_app->loading == TRUE) 
01600         if (ws_gui_app->loading == TRUE) 
01601         {
01602                 //gtk_widget_hide(GTK_WIDGET(ws_gui_app->ws_gui_banner_list_searching));
01603 
01604                 ws_gui_app->loading = FALSE;
01605                 ws_gui_set_toolbar_avail(ws_gui_app);           
01606 
01607                 //ws_gui_app->ws_gui_banner_flag = FALSE;
01608                 
01609                 ws_dbus_notify(ws_gui_app->dbus_data, WS_DBUS_INFO_STOP_SEARCH);
01610                 hildon_banner_show_information(GTK_WIDGET(
01611                                 ws_gui_app->ws_gui_hildon_window),
01612                                 NULL,
01613                         _("ws_ni_search_aborted"));
01614         }
01615 }

void ws_gui_set_bookmark_menu_items ( GtkMenuItem *  menuitem,
gpointer  user_data 
)

sets sensitivity of Bookmarks menu items due to selection made

sets sensitivity of menu items due to user selection made

Parameters:
user_data - user data set when the function was called
Returns:

Definition at line 2339 of file ws_gui_callbacks.c.

References WSGuiAppData::bookmark_mode, WSGuiAppData::last_word, WSGuiAppData::ws_gui_menu, WSGuiMenu::ws_gui_menu_add_bookmark, and WSGuiMenu::ws_gui_menu_remove_bookmark.

Referenced by ws_gui_create_main_menu().

02340 {
02341         WSGuiApp* ws_gui_app=(WSGuiApp*)user_data;
02342         if (ws_gui_app->bookmark_mode == TRUE && ws_gui_app->last_word != NULL)
02343         {
02344         gtk_widget_set_sensitive(
02345         GTK_WIDGET(ws_gui_app->ws_gui_menu->ws_gui_menu_remove_bookmark),
02346         TRUE);
02347         }
02348         else
02349         {
02350         gtk_widget_set_sensitive(
02351         GTK_WIDGET(ws_gui_app->ws_gui_menu->ws_gui_menu_remove_bookmark),
02352         FALSE);
02353         }
02354 
02355         if (ws_gui_app->last_word == NULL || 
02356         (ws_gui_app->last_word[0] == '\0') ||
02357         ws_gui_app->bookmark_mode == TRUE)
02358         {
02359         gtk_widget_set_sensitive(
02360         GTK_WIDGET(ws_gui_app->ws_gui_menu->ws_gui_menu_add_bookmark),
02361         FALSE);
02362         }
02363         else
02364         {
02365         gtk_widget_set_sensitive(
02366         GTK_WIDGET(ws_gui_app->ws_gui_menu->ws_gui_menu_add_bookmark),
02367         TRUE);
02368         }
02369 }

void ws_gui_set_bookmarks_sensitivity ( gpointer  user_data  ) 

sets sensitivity of Bookmarks menu items

sets sensitivity of menu items due to bookmark's mode

Parameters:
user_data - user data set when the function was called
Returns:

Definition at line 2225 of file ws_gui_callbacks.c.

References WSGuiAppData::bookmark_mode, WSGuiAppData::client, WSGuiAppData::directories, WSGuiAppData::directories_last, GCONF_PATH, WSGuiAppData::ws_gui_menu, WSGuiMenu::ws_gui_menu_add_bookmark, WSGuiMenu::ws_gui_menu_close_bookmark, WSGuiMenu::ws_gui_menu_dictionaries, WSGuiMenu::ws_gui_menu_open_bookmark, and WSGuiMenu::ws_gui_menu_remove_bookmark.

Referenced by ws_gui_create_window(), ws_gui_dictionary_close_bookmark(), ws_gui_dictionary_open_bookmark(), ws_gui_menu_quit(), and ws_gui_on_exit().

02226 {
02227         WSGuiApp* ws_gui_app=(WSGuiApp*)user_data;
02228         int i;
02229         gchar *string;
02230         gchar *name;
02231 
02232         if (ws_gui_app->bookmark_mode == TRUE)
02233         {
02234                 g_slist_free(ws_gui_app->directories_last);
02235                 ws_gui_app->directories_last = NULL;
02236                 ws_gui_app->directories_last = g_slist_alloc();
02237                 g_slist_free(ws_gui_app->directories);
02238                 ws_gui_app->directories = g_slist_alloc();
02239 
02240                 ws_gui_app->directories = gconf_client_all_dirs(
02241                                                         ws_gui_app->client, 
02242                                                         GCONF_PATH, NULL);
02243                 
02244         for (i=0; i<g_slist_length(ws_gui_app->directories); i++)
02245         {
02246                 string = (gchar*)g_slist_nth_data(ws_gui_app->directories, i);
02247                 name = g_path_get_basename(string);
02248                 string = g_strconcat(string, "/active", NULL);
02249                 
02250                 if (gconf_client_get_bool(ws_gui_app->client, string, NULL) == TRUE) 
02251                 {
02252                         ws_gui_app->directories_last = 
02253                                 g_slist_append(ws_gui_app->directories_last, 
02254                                         string);
02255                 }
02256 
02257                 if (strcmp(name, "bookmarks") == 0)
02258                 {
02259                         gconf_client_set_bool(ws_gui_app->client, 
02260                                         string, 
02261                                         TRUE, 
02262                                         NULL);
02263                 }
02264                 else
02265                 {
02266                         gconf_client_set_bool(ws_gui_app->client, 
02267                                         string, 
02268                                         FALSE, 
02269                                         NULL);
02270                 }
02271         }
02272 
02273         //setting sensitivity of components
02274         gtk_widget_set_sensitive(
02275                 GTK_WIDGET(ws_gui_app->ws_gui_menu->ws_gui_menu_open_bookmark),
02276                 FALSE);
02277         gtk_widget_set_sensitive(
02278                 GTK_WIDGET(ws_gui_app->ws_gui_menu->ws_gui_menu_close_bookmark),
02279                 TRUE);
02280         gtk_widget_set_sensitive(
02281         GTK_WIDGET(ws_gui_app->ws_gui_menu->ws_gui_menu_remove_bookmark),
02282         TRUE);
02283         gtk_widget_set_sensitive(
02284                 GTK_WIDGET(ws_gui_app->ws_gui_menu->ws_gui_menu_add_bookmark),
02285                 FALSE);
02286         gtk_widget_set_sensitive(
02287                 GTK_WIDGET(ws_gui_app->ws_gui_menu->ws_gui_menu_dictionaries),
02288                 FALSE);
02289         }
02290         else 
02291         {
02292         gchar *bookmarks_path = g_strconcat(GCONF_PATH, "/bookmarks/active", NULL);
02293         if (g_slist_length(ws_gui_app->directories_last) > 0)
02294         {
02295         gconf_client_set_bool(ws_gui_app->client, bookmarks_path, FALSE, NULL);
02296         }
02297         
02298         for (i=0; i<g_slist_length(ws_gui_app->directories_last); i++)
02299         {
02300                 string = (gchar*)g_slist_nth_data(ws_gui_app->directories_last, 
02301                                                 i);
02302                 
02303                 if (string != NULL)
02304                 {
02305                 gconf_client_set_bool(ws_gui_app->client, 
02306                                 string, 
02307                                 TRUE, 
02308                                 NULL);
02309                 }
02310         }
02311 
02312         //setting sensitivity of components
02313         gtk_widget_set_sensitive(
02314                 GTK_WIDGET(ws_gui_app->ws_gui_menu->ws_gui_menu_open_bookmark),
02315                 TRUE);
02316         gtk_widget_set_sensitive(
02317                 GTK_WIDGET(ws_gui_app->ws_gui_menu->ws_gui_menu_close_bookmark),
02318                 FALSE);
02319         gtk_widget_set_sensitive(
02320         GTK_WIDGET(ws_gui_app->ws_gui_menu->ws_gui_menu_remove_bookmark),
02321         FALSE);
02322         gtk_widget_set_sensitive(
02323                 GTK_WIDGET(ws_gui_app->ws_gui_menu->ws_gui_menu_add_bookmark),
02324                 TRUE);
02325         gtk_widget_set_sensitive(
02326                 GTK_WIDGET(ws_gui_app->ws_gui_menu->ws_gui_menu_dictionaries),
02327                 TRUE);
02328 
02329         g_free(bookmarks_path);
02330         }
02331 
02332 }

guint ws_gui_show_popup ( gpointer  user_data  ) 

shows popup when user clicks and holds

displays popup menu if user holds a stylus more than PRESS_TIME seconds

Parameters:
user_data - user data set when the signal handler was connected
Returns:

Definition at line 1837 of file ws_gui_callbacks.c.

References PRESS_TIME, WSGuiAppData::timer, and ws_gui_create_popup_menu().

Referenced by ws_gui_button_press().

01838 {
01839         WSGuiApp* ws_gui_app=(WSGuiApp*)user_data;
01840         gdouble tmp = g_timer_elapsed(ws_gui_app->timer, NULL);
01841         if (tmp > PRESS_TIME)
01842         {
01843                 ws_gui_create_popup_menu(ws_gui_app);
01844         }
01845         return (guint)(FALSE);
01846 
01847 }

void ws_gui_signal_hander ( GError *  error,
GArray *  words,
gpointer  user_data 
)

handle dbus signals

this function handles signals from dbus; it is called when there are any messages from other modules

Parameters:
error - error message recived from DBUS
words - array with recived data structure
user_data - pointer to data structure
Returns:

Definition at line 111 of file ws_gui_callbacks.c.

References _, WSGuiAppData::bookmark_avail, WSGuiAppData::caching_flag, create_and_fill_model(), HISTORY_LEN, WSGuiAppData::html_flag, WS_DBUS_BOOKMARKS_ADDED_FAIL, WS_DBUS_BOOKMARKS_ADDED_OK, WS_DBUS_BOOKMARKS_REMOVED_FAIL, WS_DBUS_BOOKMARKS_REMOVED_OK, WS_DBUS_ERROR_DICTIONARY_NOT_LOAD, WS_DBUS_ERROR_ENGINE_NOT_FOUND, WS_DBUS_ERROR_FILE_NOT_FOUND, WS_DBUS_EXTRACT_FILE, WS_DBUS_EXTRACT_FILE_FINISHED, WS_DBUS_INFO_CACHING, WS_DBUS_INFO_CACHING_FINISHED, WS_DBUS_LOAD_BOOKMARK_FAILED, WS_DBUS_TRANSLATION_FINISHED, WS_DBUS_TRANSLATION_STARTED, WS_DBUS_WORDS_LIST_FILLED_NOT_FULL, WS_DBUS_WORDS_LIST_FINISHED, WS_DBUS_WORDS_LIST_FULL, WS_DBUS_WORDS_LIST_STARTED, WSGuiAppData::ws_gui_banner_caching, WSGuiAppData::ws_gui_banner_extracting, WSGuiAppData::ws_gui_banner_list_searching, WSGuiAppData::ws_gui_banner_translation_loading, ws_gui_fill_html(), WSGuiAppData::ws_gui_hildon_find_toolbar, WSGuiAppData::ws_gui_hildon_window, WSGuiAppData::ws_gui_history, WSGuiAppData::ws_gui_history_cur_pos, WSGuiAppData::ws_gui_list_eventbox, WSGuiAppData::ws_gui_menu, WSGuiMenu::ws_gui_menu_bookmarks, WSGuiMenu::ws_gui_menu_search, WSGuiList::ws_gui_model, WSGuiList::ws_gui_store, WSGuiList::ws_gui_view, WSGuiAppData::ws_gui_w_list, and WSGuiAppData::ws_message_dialog.

Referenced by main().

00112 {
00113         WSGuiApp* ws_gui_app=(WSGuiApp*)user_data;
00114         osso_rpc_t osss_data;
00115         osss_data = g_array_index (words, osso_rpc_t, 0);
00116         switch(osss_data.value.i)
00117         {
00118                 case WS_DBUS_ERROR_ENGINE_NOT_FOUND:
00119                 {
00120                         ws_gui_app->ws_message_dialog = 
00121                         gtk_message_dialog_new(
00122                                 GTK_WINDOW(ws_gui_app->ws_gui_hildon_window),
00123                                 GTK_DIALOG_DESTROY_WITH_PARENT,
00124                                 GTK_MESSAGE_ERROR,
00125                                 GTK_BUTTONS_OK,
00126                                 _("ws_ni_error_occured"));
00127                         gtk_widget_show_all(ws_gui_app->ws_message_dialog);
00128 
00129                         g_signal_connect_swapped(
00130                                 GTK_OBJECT (ws_gui_app->ws_message_dialog),
00131                                 "response",
00132                                 G_CALLBACK (gtk_main_quit),
00133                                 ws_gui_app);
00134                         break;
00135                 }
00136 
00137                 case WS_DBUS_ERROR_FILE_NOT_FOUND:
00138                 {
00139                         ws_gui_app->ws_message_dialog = 
00140                                 gtk_message_dialog_new(
00141                                 GTK_WINDOW(ws_gui_app->ws_gui_hildon_window),
00142                                 GTK_DIALOG_DESTROY_WITH_PARENT,
00143                                 GTK_MESSAGE_ERROR,
00144                                 GTK_BUTTONS_OK,
00145                                 _("ws_ni_no_dictionary_available"));
00146 
00147                         gtk_widget_show_all(ws_gui_app->ws_message_dialog);
00148 
00149                         GArray *tmp;
00150                         tmp = g_array_new(TRUE, TRUE, sizeof(gchar*));
00151                         gtk_list_store_clear(
00152                                 ws_gui_app->ws_gui_w_list->ws_gui_store);
00153                         ws_gui_app->ws_gui_w_list->ws_gui_model = 
00154                                 create_and_fill_model(tmp, ws_gui_app);
00155                         ws_gui_fill_html(" ", ws_gui_app);
00156                         ws_gui_app->html_flag = FALSE;
00157 
00158                         gtk_widget_set_sensitive(
00159                         GTK_WIDGET(ws_gui_app->ws_gui_hildon_find_toolbar),
00160                         FALSE);
00161                         gtk_widget_set_sensitive(
00162                         GTK_WIDGET(ws_gui_app->ws_gui_menu->ws_gui_menu_search),
00163                         FALSE);
00164 
00165                         if (gtk_dialog_run(
00166                                 GTK_DIALOG(ws_gui_app->ws_message_dialog)) 
00167                                                         == GTK_RESPONSE_OK)
00168                         {
00169                                 gtk_widget_destroy(
00170                                                 ws_gui_app->ws_message_dialog);
00171                         }
00172                         break;
00173                 }
00174 
00175                 case WS_DBUS_INFO_CACHING:
00176                 {
00177                         ws_gui_app->ws_gui_banner_caching =
00178                                 hildon_banner_show_progress(
00179                                 GTK_WIDGET(ws_gui_app->ws_gui_hildon_window),
00180                                 NULL,
00181                                 _("ws_pb_caching"));
00182                 ws_gui_app->caching_flag = TRUE;
00183                 hildon_banner_set_fraction(
00184                         HILDON_BANNER(ws_gui_app->ws_gui_banner_caching),
00185                         0.0);
00186                 gtk_widget_set_sensitive(
00187                         GTK_WIDGET(ws_gui_app->ws_gui_hildon_find_toolbar),
00188                         FALSE);
00189                 gtk_widget_set_sensitive(
00190                         GTK_WIDGET(ws_gui_app->ws_gui_menu->ws_gui_menu_search),
00191                         FALSE);
00192                         gtk_widget_set_sensitive(
00193                         GTK_WIDGET(ws_gui_app->ws_gui_menu->ws_gui_menu_bookmarks),
00194                         FALSE);
00195                 gtk_widget_set_sensitive(
00196                 GTK_WIDGET(ws_gui_app->ws_gui_w_list->ws_gui_view),
00197                 FALSE);
00198 
00199                 break;
00200                 }
00201 
00202                 case WS_DBUS_INFO_CACHING_FINISHED:
00203                 {
00204                 gtk_widget_destroy(
00205                 GTK_WIDGET(ws_gui_app->ws_gui_banner_caching));
00206                 ws_gui_app->caching_flag = FALSE;
00207                 gtk_widget_set_sensitive(
00208                 GTK_WIDGET(ws_gui_app->ws_gui_hildon_find_toolbar),
00209                 TRUE);
00210                 gtk_widget_set_sensitive(
00211                 GTK_WIDGET(ws_gui_app->ws_gui_menu->ws_gui_menu_search),
00212                 TRUE);
00213                 gtk_widget_set_sensitive(
00214                 GTK_WIDGET(ws_gui_app->ws_gui_menu->ws_gui_menu_bookmarks),
00215                 TRUE);
00216                 gtk_widget_set_sensitive(
00217                 GTK_WIDGET(ws_gui_app->ws_gui_w_list->ws_gui_view),
00218                 TRUE);
00219 
00220                 break;
00221                 }
00222 
00223                 case WS_DBUS_ERROR_DICTIONARY_NOT_LOAD:
00224                 {
00225                         if (ws_gui_app->ws_gui_history_cur_pos >= 0 &&
00226                         ws_gui_app->ws_gui_history_cur_pos <=HISTORY_LEN)
00227                         { 
00228                                 g_array_remove_index(ws_gui_app->ws_gui_history,
00229                                         ws_gui_app->ws_gui_history_cur_pos);
00230                         }
00231 
00232                         ws_gui_app->ws_message_dialog = gtk_message_dialog_new(
00233                                 GTK_WINDOW(ws_gui_app->ws_gui_hildon_window),
00234                                 GTK_DIALOG_DESTROY_WITH_PARENT,
00235                                 GTK_MESSAGE_ERROR,
00236                                 GTK_BUTTONS_OK,
00237                                 _("ws_ni_dictionary_unavailable"));
00238                 gtk_widget_show_all(ws_gui_app->ws_message_dialog);
00239                 if (gtk_dialog_run(
00240                 GTK_DIALOG(ws_gui_app->ws_message_dialog)) 
00241                                                         == GTK_RESPONSE_OK)
00242                 {
00243                         gtk_widget_destroy(ws_gui_app->ws_message_dialog);
00244                 }
00245                 break;
00246                 }
00247                 
00248                 case  WS_DBUS_BOOKMARKS_ADDED_OK:
00249                 {
00250                         hildon_banner_show_information(GTK_WIDGET(
00251                                         ws_gui_app->ws_gui_hildon_window),
00252                                         NULL,
00253                                         _("ws_ni_bookmark_added"));
00254                 break;
00255                 }
00256 
00257                 case WS_DBUS_BOOKMARKS_REMOVED_OK:
00258                 {
00259                         hildon_banner_show_information(GTK_WIDGET(
00260                                         ws_gui_app->ws_gui_hildon_window),
00261                                         NULL,
00262                                         _("ws_ni_bookmark_removed"));
00263                 break;
00264                 }
00265         
00266                 case WS_DBUS_BOOKMARKS_ADDED_FAIL:
00267                 {
00268                         hildon_banner_show_information(GTK_WIDGET(
00269                                         ws_gui_app->ws_gui_hildon_window),
00270                                         NULL,
00271                                         _("ws_ni_bookmark_not_added"));
00272                 break;
00273                 }
00274 
00275                 case WS_DBUS_BOOKMARKS_REMOVED_FAIL:
00276                 {
00277                         hildon_banner_show_information(GTK_WIDGET(
00278                                         ws_gui_app->ws_gui_hildon_window),
00279                                         NULL,
00280                                         _("ws_ni_bookmark_not_removed"));
00281                 break;
00282                 }
00283 
00284                 case WS_DBUS_LOAD_BOOKMARK_FAILED:
00285                 {
00286                 gtk_widget_set_sensitive(
00287                 GTK_WIDGET(ws_gui_app->ws_gui_menu->ws_gui_menu_bookmarks),
00288                 FALSE);
00289                 ws_gui_app->bookmark_avail = FALSE;
00290                                 
00291                         ws_gui_app->ws_message_dialog = 
00292                         gtk_message_dialog_new(
00293                                 GTK_WINDOW(ws_gui_app->ws_gui_hildon_window),
00294                                 GTK_DIALOG_DESTROY_WITH_PARENT,
00295                                 GTK_MESSAGE_ERROR,
00296                                 GTK_BUTTONS_OK,
00297                                 _("ws_ni_bookmarks_unavailable"));
00298 
00299                         if (gtk_dialog_run(
00300                                 GTK_DIALOG(ws_gui_app->ws_message_dialog)) 
00301                                                         == GTK_RESPONSE_OK)
00302                         {
00303                                 gtk_widget_destroy(
00304                                                 ws_gui_app->ws_message_dialog);
00305                         }
00306 
00307                         
00308                         break;  
00309                 }
00310                 case WS_DBUS_EXTRACT_FILE:
00311                 {
00312                         ws_gui_app->ws_gui_banner_extracting =
00313                         hildon_banner_show_animation(
00314                                 GTK_WIDGET(ws_gui_app->ws_gui_hildon_window),
00315                                 NULL,
00316                                 _("ws_pb_extracting"));
00317 
00318                         ws_gui_app->caching_flag = TRUE;
00319                         
00320                         gtk_widget_set_sensitive(
00321                         GTK_WIDGET(ws_gui_app->ws_gui_hildon_find_toolbar),
00322                         FALSE);
00323                         gtk_widget_set_sensitive(
00324                         GTK_WIDGET(ws_gui_app->ws_gui_menu->ws_gui_menu_search),
00325                         FALSE);
00326 
00327                 break;
00328                 }
00329 
00330                 case WS_DBUS_EXTRACT_FILE_FINISHED:
00331                 {
00332                         gtk_widget_destroy(
00333                         GTK_WIDGET(ws_gui_app->ws_gui_banner_extracting));
00334                         
00335                         ws_gui_app->caching_flag = FALSE;
00336                         
00337                         hildon_banner_show_information(GTK_WIDGET(
00338                                         ws_gui_app->ws_gui_hildon_window),
00339                                         NULL,
00340                                 _("ws_ni_dictionary_added"));
00341                         
00342                         gtk_widget_set_sensitive(
00343                         GTK_WIDGET(ws_gui_app->ws_gui_hildon_find_toolbar),
00344                         TRUE);
00345                         gtk_widget_set_sensitive(
00346                         GTK_WIDGET(ws_gui_app->ws_gui_menu->ws_gui_menu_search),
00347                         TRUE);
00348 
00349                         break;
00350                 }
00351 
00352                 case  WS_DBUS_WORDS_LIST_FULL:
00353                 {
00354                         gtk_widget_show_all(GTK_WIDGET(ws_gui_app->ws_gui_list_eventbox));
00355                         /*gtk_widget_show(GTK_WIDGET(ws_gui_app->ws_gui_list_hbox));*/
00356                 break;
00357                 }
00358 
00359                 case  WS_DBUS_WORDS_LIST_FILLED_NOT_FULL:
00360                 {
00361                         gtk_widget_hide_all(GTK_WIDGET(ws_gui_app->ws_gui_list_eventbox));
00362                         /*gtk_widget_hide(GTK_WIDGET(ws_gui_app->ws_gui_list_hbox));*/
00363                 break;
00364                 }
00365 
00366                 case  WS_DBUS_WORDS_LIST_FINISHED:
00367                 {
00368                         gtk_widget_set_sensitive(
00369                         GTK_WIDGET(ws_gui_app->ws_gui_menu->ws_gui_menu_bookmarks),
00370                         TRUE);
00371                         gtk_widget_hide(GTK_WIDGET(ws_gui_app->ws_gui_banner_list_searching));
00372                 break;
00373                 }
00374 
00375                 case  WS_DBUS_TRANSLATION_FINISHED:
00376                 {
00377                         gtk_widget_hide(ws_gui_app->ws_gui_banner_translation_loading);
00378                 break;
00379                 }
00380 
00381                 case  WS_DBUS_WORDS_LIST_STARTED:
00382                 {
00383                         gtk_widget_set_sensitive(
00384                         GTK_WIDGET(ws_gui_app->ws_gui_menu->ws_gui_menu_bookmarks),
00385                         FALSE);
00386                         gtk_widget_show(GTK_WIDGET(ws_gui_app->ws_gui_banner_list_searching));
00387                 break;
00388                 }
00389 
00390                 case  WS_DBUS_TRANSLATION_STARTED:
00391                 {
00392                         gtk_widget_show(ws_gui_app->ws_gui_banner_translation_loading);
00393                 break;
00394                 }
00395 
00396         }
00397 }

void ws_gui_url_requested ( GtkHTML *  html,
const char *  url,
GtkHTMLStream *  stream 
)

necessary to load images into translation (html) area

allows to display image in html area

Parameters:
html - object which received a signal
url - url to the image
stream - html stream
Returns:

Definition at line 1730 of file ws_gui_callbacks.c.

Referenced by ws_gui_create_window().

01734 {
01735         int fd;
01736 
01737         if (url && !strncmp (url, "file:", 5)) {
01738                 url += 5;
01739                 fd = open (url, O_RDONLY);
01740                 if (fd != -1) {
01741                         gchar *buf;
01742                         size_t size;
01743                         buf = alloca (8192);
01744                         while ((size = read (fd, buf, 8192)) > 0) {
01745                                 gtk_html_stream_write (stream, buf, size);
01746                         }
01747                 gtk_html_stream_close(stream, size == -1
01748                                         ? GTK_HTML_STREAM_ERROR
01749                                         : GTK_HTML_STREAM_OK);
01750                 close (fd);
01751 
01752                 return;
01753                 }
01754         }
01755 
01756         gtk_html_stream_close (stream, GTK_HTML_STREAM_ERROR);
01757 }

void ws_gui_words_list_hide ( GtkToggleButton *  togglebutton,
gpointer  user_data 
)

allow to hide words list from toolbar

this function allow to hide words list using toggle button placed in the find toolbar

Parameters:
toolbar - the object which received the signal
user_data - user data set when the signal handler was connected
Returns:

Definition at line 900 of file ws_gui_callbacks.c.

References WSGuiAppData::ws_gui_list_vbox, WSGuiAppData::ws_gui_menu, WSGuiMenu::ws_gui_menu_hide_list, and WSGuiAppData::ws_gui_toobar_button_hide.

Referenced by ws_gui_create_find_toolbar().

00901 {
00902         WSGuiApp* ws_gui_app = (WSGuiApp *)user_data;
00903 
00904         if (gtk_toggle_tool_button_get_active(
00905                 GTK_TOGGLE_TOOL_BUTTON(ws_gui_app->ws_gui_toobar_button_hide)))
00906         {
00907                 gtk_widget_hide(ws_gui_app->ws_gui_list_vbox);
00908                 gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(
00909                                         ws_gui_app->ws_gui_toobar_button_hide),
00910                                         TRUE);
00911                 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(
00912                                 ws_gui_app->ws_gui_menu->ws_gui_menu_hide_list),
00913                                 TRUE);
00914         }
00915         else 
00916         {
00917                 gtk_widget_show(ws_gui_app->ws_gui_list_vbox);
00918                 gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(
00919                                         ws_gui_app->ws_gui_toobar_button_hide),
00920                                         FALSE);
00921                 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(
00922                                 ws_gui_app->ws_gui_menu->ws_gui_menu_hide_list),
00923                                 FALSE);
00924         }
00925 }

void ws_gui_words_list_hide_from_menu ( GtkCheckMenuItem *  checkmenuitem,
gpointer  user_data 
)

allow to hide words list from menu

this function allow to hide words list using menu item from application menu

Parameters:
checkmenuitem - the object which received the signal
user_data - user data set when the signal handler was connected
Returns:

Definition at line 866 of file ws_gui_callbacks.c.

References WSGuiAppData::ws_gui_list_vbox, WSGuiAppData::ws_gui_menu, WSGuiMenu::ws_gui_menu_hide_list, and WSGuiAppData::ws_gui_toobar_button_hide.

Referenced by ws_gui_create_main_menu().

00868 {
00869         WSGuiApp* ws_gui_app = (WSGuiApp *)user_data;
00870         if (gtk_check_menu_item_get_active(
00871         GTK_CHECK_MENU_ITEM(ws_gui_app->ws_gui_menu->ws_gui_menu_hide_list)))
00872         {
00873                 gtk_widget_hide(ws_gui_app->ws_gui_list_vbox);
00874                 gtk_toggle_tool_button_set_active(
00875                 GTK_TOGGLE_TOOL_BUTTON(ws_gui_app->ws_gui_toobar_button_hide),
00876                 TRUE);
00877                 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(
00878                                 ws_gui_app->ws_gui_menu->ws_gui_menu_hide_list),
00879                                 TRUE);
00880         }
00881         else 
00882         {
00883                 gtk_widget_show(ws_gui_app->ws_gui_list_vbox);
00884                 gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(
00885                                         ws_gui_app->ws_gui_toobar_button_hide),
00886                                         FALSE);
00887                 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(
00888                                 ws_gui_app->ws_gui_menu->ws_gui_menu_hide_list),
00889                                 FALSE);
00890         }
00891 }


Variable Documentation

gboolean WSGuiAppData::bookmark_avail [inherited]

flag, denpends on availablity of bookmarks module

Definition at line 283 of file ws_gui.h.

Referenced by ws_gui_create_popup_menu(), ws_gui_create_window(), ws_gui_dictionary_chooser(), and ws_gui_signal_hander().

gboolean WSGuiAppData::bookmark_mode [inherited]

flag, shows either bookmarks mode is on or off

Definition at line 284 of file ws_gui.h.

Referenced by ws_gui_create_popup_menu(), ws_gui_create_window(), ws_gui_fill_html(), ws_gui_history_add(), ws_gui_menu_quit(), ws_gui_on_exit(), ws_gui_search(), ws_gui_set_bookmark_menu_items(), and ws_gui_set_bookmarks_sensitivity().

gboolean WSGuiAppData::bookmark_on [inherited]

flag which switch beetween bookmark and normal mode

Definition at line 279 of file ws_gui.h.

GArray* WSGuiAppData::bookmarks_list [inherited]

array wchich contains bookmarked words

Definition at line 278 of file ws_gui.h.

gboolean WSGuiAppData::caching_flag [inherited]

flag; used when caching is being performed

Definition at line 223 of file ws_gui.h.

Referenced by ws_dbus_progress_bar(), ws_gui_create_window(), and ws_gui_signal_hander().

GConfClient* WSGuiAppData::client [inherited]

variable necessary to read from gconf

Definition at line 272 of file ws_gui.h.

Referenced by main(), ws_gui_dict_availablity(), ws_gui_dictionary_chooser(), ws_gui_dictionary_optimizer(), ws_gui_dictionary_remover(), ws_gui_load_dict(), ws_gui_read_active_dictionaries(), and ws_gui_set_bookmarks_sensitivity().

gdouble WSGuiAppData::cur_hadj [inherited]

current vertical adjustment of horizontal scrollbar in words list

Definition at line 247 of file ws_gui.h.

gdouble WSGuiAppData::cur_vadj [inherited]

current vertical adjustment of vertical scrollbar in words list

Definition at line 245 of file ws_gui.h.

WSDBusData* WSGuiAppData::dbus_data [inherited]

DBUS declaration.

Definition at line 266 of file ws_gui.h.

Referenced by create_and_fill_model(), main(), ws_gui_add_bookmark_dialog(), ws_gui_dbus_return_words(), ws_gui_dictionary_chooser(), ws_gui_dictionary_loader(), ws_gui_dictionary_optimizer(), ws_gui_dictionary_remover(), ws_gui_history_back(), ws_gui_history_next(), ws_gui_load_dict(), ws_gui_menu_quit(), ws_gui_on_exit(), ws_gui_popup_search(), ws_gui_remove_bookmark_dialog(), ws_gui_search(), ws_gui_search_stop(), ws_gui_view_cursor_changed(), and ws_refresh_search_results().

GSList* WSGuiAppData::directories [inherited]

list consist of directories previously read from gconf

Definition at line 270 of file ws_gui.h.

Referenced by ws_gui_create_window(), ws_gui_dict_availablity(), ws_gui_dictionary_chooser(), ws_gui_dictionary_optimizer(), ws_gui_dictionary_remover(), ws_gui_read_active_dictionaries(), and ws_gui_set_bookmarks_sensitivity().

GSList* WSGuiAppData::directories_last [inherited]

list consist of directories previously read from gconf

Definition at line 271 of file ws_gui.h.

Referenced by ws_gui_set_bookmarks_sensitivity().

gdouble WSGuiAppData::h_delta [inherited]

variable used for moving horizontal scrollbar in words list

Definition at line 243 of file ws_gui.h.

Referenced by hildon_key_press_listener(), and ws_gui_read_adjustment().

gdouble WSGuiAppData::h_new_value [inherited]

variable used for moving horizontal scrollbar in words list

Definition at line 244 of file ws_gui.h.

Referenced by hildon_key_press_listener().

gchar* WSGuiAppData::last_word [inherited]

stores last choosen word on the words list (necessary for bookmarks)

Definition at line 285 of file ws_gui.h.

Referenced by create_and_fill_model(), format_html(), ws_gui_add_bookmark_dialog(), ws_gui_create_popup_menu(), ws_gui_create_window(), ws_gui_dbus_return_words(), ws_gui_dictionary_add_bookmark(), ws_gui_dictionary_remove_bookmark(), ws_gui_free_memory(), ws_gui_remove_bookmark_dialog(), ws_gui_search(), ws_gui_set_bookmark_menu_items(), and ws_gui_view_cursor_changed().

GtkWidget* WSGuiAppData::licence_dialog [inherited]

variable necessary to create license dialog

Definition at line 276 of file ws_gui.h.

PangoFontDescription* WSGuiAppData::p [inherited]

schema, which allows to format text on widgets

Definition at line 275 of file ws_gui.h.

Referenced by ws_gui_about_application(), ws_gui_create_window(), and ws_gui_free_memory().

gdouble WSGuiAppData::prev_hadj [inherited]

previous vertical adjustment of horizontal scrollbar in words list

Definition at line 248 of file ws_gui.h.

gdouble WSGuiAppData::prev_vadj [inherited]

previous vertical adjustment of vertical scrollbar in words list

Definition at line 246 of file ws_gui.h.

GString* WSGuiAppData::raw_translation [inherited]

stores current translation, if user wants to add it to bookmarks

Definition at line 286 of file ws_gui.h.

Referenced by format_html(), ws_gui_add_bookmark_dialog(), ws_gui_create_window(), and ws_gui_free_memory().

GTimer* WSGuiAppData::timer [inherited]

timer, counts how long user press button (stylus)

Definition at line 277 of file ws_gui.h.

Referenced by ws_gui_button_press(), ws_gui_button_release(), ws_gui_create_window(), ws_gui_menu_quit(), ws_gui_on_exit(), and ws_gui_show_popup().

gchar* WSGuiAppData::translation_book [inherited]

translation of the word added to bookmarks

Definition at line 281 of file ws_gui.h.

gdouble WSGuiAppData::v_delta [inherited]

variable used for moving vertical scrollbar in words list

Definition at line 241 of file ws_gui.h.

Referenced by hildon_key_press_listener(), and ws_gui_read_adjustment().

gdouble WSGuiAppData::v_new_value [inherited]

variable used for moving vertical scrollbar in words list

Definition at line 242 of file ws_gui.h.

Referenced by hildon_key_press_listener(), and ws_gui_read_adjustment().

gchar* WSGuiAppData::welcome_note [inherited]

welcome note

Definition at line 211 of file ws_gui.h.

Referenced by ws_gui_create_window(), ws_gui_fill_html(), and ws_gui_free_memory().

gchar* WSGuiAppData::word_book [inherited]

word added to the bookmarks

Definition at line 280 of file ws_gui.h.

GtkWidget* WSGuiAppData::ws_gui_banner_caching [inherited]

banner, displays message that caching is in progress

Definition at line 221 of file ws_gui.h.

Referenced by ws_dbus_progress_bar(), and ws_gui_signal_hander().

gboolean WSGuiAppData::ws_gui_banner_flag [inherited]

flag; used for notifing if searching is in progress and banner has to be displaying

Definition at line 261 of file ws_gui.h.

Referenced by ws_gui_create_window().

GtkWidget* WSGuiAppData::ws_gui_banner_list_searching [inherited]

banner, displays message that searching is in progress

Definition at line 220 of file ws_gui.h.

Referenced by ws_gui_create_window(), and ws_gui_signal_hander().

GtkWidget* WSGuiAppData::ws_gui_banner_translation_loading [inherited]

banner, displays message that translation is loading

Definition at line 222 of file ws_gui.h.

Referenced by ws_gui_create_window(), and ws_gui_signal_hander().

GtkClipboard* WSGuiAppData::ws_gui_clipboard [inherited]

application clipboard (available outside the application as well)

Definition at line 273 of file ws_gui.h.

Referenced by main(), ws_gui_check_clipboard(), ws_gui_create_popup_menu(), and ws_gui_html_paste().

gboolean WSGuiAppData::ws_gui_double_click [inherited]

flag; necessary to recognize double click

Definition at line 263 of file ws_gui.h.

Referenced by ws_gui_button_press(), ws_gui_button_release(), and ws_gui_create_window().

gboolean WSGuiAppData::ws_gui_full_screen_flag [inherited]

flag; used for informing if fullscreen mode is active

Definition at line 262 of file ws_gui.h.

Referenced by ws_gui_create_window(), and ws_gui_full_screen().

GtkAdjustment* WSGuiAppData::ws_gui_hadj [inherited]

horizontal adjustment of left scrolledwindow (necessary to provide navigation (kardware keys) inside words list)

Definition at line 240 of file ws_gui.h.

Referenced by hildon_key_press_listener(), and ws_gui_read_adjustment().

HildonFindToolbar* WSGuiAppData::ws_gui_hildon_find_toolbar [inherited]

find toolbar (placed at the bottom of the window)

Definition at line 214 of file ws_gui.h.

Referenced by ws_gui_about_application(), ws_gui_create_find_toolbar(), ws_gui_fill_html(), ws_gui_history_back(), ws_gui_history_next(), ws_gui_html_paste(), ws_gui_popup_search(), ws_gui_remove_bookmark_dialog(), ws_gui_search(), ws_gui_search_home_handler(), ws_gui_signal_hander(), and ws_refresh_search_results().

HildonWindow* WSGuiAppData::ws_gui_hildon_window [inherited]

handle to hildon window

Definition at line 210 of file ws_gui.h.

Referenced by main(), ws_dbus_server_return_extracted_bzip(), ws_gui_create_find_toolbar(), ws_gui_create_main_menu(), ws_gui_create_window(), ws_gui_dbus_return_words(), ws_gui_dictionary_add_bookmark(), ws_gui_dictionary_loader(), ws_gui_dictionary_optimizer(), ws_gui_dictionary_remove_bookmark(), ws_gui_dictionary_remover(), ws_gui_full_screen(), ws_gui_html_copy(), ws_gui_html_paste(), ws_gui_html_zoom_in(), ws_gui_html_zoom_out(), ws_gui_list_full_dialog(), ws_gui_load_dict(), ws_gui_popup_search(), ws_gui_search(), ws_gui_search_stop(), and ws_gui_signal_hander().

GArray* WSGuiAppData::ws_gui_history [inherited]

words history

Definition at line 250 of file ws_gui.h.

Referenced by ws_gui_check_history(), ws_gui_create_window(), ws_gui_dbus_return_words(), ws_gui_dictionary_chooser(), ws_gui_dictionary_remover(), ws_gui_free_memory(), ws_gui_history_add(), ws_gui_history_next(), ws_gui_load_dict(), and ws_gui_signal_hander().

gint WSGuiAppData::ws_gui_history_cur_pos [inherited]

current position in words history array

Definition at line 255 of file ws_gui.h.

Referenced by ws_gui_check_history(), ws_gui_create_window(), ws_gui_dbus_return_words(), ws_gui_dictionary_chooser(), ws_gui_dictionary_remover(), ws_gui_history_add(), ws_gui_history_back(), ws_gui_history_next(), ws_gui_load_dict(), and ws_gui_signal_hander().

GtkWidget* WSGuiAppData::ws_gui_hpane [inherited]

pane; it allows to divide window into two separate panels

Definition at line 213 of file ws_gui.h.

Referenced by ws_gui_create_window().

GtkWidget* WSGuiAppData::ws_gui_html [inherited]

translation (html) area

Definition at line 212 of file ws_gui.h.

Referenced by main(), ws_gui_button_press(), ws_gui_button_release(), ws_gui_check_clipboard(), ws_gui_create_popup_menu(), ws_gui_create_window(), ws_gui_fill_html(), ws_gui_html_copy(), ws_gui_html_select_all(), ws_gui_html_zoom_in(), ws_gui_html_zoom_out(), and ws_gui_popup_search().

gchar* WSGuiAppData::ws_gui_html_source [inherited]

string which contains html content (translation of word)

Definition at line 237 of file ws_gui.h.

GtkTreeIter WSGuiList::ws_gui_iter [inherited]

variable necessary to present words list

Definition at line 197 of file ws_gui.h.

Referenced by create_and_fill_model(), and ws_gui_view_cursor_changed().

GtkWidget* WSGuiList::ws_gui_list_item [inherited]

item in words list (each word)

Definition at line 190 of file ws_gui.h.

GtkObject* WSGuiList::ws_gui_list_item_object [inherited]

object which stores data of selected item (from words list)

Definition at line 193 of file ws_gui.h.

GtkWidget* WSGuiList::ws_gui_list_label [inherited]

label, necessary to place word in words list

Definition at line 191 of file ws_gui.h.

struct WSGuiMenu* WSGuiAppData::ws_gui_menu [inherited]

structure responsible for menus

Definition at line 258 of file ws_gui.h.

Referenced by main(), ws_gui_check_clipboard(), ws_gui_check_history(), ws_gui_create_main_menu(), ws_gui_create_popup_menu(), ws_gui_dict_availablity(), ws_gui_free_memory(), ws_gui_full_screen(), ws_gui_history_next(), ws_gui_set_bookmark_menu_items(), ws_gui_set_bookmarks_sensitivity(), ws_gui_set_toolbar_avail(), ws_gui_signal_hander(), ws_gui_words_list_hide(), and ws_gui_words_list_hide_from_menu().

GtkWidget* WSGuiMenu::ws_gui_menu_about [inherited]

menuitem which opens 'about application' dialog window

Definition at line 158 of file ws_gui.h.

Referenced by ws_gui_create_main_menu().

GtkWidget* WSGuiMenu::ws_gui_menu_add_bookmark [inherited]

menuitem, closes bookmark window

Definition at line 141 of file ws_gui.h.

Referenced by ws_gui_create_main_menu(), ws_gui_set_bookmark_menu_items(), and ws_gui_set_bookmarks_sensitivity().

GtkWidget* WSGuiMenu::ws_gui_menu_close [inherited]

menuitem which closes the application

Definition at line 159 of file ws_gui.h.

Referenced by ws_gui_create_main_menu().

GtkWidget* WSGuiMenu::ws_gui_menu_close_bookmark [inherited]

menuitem, opens bookmark window

Definition at line 140 of file ws_gui.h.

Referenced by ws_gui_create_main_menu(), and ws_gui_set_bookmarks_sensitivity().

GtkWidget* WSGuiMenu::ws_gui_menu_copy [inherited]

menuitem in edit submenu; copy selected text to the clipboard

Definition at line 145 of file ws_gui.h.

Referenced by ws_gui_check_clipboard(), and ws_gui_create_main_menu().

GtkWidget* WSGuiMenu::ws_gui_menu_dictionaries [inherited]

dictionaries submenu (managing with the dictionary files)

Definition at line 132 of file ws_gui.h.

Referenced by ws_gui_create_main_menu(), and ws_gui_set_bookmarks_sensitivity().

GtkWidget* WSGuiMenu::ws_gui_menu_edit [inherited]

menuitem, allows for removing bookmarks edit submenu(connected with text editing)

Definition at line 144 of file ws_gui.h.

Referenced by ws_gui_create_main_menu().

GtkWidget* WSGuiMenu::ws_gui_menu_find_next [inherited]

menuitem which allows to find next word in the history

Definition at line 156 of file ws_gui.h.

Referenced by ws_gui_check_history(), ws_gui_create_main_menu(), and ws_gui_history_next().

GtkWidget* WSGuiMenu::ws_gui_menu_find_prev [inherited]

menuitem which allows to find previous word from the history

Definition at line 155 of file ws_gui.h.

Referenced by ws_gui_check_history(), and ws_gui_create_main_menu().

GtkWidget* WSGuiMenu::ws_gui_menu_find_word [inherited]

menuitem which allows to start searching

Definition at line 154 of file ws_gui.h.

Referenced by ws_gui_create_main_menu().

GtkWidget* WSGuiMenu::ws_gui_menu_full_screen [inherited]

menuitem which allows to switch between fullscreen and normal mode

Definition at line 152 of file ws_gui.h.

Referenced by ws_gui_create_main_menu(), and ws_gui_full_screen().

GtkWidget* WSGuiMenu::ws_gui_menu_hide_list [inherited]

menuitem which allows to hide/show words list

Definition at line 149 of file ws_gui.h.

Referenced by ws_gui_create_main_menu(), ws_gui_words_list_hide(), and ws_gui_words_list_hide_from_menu().

GtkWidget* WSGuiMenu::ws_gui_menu_load_dict [inherited]

menuitem in dictionaries submenu; load new dictionary file into application

Definition at line 133 of file ws_gui.h.

Referenced by ws_gui_create_main_menu().

GtkWidget* WSGuiMenu::ws_gui_menu_open_bookmark [inherited]

bookmarks submenu

Definition at line 139 of file ws_gui.h.

Referenced by ws_gui_create_main_menu(), and ws_gui_set_bookmarks_sensitivity().

GtkWidget* WSGuiMenu::ws_gui_menu_optimize_dict [inherited]

menuitem used for optimizing dictionaries

Definition at line 136 of file ws_gui.h.

Referenced by ws_gui_create_main_menu(), and ws_gui_dict_availablity().

GtkWidget* WSGuiMenu::ws_gui_menu_paste [inherited]

menuitem in edit submenu; paste content of the clipboard into find toolbar entry

Definition at line 146 of file ws_gui.h.

Referenced by ws_gui_check_clipboard(), and ws_gui_create_main_menu().

GtkWidget* WSGuiMenu::ws_gui_menu_remove_bookmark [inherited]

menuitem used fot adding bookmarks

Definition at line 142 of file ws_gui.h.

Referenced by ws_gui_create_main_menu(), ws_gui_set_bookmark_menu_items(), and ws_gui_set_bookmarks_sensitivity().

GtkWidget* WSGuiMenu::ws_gui_menu_remove_dict [inherited]

menuitem in dictionaries submenu; remove dictionary files which are no longer used

Definition at line 135 of file ws_gui.h.

Referenced by ws_gui_create_main_menu(), and ws_gui_dict_availablity().

GtkWidget* WSGuiMenu::ws_gui_menu_search [inherited]

search submenu (connected with searching)

Definition at line 153 of file ws_gui.h.

Referenced by ws_gui_create_main_menu(), ws_gui_set_toolbar_avail(), and ws_gui_signal_hander().

GtkWidget* WSGuiMenu::ws_gui_menu_select_all [inherited]

menuitem in edit submenu; select whole text in the translation (html) area

Definition at line 147 of file ws_gui.h.

Referenced by ws_gui_check_clipboard(), and ws_gui_create_main_menu().

GtkWidget* WSGuiMenu::ws_gui_menu_select_dict [inherited]

menuitem in dictionaries submenu; allow to select which dictionaries are used

Definition at line 134 of file ws_gui.h.

Referenced by ws_gui_create_main_menu(), and ws_gui_dict_availablity().

GtkWidget* WSGuiMenu::ws_gui_menu_stop [inherited]

menuitem which stops search

Definition at line 157 of file ws_gui.h.

Referenced by ws_gui_create_main_menu().

GtkWidget* WSGuiMenu::ws_gui_menu_view [inherited]

view submenu

Definition at line 148 of file ws_gui.h.

Referenced by ws_gui_create_main_menu().

GtkWidget* WSGuiMenu::ws_gui_menu_zoom_in [inherited]

menuitem which allows to zoom in text in the translation area

Definition at line 150 of file ws_gui.h.

Referenced by ws_gui_create_main_menu().

GtkWidget* WSGuiMenu::ws_gui_menu_zoom_out [inherited]

menuitem which allows to zoom out text in the translation area

Definition at line 151 of file ws_gui.h.

Referenced by ws_gui_create_main_menu().

GtkTreeModel* WSGuiList::ws_gui_model [inherited]

model of GtkTree

Definition at line 199 of file ws_gui.h.

Referenced by create_view_and_model(), ws_gui_dbus_return_words(), ws_gui_signal_hander(), and ws_gui_view_cursor_changed().

GtkWidget* WSGuiMenu::ws_gui_popup_bookmark [inherited]

search option, allow to search selected text

Definition at line 171 of file ws_gui.h.

Referenced by ws_gui_create_popup_menu().

GtkWidget* WSGuiMenu::ws_gui_popup_copy [inherited]

menuitem which allows to copy selected to the clipboard

Definition at line 174 of file ws_gui.h.

Referenced by ws_gui_create_popup_menu().

GtkWidget* WSGuiMenu::ws_gui_popup_edit [inherited]

edit submenu

Definition at line 172 of file ws_gui.h.

Referenced by ws_gui_create_popup_menu().

GtkWidget* WSGuiMenu::ws_gui_popup_menu [inherited]

popup menu

Definition at line 169 of file ws_gui.h.

Referenced by ws_gui_create_popup_menu().

GtkWidget* WSGuiMenu::ws_gui_popup_paste [inherited]

menuitem which allows to paste content of the clipboard into find toolbar entry

Definition at line 175 of file ws_gui.h.

Referenced by ws_gui_create_popup_menu().

GtkWidget* WSGuiMenu::ws_gui_popup_search [inherited]

search option, allow to search selected text

Definition at line 170 of file ws_gui.h.

Referenced by ws_gui_create_popup_menu().

GtkWidget* WSGuiMenu::ws_gui_popup_select_all [inherited]

menuitem which allows to select whole text in translation area

Definition at line 176 of file ws_gui.h.

Referenced by ws_gui_create_popup_menu().

GtkWidget* WSGuiMenu::ws_gui_popup_submenu [inherited]

submenu (necessary to create edit submenu)

Definition at line 173 of file ws_gui.h.

Referenced by ws_gui_create_popup_menu().

GtkWidget* WSGuiMenu::ws_gui_popup_zoom_in [inherited]

menuitem which allows to zoom in text in translation area

Definition at line 177 of file ws_gui.h.

Referenced by ws_gui_create_popup_menu().

GtkWidget* WSGuiMenu::ws_gui_popup_zoom_out [inherited]

menuitem which allows to zoom in text in translation area

Definition at line 178 of file ws_gui.h.

Referenced by ws_gui_create_popup_menu().

GtkCellRenderer* WSGuiList::ws_gui_renderer [inherited]

variable necessary to draw GtkTree

Definition at line 198 of file ws_gui.h.

Referenced by create_view_and_model().

GtkWidget* WSGuiAppData::ws_gui_scrolledwindow_left [inherited]

scrollwindow (placed in left pane), necessary to provide scrollbars)

Definition at line 229 of file ws_gui.h.

Referenced by hildon_key_press_listener(), ws_gui_create_window(), and ws_gui_read_adjustment().

GtkWidget* WSGuiAppData::ws_gui_scrolledwindow_right [inherited]

right scrolledwindow (placed in right pane), necessary to provide scrollbars)

Definition at line 228 of file ws_gui.h.

Referenced by ws_gui_create_window().

gboolean WSGuiAppData::ws_gui_sel_flag [inherited]

flag; used to identify selected text

Definition at line 264 of file ws_gui.h.

Referenced by ws_gui_button_press(), and ws_gui_create_window().

GtkTreeSelection* WSGuiList::ws_gui_selection [inherited]

variable necessary to read selection (from words list)

Definition at line 201 of file ws_gui.h.

Referenced by ws_gui_create_window(), ws_gui_dbus_return_words(), and ws_gui_view_cursor_changed().

GtkWidget* WSGuiMenu::ws_gui_separator [inherited]

separator, it is used to provide nice layout

Definition at line 166 of file ws_gui.h.

Referenced by ws_gui_create_main_menu(), and ws_gui_create_popup_menu().

GtkWidget* WSGuiMenu::ws_gui_separator1 [inherited]

separator, it is used to provide nice layout

Definition at line 180 of file ws_gui.h.

Referenced by ws_gui_create_main_menu().

GtkWidget* WSGuiMenu::ws_gui_separator2 [inherited]

separator, it is used to provide nice layout

Definition at line 181 of file ws_gui.h.

GtkListStore* WSGuiList::ws_gui_store [inherited]

list necessary to present words list

Definition at line 196 of file ws_gui.h.

Referenced by create_and_fill_model(), ws_gui_create_window(), ws_gui_remove_bookmark_dialog(), and ws_gui_signal_hander().

GtkWidget* WSGuiMenu::ws_gui_submenu_0 [inherited]

submenu which is necessaty to build dictionaries submenu

Definition at line 161 of file ws_gui.h.

Referenced by ws_gui_create_main_menu().

GtkWidget* WSGuiMenu::ws_gui_submenu_1 [inherited]

submenu which is necessary to build edit submenu

Definition at line 162 of file ws_gui.h.

Referenced by ws_gui_create_main_menu().

GtkWidget* WSGuiMenu::ws_gui_submenu_2 [inherited]

submenu which is necessary to build view submenu

Definition at line 163 of file ws_gui.h.

Referenced by ws_gui_create_main_menu().

GtkWidget* WSGuiMenu::ws_gui_submenu_3 [inherited]

submenu which is necessary to build search submenu

Definition at line 164 of file ws_gui.h.

Referenced by ws_gui_create_main_menu().

GtkWidget* WSGuiMenu::ws_gui_submenu_4 [inherited]

submenu which is necessary to build search submenu

Definition at line 165 of file ws_gui.h.

Referenced by ws_gui_create_main_menu().

GtkToolItem* WSGuiAppData::ws_gui_toobar_button_back [inherited]

back button at the find toolbar (history navigator)

Definition at line 216 of file ws_gui.h.

Referenced by ws_gui_check_history(), and ws_gui_create_find_toolbar().

GtkToolItem* WSGuiAppData::ws_gui_toobar_button_close [inherited]

close button at the find toolbar

Definition at line 215 of file ws_gui.h.

Referenced by ws_gui_create_find_toolbar().

GtkToolItem* WSGuiAppData::ws_gui_toobar_button_forward [inherited]

next button at the find toolbar (history navigator)

Definition at line 217 of file ws_gui.h.

Referenced by ws_gui_check_history(), ws_gui_create_find_toolbar(), and ws_gui_history_next().

GtkToolItem* WSGuiAppData::ws_gui_toobar_button_hide [inherited]

button hide, allows to hide/show words list with button placed at find toolbar

Definition at line 227 of file ws_gui.h.

Referenced by ws_gui_create_find_toolbar(), ws_gui_words_list_hide(), and ws_gui_words_list_hide_from_menu().

GtkToolItem* WSGuiAppData::ws_gui_toobar_button_start [inherited]

stop butoon at the find toolbar (allows to stop searching)

Definition at line 219 of file ws_gui.h.

Referenced by ws_gui_create_find_toolbar().

GtkToolItem* WSGuiAppData::ws_gui_toobar_button_stop [inherited]

stop butoon at the find toolbar (allows to stop searching)

Definition at line 218 of file ws_gui.h.

Referenced by ws_gui_create_find_toolbar(), and ws_gui_set_toolbar_avail().

GtkAdjustment* WSGuiAppData::ws_gui_vadj [inherited]

vertical adjustment of left scrolledwindow (necessary to provide navigation (kardware keys) inside words list)

Definition at line 239 of file ws_gui.h.

Referenced by hildon_key_press_listener(), and ws_gui_read_adjustment().

GtkWidget* WSGuiList::ws_gui_view [inherited]

variable responsible for view of GtkTree

Definition at line 200 of file ws_gui.h.

Referenced by create_and_fill_model(), create_view_and_model(), main(), ws_gui_create_window(), ws_gui_dbus_return_words(), and ws_gui_signal_hander().

struct WSGuiList* WSGuiAppData::ws_gui_w_list [inherited]

structure responsible for words list

Definition at line 259 of file ws_gui.h.

Referenced by create_and_fill_model(), create_view_and_model(), main(), ws_gui_create_window(), ws_gui_dbus_return_words(), ws_gui_free_memory(), ws_gui_remove_bookmark_dialog(), ws_gui_signal_hander(), and ws_gui_view_cursor_changed().

GtkWidget* WSGuiAppData::ws_message_dialog [inherited]

message dialogs; used for informing user about errors

Definition at line 268 of file ws_gui.h.

Referenced by ws_gui_dictionary_optimizer(), ws_gui_list_full_dialog(), and ws_gui_signal_hander().


Generated on Fri Jan 11 14:30:18 2008 for mDictionary Project by  doxygen 1.5.1