Imported version 0.2-4 v0.2-4
authorRoman Moravcik <roman.moravcik@gmail.com>
Thu, 18 Feb 2010 16:33:39 +0000 (17:33 +0100)
committerRoman Moravcik <roman.moravcik@gmail.com>
Thu, 18 Feb 2010 16:33:39 +0000 (17:33 +0100)
debian/changelog
src/lib/stddict.hpp
src/libwrapper.cpp
src/libwrapper.hpp
src/mstardict.cpp
src/mstardict.hpp

index e4b92dc..b84aade 100644 (file)
@@ -1,3 +1,9 @@
+mstardict (0.2-4) unstable; urgency=low
+
+  * sdcv search mechanism replaced by ported search from stardict.
+
+ -- Roman Moravcik <roman.moravcik@gmail.com>  Fri, 29 Jan 2010 16:53:10 +0100
+
 mstardict (0.2-3) unstable; urgency=low
 
   * Fixed installation of desktop file.
index aa0b276..a6099fd 100644 (file)
@@ -235,7 +235,6 @@ public:
        const std::string& dict_name(size_t idict) { return oLib[idict]->dict_name(); }
        const std::string& dict_type(size_t idict) { return oLib[idict]->dict_type(); }
        bool has_dict() { return !oLib.empty(); }
-       gint ndicts() { return oLib.size(); }
 
        const gchar * poGetWord(glong iIndex,size_t iLib, int servercollatefunc) {
                return oLib[iLib]->idx_file->getWord(iIndex, EnableCollationLevel, servercollatefunc);
index 94acaa1..28b068e 100644 (file)
@@ -26,7 +26,7 @@
 #include <map>
 
 #include "libwrapper.hpp"
-
+#include "mstardict.hpp"
 
 static std::string xdxf2text(const char *p)
 {
@@ -158,20 +158,103 @@ static string parse_data(const gchar *data)
                p += sec_size;
        }
 
-  
        return res;
 }
 
