Bug fix for 7037369, to S11 B168
authormkaz
Sun, 05 Jun 2011 01:15:52 +0900
changeset 682 548538ad03b6
parent 681 d0db4ae7621e
child 683 8fc3e7f72429
child 684 622cdaa8e563
child 685 ea77e00fbe22
child 687 fcb06c0bc596
Bug fix for 7037369, to S11 B168
iiim/build/imf_0020.iiim
imf-selector/data/0210.im
imf-selector/src/imf-selector
specs/ext-sources/ibus-xinput
specs/ext-sources/imf-selector-1.0.tar.gz
specs/ext-sources/imf-selector.copyright
specs/ext-sources/scim-xinput
--- a/iiim/build/imf_0020.iiim	Thu May 26 16:26:32 2011 +0900
+++ b/iiim/build/imf_0020.iiim	Sun Jun 05 01:15:52 2011 +0900
@@ -20,11 +20,13 @@
 #
 # CDDL HEADER END
 #
-# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
 #
 
 # Used in IMselect
-show_name(){
+ID="IIIM"
+
+show_desc(){
     print "IIIM - Internet/Intranet Input Method"
 }
 
@@ -33,16 +35,18 @@
     case $lang in
         ja*) 
             if [ -d /usr/lib/iiim/le/atokx2 ]; then
-                echo "$0|ATOK|IIIMF"
+                echo "$0|ATOK|$ID"
             elif [ -d /usr/lib/iiim/le/wnn8 ]; then
-                echo "$0|Wnn|IIIMF"
+                echo "$0|Wnn|$ID"
             fi; break;;
     esac
 }
 
 case "X$1" in
-    'X-name') show_name; exit 0;;
+    'X-id') echo "$ID"; exit 0;;
+    'X-desc') show_desc; exit 0;;
     'X-prior') show_prior $2; exit 0;;
+    'X-id') echo "$ID"; exit 0;;
 esac
 
 if [ -x /usr/bin/iiimx ]; then
--- a/imf-selector/data/0210.im	Thu May 26 16:26:32 2011 +0900
+++ b/imf-selector/data/0210.im	Sun Jun 05 01:15:52 2011 +0900
@@ -20,7 +20,7 @@
 #
 # CDDL HEADER END
 #
-# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
 #
 
 LING=${LC_CTYPE:-"$LC_ALL"}
@@ -35,8 +35,9 @@
 tolines(){
     for imfile in $@
     do
-        im_name=`sh $imfile -name`
-        /bin/echo "$im_name|$imfile"
+        im_id=`sh $imfile -id`
+        im_desc=`sh $imfile -desc`
+        /bin/echo "$im_id|$im_desc|$imfile"
     done
 }
 
@@ -51,8 +52,9 @@
         im_file=`LC_ALL=C /bin/ls $XIM_SCRIPT_DIR \
         | /bin/grep "[0-9][0-9]*\.$s\$"`
         if [ X$im_file != X ]; then
-            im_name=`sh $XIM_SCRIPT_DIR/$im_file -name`
-            /bin/echo "$im_name|$XIM_SCRIPT_DIR/$im_file"
+            im_id=`sh $XIM_SCRIPT_DIR/$im_file -id`
+            im_desc=`sh $XIM_SCRIPT_DIR/$im_file -desc`
+            /bin/echo "$im_id|$im_desc|$XIM_SCRIPT_DIR/$im_file"
         fi
         return
     fi
@@ -79,6 +81,12 @@
     done
 }
 
+get_id(){
+    # If IMF has notification message, show it when it selected.
+    im_script="$1"
+    sh $im_script -id
+}
+
 get_default_im(){
 
     # As default, enable for only specified Asian locales
@@ -95,8 +103,8 @@
     if [ -f $XIM_USR_CONF ]; then
 
         # 1. configuration in $HOME by tool
-        im_name=`/bin/sh $XIM_USR_CONF -name`
-        if [ X"$im_name" = X ]; then
+        im_id=`/bin/sh $XIM_USR_CONF -id`
+        if [ X"$im_id" = X ]; then
             im_data="None"
 
             . "$XIM_USR_CONF" 
@@ -104,7 +112,8 @@
                 im_data=""
             fi
         else
-            im_data="$im_name|$XIM_USR_CONF"
+            im_desc=`/bin/sh $XIM_USR_CONF -desc`
+            im_data="$im_id|$im_desc|$XIM_USR_CONF"
         fi
 
     elif [ X$GTK_IM_MODULE != X ]; then
@@ -174,11 +183,12 @@
     '-default') get_default_im;       exit $?;;
     '-get')     get_current_im;       exit $?;;
     '-set')     set_im $2;            exit $?;;
