[mozc] Apply an upstream patch to fix a text property for menus (#920122)

Akira TAGOH tagoh at fedoraproject.org
Wed Mar 13 08:26:01 UTC 2013


commit 2f8ff209e534d75dc38f329c559344f4f9f39d81
Author: Akira TAGOH <tagoh at redhat.com>
Date:   Wed Mar 13 17:25:56 2013 +0900

    Apply an upstream patch to fix a text property for menus (#920122)
    
    - Update zipcode dictionaries.

 mozc-ibus-prop.patch |  145 ++++++++++++++++++++++++++++++++++++++++++++++++++
 mozc.spec            |    8 +++-
 sources              |    4 +-
 3 files changed, 154 insertions(+), 3 deletions(-)
---
diff --git a/mozc-ibus-prop.patch b/mozc-ibus-prop.patch
new file mode 100644
index 0000000..1b975a1
--- /dev/null
+++ b/mozc-ibus-prop.patch
@@ -0,0 +1,145 @@
+Index: unix/ibus/message_translator.cc
+===================================================================
+--- unix/ibus/message_translator.cc	(revision 130)
++++ unix/ibus/message_translator.cc	(working copy)
+@@ -73,6 +73,9 @@
+   { "Character Palette",
+     "\xE6\x96\x87\xE5\xAD\x97"
+     "\xE3\x83\x91\xE3\x83\xAC\xE3\x83\x83\xE3\x83\x88" },
++  // "入力モード"
++  { "Input Mode",
++    "\xE5\x85\xA5\xE5\x8A\x9B\xE3\x83\xA2\xE3\x83\xBC\xE3\x83\x89" },
+   // "Mozc について"
+   // TODO(team): This should be "Google 日本語入力について"
+   //     for official branding build.
+Index: unix/ibus/mozc_engine_property.cc
+===================================================================
+--- unix/ibus/mozc_engine_property.cc	(revision 130)
++++ unix/ibus/mozc_engine_property.cc	(working copy)
+@@ -40,42 +40,42 @@
+ const MozcEngineProperty kMozcEnginePropertiesArray[] = {
+   {
+     commands::DIRECT,
+-    "CompositionMode.Direct",
++    "InputMode.Direct",
+     "Direct input",
+     "A",
+     "direct.png",
+   },
+   {
+     commands::HIRAGANA,
+-    "CompositionMode.Hiragana",
++    "InputMode.Hiragana",
+     "Hiragana",
+     "\xe3\x81\x82",  // Hiragana letter A
+     "hiragana.png",
+   },
+   {
+     commands::FULL_KATAKANA,
+-    "CompositionMode.Katakana",
++    "InputMode.Katakana",
+     "Katakana",
+     "\xe3\x82\xa2",  // Katakana letter A
+     "katakana_full.png",
+   },
+   {
+     commands::HALF_ASCII,
+-    "CompositionMode.Latin",
++    "InputMode.Latin",
+     "Latin",
+     "_A",
+     "alpha_half.png",
+   },
+   {
+     commands::FULL_ASCII,
+-    "CompositionMode.WideLatin",
++    "InputMode.WideLatin",
+     "Wide Latin",
+     "\xef\xbc\xa1",  // Full width ASCII letter A
+     "alpha_full.png",
+   },
+   {
+     commands::HALF_KATAKANA,
+-    "CompositionMode.HalfWidthKatakana",
++    "InputMode.HalfWidthKatakana",
+     "Half width katakana",
+     "_\xef\xbd\xb1",  // Half width Katakana letter A
+     "katakana_half.png",
+Index: unix/ibus/property_handler.cc
+===================================================================
+--- unix/ibus/property_handler.cc	(revision 130)
++++ unix/ibus/property_handler.cc	(working copy)
+@@ -36,6 +36,10 @@
+ #include "unix/ibus/path_util.h"
+ #include "unix/ibus/message_translator.h"
+ 
++#if IBUS_CHECK_VERSION(1, 5, 0)
++#define MOZC_IBUS_HAS_SYMBOL
++#endif  // IBus >= 1.5
++
+ namespace mozc {
+ namespace ibus {
+ 
+@@ -115,6 +119,7 @@
+ 
+   // Create items for the radio menu.
+   string icon_path_for_panel;
++  const char *mode_symbol = NULL;
+   for (size_t i = 0; i < kMozcEnginePropertiesSize; ++i) {
+     const MozcEngineProperty &entry = kMozcEngineProperties[i];
+     IBusText *label = ibus_text_new_from_string(
+@@ -123,6 +128,7 @@
+     if (entry.composition_mode == kMozcEngineInitialCompositionMode) {
+       state = PROP_STATE_CHECKED;
+       icon_path_for_panel = GetIconPath(entry.icon);
++      mode_symbol = entry.label_for_panel;
+     }
+     IBusProperty *item = ibus_property_new(entry.key,
+                                            PROP_TYPE_RADIO,
+@@ -141,10 +147,13 @@
+   }
+   DCHECK(!icon_path_for_panel.empty());
+ 
++  const string &mode_label =
++      translator_->MaybeTranslate("Input Mode") + " (" + mode_symbol + ")";
++  IBusText *label = ibus_text_new_from_string(mode_label.c_str());
+   // The label of |prop_composition_mode_| is shown in the language panel.
+-  prop_composition_mode_ = ibus_property_new("CompositionMode",
++  prop_composition_mode_ = ibus_property_new("InputMode",
+                                              PROP_TYPE_MENU,
+-                                             NULL /* label */,
++                                             label,
+                                              icon_path_for_panel.c_str(),
+                                              NULL /* tooltip */,
+                                              TRUE /* sensitive */,
+@@ -152,6 +161,11 @@
+                                              PROP_STATE_UNCHECKED,
+                                              sub_prop_list);
+ 
++#ifdef MOZC_IBUS_HAS_SYMBOL
++  IBusText *symbol = ibus_text_new_from_static_string(mode_symbol);
++  ibus_property_set_symbol(prop_composition_mode_, symbol);
++#endif  // MOZC_IBUS_HAS_SYMBOL
++
+   // Likewise, |prop_composition_mode_| owns |sub_prop_list|. We have to sink
+   // |prop_composition_mode_| here so ibus_engine_update_property() call in
+   // PropertyActivate() does not destruct the object.
+@@ -297,6 +311,18 @@
+     }
+     // No need to call unref since ibus_prop_list_get does not add ref.
+   }
++
++  const char *mode_symbol = entry->label_for_panel;
++#ifdef MOZC_IBUS_HAS_SYMBOL
++  IBusText *symbol = ibus_text_new_from_static_string(mode_symbol);
++  ibus_property_set_symbol(prop_composition_mode_, symbol);
++#endif  // MOZC_IBUS_HAS_SYMBOL
++
++  const string &mode_label =
++      translator_->MaybeTranslate("Input Mode") + " (" + mode_symbol + ")";
++  IBusText *label = ibus_text_new_from_string(mode_label.c_str());
++  ibus_property_set_label(prop_composition_mode_, label);
++
+   ibus_engine_update_property(engine, prop_composition_mode_);
+ }
+ 
diff --git a/mozc.spec b/mozc.spec
index da3c2eb..1933074 100644
--- a/mozc.spec
+++ b/mozc.spec
@@ -2,7 +2,7 @@
 
 Name:		mozc
 Version:	1.6.1187.102
-Release:	3%{?dist}
+Release:	4%{?dist}
 Summary:	Open-sourced Google Japanese Input
 
 Group:		System Environment/Libraries
@@ -27,6 +27,7 @@ Patch1:		mozc-fix-model-path-for-zinnia.patch
 Patch2:		mozc-no-Werror.patch
 Patch3:		mozc-support-new-ibus.patch
 Patch4:		mozc-fix-dirs.patch
+Patch5:		mozc-ibus-prop.patch
 
 BuildRequires:	python gettext
 BuildRequires:	openssl-devel libstdc++-devel zlib-devel libxcb-devel protobuf-devel glib2-devel qt-devel zinnia-devel gtk2-devel
@@ -127,6 +128,7 @@ to use mozc with XEmacs.
 %patch2 -p1 -b .2-no-Werror
 %patch3 -p1 -b .3-new-ibus
 %patch4 -p1 -b .4-dirs
+%patch5 -p0 -b .5-ibus-prop
 (cd data/dictionary_oss;
 python ../../dictionary/gen_zip_code_seed.py --zip_code=../../KEN_ALL.CSV --jigyosyo=../../JIGYOSYO.CSV >> dictionary09.txt;
 )
@@ -225,6 +227,10 @@ rm -rf $RPM_BUILD_ROOT
 %{_xemacs_sitelispdir}/%{pkg}/*.el
 
 %changelog
+* Wed Mar 13 2013 Akira TAGOH <tagoh at redhat.com> - 1.6.1187.102-4
+- Apply an upstream patch to fix a text property for menus (#920122)
+- Update zipcode dictionaries.
+
 * Tue Mar 12 2013 Akira TAGOH <tagoh at redhat.com> - 1.6.1187.102-3
 - Rebuild against latest protobuf.
 
diff --git a/sources b/sources
index 208585a..ed0f6ed 100644
--- a/sources
+++ b/sources
@@ -1,3 +1,3 @@
-0f7eff544b256eb643ef309678742e09  jigyosyo.zip
-d1df91ca1fc0cf2b0ffe4eb4ddcf09ca  ken_all.zip
 e5246d17a81d2e942e9e8de0c3240c95  mozc-1.6.1187.102.tar.bz2
+0ce9bd1663e320dc63bd2afffc475ab9  ken_all.zip
+e2a4bdf2d1384b124492a175d35b7867  jigyosyo.zip


More information about the scm-commits mailing list