virtual ~Config (void);
public:
+ std::string dictionaries (void) const { return m_dictionaries; }
guint option (void) const { return m_option & m_option_mask; }
guint orientation (void) const { return m_orientation; }
guint pageSize (void) const { return m_page_size; }
protected:
std::string m_section;
+ std::string m_dictionaries;
guint m_option;
guint m_option_mask;
g_free(userdir); userdir = NULL;
}
context = pinyin_init ("/usr/share/libpinyin/data", userdir);
+ g_free (userdir);
-#if 0
- pinyin_load_phrase_library(m_pinyin_context, 2);
-#endif
- /* TODO: load phrase libraries here. */
+ const char *dicts = config->dictionaries ().c_str ();
+ gchar ** indices = g_strsplit_set (dicts, "", -1);
+ for (size_t i = 0; i < g_strv_length(indices); ++i) {
+ int index = atoi (indices [i]);
+ if (index <= 1)
+ continue;
+
+ pinyin_load_phrase_library (context, index);
+ }
+ g_strfreev (indices);
- g_free(userdir);
return context;
}
g_free(userdir); userdir = NULL;
}
context = pinyin_init ("/usr/share/libpinyin/data", userdir);
+ g_free(userdir);
-#if 0
- pinyin_load_phrase_library(m_chewing_context, 2);
-#endif
- /* TODO: load phrase libraries here. */
+ const char *dicts = config->dictionaries ().c_str ();
+ gchar ** indices = g_strsplit_set (dicts, "", -1);
+ for (size_t i = 0; i < g_strv_length(indices); ++i) {
+ int index = atoi (indices [i]);
+ if (index <= 1)
+ continue;
+
+ pinyin_load_phrase_library (context, index);
+ }
+ g_strfreev (indices);
- g_free(userdir);
return context;
}