summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/ZYZPhoneticEditor.cc2
-rw-r--r--src/ZYZPhoneticEditor.h2
-rw-r--r--src/ZYZUserSymbolListAllSection.cc56
-rw-r--r--src/ZYZUserSymbolListAllSection.h2
4 files changed, 60 insertions, 2 deletions
diff --git a/src/ZYZPhoneticEditor.cc b/src/ZYZPhoneticEditor.cc
index 1788f1a..6252aa1 100644
--- a/src/ZYZPhoneticEditor.cc
+++ b/src/ZYZPhoneticEditor.cc
@@ -85,7 +85,7 @@ PhoneticEditor::~PhoneticEditor (void)
}
gboolean
-PhoneticEditor::loadEasySymbolFile(const gchar * filename)
+PhoneticEditor::loadEasySymbolFile (const gchar * filename)
{
gboolean retval = m_easy_symbols.loadFromFile (filename);
return retval;
diff --git a/src/ZYZPhoneticEditor.h b/src/ZYZPhoneticEditor.h
index 4bb6f4a..5e08587 100644
--- a/src/ZYZPhoneticEditor.h
+++ b/src/ZYZPhoneticEditor.h
@@ -97,7 +97,7 @@ protected:
void resizeInstances (void);
- gboolean loadEasySymbolFile(const gchar * filename);
+ gboolean loadEasySymbolFile (const gchar * filename);
/* varibles */
LookupTable m_lookup_table;
diff --git a/src/ZYZUserSymbolListAllSection.cc b/src/ZYZUserSymbolListAllSection.cc
new file mode 100644
index 0000000..af67962
--- /dev/null
+++ b/src/ZYZUserSymbolListAllSection.cc
@@ -0,0 +1,56 @@
+/* vim:set et ts=4 sts=4:
+ *
+ * ibus-libzhuyin - New Zhuyin engine based on libzhuyin for IBus
+ *
+ * Copyright (c) 2014 Peng Wu <alexepico@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include "ZYZUserSymbolListAllSection.h"
+#include <assert.h>
+#include "ZYSymbols.h"
+
+namespace ZY {
+
+UserSymbolListAllSection::UserSymbolListAllSection (PhoneticEditor & editor,
+ ZhuyinProperties & props) :
+ SymbolSection (editor, props)
+{
+ m_type = BUILTIN_SYMBOL_TYPE;
+
+ /* load user symbol. */
+ gchar * path = g_build_filename (g_get_user_config_dir (),
+ "ibus", "libzhuyin",
+ "usersymbol.txt", NULL);
+ loadUserSymbolFile (".." G_DIR_SEPARATOR_S "data" G_DIR_SEPARATOR_S
+ "usersymbol.txt") ||
+ loadUserSymbolFile (path) ||
+ loadUserSymbolFile (PKGDATADIR G_DIR_SEPARATOR_S "usersymbol.txt");
+ g_free(path);
+}
+
+UserSymbolListAllSection::~UserSymbolListAllSection ()
+{
+}
+
+gboolean
+UserSymbolListAllSection::loadUserSymbolFile (const gchar * filename)
+{
+ gboolean retval = m_user_symbols.loadFromFile (filename);
+ return retval;
+}
+
+};
diff --git a/src/ZYZUserSymbolListAllSection.h b/src/ZYZUserSymbolListAllSection.h
index b0e2756..9b7bec4 100644
--- a/src/ZYZUserSymbolListAllSection.h
+++ b/src/ZYZUserSymbolListAllSection.h
@@ -45,6 +45,8 @@ public:
virtual int selectCandidate (guint index);
protected:
+ gboolean loadUserSymbolFile (const gchar * filename);
+
std::vector<String> m_candidates;
SymbolLookup m_user_symbols;
}