Update the symbol of the ibus indicator

This commit is contained in:
Peng Wu 2013-07-30 12:44:02 +08:00
parent fc98aaea3d
commit 5253c3180b
2 changed files with 85 additions and 2 deletions

View File

@ -0,0 +1,80 @@
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] 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

View File

@ -1,8 +1,8 @@
%global snapshot 0
%global snapshot 1
Name: ibus-libpinyin
Version: 1.6.91
Release: 1%{?dist}
Release: 2%{?dist}
Summary: Intelligent Pinyin engine based on libpinyin for IBus
License: GPLv2+
Group: System Environment/Libraries
@ -78,6 +78,9 @@ make install DESTDIR=$RPM_BUILD_ROOT INSTALL="install -p"
%{_datadir}/ibus/component/*
%changelog
* Tue Jul 30 2013 Peng Wu <pwu@redhat.com> - 1.6.91-2
- Update the symbol of the ibus indicator
* Sun Apr 28 2013 Peng Wu <pwu@redhat.com> - 1.6.91-1
- Update to 1.6.91