-void Library::SimpleLookup(const string &str, TSearchResultList& res_list)
-{      
-       glong idx, idx_suggest;
-       res_list.reserve(ndicts());
-       for (gint idict=0; idict<ndicts(); ++idict)
-               if (SimpleLookupWord(str.c_str(), idx, idx_suggest, (size_t) idict, 0))
-                       res_list.push_back(
-                               TSearchResult(dict_name(idict),
-                                             poGetWord(idx, idict, 0),
-                                             parse_data(poGetOrigWordData(idx, idict))));
+void Library::ListWords(CurrentIndex* iIndex)
+{
+       CurrentIndex *iCurrent = (CurrentIndex*)g_memdup(iIndex, sizeof(CurrentIndex)*query_dictmask.size());
+
+       pMStarDict->ResultsListClear();
+
+       int iWordCount=0;
+       const gchar * poCurrentWord = poGetCurrentWord(iIndex, query_dictmask, 0);
+       if (poCurrentWord) {
+               pMStarDict->ResultsListInsertLast(poCurrentWord);
+               iWordCount++;
+
+               while (iWordCount < 30 && (poCurrentWord = poGetNextWord(NULL, iIndex, query_dictmask, 0))) {
+                       pMStarDict->ResultsListInsertLast(poCurrentWord);
+                       iWordCount++;
+               }
+       }
+       pMStarDict->ReScroll();
+
+       if (iCurrent)
+               g_free (iCurrent);
+}
+
+bool Library::BuildResultData(std::vector<InstantDictIndex> &dictmask, const char* sWord, CurrentIndex *iIndex, int iLib, TSearchResultList& res_list)
+{
+       int iRealLib;
+       bool bFound = false, bLookupWord = false, bLookupSynonymWord = false;
+       gint nWord=0, count=0, i=0, j=0;
+
+       iRealLib = dictmask[iLib].index;
+
+       bLookupWord = LookupWord(sWord, iIndex[iLib].idx, iIndex[iLib].idx_suggest, iRealLib, 0);
+       if (!bLookupWord)
+               bLookupWord = LookupSimilarWord(sWord, iIndex[iLib].idx, iIndex[iLib].idx_suggest, iRealLib, 0);
+       if (!bLookupWord)
+               bLookupWord = SimpleLookupWord(sWord, iIndex[iLib].idx, iIndex[iLib].idx_suggest, iRealLib, 0);
+
+       bLookupSynonymWord = LookupSynonymWord(sWord, iIndex[iLib].synidx, iIndex[iLib].synidx_suggest, iRealLib, 0);
+       if (!bLookupSynonymWord)
+               bLookupSynonymWord = LookupSynonymSimilarWord(sWord, iIndex[iLib].synidx, iIndex[iLib].synidx_suggest, iRealLib, 0);
+       if (!bLookupSynonymWord)
+               bLookupSynonymWord = SimpleLookupSynonymWord(sWord, iIndex[iLib].synidx, iIndex[iLib].synidx_suggest, iRealLib, 0);
+
+       g_debug ("bookname: %s, iLib: %d, iRealLib: %d, str: %s", dict_name(iLib).c_str(), iLib, iRealLib, sWord);
+
+       if (bLookupWord || bLookupSynonymWord) {
+               if (bLookupWord)
+                       nWord++;
+
+               if (bLookupSynonymWord)
+                       nWord+=GetOrigWordCount(iIndex[iLib].synidx, iRealLib, false);
+
+               if (bLookupWord) {
+                       count = GetOrigWordCount(iIndex[iLib].idx, iRealLib, true);
+                       for (i=0;i<count;i++) {
+                               res_list.push_back(TSearchResult(dict_name(iLib),
+                                                                poGetWord(iIndex[iLib].idx, iRealLib, 0),
+                                                                parse_data(poGetOrigWordData(iIndex[iLib].idx+i, iRealLib))));
+                       }
+                       i = 1;
+               } else {
+                       i = 0;
+               }
+               for (j = 0; i < nWord; i++, j++) {
+                               res_list.push_back(TSearchResult(dict_name(iLib),
+                                                                poGetWord(iIndex[iLib].synidx+j, iRealLib, 0),
+                                                                parse_data(poGetOrigWordData(iIndex[iLib].synidx+j, iRealLib))));
+               }
+
+               bFound = true;
+       }
+
+       return bFound;
+}
+
+bool Library::SimpleLookup(const gchar* sWord, CurrentIndex* piIndex)
+{
+       CurrentIndex *iIndex;
+       TSearchResultList results;
+       bool bFound = false;
+
+       if (!piIndex)
+               iIndex = (CurrentIndex *)g_malloc(sizeof(CurrentIndex) * query_dictmask.size());
+       else
+               iIndex = piIndex;
+
+       for (size_t iLib=0; iLib<query_dictmask.size(); iLib++) {
+               bFound = BuildResultData(query_dictmask, sWord, iIndex, iLib, results);
+       }
+
+       if (!piIndex)
+               g_free(iIndex);
+
+       return bFound;
 }
 
 void Library::LookupWithFuzzy(const string &str, TSearchResultList& res_list)
@@ -184,21 +267,21 @@ void Library::LookupWithFuzzy(const string &str, TSearchResultList& res_list)
        
        for (gchar **p=fuzzy_res, **end=fuzzy_res+MAXFUZZY; 
             p!=end && *p; ++p) {
-               SimpleLookup(*p, res_list);
+//             SimpleLookup(*p, res_list);
                g_free(*p);
        }
 }
 
 void Library::LookupWithRule(const string &str, TSearchResultList& res_list)
 {
-       std::vector<gchar *> match_res((MAX_MATCH_ITEM_PER_LIB) * ndicts());
+       std::vector<gchar *> match_res((MAX_MATCH_ITEM_PER_LIB) * query_dictmask.size());
 
        gint nfound=Libs::LookupWithRule(str.c_str(), &match_res[0], query_dictmask);
        if (!nfound)
                return;
 
        for (gint i=0; i<nfound; ++i) {
-               SimpleLookup(match_res[i], res_list);
+//             SimpleLookup(match_res[i], res_list);
                g_free(match_res[i]);
        }
 }