+    '-id')      get_id $2;            exit $?;;
 esac
 
 PRIOR_IM=`get_prior_im`
 if [ X"$PRIOR_IM" != X ]; then
     (sleep 10 && $IMFSELECTOR -p "$PRIOR_IM") &
 fi
-IM_SCRIPT=`get_current_im | cut -d '|' -f 2`
+IM_SCRIPT=`get_current_im | cut -d '|' -f 3`
 start_im
--- a/imf-selector/src/imf-selector	Thu May 26 16:26:32 2011 +0900
+++ b/imf-selector/src/imf-selector	Sun Jun 05 01:15:52 2011 +0900
@@ -20,7 +20,7 @@
 #
 # CDDL HEADER END
 #
-# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
 #
 
 import gettext
@@ -47,9 +47,19 @@
     IMSCRIPT        = '/etc/X11/xinit/xinitrc.d/0210.im'
     LOCALEDIR       = '/usr/share/locale'
     DATADIR         = '/usr/share/imf-selector'
-    XIM_DATA        = {}     # Keep name and script path
     ENABLE_FLAG     = False  # Flag for enabling IM
 
+    # Line starting with 'setxkbmap' is command. Please leave it in English
+    MSGS = { 'IIIM': _("Notification:\n\nIf you use ATOK or Wnn8 with "\
+                    "Japanese type7 keyobard, you will need to set 'Sun "\
+                    "Japanese keyboard compatible' variant for Japanese "\
+                    "keyboard. Please set it through setxkbmap, "\
+                    "gnome-keyboard-properties or GDM keyboard menu. \n\n"\
+                    "% setxkbmap -model sun_type7_jp_usb "\
+                    "-layout jp -variant suncompat\n\nOr select 'Japan "\
+                    "(Sun Japanese keyboard compatible)' on "\
+                    "gnome-keyboard-properties or GDM keyboard menu.")}
+
     def __init__(self):
         super(IMSelector, self).__init__()
         props = {gnome.PARAM_APP_DATADIR: self.DATADIR}
@@ -80,12 +90,13 @@
         vbox.pack_start(scroll_window)
 
         self.tv = gtk.TreeView() 
-        self.lst = gtk.ListStore(gobject.TYPE_STRING)
+        self.lst = gtk.ListStore(gobject.TYPE_STRING, gobject.TYPE_STRING,
+                                 gobject.TYPE_STRING)
         self.tv.set_model(self.lst)
         tv_clm = gtk.TreeViewColumn(_("Available Input Method Framework"))
         tv_cl = gtk.CellRendererText()
         tv_clm.pack_start(tv_cl, True)
-        tv_clm.add_attribute(tv_cl, 'text', 0)
+        tv_clm.add_attribute(tv_cl, 'text', 1)
         self.tv.append_column(tv_clm)
         scroll_window.add(self.tv) 
 
@@ -119,11 +130,11 @@
             selection.unselect_all()
             self.__disable_im()
             return None
-        name = im.split('|')[0]
+        id = im.split('|')[0]
         iter = self.lst.get_iter_first()
         while iter:
             value = self.lst.get_value(iter, 0)
-            if(name == value):
+            if(id == value):
                 selection = self.tv.get_selection()
                 selection.select_iter(iter)
                 self.__enable_im()
@@ -150,10 +161,10 @@
         if(list == ""):
             return 0
         for im in list.split('\n'):
-            name = im.split('|')[0]
-            path = im.split('|')[1]
-            self.XIM_DATA[name] = path
-            self.lst.append([name])
+            id   = im.split('|')[0]
+            desc = im.split('|')[1]
+            path = im.split('|')[2]
+            self.lst.append([id, desc, path])
 
     def __exec_script(self, opt, arg=""):
         cmd = self.IMSCRIPT + ' ' + opt + ' ' + arg
@@ -179,11 +190,11 @@
             selection.unselect_all()
             self.__disable_im()
             return None
-        name = im.split('|')[0]
+        id = im.split('|')[0]
         iter=self.lst.get_iter_first()
         while iter:
             value = self.lst.get_value(iter, 0) 
-            if(name == value):
+            if(id == value):
                 selection = self.tv.get_selection()
                 selection.select_iter(iter)
                 self.__enable_im()
