ibus-libpinyin/ibus-libpinyin-1.7.x-head.patch
2013-08-01 10:35:18 +08:00

134 lines
3.7 KiB
Diff

From 9ef836117508d9c0c938f57a5ffa5ffca7eb2e7b Mon Sep 17 00:00:00 2001
From: Peng Wu <alexepico@gmail.com>
Date: Fri, 26 Jul 2013 13:03:44 +0800
Subject: [PATCH 1/2] Update the symbol of the ibus indicator
---
src/PYPinyinProperties.cc | 14 +++++++++++++-
src/PYProperty.h | 10 ++++++++++
2 files changed, 23 insertions(+), 1 deletion(-)
diff --git a/src/PYPinyinProperties.cc b/src/PYPinyinProperties.cc
index 0a77163..66205de 100644
--- a/src/PYPinyinProperties.cc
+++ b/src/PYPinyinProperties.cc
@@ -26,6 +26,7 @@
namespace PY {
#define _(text) (dgettext (GETTEXT_PACKAGE, text))
+#define N_(text) text
PinyinProperties::PinyinProperties (Config & config)
: m_config (config),
@@ -33,7 +34,7 @@ PinyinProperties::PinyinProperties (Config & config)
m_mode_full (m_config.initFull ()),
m_mode_full_punct (m_config.initFullPunct ()),
m_mode_simp (m_config.initSimpChinese ()),
- m_prop_chinese ("mode.chinese",
+ m_prop_chinese ("InputMode",
PROP_TYPE_NORMAL,
StaticText (m_mode_chinese ?
_("Chinese") :
@@ -83,6 +84,11 @@ PinyinProperties::PinyinProperties (Config & config)
"ibus-setup",
StaticText (_("Preferences")))
{
+ if (m_mode_chinese)
+ m_prop_chinese.setSymbol(N_("中"));
+ else
+ m_prop_chinese.setSymbol(N_("英"));
+
m_props.append (m_prop_chinese);
m_props.append (m_prop_full);
m_props.append (m_prop_full_punct);
@@ -98,6 +104,12 @@ PinyinProperties::toggleModeChinese (void)
m_prop_chinese.setLabel (m_mode_chinese ?
_("Chinese") :
_("English"));
+
+ if (m_mode_chinese)
+ m_prop_chinese.setSymbol(N_("中"));
+ else
+ m_prop_chinese.setSymbol(N_("英"));
+
m_prop_chinese.setIcon (m_mode_chinese ?
PKGDATADIR"/icons/chinese.svg" :
PKGDATADIR"/icons/english.svg");
diff --git a/src/PYProperty.h b/src/PYProperty.h
index 70c0808..13b9340 100644
--- a/src/PYProperty.h
+++ b/src/PYProperty.h
@@ -55,6 +55,16 @@ public:
ibus_property_set_icon (get<IBusProperty> (), icon);
}
+ void setSymbol (IBusText *text)
+ {
+ ibus_property_set_symbol (get<IBusProperty> (), text);
+ }
+
+ void setSymbol (const gchar *text)
+ {
+ setSymbol (Text (text));
+ }
+
void setSensitive (gboolean sensitive)
{
ibus_property_set_sensitive (get<IBusProperty> (), sensitive);
--
1.8.3.1
From c42d0a870697e95301deabe0bcb770a68649c81d Mon Sep 17 00:00:00 2001
From: Peng Wu <alexepico@gmail.com>
Date: Wed, 31 Jul 2013 10:53:14 +0800
Subject: [PATCH 2/2] fixes lua 5.2 compile
---
lua/lua-plugin-init.c | 8 ++++++++
lua/lua-plugin.c | 9 +++++++++
2 files changed, 17 insertions(+)
diff --git a/lua/lua-plugin-init.c b/lua/lua-plugin-init.c
index b607b2a..8e95286 100644
--- a/lua/lua-plugin-init.c
+++ b/lua/lua-plugin-init.c
@@ -26,6 +26,14 @@
#include "lua-plugin.h"
+#if LUA_VERSION_NUM >= 502
+/* ugly hack for lua 5.2 */
+
+#define lua_objlen lua_rawlen
+
+#endif
+
+
static const luaL_Reg lualibs[] = {
{"", luaopen_base},
{LUA_TABLIBNAME, luaopen_table},
diff --git a/lua/lua-plugin.c b/lua/lua-plugin.c
index 9fd36fb..5ccb837 100644
--- a/lua/lua-plugin.c
+++ b/lua/lua-plugin.c
@@ -25,6 +25,15 @@
#include "lua-plugin.h"
+#if LUA_VERSION_NUM >= 502
+/* ugly hack for lua 5.2 */
+
+#define lua_open luaL_newstate
+
+#define lua_objlen lua_rawlen
+
+#endif
+
#define IBUS_ENGINE_PLUGIN_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), IBUS_TYPE_ENGINE_PLUGIN, IBusEnginePluginPrivate))
struct _IBusEnginePluginPrivate{
--
1.8.3.1