@@ -206,67 +289,23 @@ void Library::LookupWithRule(const string &str, TSearchResultList& res_list)
 void Library::LookupData(const string &str, TSearchResultList& res_list)
 {
        bool cancel = false;
-       std::vector<gchar *> drl[ndicts()];
+       std::vector<gchar *> drl[query_dictmask.size()];
        if (!Libs::LookupData(str.c_str(), drl, NULL, NULL, &cancel, query_dictmask))
                return;
-       for (int idict=0; idict<ndicts(); ++idict)
-               for (std::vector<gchar *>::size_type j=0; j<drl[idict].size(); ++j) {
-                       SimpleLookup(drl[idict][j], res_list);
-                       g_free(drl[idict][j]);
+       for (size_t iLib=0; iLib<query_dictmask.size(); iLib++)
+               for (std::vector<gchar *>::size_type j=0; j<drl[iLib].size(); ++j) {
+//                     SimpleLookup(drl[iLib][j], res_list);
+                       g_free(drl[iLib][j]);
                }
 }
 
-bool Library::process_phrase(const char *loc_str, TSearchResultList &res_list)
+Library::Library () : Libs (NULL, FALSE, 0, 0)
 {
-       if (NULL==loc_str)
-               return true;
-
-       std::string query;
-
-       gsize bytes_read;
-       gsize bytes_written;
-       GError *err=NULL;
-       char *str=NULL;
-       if (!utf8_input)
-               str=g_locale_to_utf8(loc_str, -1, &bytes_read, &bytes_written, &err);
-       else
-               str=g_strdup(loc_str);
-
-       if (NULL==str) {
-               fprintf(stderr, _("Can not convert %s to utf8.\n"), loc_str);
-               fprintf(stderr, "%s\n", err->message);
-               g_error_free(err);
-               return false;
-       }
-
-       if (str[0]=='\0')
-               return true;
-
-       switch (analyse_query(str, query)) {
-       case qtFUZZY:
-               g_debug ("FUZZY");
-               LookupWithFuzzy(query, res_list);
-               break;
-       case qtREGEX:
-               g_debug ("REGEX");
-               LookupWithRule(query, res_list);
-               break;
-       case qtSIMPLE:
-               g_debug ("SIMPLE");
-               SimpleLookup(str, res_list);
-               if (res_list.empty())
-                       LookupWithFuzzy(str, res_list);
-               break;
-       case qtDATA:
-               g_debug ("DATA");
-               LookupData(query, res_list);
-               break;
-       default:
-               g_debug ("DEFAULT");
-               /*nothing*/;
-       }
-
-       g_free(str);
-       return true;
+       iCurrentIndex = NULL;
 }
 
+Library::~Library ()
+{
+       if (iCurrentIndex)
+               g_free (iCurrentIndex);
+}
index b7cd6d3..cc76aa8 100644 (file)
@@ -30,16 +30,17 @@ typedef TSearchResultList::iterator PSearchResult;
 //of it
 class Library : public Libs {
 public:
-       Library(bool uinput, bool uoutput) : 
-               Libs(NULL, FALSE, 0, 0), utf8_input(uinput), utf8_output(uoutput)  {}
+       Library();
+       ~Library();
 
-       bool process_phrase(const char *loc_str, TSearchResultList &res_list);
        std::vector<InstantDictIndex> query_dictmask;
+       CurrentIndex *iCurrentIndex;
 
-private:
-       bool utf8_input, utf8_output;
+       void ListWords(CurrentIndex* iIndex);
+       bool BuildResultData(std::vector<InstantDictIndex> &dictmask, const char* sWord, CurrentIndex *iIndex, int iLib, TSearchResultList& res_list);
 
-       void SimpleLookup(const string &str, TSearchResultList& res_list);
+       bool SimpleLookup(const gchar* sWord, CurrentIndex* piIndex);
+private:
        void LookupWithFuzzy(const string &str, TSearchResultList& res_list);
        void LookupWithRule(const string &str, TSearchResultList& res_lsit);
        void LookupData(const string &str, TSearchResultList& res_list);
index 14d1fa7..9a0d964 100644 (file)
 #include "file.hpp"
 #include "mstardict.hpp"
 
+MStarDict *pMStarDict;
+
 enum {
-       INDEX_COLUMN = 0,
-       BOOKNAME_COLUMN,
        DEF_COLUMN,
        N_COLUMNS
 };
 
-
 MStarDict::MStarDict ()
 {
        label_widget = NULL;
        results_widget = NULL;
        results_view = NULL;
+       results_view_scroll = NULL;
 
        /* create list of ressults */
        results_list = gtk_list_store_new (N_COLUMNS,
-                                          G_TYPE_INT,          /* INDEX_COLUMN */
-                                          G_TYPE_STRING,       /* BOOKNAME_COLUMN */
                                           G_TYPE_STRING);      /* DEF_COLUMN */
 
-       /* set sorting of resuslts */
-       gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (results_list),
-                                             DEF_COLUMN,
-                                             GTK_SORT_ASCENDING);
-
        /* initialize stardict library */
-       lib = new Library (true, true);
+       oLibs = new Library ();
 }
 
 MStarDict::~MStarDict ()
@@ -78,31 +71,44 @@ MStarDict::~MStarDict ()
        g_object_unref (results_list);
 
        /* deinitialize stardict library */
-       delete lib;
+       delete oLibs;
 }
 
 gboolean