@@ -196,9 +207,12 @@
         iter = selection.get_selected()[1]
         if((not iter) and self.ENABLE_FLAG):
             return
+        id = self.__exec_script('-id', self.lst.get_value(iter, 2))
         msg = _("Do you update your configuration ?\n"\
                 "This configuration becomes effective "\
                 "from next desktop login.")
+        if(id in self.MSGS):
+            msg = msg+"\n\n"+self.MSGS[id]
         dlg = gtk.MessageDialog(type = gtk.MESSAGE_INFO,
                     buttons = gtk.BUTTONS_YES_NO,
                     message_format = msg)
@@ -209,8 +223,8 @@
                 if(self.__exec_script('-set') != False):
                     self.__quit()
             else:
-                imname = self.lst.get_value(iter, 0)
-                if(self.__exec_script('-set', self.XIM_DATA[imname]) != False):
+                path = self.lst.get_value(iter, 2)
+                if(self.__exec_script('-set', path) != False):
                     self.__quit()
         elif id == gtk.RESPONSE_NO:
             return
@@ -231,12 +245,14 @@
         self.dlg.show_all()
         gtk.main()
 
-    def init_priorui(self, script, engine, imf):
+    def init_priorui(self, script, engine, id):
         msg = _("Found Input Method '%s' under '%s' framework on "\
                 "system for this locale.\n Do you use this Input Method "\
                 "in your desktop ?\n"\
                 "This configuration becomes effective "\
-                "from next desktop login.") %(engine, imf)
+                "from next desktop login.") %(engine, id)
+        if(id in self.MSGS):
+            msg = msg+"\n\n"+self.MSGS[id]
         
         self.priordlg = gtk.MessageDialog(type = gtk.MESSAGE_INFO,
                     buttons = gtk.BUTTONS_YES_NO,
@@ -249,8 +265,8 @@
             self.__exec_script('-set', 'IGNORE')
         sys.exit(0)
 
-    def run_prior(self, script, engine, imf):
-        self.init_priorui(script, engine, imf)
+    def run_prior(self, script, engine, id):
+        self.init_priorui(script, engine, id)
         gtk.main()
 
 if __name__ == "__main__":
@@ -265,8 +281,8 @@
         if option in ("-p", "--prior"):
             script=argument.split('|')[0]
             engine=argument.split('|')[1]
-            imf=argument.split('|')[2]
-            setup.run_prior(script, engine, imf)
+            id=argument.split('|')[2]
+            setup.run_prior(script, engine, id)
             sys.exit(0)
 
     setup.run()
--- a/specs/ext-sources/ibus-xinput	Thu May 26 16:26:32 2011 +0900
+++ b/specs/ext-sources/ibus-xinput	Sun Jun 05 01:15:52 2011 +0900
@@ -20,11 +20,13 @@
 #
 # CDDL HEADER END
 #
-# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
 #
 
 # Used in IMselect
-show_name(){
+ID="IBus"
+
+show_desc(){
     print "IBus - Intelligent Input Bus"
 }
 
@@ -36,7 +38,8 @@
 }
 
 case "X$1" in
-    'X-name') show_name; exit 0;;
+    'X-id') echo "$ID"; exit 0;;
+    'X-desc') show_desc; exit 0;;
     'X-prior') show_prior $2; exit 0;;
 esac
 
Binary file specs/ext-sources/imf-selector-1.0.tar.gz has changed
--- a/specs/ext-sources/imf-selector.copyright	Thu May 26 16:26:32 2011 +0900
+++ b/specs/ext-sources/imf-selector.copyright	Sun Jun 05 01:15:52 2011 +0900
@@ -1,1 +1,1 @@
-Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
--- a/specs/ext-sources/scim-xinput	Thu May 26 16:26:32 2011 +0900
+++ b/specs/ext-sources/scim-xinput	Sun Jun 05 01:15:52 2011 +0900
@@ -20,11 +20,13 @@
 #
 # CDDL HEADER END
 #
-# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
 #
 
 # Used in IMselect
-show_name(){
+ID="SCIM"
+
+show_desc(){
     print "SCIM - Smart Common Input Method"
 }
 
@@ -36,7 +38,8 @@
 }
 
 case "X$1" in
-    'X-name') show_name; exit 0;;
+    'X-id') echo "$ID" ; exit 0;;
+    'X-desc') show_desc; exit 0;;
     'X-prior') show_prior $2; exit 0;;
 esac