-MStarDict::on_results_view_selection_changed (GtkTreeSelection *selection,
+MStarDict::onResultsViewSelectionChanged (GtkTreeSelection *selection,
                                              MStarDict *mStarDict)
 {
        GtkTreeModel *model;
        GtkTreeIter iter;
        char *bookname, *def, *exp;
-       gint selected = 0;
+       const gchar *sWord;
+       bool bFound = false;
 
        if (gtk_tree_selection_get_selected (selection, &model, &iter)) {
                /* unselect selected rows */
                gtk_tree_selection_unselect_all (selection);
-               gtk_tree_model_get (model, &iter, INDEX_COLUMN, &selected, -1);
+
+               gtk_tree_model_get (model, &iter, DEF_COLUMN, &sWord, -1);
+
+               /* clear previous search results */
+               mStarDict->results.clear();
+
+               for (size_t iLib=0; iLib<mStarDict->oLibs->query_dictmask.size(); iLib++) {
+                       bFound = mStarDict->oLibs->BuildResultData(mStarDict->oLibs->query_dictmask,
+                                                                  sWord,
+                                                                  mStarDict->oLibs->iCurrentIndex,
+                                                                  iLib,
+                                                                  mStarDict->results);
+               }
 
                bookname = g_markup_printf_escaped ("<span color=\"dimgray\" size=\"x-small\">%s</span>",
-                                                   mStarDict->result_list[selected].bookname.c_str());
+                                                   mStarDict->results[0].bookname.c_str());
                def = g_markup_printf_escaped ("<span color=\"darkred\" weight=\"heavy\" size=\"large\">%s</span>",
-                                              mStarDict->result_list[selected].def.c_str());
-               exp = g_strdup (mStarDict->result_list[selected].exp.c_str());
+                                              mStarDict->results[0].def.c_str());
+               exp = g_strdup (mStarDict->results[0].exp.c_str());
 
                /* create translation window */
-               mStarDict->create_translation_window (bookname, def, exp);
+               mStarDict->CreateTranslationWindow (bookname, def, exp);
 
                g_free (bookname);
                g_free (def);
@@ -116,43 +122,52 @@ MStarDict::on_results_view_selection_changed (GtkTreeSelection *selection,
 }
 
 gboolean
-MStarDict::on_search_entry_changed (GtkEditable *editable,
+MStarDict::onSearchEntryChanged (GtkEditable *editable,
                                    MStarDict *mStarDict)
 {
        GtkTreeSelection *selection;
-       const gchar *search;
-       GtkTreeIter iter;
+       const gchar *sWord;
+       bool bFound = false;
+       std::string query;
 
-       search = gtk_entry_get_text (GTK_ENTRY (editable));
+       sWord = gtk_entry_get_text (GTK_ENTRY (editable));
 
-       if (strcmp (search, "") == 0) {
+       if (strcmp (sWord, "") == 0) {
                gtk_widget_show (mStarDict->label_widget);
                gtk_widget_hide (mStarDict->results_widget);
        } else {
                selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (mStarDict->results_view));
                gtk_tree_selection_set_mode (selection, GTK_SELECTION_NONE);
 
-               /* clear previous search results */
-               mStarDict->result_list.clear();
-               gtk_list_store_clear (mStarDict->results_list);
-
                /* unselect rows */
                selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (mStarDict->results_view));
                gtk_tree_selection_unselect_all (selection);
 
-               /* fill list with new results */
-               mStarDict->lib->process_phrase(search, mStarDict->result_list);
-               if (!mStarDict->result_list.empty()) {
-                       for (size_t i = 0; i < mStarDict->result_list.size(); ++i) {
-                               gtk_list_store_append (mStarDict->results_list, &iter);
-                               gtk_list_store_set (mStarDict->results_list,
-                                                   &iter,
-                                                   INDEX_COLUMN, i,
-                                                   BOOKNAME_COLUMN, mStarDict->result_list[i].bookname.c_str(),
-                                                   DEF_COLUMN, mStarDict->result_list[i].def.c_str(),
-                                                   -1);
+               switch (analyse_query(sWord, query)) {
+                       case qtFUZZY:
+                               g_debug ("FUZZY");
+//                             oLibs->LookupWithFuzzy(query, res_list);
+                               break;
+                       case qtREGEX:
+                               g_debug ("REGEX");
+//                             oLibs->LookupWithRule(query, res_list);
+                               break;
+                       case qtSIMPLE:
+                               g_debug ("SIMPLE");
+                               bFound = mStarDict->oLibs->SimpleLookup(sWord, mStarDict->oLibs->iCurrentIndex);
+                               if (!bFound) {
+                                       /* suggested */
+                               }
+                               mStarDict->oLibs->ListWords(mStarDict->oLibs->iCurrentIndex);
+                               break;
+                       case qtDATA:
+                               g_debug ("DATA");
+//                             oLibs->LookupData(query, res_list);
+                               break;
+                       default:
+                               g_debug ("DEFAULT");
+                               /*nothing*/;
                        }
-               }
 
                /* unselect selected rows */
                gtk_tree_selection_unselect_all (selection);
@@ -177,7 +192,7 @@ private:
 };
 
 void
-MStarDict::load_dictionaries ()
+MStarDict::LoadDictionaries ()
 {
        strlist_t dicts_dir_list;
        strlist_t order_list;
@@ -189,22 +204,27 @@ MStarDict::load_dictionaries ()
        dicts_dir_list.push_back (std::string ("/home/user/MyDocs/mstardict"));
 
        for_each_file(dicts_dir_list, ".ifo", order_list, disable_list, GetAllDictList(load_list));
-       lib->load(load_list);
+       oLibs->load(load_list);
 
-       lib->query_dictmask.clear();
+       oLibs->query_dictmask.clear();
        for (std::list<std::string>::iterator i = load_list.begin(); i != load_list.end(); ++i) {
                size_t iLib;
-               if (lib->find_lib_by_filename(i->c_str(), iLib)) {
+               if (oLibs->find_lib_by_filename(i->c_str(), iLib)) {
                        InstantDictIndex instance_dict_index;
                        instance_dict_index.type = InstantDictType_LOCAL;
                        instance_dict_index.index = iLib;
-                       lib->query_dictmask.push_back(instance_dict_index);
+                       oLibs->query_dictmask.push_back(instance_dict_index);
                }
        }
+
+       if (oLibs->iCurrentIndex)
+               g_free (oLibs->iCurrentIndex);
+       oLibs->iCurrentIndex = (CurrentIndex *)g_malloc(sizeof(CurrentIndex) * oLibs->query_dictmask.size());
+
 }
 
 void
-MStarDict::create_translation_window (const gchar *bookname,
+MStarDict::CreateTranslationWindow (const gchar *bookname,
                                      const gchar *def,
                                      const gchar *exp)
 {
@@ -249,13 +269,12 @@ MStarDict::create_translation_window (const gchar *bookname,
 }
 
 void
-MStarDict::create_main_window ()
+MStarDict::CreateMainWindow ()
 {
        HildonProgram *program = NULL;
-       GtkWidget *window, *alignment, *vbox, *pannable;
+       GtkWidget *window, *alignment, *vbox;
        GtkCellRenderer *renderer;
        GtkTreeSelection *selection;
-       GdkColor style_color;
 
        /* hildon program */
        program = hildon_program_get_instance ();
@@ -295,18 +314,18 @@ MStarDict::create_main_window ()
        gtk_box_pack_start (GTK_BOX (vbox), results_widget, TRUE, TRUE, 0);
 
        /* pannable for tree view */
-       pannable = hildon_pannable_area_new ();
-       gtk_container_add (GTK_CONTAINER (results_widget), pannable);
+       results_view_scroll = hildon_pannable_area_new ();
+       gtk_container_add (GTK_CONTAINER (results_widget), results_view_scroll);
 
        /* result tree view */
        results_view = hildon_gtk_tree_view_new (HILDON_UI_MODE_EDIT);
        gtk_tree_view_set_model (GTK_TREE_VIEW (results_view),
                                 GTK_TREE_MODEL (results_list));
-       gtk_container_add (GTK_CONTAINER (pannable), results_view);
+       gtk_container_add (GTK_CONTAINER (results_view_scroll), results_view);
 
        selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (results_view));
        g_signal_connect (selection, "changed",
-                         G_CALLBACK (on_results_view_selection_changed), this);
+                         G_CALLBACK (onResultsViewSelectionChanged), this);
 
        /* def column */
        renderer = gtk_cell_renderer_text_new ();
@@ -317,33 +336,11 @@ MStarDict::create_main_window ()
                                                     NULL);
        g_object_set (G_OBJECT (renderer), "xpad", 10, NULL);
 
-       /* bookname column */
-       renderer = gtk_cell_renderer_text_new ();
-       gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (results_view),
-                                                    -1,
-                                                    "Bookname", renderer,
-                                                    "text", BOOKNAME_COLUMN,
-                                                    NULL);
-
-       if (!gtk_style_lookup_color (GTK_WIDGET (label_widget)->style, "SecondaryTextColor",
-                                    &style_color)) {
-               gdk_color_parse ("grey", &style_color);
-       }
-       g_object_set (G_OBJECT (renderer),
-                     "xalign", 1.0,
-                     "width-chars", 10,
-                     "foreground-gdk", &style_color,
-                     "foreground-set", TRUE,
-                     "size", 12000,
-                     "ellipsize", PANGO_ELLIPSIZE_END,
-                     "ellipsize-set", TRUE,
-                     NULL);
-
        /* search entry */
        search = hildon_entry_new (HILDON_SIZE_FINGER_HEIGHT);
        gtk_box_pack_end (GTK_BOX (vbox), search, FALSE, TRUE, 0);
        g_signal_connect (search, "changed",
-                         G_CALLBACK (on_search_entry_changed), this);
+                         G_CALLBACK (onSearchEntryChanged), this);
 
        /* window signals */
        g_signal_connect (G_OBJECT (window), "destroy",
@@ -357,6 +354,26 @@ MStarDict::create_main_window ()
        gtk_widget_grab_focus (GTK_WIDGET (search));
 }
 
+void
+MStarDict::ResultsListClear()
+{
+       gtk_list_store_clear (results_list);
+}
+
+void
+MStarDict::ResultsListInsertLast(const gchar *word)
+{
+       GtkTreeIter iter;
+       gtk_list_store_append (results_list, &iter);
+       gtk_list_store_set (results_list, &iter, DEF_COLUMN, word, -1);
+}
+
+void
+MStarDict::ReScroll()
+{
+       hildon_pannable_area_scroll_to (HILDON_PANNABLE_AREA (results_view_scroll), -1, 0);
+}
+
 int
 main (int argc, char **argv)
 {
@@ -371,10 +388,11 @@ main (int argc, char **argv)
 
        /* create main window */
        MStarDict mStarDict;
-       mStarDict.create_main_window ();
+       pMStarDict = &mStarDict;
+       mStarDict.CreateMainWindow();
 
        /* load all dictionaries */
-       mStarDict.load_dictionaries ();
+       mStarDict.LoadDictionaries();
 
        gtk_main ();
        return 0;
index 2fd3439..a4b6bd8 100644 (file)
@@ -21,6 +21,9 @@
 #include <hildon/hildon.h>
 
 class Library;
+class MStarDict;
+
+extern MStarDict *pMStarDict;
 
 class MStarDict {
 private:
@@ -28,19 +31,26 @@ private:
        GtkWidget *results_widget;
        GtkWidget *search;
        GtkWidget *results_view;
+       GtkWidget *results_view_scroll;
 
        GtkListStore *results_list;
 
-       Library *lib;
-       TSearchResultList result_list;
+       Library *oLibs;
+       TSearchResultList results;
 
-       static gboolean on_results_view_selection_changed (GtkTreeSelection *selection, MStarDict *mStarDict);
-       static gboolean on_search_entry_changed (GtkEditable *editable, MStarDict *mStarDict);
+       static gboolean onResultsViewSelectionChanged (GtkTreeSelection *selection, MStarDict *mStarDict);
+       static gboolean onSearchEntryChanged (GtkEditable *editable, MStarDict *mStarDict);
 
 public:
-       MStarDict ();
-       ~MStarDict ();
-       void create_translation_window (const gchar *bookname, const gchar *def, const gchar *exp);
-       void create_main_window ();
-       void load_dictionaries ();
+       MStarDict();
+       ~MStarDict();
+
+       void CreateTranslationWindow(const gchar *bookname, const gchar *def, const gchar *exp);
+       void CreateMainWindow();
+
+       void LoadDictionaries();
+
+       void ResultsListClear();
+       void ResultsListInsertLast(const gchar *word);
+       void ReScroll();
 };