[ibus/f15/master] Updated to 1.3.99.20110228

Takao Fujiwara fujiwara at fedoraproject.org
Thu Mar 10 09:17:35 UTC 2011


commit 9d6bb4f328850a814443f3ab196d7cac5c842028
Author: Takao Fujiwara <tfujiwar at redhat.com>
Date:   Thu Mar 10 18:07:52 2011 +0900

    Updated to 1.3.99.20110228
    
    - Fixed Bug 673047 - abrt ibus_xkb_get_current_layout for non-XKB system
      Updated ibus-541492-xkb.patch

 .gitignore                    |    2 +
 ibus-530711-preload-sys.patch |  107 +++--
 ibus-541492-xkb.patch         |   74 ++--
 ibus-657165-gjs-plugins.patch |   38 --
 ibus-657165-panel-libs.patch  | 1118 ++++++++++++++++++++++++++++++++++------
 ibus-HEAD.patch               |  124 -----
 ibus.js                       |   53 --
 ibus.spec                     |   51 ++-
 sources                       |    4 +-
 xinput-ibus                   |    2 +-
 10 files changed, 1097 insertions(+), 476 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index 60843a7..a0e8a7a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -9,3 +9,5 @@ ibus-1.3.6.tar.gz
 /ibus-1.3.99.20110127.tar.gz
 /ibus-1.3.99.20110206.tar.gz
 /ibus-ui-gjs-plugins-20110214.tar.bz2
+/ibus-1.3.99.20110228.tar.gz
+/gnome-shell-ibus-plugins-20110304.tar.bz2
diff --git a/ibus-530711-preload-sys.patch b/ibus-530711-preload-sys.patch
index a30d069..cab75a4 100644
--- a/ibus-530711-preload-sys.patch
+++ b/ibus-530711-preload-sys.patch
@@ -1,6 +1,6 @@
-From 8265052e2616f25af6e6a84cda8fb6d5c4d5f4ed Mon Sep 17 00:00:00 2001
+From 4e217b71d30c4f645014e67dd083364a58bd15db Mon Sep 17 00:00:00 2001
 From: fujiwarat <takao.fujiwara1 at gmail.com>
-Date: Fri, 4 Feb 2011 19:48:19 +0900
+Date: Thu, 10 Mar 2011 15:31:55 +0900
 Subject: [PATCH] Reload preload engines until users customize the list.
 
 The idea is, if users don't customize the preload_engines with ibus-setup,
@@ -18,19 +18,19 @@ IBUS_PRELOAD_ENGINE_MODE_USER and users can customize the value
 Loading system default may spend the startup time. If you mind it,
 your dist may like to put TRUE in 'use_local_preload_engines' value.
 ---
- bus/ibusimpl.c       |  241 ++++++++++++++++++++++++++++++++++----------------
+ bus/ibusimpl.c       |  279 ++++++++++++++++++++++++++++++++++---------------
  data/ibus.schemas.in |   13 +++
- ibus/common.py       |    6 ++
- setup/main.py        |   37 +++++++-
- setup/setup.ui       |   21 ++++-
+ ibus/common.py       |    6 +
+ setup/main.py        |   37 ++++++-
+ setup/setup.ui       |   21 +++-
  src/ibustypes.h      |   10 ++
- 6 files changed, 242 insertions(+), 86 deletions(-)
+ 6 files changed, 272 insertions(+), 94 deletions(-)
 
 diff --git a/bus/ibusimpl.c b/bus/ibusimpl.c
-index cbcf7f4..1bb159e 100644
+index 8d4ec36..f86b149 100644
 --- a/bus/ibusimpl.c
 +++ b/bus/ibusimpl.c
-@@ -144,6 +144,9 @@ static void     bus_ibus_impl_set_previous_engine
+@@ -144,6 +144,9 @@ static void     bus_ibus_impl_set_previo
  static void     bus_ibus_impl_set_preload_engines
                                                  (BusIBusImpl        *ibus,
                                                   GVariant           *value);
@@ -40,10 +40,11 @@ index cbcf7f4..1bb159e 100644
  static void     bus_ibus_impl_set_use_sys_layout
                                                  (BusIBusImpl        *ibus,
                                                   GVariant           *value);
-@@ -270,6 +273,126 @@ _panel_destroy_cb (BusPanelProxy *panel,
+@@ -271,6 +274,141 @@ _panel_destroy_cb (BusPanelProxy *panel,
      g_object_unref (panel);
  }
  
++#ifndef OS_CHROMEOS
 +static gint
 +_engine_desc_cmp (IBusEngineDesc *desc1,
 +                  IBusEngineDesc *desc2)
@@ -51,7 +52,9 @@ index cbcf7f4..1bb159e 100644
 +    return - ((gint) ibus_engine_desc_get_rank (desc1)) +
 +              ((gint) ibus_engine_desc_get_rank (desc2));
 +}
++#endif
 +
++#ifndef OS_CHROMEOS
 +static gint
 +_get_config_preload_engine_mode (BusIBusImpl *ibus)
 +{
@@ -75,6 +78,7 @@ index cbcf7f4..1bb159e 100644
 +
 +    return preload_engine_mode;
 +}
++#endif
 +
 +static void
 +_set_preload_engines (BusIBusImpl *ibus,
@@ -104,7 +108,13 @@ index cbcf7f4..1bb159e 100644
 +                                   "preload_engines") == NULL) {
 +            ibus_config_set_value (ibus->config, "general",
 +                                   "preload_engines", value);
++        } else {
++            /* We don't update preload_engines with an empty string for safety.
++             * Just unref the floating value. */
++            g_variant_unref (value);
 +        }
++    } else if (value != NULL) {
++        g_variant_unref (value);
 +    }
 +
 +    g_list_foreach (engine_list, (GFunc) g_object_ref, NULL);
@@ -120,6 +130,7 @@ index cbcf7f4..1bb159e 100644
 +    bus_ibus_impl_update_engines_hotkey_profile (ibus);
 +}
 +
++#ifndef OS_CHROMEOS
 +static void
 +_set_language_relative_preload_engines (BusIBusImpl *ibus)
 +{
@@ -131,10 +142,13 @@ index cbcf7f4..1bb159e 100644
 +
 +    g_assert (BUS_IS_IBUS_IMPL (ibus));
 +
++    /* The setlocale call first checks LC_ALL. If it's not available, checks
++     * LC_CTYPE. If it's also not available, checks LANG. */
 +    lang = g_strdup (setlocale (LC_CTYPE, NULL));
 +    if (lang == NULL) {
 +        return;
 +    }
++
 +    p = index (lang, '.');
 +    if (p) {
 +        *p = '\0';
@@ -163,20 +177,22 @@ index cbcf7f4..1bb159e 100644
 +    _set_preload_engines (ibus, g_variant_builder_end (&builder));
 +    g_list_free (engines);
 +}
++#endif
 +
  static void
  bus_ibus_impl_set_hotkey (BusIBusImpl *ibus,
                            GQuark       hotkey,
-@@ -354,34 +477,32 @@ static void
+@@ -381,34 +519,43 @@ static void
  bus_ibus_impl_set_preload_engines (BusIBusImpl *ibus,
                                     GVariant    *value)
  {
 -    GList *engine_list = NULL;
-+    gint preload_engine_mode = _get_config_preload_engine_mode (ibus);
- 
+-
 -    g_list_foreach (ibus->engine_list, (GFunc) g_object_unref, NULL);
 -    g_list_free (ibus->engine_list);
--
++#ifndef OS_CHROMEOS
++    gint preload_engine_mode = _get_config_preload_engine_mode (ibus);
+ 
 -    if (value != NULL && g_variant_classify (value) == G_VARIANT_CLASS_ARRAY) {
 -        GVariantIter iter;
 -        g_variant_iter_init (&iter, value);
@@ -193,14 +209,23 @@ index cbcf7f4..1bb159e 100644
 +            _set_preload_engines (ibus, value);
          }
      }
++#else
++    _set_preload_engines (ibus, value);
++#endif
 +}
  
 -    g_list_foreach (engine_list, (GFunc) g_object_ref, NULL);
 -    ibus->engine_list = engine_list;
++/**
++ * bus_ibus_impl_set_preload_engine_mode:
++ *
++ * A function to be called when "preload_engines_mode" config is updated.
++ */
 +static void
 +bus_ibus_impl_set_preload_engine_mode (BusIBusImpl *ibus,
 +                                       GVariant    *value)
 +{
++#ifndef OS_CHROMEOS
 +    gint preload_engine_mode = IBUS_PRELOAD_ENGINE_MODE_LANG_RELATIVE;
  
 -    if (ibus->engine_list) {
@@ -218,10 +243,11 @@ index cbcf7f4..1bb159e 100644
 +    }
 +
 +    _set_language_relative_preload_engines (ibus);
++#endif
  }
  
  /**
-@@ -459,82 +580,48 @@ bus_ibus_impl_set_use_global_engine (BusIBusImpl *ibus,
+@@ -489,89 +636,48 @@ bus_ibus_impl_set_use_global_engine (Bus
      }
  }
  
@@ -238,7 +264,7 @@ index cbcf7f4..1bb159e 100644
  /**
   * bus_ibus_impl_set_default_preload_engines:
   *
-- * If the "preload_engines" config variable is not set yet, set the default value which is determined based on a current locale (LC_ALL).
+- * If the "preload_engines" config variable is not set yet, set the default value which is determined based on a current locale.
 + * bus_ibus_impl_set_default_preload_engines handles the gconf value
 + * /desktop/ibus/general/preload_engines and preload_engine_mode.
 + * The idea is, if users don't customize the preload_engines with ibus-setup,
@@ -282,7 +308,14 @@ index cbcf7f4..1bb159e 100644
      }
  
      done = TRUE;
--    gchar *lang = g_strdup (setlocale (LC_ALL, NULL));
+-
+-    /* The setlocale call first checks LC_ALL. If it's not available, checks
+-     * LC_CTYPE. If it's also not available, checks LANG. */
+-    gchar *lang = g_strdup (setlocale (LC_CTYPE, NULL));
+-    if (lang == NULL) {
+-        return;
+-    }
+-
 -    gchar *p = index (lang, '.');
 -    if (p) {
 -        *p = '\0';
@@ -327,16 +360,16 @@ index cbcf7f4..1bb159e 100644
  #endif
  }
  
-@@ -548,6 +635,7 @@ const static struct {
-     { "general/hotkey", "next_engine_in_menu",  bus_ibus_impl_set_next_engine_in_menu },
-     { "general/hotkey", "previous_engine",      bus_ibus_impl_set_previous_engine },
-     { "general", "preload_engines",             bus_ibus_impl_set_preload_engines },
-+    { "general", "preload_engine_mode",         bus_ibus_impl_set_preload_engine_mode },
-     { "general", "use_system_keyboard_layout",  bus_ibus_impl_set_use_sys_layout },
-     { "general", "use_global_engine",           bus_ibus_impl_set_use_global_engine },
-     { "general", "embed_preedit_text",          bus_ibus_impl_set_embed_preedit_text },
+@@ -587,6 +693,7 @@ const static struct {
+     { "general/hotkey", "next_engine_in_menu",   bus_ibus_impl_set_next_engine_in_menu },
+     { "general/hotkey", "previous_engine",       bus_ibus_impl_set_previous_engine },
+     { "general", "preload_engines",              bus_ibus_impl_set_preload_engines },
++    { "general", "preload_engines_mode",         bus_ibus_impl_set_preload_engine_mode },
+     { "general", "use_system_keyboard_layout",   bus_ibus_impl_set_use_sys_layout },
+     { "general", "use_global_engine",            bus_ibus_impl_set_use_global_engine },
+     { "general", "embed_preedit_text",           bus_ibus_impl_set_embed_preedit_text },
 diff --git a/data/ibus.schemas.in b/data/ibus.schemas.in
-index 54709ce..2ed0321 100644
+index 7ca4899..39922a0 100644
 --- a/data/ibus.schemas.in
 +++ b/data/ibus.schemas.in
 @@ -13,6 +13,19 @@
@@ -360,7 +393,7 @@ index 54709ce..2ed0321 100644
        <applyto>/desktop/ibus/general/hotkey/trigger</applyto>
        <owner>ibus</owner>
 diff --git a/ibus/common.py b/ibus/common.py
-index 763ed1c..1264787 100644
+index e105f18..20c0710 100644
 --- a/ibus/common.py
 +++ b/ibus/common.py
 @@ -33,6 +33,8 @@ __all__ = (
@@ -372,7 +405,7 @@ index 763ed1c..1264787 100644
          "default_reply_handler",
          "default_error_handler",
          "DEFAULT_ASYNC_HANDLERS",
-@@ -133,6 +135,10 @@ ORIENTATION_HORIZONTAL  = 0
+@@ -132,6 +134,10 @@ ORIENTATION_HORIZONTAL  = 0
  ORIENTATION_VERTICAL    = 1
  ORIENTATION_SYSTEM      = 2
  
@@ -384,10 +417,10 @@ index 763ed1c..1264787 100644
      pass
  
 diff --git a/setup/main.py b/setup/main.py
-index 8bac900..c855b86 100644
+index 7f4a040..9cdce02 100644
 --- a/setup/main.py
 +++ b/setup/main.py
-@@ -191,15 +191,22 @@ class Setup(object):
+@@ -213,15 +213,22 @@ class Setup(object):
          self.__checkbutton_use_global_engine.connect("toggled", self.__checkbutton_use_global_engine_toggled_cb)
  
          # init engine page
@@ -415,7 +448,7 @@ index 8bac900..c855b86 100644
  
          self.__treeview = self.__builder.get_object("treeview_engines")
          self.__treeview.set_engines(engines)
-@@ -243,6 +250,13 @@ class Setup(object):
+@@ -265,6 +272,13 @@ class Setup(object):
              engine_names = map(lambda e: e.name, engines)
              self.__config.set_list("general", "preload_engines", engine_names, "s")
  
@@ -429,7 +462,7 @@ index 8bac900..c855b86 100644
      def __button_engine_add_cb(self, button):
          engine = self.__combobox.get_active_engine()
          self.__treeview.append_engine(engine)
-@@ -254,6 +268,19 @@ class Setup(object):
+@@ -276,6 +290,19 @@ class Setup(object):
              about.run()
              about.destroy()
  
@@ -450,10 +483,10 @@ index 8bac900..c855b86 100644
          try:
              self.__bus = ibus.Bus()
 diff --git a/setup/setup.ui b/setup/setup.ui
-index de58446..71f723d 100644
+index cddae98..edfb3a8 100644
 --- a/setup/setup.ui
 +++ b/setup/setup.ui
-@@ -486,7 +486,22 @@
+@@ -582,7 +582,22 @@
                      <property name="visible">True</property>
                      <property name="orientation">vertical</property>
                      <child>
@@ -477,7 +510,7 @@ index de58446..71f723d 100644
                          <property name="visible">True</property>
                          <child>
                            <object class="GtkAlignment" id="alignment6">
-@@ -637,7 +652,7 @@
+@@ -733,7 +748,7 @@
                          </child>
                        </object>
                        <packing>
@@ -486,7 +519,7 @@ index de58446..71f723d 100644
                        </packing>
                      </child>
                      <child>
-@@ -676,7 +691,7 @@ You may use up/down buttons to change it.&lt;/i&gt;&lt;/small&gt;</property>
+@@ -772,7 +787,7 @@ You may use up/down buttons to change it.&lt;/i&gt;&lt;/small&gt;</property>
                        </object>
                        <packing>
                          <property name="expand">False</property>
@@ -517,5 +550,5 @@ index 035d124..0a9d7b2 100644
   * @x: x coordinate.
   * @y: y coordinate.
 -- 
-1.7.3.2
+1.7.4.1
 
diff --git a/ibus-541492-xkb.patch b/ibus-541492-xkb.patch
index 3f6912e..3374c0f 100644
--- a/ibus-541492-xkb.patch
+++ b/ibus-541492-xkb.patch
@@ -1,6 +1,6 @@
-From 245b932b2a72bd23ab8f40ec624184da7ad53b8d Mon Sep 17 00:00:00 2001
+From ab4b0cc4dca45cc950a72ec65664649b415d40f0 Mon Sep 17 00:00:00 2001
 From: fujiwarat <takao.fujiwara1 at gmail.com>
-Date: Fri, 4 Feb 2011 19:48:10 +0900
+Date: Thu, 10 Mar 2011 14:26:49 +0900
 Subject: [PATCH] Add XKB layouts
 
 ---
@@ -27,11 +27,11 @@ Subject: [PATCH] Add XKB layouts
  xkb/ibus-xkb-main.c        |  105 +++++++
  xkb/xkblayout.xml.in       |   16 +
  xkb/xkblayoutconfig.xml.in |    6 +
- xkb/xkblib.c               |  297 +++++++++++++++++++
+ xkb/xkblib.c               |  303 +++++++++++++++++++
  xkb/xkblib.h               |   40 +++
  xkb/xkbxml.c               |  696 ++++++++++++++++++++++++++++++++++++++++++++
  xkb/xkbxml.h               |  189 ++++++++++++
- 27 files changed, 3793 insertions(+), 6 deletions(-)
+ 27 files changed, 3799 insertions(+), 6 deletions(-)
  create mode 100644 ibus/xkblayout.py.in
  create mode 100644 ibus/xkbxml.py.in
  create mode 100644 setup/xkbsetup.py
@@ -72,7 +72,7 @@ index 02b7163..6cbe82a 100644
  	$(NULL)
  
 diff --git a/configure.ac b/configure.ac
-index 0c06fbc..8667510 100644
+index def1986..1347991 100644
 --- a/configure.ac
 +++ b/configure.ac
 @@ -185,6 +185,57 @@ else
@@ -133,7 +133,7 @@ index 0c06fbc..8667510 100644
  # GObject introspection
  GOBJECT_INTROSPECTION_CHECK([0.6.8])
  
-@@ -427,6 +478,7 @@ gconf/Makefile
+@@ -413,6 +464,7 @@ gconf/Makefile
  gconf/gconf.xml.in
  bindings/Makefile
  bindings/vala/Makefile
@@ -141,7 +141,7 @@ index 0c06fbc..8667510 100644
  ])
  
  AC_OUTPUT
-@@ -442,6 +494,7 @@ Build options:
+@@ -428,6 +480,7 @@ Build options:
    Build gtk2 immodule       $enable_gtk2
    Build gtk3 immodule       $enable_gtk3
    Build XIM agent server    $enable_xim
@@ -150,10 +150,10 @@ index 0c06fbc..8667510 100644
    Build gconf modules       $enable_gconf
    Build memconf modules     $enable_memconf
 diff --git a/data/ibus.schemas.in b/data/ibus.schemas.in
-index aa66aa5..54709ce 100644
+index b75295e..7ca4899 100644
 --- a/data/ibus.schemas.in
 +++ b/data/ibus.schemas.in
-@@ -167,6 +167,42 @@
+@@ -190,6 +190,42 @@
        </locale>
      </schema>
      <schema>
@@ -251,10 +251,10 @@ index 7c8f8be..3c25605 100644
 +from xkbxml import *
  from _config import *
 diff --git a/ibus/bus.py b/ibus/bus.py
-index 15a8fd3..74b6820 100644
+index b915190..c01468c 100644
 --- a/ibus/bus.py
 +++ b/ibus/bus.py
-@@ -154,6 +154,9 @@ class Bus(object.Object):
+@@ -157,6 +157,9 @@ class Bus(object.Object):
              data = serializable.deserialize_object(data)
          return data
  
@@ -265,10 +265,10 @@ index 15a8fd3..74b6820 100644
          return self.__ibus.Introspect()
  
 diff --git a/ibus/interface/iibus.py b/ibus/interface/iibus.py
-index e63caa3..8b7b6f7 100644
+index 678d517..7de56fc 100644
 --- a/ibus/interface/iibus.py
 +++ b/ibus/interface/iibus.py
-@@ -72,6 +72,9 @@ class IIBus(dbus.service.Object):
+@@ -75,6 +75,9 @@ class IIBus(dbus.service.Object):
      @method(in_signature="v", out_signature="v")
      def Ping(self, data, dbusconn): pass
  
@@ -971,7 +971,7 @@ index 2fd8876..7383177 100644
 +        self.__title = title
  
 diff --git a/setup/main.py b/setup/main.py
-index 96e9456..8bac900 100644
+index a22bb0c..7f4a040 100644
 --- a/setup/main.py
 +++ b/setup/main.py
 @@ -37,6 +37,7 @@ from gtk import gdk
@@ -982,7 +982,7 @@ index 96e9456..8bac900 100644
  from i18n import DOMAINNAME, _, N_, init as i18n_init
  
  (
-@@ -219,6 +220,8 @@ class Setup(object):
+@@ -241,6 +242,8 @@ class Setup(object):
          self.__combobox.connect("notify::active-engine", self.__combobox_notify_active_engine_cb)
          self.__treeview.connect("notify", self.__treeview_notify_cb)
  
@@ -992,10 +992,10 @@ index 96e9456..8bac900 100644
          engine = self.__combobox.get_active_engine()
          button = self.__builder.get_object("button_engine_add")
 diff --git a/setup/setup.ui b/setup/setup.ui
-index 0e31a78..de58446 100644
+index 0a69df8..cddae98 100644
 --- a/setup/setup.ui
 +++ b/setup/setup.ui
-@@ -129,7 +129,6 @@
+@@ -117,7 +117,6 @@
                                  <child>
                                    <object class="GtkLabel" id="label9">
                                      <property name="visible">True</property>
@@ -1003,7 +1003,7 @@ index 0e31a78..de58446 100644
                                      <property name="tooltip_text" translatable="yes">The shortcut keys for switching to previous input method in the list</property>
                                      <property name="xalign">0</property>
                                      <property name="label" translatable="yes">Previous input method:</property>
-@@ -216,7 +215,6 @@
+@@ -204,7 +203,6 @@
                                      <child>
                                        <object class="GtkEntry" id="entry_prev_engine">
                                          <property name="visible">True</property>
@@ -1011,7 +1011,7 @@ index 0e31a78..de58446 100644
                                          <property name="can_focus">True</property>
                                          <property name="editable">False</property>
                                        </object>
-@@ -228,7 +226,6 @@
+@@ -216,7 +214,6 @@
                                        <object class="GtkButton" id="button_prev_engine">
                                          <property name="label" translatable="yes">...</property>
                                          <property name="visible">True</property>
@@ -1019,7 +1019,7 @@ index 0e31a78..de58446 100644
                                          <property name="can_focus">True</property>
                                          <property name="receives_default">False</property>
                                          <property name="use_underline">True</property>
-@@ -729,6 +726,7 @@ You may use up/down buttons to change it.&lt;/i&gt;&lt;/small&gt;</property>
+@@ -825,6 +822,7 @@ You may use up/down buttons to change it.&lt;/i&gt;&lt;/small&gt;</property>
                                      <property name="visible">True</property>
                                      <property name="orientation">vertical</property>
                                      <property name="spacing">6</property>
@@ -1027,7 +1027,7 @@ index 0e31a78..de58446 100644
                                      <child>
                                        <object class="GtkCheckButton" id="checkbutton_use_sys_layout">
                                          <property name="label" translatable="yes">Use system keyboard layout</property>
-@@ -797,6 +795,57 @@ You may use up/down buttons to change it.&lt;/i&gt;&lt;/small&gt;</property>
+@@ -840,6 +838,57 @@ You may use up/down buttons to change it.&lt;/i&gt;&lt;/small&gt;</property>
                                          <property name="position">0</property>
                                        </packing>
                                      </child>
@@ -1036,7 +1036,7 @@ index 0e31a78..de58446 100644
 +                                        <property name="visible">True</property>
 +                                        <property name="spacing">6</property>
 +                                        <child>
-+                                          <object class="GtkLabel" id="label18">
++                                          <object class="GtkLabel" id="label20">
 +                                            <property name="visible">True</property>
 +                                            <property name="label" translatable="yes">System Keyboard Layout:</property>
 +                                            <property name="use_markup">True</property>
@@ -1085,7 +1085,7 @@ index 0e31a78..de58446 100644
                                    </object>
                                  </child>
                                </object>
-@@ -942,4 +991,558 @@ Homepage: http://code.google.com/p/ibus
+@@ -1038,4 +1087,558 @@ Homepage: http://code.google.com/p/ibus
        </object>
      </child>
    </object>
@@ -2984,10 +2984,10 @@ index 0000000..b1212d1
 +</xkblayout>
 diff --git a/xkb/xkblib.c b/xkb/xkblib.c
 new file mode 100644
-index 0000000..1f6f8d7
+index 0000000..640f783
 --- /dev/null
 +++ b/xkb/xkblib.c
-@@ -0,0 +1,297 @@
+@@ -0,0 +1,303 @@
 +/* -*- mode: C; c-basic-offset: 4; indent-tabs-mode: nil; -*- */
 +/* vim:set et sts=4: */
 +/* bus - The Input Bus
@@ -3053,12 +3053,6 @@ index 0000000..1f6f8d7
 +    unsigned long l, nitems, bytes_after;
 +    unsigned char *prop = NULL;
 +
-+    if (XkbGetState (xdisplay, XkbUseCoreKbd, &state) != Success) {
-+        g_warning ("Could not get state");
-+        return;
-+    }
-+    default_layout_group = state.group;
-+
 +    xkb_rules_name = XInternAtom (xdisplay, "_XKB_RULES_NAMES", TRUE);
 +    if (xkb_rules_name == None) {
 +        g_warning ("Could not get XKB rules atom");
@@ -3088,6 +3082,12 @@ index 0000000..1f6f8d7
 +    default_models = g_strsplit ((gchar *) prop, ",", -1);
 +    prop += strlen ((const char *) prop) + 1;
 +    default_options = g_strsplit ((gchar *) prop, ",", -1);
++
++    if (XkbGetState (xdisplay, XkbUseCoreKbd, &state) != Success) {
++        g_warning ("Could not get state");
++        return;
++    }
++    default_layout_group = state.group;
 +}
 +
 +static Bool
@@ -3232,7 +3232,10 @@ index 0000000..1f6f8d7
 +gchar *
 +ibus_xkb_get_current_layout (void)
 +{
-+    g_assert (default_layouts != NULL);
++    if (default_layouts == NULL) {
++        g_warning ("Your system seems not to support XKB.");
++        return NULL;
++    }
 +
 +    return g_strjoinv (",", (gchar **) default_layouts);
 +}
@@ -3266,7 +3269,10 @@ index 0000000..1f6f8d7
 +    gboolean retval;
 +    gchar *layouts_line;
 +
-+    g_assert (default_layouts != NULL);
++    if (default_layouts == NULL) {
++        g_warning ("Your system seems not to support XKB.");
++        return NULL;
++    }
 +
 +    if (layouts == NULL || g_strcmp0 (layouts, "default") == 0) {
 +        layouts_line = g_strjoinv (",", (gchar **) default_layouts);
@@ -4229,5 +4235,5 @@ index 0000000..f4858fa
 +G_END_DECLS
 +#endif
 -- 
-1.7.3.2
+1.7.4.1
 
diff --git a/ibus-657165-panel-libs.patch b/ibus-657165-panel-libs.patch
index 969c053..401ebc2 100644
--- a/ibus-657165-panel-libs.patch
+++ b/ibus-657165-panel-libs.patch
@@ -1,114 +1,777 @@
-From 4c390e4259cf3f78ef1fd685925d275be4952ed1 Mon Sep 17 00:00:00 2001
+From 71689f16ab8d19045ed44f2609c90202a6bf5db7 Mon Sep 17 00:00:00 2001
 From: fujiwarat <takao.fujiwara1 at gmail.com>
-Date: Wed, 9 Feb 2011 11:02:14 +0900
+Date: Fri, 4 Mar 2011 00:04:34 +0900
 Subject: [PATCH] Implement APIs for another non-Python panel.
 
+1. Support icon and prop_list = null in ibus_property_new with GIR.
+2. Add getter methods in IBusText and IBusProperty since GJS cannot access
+   the members in C-Structure.
+3. Add ibus_get_language_name() since GIR libxml2 does not provide the
+   useful APIs.
+4. Implement flags in ibus_bus_request_name() to follow DBus
+   RequestName signal spec.
+   http://dbus.freedesktop.org/doc/dbus-specification.html#message-bus-names
+   This is needed to terminate the current IBus panel.
+   E.g. IBus GTK panel is launched by ibus-daemon but another panel is
+   launched by gnome-shell.
+5. Support IBUS_BUS_NAME_FLAG_ALLOW_REPLACEMENT in ui/gtk/main.py
+6. Fix bus_component_set_factory() not to call
+   bus_component_factory_destroy_cb() twice.
+7. Hide ibus_text_new_from_static_string() for GIR.
+8. Add ibus_is_running_gnome_shell() for ibus-ui-gtk because
+   gnome-shell runs earlier than ibus-ui-gtk.
 ---
- bus/dbusimpl.c     |   45 ++++++++++++++++
- configure.ac       |    1 +
- src/Makefile.am    |    2 +
- src/ibusbus.c      |   23 ++++++++
- src/ibusbus.h      |   12 ++++
- src/ibusproperty.c |   24 +++++++++
- src/ibusproperty.h |   85 ++++++++++++++++++++++++++++++-
- src/ibustext.c     |   18 +++++++
- src/ibustext.h     |   27 ++++++++++
- src/ibusutil.c     |  145 ++++++++++++++++++++++++++++++++++++++++++++++++++++
- src/ibusutil.h     |   33 ++++++++++++
- ui/gtk/panel.py    |    9 +++
- 12 files changed, 422 insertions(+), 2 deletions(-)
+ bus/component.c           |    2 +-
+ bus/connection.c          |    8 +
+ bus/connection.h          |   12 +-
+ bus/dbusimpl.c            |  480 +++++++++++++++++++++++++++++++++++++++++++--
+ bus/marshalers.list       |    3 +-
+ ibus/common.py            |   24 +++-
+ src/Makefile.am           |    2 +
+ src/ibusbus.c             |    6 +-
+ src/ibusbus.h             |    8 +-
+ src/ibusproperty.c        |   24 +++
+ src/ibusproperty.h        |   85 ++++++++-
+ src/ibustext.c            |   18 ++
+ src/ibustext.h            |   29 +++-
+ src/ibustypes.h           |   33 +++
+ src/ibusutil.c            |  169 ++++++++++++++++
+ src/ibusutil.h            |   39 ++++
+ ui/gtk/gtkpanel.xml.in.in |    2 +-
+ ui/gtk/main.py            |   23 ++-
+ 18 files changed, 928 insertions(+), 39 deletions(-)
  create mode 100644 src/ibusutil.c
  create mode 100644 src/ibusutil.h
 
+diff --git a/bus/component.c b/bus/component.c
+index c1ff85a..fdff9c3 100644
+--- a/bus/component.c
++++ b/bus/component.c
+@@ -256,7 +256,7 @@ bus_component_set_factory (BusComponent    *component,
+     }
+ 
+     if (component->factory) {
+-        g_signal_handlers_disconnect_by_func (factory,
++        g_signal_handlers_disconnect_by_func (component->factory,
+                                               bus_component_factory_destroy_cb,
+                                               component);
+         g_object_unref (component->factory);
+diff --git a/bus/connection.c b/bus/connection.c
+index a3b4c9c..9e73213 100644
+--- a/bus/connection.c
++++ b/bus/connection.c
+@@ -204,6 +204,14 @@ bus_connection_remove_name (BusConnection     *connection,
+     return FALSE;
+ }
+ 
++gboolean
++bus_connection_has_name (BusConnection     *connection,
++                         const gchar       *name)
++{
++    GList *list = g_list_find_custom (connection->names, name, (GCompareFunc) g_strcmp0);
++    return list != NULL;
++}
++
+ GDBusConnection *
+ bus_connection_get_dbus_connection (BusConnection *connection)
+ {
+diff --git a/bus/connection.h b/bus/connection.h
+index df86036..2a34319 100644
+--- a/bus/connection.h
++++ b/bus/connection.h
+@@ -85,7 +85,7 @@ const gchar     *bus_connection_add_name            (BusConnection      *connect
+                                                      const gchar        *name);
+ 
+ /**
+- * bus_connection_add_name:
++ * bus_connection_remove_name:
+  * @name: a well-known name for the connection.
+  * @returns: TRUE on success.
+  *
+@@ -95,6 +95,16 @@ gboolean         bus_connection_remove_name         (BusConnection      *connect
+                                                      const gchar        *name);
+ 
+ /**
++ * bus_connection_has_name:
++ * @name: a well-known name for the connection.
++ * @returns: TRUE if found the name.
++ *
++ * Lookup the well-known name from the connection.
++ */
++gboolean         bus_connection_has_name            (BusConnection      *connection,
++                                                     const gchar        *name);
++
++/**
+  * bus_connection_get_dbus_connection:
+  *
+  * Get the underlying GDBus connection.
 diff --git a/bus/dbusimpl.c b/bus/dbusimpl.c
-index 48dbd42..3abaa4a 100644
+index 48dbd42..8002bac 100644
 --- a/bus/dbusimpl.c
 +++ b/bus/dbusimpl.c
-@@ -138,6 +138,10 @@ static const gchar introspection_xml[] =
-     "      <arg direction='in'  type='s' name='name' />"
-     "      <arg direction='out' type='u' />"
-     "    </method>"
-+    "    <method name='AskReleaseName'>"
-+    "      <arg direction='in'  type='s' name='name' />"
-+    "      <arg direction='in'  type='u' name='reason' />"
-+    "    </method>"
-     "    <method name='StartServiceByName'>"
-     "      <arg direction='in'  type='s' />"
-     "      <arg direction='in'  type='u' />"
-@@ -195,6 +199,10 @@ static const gchar introspection_xml[] =
-     "      <arg type='s' name='old_owner' />"
-     "      <arg type='s' name='new_owner' />"
-     "    </signal>"
-+    "    <signal name='AskReleaseName'>"
-+    "      <arg type='s' name='name' />"
-+    "      <arg type='u' name='reason' />"
-+    "    </signal>"
-     "    <signal name='NameLost'>"
-     "      <arg type='s' name='name' />"
-     "    </signal>"
-@@ -648,6 +656,42 @@ bus_dbus_impl_release_name (BusDBusImpl           *dbus,
+@@ -27,6 +27,8 @@
+ 
+ enum {
+     NAME_OWNER_CHANGED,
++    NAME_LOST,
++    NAME_ACQUIRED,
+     LAST_SIGNAL,
+ };
+ 
+@@ -68,6 +70,14 @@ struct _BusDBusImplClass {
+                                     gchar           *name,
+                                     gchar           *old_name,
+                                     gchar           *new_name);
++
++    void    (* name_lost)          (BusDBusImpl     *dbus,
++                                    BusConnection   *connection,
++                                    gchar           *name);
++
++    void    (* name_acquired)      (BusDBusImpl     *dbus,
++                                    BusConnection   *connection,
++                                    gchar           *name);
+ };
+ 
+ typedef struct _BusDispatchData BusDispatchData;
+@@ -76,6 +86,19 @@ struct _BusDispatchData {
+     BusConnection *skip_connection;
+ };
+ 
++typedef struct _BusNameService BusNameService;
++struct _BusNameService {
++    gchar *name;
++    GSList *owners;
++};
++
++typedef struct _BusConnectionOwner BusConnectionOwner;
++struct _BusConnectionOwner {
++    BusConnection *conn;
++
++    guint allow_replacement : 1;
++    guint do_not_queue : 1;
++};
+ 
+ /* functions prototype */
+ static void     bus_dbus_impl_destroy           (BusDBusImpl        *dbus);
+@@ -111,6 +134,14 @@ static void      bus_dbus_impl_name_owner_changed
+                                                  gchar              *name,
+                                                  gchar              *old_name,
+                                                  gchar              *new_name);
++static void      bus_dbus_impl_name_lost
++                                                (BusDBusImpl        *dbus,
++                                                 BusConnection      *connection,
++                                                 gchar              *name);
++static void      bus_dbus_impl_name_acquired
++                                                (BusDBusImpl        *dbus,
++                                                 BusConnection      *connection,
++                                                 gchar              *name);
+ static void      bus_dbus_impl_connection_destroy_cb
+                                                 (BusConnection      *connection,
+                                                  BusDBusImpl        *dbus);
+@@ -205,6 +236,188 @@ static const gchar introspection_xml[] =
+     "</node>";
+ 
+ static void
++bus_connection_owner_set_flags (BusConnectionOwner *owner,
++                                guint32             flags)
++{
++    owner->allow_replacement =
++        (flags & IBUS_BUS_NAME_FLAG_ALLOW_REPLACEMENT) != 0;
++
++    owner->do_not_queue =
++        (flags & IBUS_BUS_NAME_FLAG_DO_NOT_QUEUE) != 0;
++}
++
++static BusConnectionOwner *
++bus_connection_owner_new (BusConnection *connection,
++                          guint32        flags)
++{
++    BusConnectionOwner *owner = NULL;
++
++    g_assert (connection != NULL);
++
++    owner = (BusConnectionOwner *) g_new0 (BusConnectionOwner, 1);
++    if (owner != NULL) {
++        owner->conn = g_object_ref (connection);
++        bus_connection_owner_set_flags (owner, flags);
++    }
++
++    return owner;
++}
++
++static void
++bus_connection_owner_free (BusConnectionOwner *owner)
++{
++    g_assert (owner != NULL);
++
++    g_object_unref (owner->conn);
++    owner->conn = NULL;
++    g_free (owner);
++}
++
++static GSList *
++_bus_name_service_find_owner_link (BusNameService *service,
++                                   BusConnection  *connection)
++{
++    GSList *owners = service->owners;
++
++    while (owners) {
++        BusConnectionOwner *owner = (BusConnectionOwner *) owners->data;
++        if (owner->conn == connection) {
++            break;
++        }
++        owners = owners->next;
++    }
++
++    return owners;
++}
++
++static BusNameService *
++bus_name_service_new (const gchar *name)
++{
++    BusNameService *service = NULL;
++
++    g_assert (name != NULL);
++
++    service = g_new0 (BusNameService, 1);
++    if (service != NULL) {
++        service->name = g_strdup (name);
++    }
++
++    return service;
++}
++
++static void
++bus_name_service_free (BusNameService *service)
++{
++    GSList *list = NULL;
++
++    g_assert (service != NULL);
++
++    list = service->owners;
++
++    while (list) {
++        bus_connection_owner_free ((BusConnectionOwner *) list->data);
++        list->data = NULL;
++        list = list->next;
++    }
++    if (service->owners) {
++        g_slist_free (service->owners);
++        service->owners = NULL;
++    }
++    g_free (service->name);
++    service->name = NULL;
++    g_free (service);
++}
++
++static void
++bus_name_service_add_primary_owner (BusNameService     *service,
++                                    BusConnectionOwner *owner,
++                                    BusDBusImpl        *dbus)
++{
++    g_assert (service != NULL);
++
++    if (dbus) {
++        g_signal_emit (dbus,
++                       dbus_signals[NAME_ACQUIRED],
++                       0,
++                       g_object_ref (owner->conn),
++                       service->name ? service->name : "");
++    }
++
++    service->owners = g_slist_prepend (service->owners, (gpointer) owner);
++}
++
++static BusConnectionOwner *
++bus_name_service_get_primary_owner (BusNameService *service)
++{
++    g_assert (service != NULL);
++
++    if (service->owners == NULL) {
++        return NULL;
++    }
++
++    return (BusConnectionOwner *) service->owners->data;
++}
++
++static void
++bus_name_service_add_owner (BusNameService     *service,
++                            BusConnectionOwner *owner,
++                            BusDBusImpl        *dbus)
++{
++    g_assert (service != NULL);
++
++    if (dbus && service->owners == NULL) {
++        g_signal_emit (dbus,
++                       dbus_signals[NAME_ACQUIRED],
++                       0,
++                       g_object_ref (owner->conn),
++                       service->name ? service->name : "");
++    }
++
++    service->owners = g_slist_append (service->owners, (gpointer) owner);
++}
++
++static void
++bus_name_service_remove_owner (BusNameService     *service,
++                               BusConnectionOwner *owner,
++                               BusDBusImpl        *dbus)
++{
++    GSList *owners;
++
++    g_assert (service != NULL);
++    g_assert (owner != NULL);
++
++    owners = _bus_name_service_find_owner_link (service, owner->conn);
++    if (owners == NULL) {
++        return;
++    }
++
++    if (dbus &&
++        owners->data == bus_name_service_get_primary_owner (service)) {
++        g_signal_emit (dbus,
++                       dbus_signals[NAME_LOST],
++                       0,
++                       g_object_ref (owner->conn),
++                       service->name ? service->name : "");
++    }
++
++    service->owners = g_slist_remove_link (service->owners, (gpointer) owners);
++}
++
++static gboolean
++bus_name_service_get_allow_replacement (BusNameService *service)
++{
++    BusConnectionOwner *owner = NULL;
++
++    g_assert (service != NULL);
++
++    owner = bus_name_service_get_primary_owner (service);
++    if (owner == NULL) {
++        return TRUE;
++    }
++    return owner->allow_replacement;
++}
++
++static void
+ bus_dbus_impl_class_init (BusDBusImplClass *class)
+ {
+     GObjectClass *gobject_class = G_OBJECT_CLASS (class);
+@@ -221,6 +434,12 @@ bus_dbus_impl_class_init (BusDBusImplClass *class)
+     /* register a handler of the name-owner-changed signal below. */
+     class->name_owner_changed = bus_dbus_impl_name_owner_changed;
+ 
++    /* register a handler of the name-lost signal below. */
++    class->name_lost = bus_dbus_impl_name_lost;
++
++    /* register a handler of the name-acquired signal below. */
++    class->name_acquired = bus_dbus_impl_name_acquired;
++
+     /* install signals */
+     dbus_signals[NAME_OWNER_CHANGED] =
+         g_signal_new (I_("name-owner-changed"),
+@@ -234,13 +453,39 @@ bus_dbus_impl_class_init (BusDBusImplClass *class)
+             G_TYPE_STRING,
+             G_TYPE_STRING,
+             G_TYPE_STRING);
++
++    dbus_signals[NAME_LOST] =
++        g_signal_new (I_("name-lost"),
++            G_TYPE_FROM_CLASS (class),
++            G_SIGNAL_RUN_FIRST,
++            G_STRUCT_OFFSET (BusDBusImplClass, name_lost),
++            NULL, NULL,
++            bus_marshal_VOID__OBJECT_STRING,
++            G_TYPE_NONE,
++            2,
++            BUS_TYPE_CONNECTION,
++            G_TYPE_STRING);
++
++    dbus_signals[NAME_ACQUIRED] =
++        g_signal_new (I_("name-acquired"),
++            G_TYPE_FROM_CLASS (class),
++            G_SIGNAL_RUN_FIRST,
++            G_STRUCT_OFFSET (BusDBusImplClass, name_acquired),
++            NULL, NULL,
++            bus_marshal_VOID__OBJECT_STRING,
++            G_TYPE_NONE,
++            2,
++            BUS_TYPE_CONNECTION,
++            G_TYPE_STRING);
+ }
+ 
+ static void
+ bus_dbus_impl_init (BusDBusImpl *dbus)
+ {
+     dbus->unique_names = g_hash_table_new (g_str_hash, g_str_equal);
+-    dbus->names = g_hash_table_new (g_str_hash, g_str_equal);
++    dbus->names = g_hash_table_new_full (g_str_hash, g_str_equal,
++                                         (GDestroyNotify) g_free,
++                                         (GDestroyNotify) bus_name_service_free);
+ 
+     dbus->dispatch_lock = g_mutex_new ();
+     dbus->forward_lock = g_mutex_new ();
+@@ -557,10 +802,15 @@ bus_dbus_impl_request_name (BusDBusImpl           *dbus,
+                             GVariant              *parameters,
+                             GDBusMethodInvocation *invocation)
+ {
+-    /* FIXME need to handle flags defined in:
+-     * http://dbus.freedesktop.org/doc/dbus-specification.html#message-bus-names */
+     const gchar *name = NULL;  // e.g. "org.freedesktop.IBus.Panel"
+-    guint flags = 0;
++    guint32 flags = 0;
++    guint32 retval = 0;
++    gchar *old_owner_name = NULL;
++    BusNameService *service = NULL;
++    BusConnectionOwner *primary_owner = NULL;
++    BusConnectionOwner *owner = NULL;
++    BusConnection *old_owner_conn = NULL;
++
+     g_variant_get (parameters, "(&su)", &name, &flags);
+ 
+     if (name == NULL ||
+@@ -580,25 +830,82 @@ bus_dbus_impl_request_name (BusDBusImpl           *dbus,
+         return;
+     }
+ 
+-    if (g_hash_table_lookup (dbus->names, name) != NULL) {
+-        g_dbus_method_invocation_return_error (invocation,
+-                        G_DBUS_ERROR, G_DBUS_ERROR_FAILED,
+-                        "Service name '%s' already has an owner.", name);
+-        return;
++    service = (BusNameService *) g_hash_table_lookup (dbus->names, name);
++
++    if (service != NULL) {
++        primary_owner = bus_name_service_get_primary_owner (service);
++        if (primary_owner != NULL) {
++            old_owner_conn = primary_owner->conn;
++        } else {
++            old_owner_conn = NULL;
++        }
++    } else {
++        old_owner_conn = NULL;
+     }
+ 
+-    const guint retval = 1; /* DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER */
+-    g_dbus_method_invocation_return_value (invocation, g_variant_new ("(u)", retval));
+-    g_hash_table_insert (dbus->names,
+-                         (gpointer) bus_connection_add_name (connection, name),
+-                         connection);
++    if (old_owner_conn == NULL) {
++        retval = IBUS_BUS_REQUEST_NAME_REPLY_PRIMARY_OWNER;
++    }
++    else if (old_owner_conn == connection) {
++        retval = IBUS_BUS_REQUEST_NAME_REPLY_ALREADY_OWNER;
++        goto out;
++    }
++    else if (((flags & IBUS_BUS_NAME_FLAG_DO_NOT_QUEUE) &&
++             !(bus_name_service_get_allow_replacement (service))) ||
++             ((flags & IBUS_BUS_NAME_FLAG_DO_NOT_QUEUE) &&
++             !(flags & IBUS_BUS_NAME_FLAG_REPLACE_EXISTING))) {
++        retval = IBUS_BUS_REQUEST_NAME_REPLY_EXISTS;
++        goto out;
++    }
++    else if (!(flags & IBUS_BUS_NAME_FLAG_DO_NOT_QUEUE) &&
++             (!(flags & IBUS_BUS_NAME_FLAG_REPLACE_EXISTING) ||
++              !(bus_name_service_get_allow_replacement (service)))) {
++        if (!bus_connection_has_name (connection, name)) {
++            bus_connection_add_name (connection, name);
++        }
++        owner = bus_connection_owner_new (connection, flags);
++        bus_name_service_add_owner (service, owner, dbus);
++        retval = IBUS_BUS_REQUEST_NAME_REPLY_IN_QUEUE;
++        goto out;
++    }
++    else {
++        if (!bus_connection_has_name (connection, name)) {
++            bus_connection_add_name (connection, name);
++        }
++        owner = bus_connection_owner_new (connection, flags);
++        old_owner_name = g_strdup (bus_connection_get_unique_name (primary_owner->conn));
++        bus_name_service_remove_owner (service, primary_owner, dbus);
++        bus_name_service_add_primary_owner (service, owner, dbus);
++        if (primary_owner->do_not_queue == 0) {
++            bus_name_service_add_owner (service, primary_owner, dbus);
++        } else {
++            if (bus_connection_has_name (primary_owner->conn, name)) {
++                bus_connection_remove_name (primary_owner->conn, name);
++            }
++            bus_connection_owner_free (primary_owner);
++        }
++        retval = IBUS_BUS_REQUEST_NAME_REPLY_PRIMARY_OWNER;
++    }
++
++    if (service == NULL) {
++        service = bus_name_service_new (name);
++        owner = bus_connection_owner_new (connection, flags);
++        bus_name_service_add_owner (service, owner, dbus);
++        g_hash_table_insert (dbus->names,
++                             (gpointer) g_strdup (bus_connection_add_name (connection, name)),
++                             service);
++    }
+ 
+     g_signal_emit (dbus,
+                    dbus_signals[NAME_OWNER_CHANGED],
+                    0,
+                    name,
+-                   "",
++                   old_owner_name ? old_owner_name : "",
+                    bus_connection_get_unique_name (connection));
++    g_free (old_owner_name);
++
++out:
++    g_dbus_method_invocation_return_value (invocation, g_variant_new ("(u)", retval));
+ }
+ 
+ /**
+@@ -682,6 +989,70 @@ bus_dbus_impl_name_owner_changed (BusDBusImpl   *dbus,
  }
  
  /**
-+ * bus_dbus_impl_ask_release_name:
++ * bus_dbus_impl_name_lost:
 + *
-+ * Implement the "AskReleaseName" method call of the org.freedesktop.DBus interface.
-+ * The "AskReleaseName" signal is broadcasted to clients.
++ * The function is called on name-lost signal, typically when g_signal_emit (dbus, NAME_LOST)
++ * is called, and broadcasts the signal to clients.
 + */
 +static void
-+bus_dbus_impl_ask_release_name (BusDBusImpl           *dbus,
-+                                BusConnection         *connection,
-+                                GVariant              *parameters,
-+                                GDBusMethodInvocation *invocation)
++bus_dbus_impl_name_lost (BusDBusImpl   *dbus,
++                         BusConnection *connection,
++                         gchar         *name)
 +{
 +    static guint32 serial = 0;
-+    GDBusMessage *message;
-+    const gchar *name= NULL;
-+    guint reason = 0;
 +
-+    g_variant_get (parameters, "(&su)", &name, &reason);
++    g_assert (BUS_IS_DBUS_IMPL (dbus));
++    g_assert (name != NULL);
 +
-+    message = g_dbus_message_new_signal ("/org/freedesktop/DBus",
-+                                         "org.freedesktop.DBus",
-+                                         "AskReleaseName");
++    GDBusMessage *message = g_dbus_message_new_signal ("/org/freedesktop/DBus",
++                                                       "org.freedesktop.DBus",
++                                                       "NameLost");
 +    g_dbus_message_set_sender (message, "org.freedesktop.DBus");
++    g_dbus_message_set_destination (message, bus_connection_get_unique_name (connection));
 +
 +    /* set a non-zero serial to make libdbus happy */
 +    g_dbus_message_set_serial (message, ++serial);
 +    g_dbus_message_set_body (message,
-+                             g_variant_new ("(su)", name, reason));
++                             g_variant_new ("(s)", name));
 +
-+    /* broadcast the message to clients that listen to the signal. */
-+    bus_dbus_impl_dispatch_message_by_rule (dbus, message, NULL);
++    bus_dbus_impl_forward_message (dbus, connection, message);
 +    g_object_unref (message);
++    g_object_unref (connection);
++}
++
++/**
++ * bus_dbus_impl_name_acquired:
++ *
++ * The function is called on name-acquired signal, typically when g_signal_emit (dbus, NAME_LOST)
++ * is called, and broadcasts the signal to clients.
++ */
++static void
++bus_dbus_impl_name_acquired (BusDBusImpl   *dbus,
++                             BusConnection *connection,
++                             gchar         *name)
++{
++    static guint32 serial = 0;
++
++    g_assert (BUS_IS_DBUS_IMPL (dbus));
++    g_assert (name != NULL);
++
++    GDBusMessage *message = g_dbus_message_new_signal ("/org/freedesktop/DBus",
++                                                       "org.freedesktop.DBus",
++                                                       "NameAcquired");
++    g_dbus_message_set_sender (message, "org.freedesktop.DBus");
++    g_dbus_message_set_destination (message, bus_connection_get_unique_name (connection));
++
++    /* set a non-zero serial to make libdbus happy */
++    g_dbus_message_set_serial (message, ++serial);
++    g_dbus_message_set_body (message,
++                             g_variant_new ("(s)", name));
 +
-+    g_dbus_method_invocation_return_value (invocation, NULL);
++    bus_dbus_impl_forward_message (dbus, connection, message);
++    g_object_unref (message);
++    g_object_unref (connection);
 +}
 +
 +/**
-  * bus_dbus_impl_name_owner_changed:
+  * bus_dbus_impl_service_method_call:
   *
-  * The function is called on name-owner-changed signal, typically when g_signal_emit (dbus, NAME_OWNER_CHANGED)
-@@ -725,6 +769,7 @@ bus_dbus_impl_service_method_call (IBusService           *service,
-         { "RemoveMatch",    bus_dbus_impl_remove_match },
-         { "RequestName",    bus_dbus_impl_request_name },
-         { "ReleaseName",    bus_dbus_impl_release_name },
-+        { "AskReleaseName", bus_dbus_impl_ask_release_name },
-     };
- 
-     gint i;
-diff --git a/configure.ac b/configure.ac
-index 1a1e663..f1575e7 100644
---- a/configure.ac
-+++ b/configure.ac
-@@ -291,6 +291,7 @@ AC_SUBST(GETTEXT_PACKAGE)
- AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [Gettext package])
- 
- AM_GLIB_GNU_GETTEXT
-+AM_GLIB_DEFINE_LOCALEDIR(IBUS_LOCALEDIR)
- 
- # define gtk2 immodule dir
- AC_ARG_WITH(gtk2-im-module-dir,
+  * Handle a D-Bus method call from a client. This function overrides an implementation in src/ibusservice.c.
+@@ -935,6 +1306,10 @@ bus_dbus_impl_connection_destroy_cb (BusConnection *connection,
+                                      BusDBusImpl   *dbus)
+ {
+     const gchar *unique_name = bus_connection_get_unique_name (connection);
++    const GList *names = NULL;
++    BusNameService *service = NULL;
++    GSList *owners = NULL;
++
+     if (unique_name != NULL) {
+         g_hash_table_remove (dbus->unique_names, unique_name);
+         g_signal_emit (dbus,
+@@ -945,16 +1320,71 @@ bus_dbus_impl_connection_destroy_cb (BusConnection *connection,
+                        "");
+     }
+ 
+-    const GList *name = bus_connection_get_names (connection);
+-    while (name != NULL) {
+-        g_hash_table_remove (dbus->names, name->data);
++    /* service->owners is the queue of connections.
++     * If the connection is the primary owner and
++     * bus_name_service_remove_owner() is called, the owner is removed
++     * in the queue and the next owner will become the primary owner
++     * automatically because service->owners is just a GSList.
++     * If service->owners == NULL, it's good to remove the service in
++     * dbus->names.
++     * I suppose dbus->names are global queue for every connection and
++     * connection->names are private queue of the connection.
++     */
++    names = bus_connection_get_names (connection);
++    while (names != NULL) {
++        service = (BusNameService *) g_hash_table_lookup (dbus->names,
++                                                          names->data);
++        if (service) {
++            owners = _bus_name_service_find_owner_link (service, connection);
++            if (owners) {
++                BusConnectionOwner *owner = owners->data;
++                bus_name_service_remove_owner (service, owner, dbus);
++                bus_connection_owner_free (owner);
++            }
++            if (service->owners == NULL) {
++                /* g_hash_table_remove() will call bus_name_service_free()
++                 * due to g_hash_table_new_full() */
++                g_hash_table_remove (dbus->names, names->data);
++                service = NULL;
++            }
++        }
++        /* if service == NULL, the names->data should be removed in
++         * the connection by bus_connection_remove_name().
++         * But connection->names is GSList so it cannot be removed
++         * during this while loop because names->next would not
++         * become the wrong pointer here.
++         * the next while loop can call bus_connection_remove_name().
++         */
++
+         g_signal_emit (dbus,
+                        dbus_signals[NAME_OWNER_CHANGED],
+                        0,
+-                       name->data,
++                       names->data,
+                        unique_name,
+                        "");
+-        name = name->next;
++        names = names->next;
++    }
++
++    while ((names = bus_connection_get_names (connection)) != NULL) {
++        const gchar *name = NULL;
++        service = NULL;
++
++        while (names != NULL) {
++            name = (const gchar *) names->data;
++            service = (BusNameService *) g_hash_table_lookup (dbus->names,
++                                                              name);
++            if (service == NULL) {
++                break;
++            }
++            names = names->next;
++        }
++        if (names == NULL) {
++            break;
++        }
++        if (name == NULL) {
++            break;
++        }
++        bus_connection_remove_name (connection, name);
+     }
+ 
+     dbus->connections = g_list_remove (dbus->connections, connection);
+@@ -1004,7 +1434,15 @@ bus_dbus_impl_get_connection_by_name (BusDBusImpl    *dbus,
+         return (BusConnection *) g_hash_table_lookup (dbus->unique_names, name);
+     }
+     else {
+-        return (BusConnection *) g_hash_table_lookup (dbus->names, name);
++        BusNameService *service;
++        BusConnectionOwner *owner;
++
++        service = (BusNameService *) g_hash_table_lookup (dbus->names, name);
++        if (service == NULL) {
++            return NULL;
++        }
++        owner = bus_name_service_get_primary_owner (service);
++        return owner ? owner->conn : NULL;
+     }
+ }
+ 
+diff --git a/bus/marshalers.list b/bus/marshalers.list
+index 15bdf02..514d6ea 100644
+--- a/bus/marshalers.list
++++ b/bus/marshalers.list
+@@ -5,9 +5,10 @@ VOID:INT,UINT
+ VOID:UINT,UINT,UINT
+ VOID:INT,INT,INT,INT
+ VOID:STRING,INT
+-VOID:OBJECT
+ VOID:STRING,STRING,STRING
++VOID:OBJECT
+ VOID:OBJECT,BOOLEAN
++VOID:OBJECT,STRING
+ VOID:OBJECT,UINT,BOOLEAN
+ VOID:OBJECT,UINT,BOOLEAN,UINT
+ BOOL:UINT,UINT,UINT
+diff --git a/ibus/common.py b/ibus/common.py
+index cbc8d56..614d782 100644
+--- a/ibus/common.py
++++ b/ibus/common.py
+@@ -35,6 +35,13 @@ __all__ = (
+         "ORIENTATION_SYSTEM",
+         "PRELOAD_ENGINE_MODE_USER",
+         "PRELOAD_ENGINE_MODE_LANG_RELATIVE",
++        "BUS_NAME_FLAG_ALLOW_REPLACEMENT",
++        "BUS_NAME_FLAG_REPLACE_EXISTING",
++        "BUS_NAME_FLAG_DO_NOT_QUEUE",
++        "BUS_REQUEST_NAME_REPLY_PRIMARY_OWNER",
++        "BUS_REQUEST_NAME_REPLY_IN_QUEUE",
++        "BUS_REQUEST_NAME_REPLY_EXISTS",
++        "BUS_REQUEST_NAME_REPLY_ALREADY_OWNER",
+         "default_reply_handler",
+         "default_error_handler",
+         "DEFAULT_ASYNC_HANDLERS",
+@@ -47,7 +54,8 @@ __all__ = (
+         "main_quit",
+         "main_iteration",
+         "get_address",
+-        "get_socket_path"
++        "get_socket_path",
++        "is_running_gnome_shell",
+     )
+ 
+ import os
+@@ -106,6 +114,9 @@ get_address.restype=ctypes.c_char_p
+ get_socket_path = libibus.ibus_get_socket_path
+ get_socket_path.restype=ctypes.c_char_p
+ 
++is_running_gnome_shell = libibus.ibus_is_running_gnome_shell
++is_running_gnome_shell.restype = ctypes.c_bool
++
+ # __session_id = os.getenv ("IBUS_SESSION_ID")
+ # 
+ # IBUS_ADDR = "unix:path=/tmp/ibus-%s%s/ibus-%s-%s" % (__username,
+@@ -138,6 +149,17 @@ ORIENTATION_SYSTEM      = 2
+ PRELOAD_ENGINE_MODE_USER          = 0
+ PRELOAD_ENGINE_MODE_LANG_RELATIVE = 1
+ 
++# define bus name flag
++BUS_NAME_FLAG_ALLOW_REPLACEMENT   = (1 << 0)
++BUS_NAME_FLAG_REPLACE_EXISTING    = (1 << 1)
++BUS_NAME_FLAG_DO_NOT_QUEUE        = (1 << 2)
++
++# define bus request name reply
++BUS_REQUEST_NAME_REPLY_PRIMARY_OWNER = 1
++BUS_REQUEST_NAME_REPLY_IN_QUEUE      = 2
++BUS_REQUEST_NAME_REPLY_EXISTS        = 3
++BUS_REQUEST_NAME_REPLY_ALREADY_OWNER = 4
++
+ def default_reply_handler( *args):
+     pass
+ 
 diff --git a/src/Makefile.am b/src/Makefile.am
 index 08152a7..d422106 100644
 --- a/src/Makefile.am
@@ -130,62 +793,53 @@ index 08152a7..d422106 100644
  ibusincludedir = $(includedir)/ibus- at IBUS_API_VERSION@
  ibus_public_headers =       \
 diff --git a/src/ibusbus.c b/src/ibusbus.c
-index 5a3b978..ecb7775 100644
+index 5a3b978..78808a4 100644
 --- a/src/ibusbus.c
 +++ b/src/ibusbus.c
-@@ -551,6 +551,29 @@ ibus_bus_release_name (IBusBus      *bus,
-     return retval;
+@@ -613,15 +613,15 @@ ibus_bus_hello (IBusBus *bus)
+ #endif
  }
  
-+void
-+ibus_bus_ask_release_name (IBusBus      *bus,
-+                           const gchar  *name,
-+                           guint         reason)
-+{
-+    GVariant *result;
-+
-+    g_return_if_fail (IBUS_IS_BUS (bus));
-+    g_return_if_fail (name != NULL);
-+
-+    result = ibus_bus_call (bus,
-+                            DBUS_SERVICE_DBUS,
-+                            DBUS_PATH_DBUS,
-+                            DBUS_INTERFACE_DBUS,
-+                            "AskReleaseName",
-+                            g_variant_new ("(su)", name, reason),
-+                            NULL);
-+
-+    if (result) {
-+        g_variant_unref (result);
-+    }
-+}
-+
- gboolean
- ibus_bus_name_has_owner (IBusBus        *bus,
-                          const gchar    *name)
+-guint
++guint32
+ ibus_bus_request_name (IBusBus      *bus,
+                        const gchar  *name,
+-                       guint         flags)
++                       guint32       flags)
+ {
+     g_return_val_if_fail (IBUS_IS_BUS (bus), 0);
+     g_return_val_if_fail (name != NULL, 0);
+ 
+-    guint retval = 0;
++    guint32 retval = 0;
+     GVariant *result;
+     result = ibus_bus_call_sync (bus,
+                                  DBUS_SERVICE_DBUS,
 diff --git a/src/ibusbus.h b/src/ibusbus.h
-index b1ec63c..001e989 100644
+index b1ec63c..de4cd36 100644
 --- a/src/ibusbus.h
 +++ b/src/ibusbus.h
-@@ -143,6 +143,18 @@ guint        ibus_bus_release_name      (IBusBus        *bus,
-                                          const gchar    *name);
+@@ -122,16 +122,16 @@ const gchar *ibus_bus_hello             
+  * ibus_bus_request_name:
+  * @bus: the IBusBus instance to be processed.
+  * @name: Name to be requested.
+- * @flags: Flags (FixMe).
+- * @returns: 0 if failed; positive number otherwise.
++ * @flags: IBusBusNameFlag.
++ * @returns: 0 if failed; IBusBusRequestNameReply otherwise.
+  *
+  * Request a name from IBus daemon synchronously.
+  *
+  * FIXME add an asynchronous version.
+  */
+-guint        ibus_bus_request_name      (IBusBus        *bus,
++guint32      ibus_bus_request_name      (IBusBus        *bus,
+                                          const gchar    *name,
+-                                         guint           flags);
++                                         guint32         flags);
  
  /**
-+ * ibus_bus_ask_release_name:
-+ * @bus: An IBusBus.
-+ * @name: Name to be released.
-+ * @reason: Reason to be released.
-+ *
-+ * Ask other processes to release the name via IBus daemon.
-+ */
-+void         ibus_bus_ask_release_name  (IBusBus        *bus,
-+                                         const gchar    *name,
-+                                         guint           reason);
-+
-+/**
-  * ibus_bus_name_has_owner:
-  * @bus: An IBusBus.
-  * @name: Name to be released.
+  * ibus_bus_release_name:
 diff --git a/src/ibusproperty.c b/src/ibusproperty.c
 index bb9cc21..5a2dd78 100644
 --- a/src/ibusproperty.c
@@ -397,9 +1051,18 @@ index b63cbc9..5889b64 100644
 +    return text->attrs;
 +}
 diff --git a/src/ibustext.h b/src/ibustext.h
-index 246e5ab..b7638da 100644
+index 246e5ab..6f7c505 100644
 --- a/src/ibustext.h
 +++ b/src/ibustext.h
+@@ -110,7 +110,7 @@ IBusText        *ibus_text_new_from_string          (const gchar    *str);
+ IBusText        *ibus_text_new_from_ucs4            (const gunichar *str);
+ 
+ /**
+- * ibus_text_new_from_static_string:
++ * ibus_text_new_from_static_string: (skip)
+  * @str: An text string to be set.
+  * @returns: A newly allocated IBusText.
+  *
 @@ -169,6 +169,33 @@ void             ibus_text_append_attribute         (IBusText       *text,
   */
  guint            ibus_text_get_length               (IBusText       *text);
@@ -434,12 +1097,56 @@ index 246e5ab..b7638da 100644
  G_END_DECLS
  #endif
  
+diff --git a/src/ibustypes.h b/src/ibustypes.h
+index 035d124..6a31847 100644
+--- a/src/ibustypes.h
++++ b/src/ibustypes.h
+@@ -154,6 +154,39 @@ typedef enum {
+ } IBusPreloadEngineMode;
+ 
+ /**
++ * IBusBusNameFlag:
++ * @IBUS_BUS_NAME_FLAG_ALLOW_REPLACEMENT:
++ *    same as DBUS_NAME_FLAG_ALLOW_REPLACEMENT	
++ * @IBUS_BUS_NAME_FLAG_REPLACE_EXISTING:
++ *    same as DBUS_NAME_FLAG_REPLACE_EXISTING
++ * @IBUS_BUS_NAME_FLAG_DO_NOT_QUEUE:
++ *    same as DBUS_NAME_FLAG_DO_NOT_QUEUE 
++ */
++typedef enum {
++    IBUS_BUS_NAME_FLAG_ALLOW_REPLACEMENT   = (1 << 0),
++    IBUS_BUS_NAME_FLAG_REPLACE_EXISTING    = (1 << 1),
++    IBUS_BUS_NAME_FLAG_DO_NOT_QUEUE        = (1 << 2),
++} IBusBusNameFlag;
++
++/**
++ * IBusBusRequestNameReply:
++ * @IBUS_BUS_REQUEST_NAME_REPLY_PRIMARY_OWNER:
++ *    same as DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER
++ * @IBUS_BUS_REQUEST_NAME_REPLY_IN_QUEUE:
++ *    same as DBUS_REQUEST_NAME_REPLY_IN_QUEUE
++ * @IBUS_BUS_REQUEST_NAME_REPLY_EXISTS:
++ *    same as DBUS_REQUEST_NAME_REPLY_EXISTS
++ * @IBUS_BUS_REQUEST_NAME_REPLY_ALREADY_OWNER:
++ *    same as DBUS_REQUEST_NAME_REPLY_ALREADY_OWNER
++ */
++typedef enum {
++    IBUS_BUS_REQUEST_NAME_REPLY_PRIMARY_OWNER   = 1,
++    IBUS_BUS_REQUEST_NAME_REPLY_IN_QUEUE        = 2,
++    IBUS_BUS_REQUEST_NAME_REPLY_EXISTS          = 3,
++    IBUS_BUS_REQUEST_NAME_REPLY_ALREADY_OWNER   = 4,
++} IBusBusRequestNameReply;
++
++/**
+  * IBusRectangle:
+  * @x: x coordinate.
+  * @y: y coordinate.
 diff --git a/src/ibusutil.c b/src/ibusutil.c
 new file mode 100644
-index 0000000..38ac058
+index 0000000..59291f9
 --- /dev/null
 +++ b/src/ibusutil.c
-@@ -0,0 +1,145 @@
+@@ -0,0 +1,169 @@
 +/* -*- mode: C; c-basic-offset: 4; indent-tabs-mode: nil; -*- */
 +/* vim:set et sts=4: */
 +/* bus - The Input Bus
@@ -466,7 +1173,9 @@ index 0000000..38ac058
 +#include <config.h>
 +#endif
 +
++#include <glib.h>
 +#include <glib/gstdio.h>
++#include <gio/gio.h>
 +#include "ibusxml.h"
 +
 +#ifdef ENABLE_NLS
@@ -535,12 +1244,6 @@ index 0000000..38ac058
 +    gchar *filename;
 +    XMLNode *node;
 +    struct stat buf;
-+    gboolean retval;
-+
-+#ifdef ENABLE_NLS
-+    bindtextdomain(GETTEXT_PACKAGE, IBUS_LOCALEDIR);
-+    bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");
-+#endif
 +
 +    __languages_dict = g_hash_table_new (g_str_hash, (GEqualFunc) g_str_equal);
 +    filename = g_build_filename ("/usr", "share/xml/iso-codes/iso_639.xml", NULL);
@@ -557,7 +1260,7 @@ index 0000000..38ac058
 +        return;
 +    }
 +
-+    retval = _iso_codes_parse_xml_node (node);
++    _iso_codes_parse_xml_node (node);
 +    ibus_xml_free (node);
 +}
 +
@@ -575,22 +1278,50 @@ index 0000000..38ac058
 +#else
 +        return retval;
 +#endif
++    }
++    return retval;
++}
++
++gboolean
++ibus_is_running_gnome_shell (void)
++{
++    GDBusConnection *connection = NULL;
++    GVariant *result;
++    gboolean is_running = FALSE;
++
++    connection = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, NULL);
++    if (connection == NULL) {
++        return FALSE;
++    }
++
++    result = g_dbus_connection_call_sync (connection,
++                                          "org.freedesktop.DBus",
++                                          "/org/freedesktop/DBus",
++                                          "org.freedesktop.DBus",
++                                          "GetNameOwner",
++                                          g_variant_new ("(s)", "org.gnome.Shell"),
++                                          G_VARIANT_TYPE ("(s)"),
++                                          G_DBUS_CALL_FLAGS_NONE,
++                                          -1,
++                                          NULL,
++                                          NULL);
++
++    if (result != NULL) {
++        is_running = TRUE;
++        g_variant_unref (result);
 +    } else {
-+#ifdef ENABLE_NLS
-+#define _(a) dgettext(GETTEXT_PACKAGE, (a))
-+        return _("Other");
-+#undef _
-+#else
-+        return "Other";
-+#endif
++        is_running = FALSE;
 +    }
++    g_object_unref (connection);
++
++    return is_running;
 +}
 diff --git a/src/ibusutil.h b/src/ibusutil.h
 new file mode 100644
-index 0000000..d012589
+index 0000000..8892996
 --- /dev/null
 +++ b/src/ibusutil.h
-@@ -0,0 +1,33 @@
+@@ -0,0 +1,39 @@
 +/* -*- mode: C; c-basic-offset: 4; indent-tabs-mode: nil; -*- */
 +/* vim:set et sts=4: */
 +/* bus - The Input Bus
@@ -624,33 +1355,84 @@ index 0000000..d012589
 + * @returns: language name
 + */
 +const gchar *    ibus_get_language_name         (const gchar    *_locale);
-diff --git a/ui/gtk/panel.py b/ui/gtk/panel.py
-index 07b0fa2..30ece51 100644
---- a/ui/gtk/panel.py
-+++ b/ui/gtk/panel.py
-@@ -117,6 +117,11 @@ class Panel(ibus.PanelBase):
-         self.__config_load_show_im_name()
-         # self.__bus.request_name(ibus.panel.IBUS_SERVICE_PANEL, 0)
++
++/**
++ * ibus_is_running_gnome_shell:
++ * @returns: TRUE if gnome-shell is running
++ */
++gboolean         ibus_is_running_gnome_shell    (void);
+diff --git a/ui/gtk/gtkpanel.xml.in.in b/ui/gtk/gtkpanel.xml.in.in
+index edeed1c..1e1e656 100644
+--- a/ui/gtk/gtkpanel.xml.in.in
++++ b/ui/gtk/gtkpanel.xml.in.in
+@@ -3,7 +3,7 @@
+ <component>
+ 	<name>org.freedesktop.IBus.Panel</name>
+ 	<description>Gtk Panel Component</description>
+-	<exec>${libexecdir}/ibus-ui-gtk</exec>
++	<exec>${libexecdir}/ibus-ui-gtk -s</exec>
+ 	<version>@VERSION@</version>
+ 	<author>Peng Huang &lt;shawn.p.huang at gmail.com&gt;</author>
+ 	<license>GPL</license>
+diff --git a/ui/gtk/main.py b/ui/gtk/main.py
+index f4c901d..5e75ab7 100644
+--- a/ui/gtk/main.py
++++ b/ui/gtk/main.py
+@@ -50,7 +50,13 @@ class UIApplication:
+         self.__bus.add_match(match_rule)
  
+         self.__panel = panel.Panel(self.__bus)
+-        self.__bus.request_name(ibus.IBUS_SERVICE_PANEL, 0)
++        self.__bus.request_name(ibus.IBUS_SERVICE_PANEL,
++                                ibus.BUS_NAME_FLAG_ALLOW_REPLACEMENT |
++                                ibus.BUS_NAME_FLAG_REPLACE_EXISTING)
 +        self.__bus.add_match("type='signal',\
 +                             sender='org.freedesktop.DBus',\
-+                             member='AskReleaseName'")
-+        self.__bus.get_dbusconn().add_signal_receiver(self.__ask_release_name_cb, signal_name="AskReleaseName")
-+
-         # init xkb
-         self.__xkblayout = ibus.XKBLayout(self.__config)
-         use_xkb = self.__config.get_value("general", "use_system_keyboard_layout", False)
-@@ -196,6 +201,10 @@ class Panel(ibus.PanelBase):
-     def get_status_icon(self):
-         return self.__status_icon
- 
-+    def __ask_release_name_cb(self, name, reason):
-+        print "Quiting ibus because of", str(reason)
++                             member='NameLost'")
++        self.__bus.get_dbusconn().add_signal_receiver(self.__name_lost_cb, signal_name="NameLost")
+         self.__notify = pynotify.Notification("IBus", \
+                             _("Some input methods have been installed, removed or updated. " \
+                             "Please restart ibus input platform."), \
+@@ -66,6 +72,10 @@ class UIApplication:
+     def __registry_changed_cb(self, bus):
+         self.__notify.show()
+ 
++    def __name_lost_cb(self, name):
++        print "Got NameLost signal", name
 +        gtk.main_quit()
 +
-     def __set_im_icon(self, icon_name):
-         if not icon_name:
-             icon_name = ICON_ENGINE
+     def run(self):
+         try:
+             gtk.main()
+@@ -84,8 +94,9 @@ def print_help(out, v = 0):
+ 
+ def main():
+     daemonize = False
+-    shortopt = "hd"
+-    longopt = ["help", "daemonize"]
++    stop_by_shell = False
++    shortopt = "hds"
++    longopt = ["help", "daemonize", "stop-by-shell"]
+     try:
+         opts, args = getopt.getopt(sys.argv[1:], shortopt, longopt)
+     except getopt.GetoptError, err:
+@@ -96,10 +107,16 @@ def main():
+             print_help(sys.stdout)
+         elif o in("-d", "--daemonize"):
+             daemonize = True
++        elif o in("-s", "--stop-by-shell"):
++            stop_by_shell = True
+         else:
+             print >> sys.stderr, "Unknown argument: %s" % o
+             print_help(sys.stderr, 1)
+ 
++    if stop_by_shell and ibus.is_running_gnome_shell():
++        print "Exit because GNOME-Shell is running"
++        sys.exit()
++
+     if daemonize:
+         if os.fork():
+             sys.exit()
 -- 
-1.7.3.2
+1.7.4.1
 
diff --git a/ibus-HEAD.patch b/ibus-HEAD.patch
index 571558d..8b13789 100644
--- a/ibus-HEAD.patch
+++ b/ibus-HEAD.patch
@@ -1,125 +1 @@
-From 2cf859f01912fe41fd36edaeb0efc21f4fabcb0f Mon Sep 17 00:00:00 2001
-From: fujiwarat <takao.fujiwara1 at gmail.com>
-Date: Sat, 5 Feb 2011 03:00:04 +0900
-Subject: [PATCH] Added GTK3 definitions.
-
----
- client/gtk2/ibusimcontext.c |    9 +++++++++
- 1 files changed, 9 insertions(+), 0 deletions(-)
-
-diff --git a/client/gtk2/ibusimcontext.c b/client/gtk2/ibusimcontext.c
-index 745722f..608f294 100644
---- a/client/gtk2/ibusimcontext.c
-+++ b/client/gtk2/ibusimcontext.c
-@@ -506,12 +506,21 @@ ibus_im_context_class_init (IBusIMContextClass *class)
-  * used extensively.
-  */
- static guint16 cedilla_compose_seqs[] = {
-+#ifdef DEPRECATED_GDK_KEYSYMS
-   GDK_dead_acute,	GDK_C,	0,	0,	0,	0x00C7,	/* LATIN_CAPITAL_LETTER_C_WITH_CEDILLA */
-   GDK_dead_acute,	GDK_c,	0,	0,	0,	0x00E7,	/* LATIN_SMALL_LETTER_C_WITH_CEDILLA */
-   GDK_Multi_key,	GDK_apostrophe,	GDK_C,  0,      0,      0x00C7, /* LATIN_CAPITAL_LETTER_C_WITH_CEDILLA */
-   GDK_Multi_key,	GDK_apostrophe,	GDK_c,  0,      0,      0x00E7, /* LATIN_SMALL_LETTER_C_WITH_CEDILLA */
-   GDK_Multi_key,	GDK_C,  GDK_apostrophe,	0,      0,      0x00C7, /* LATIN_CAPITAL_LETTER_C_WITH_CEDILLA */
-   GDK_Multi_key,	GDK_c,  GDK_apostrophe,	0,      0,      0x00E7, /* LATIN_SMALL_LETTER_C_WITH_CEDILLA */
-+#else
-+  GDK_KEY_dead_acute,	GDK_KEY_C,	0,	0,	0,	0x00C7,	/* LATIN_CAPITAL_LETTER_C_WITH_CEDILLA */
-+  GDK_KEY_dead_acute,	GDK_KEY_c,	0,	0,	0,	0x00E7,	/* LATIN_SMALL_LETTER_C_WITH_CEDILLA */
-+  GDK_KEY_Multi_key,	GDK_KEY_apostrophe,	GDK_KEY_C,  0,      0,      0x00C7, /* LATIN_CAPITAL_LETTER_C_WITH_CEDILLA */
-+  GDK_KEY_Multi_key,	GDK_KEY_apostrophe,	GDK_KEY_c,  0,      0,      0x00E7, /* LATIN_SMALL_LETTER_C_WITH_CEDILLA */
-+  GDK_KEY_Multi_key,	GDK_KEY_C,  GDK_KEY_apostrophe,	0,      0,      0x00C7, /* LATIN_CAPITAL_LETTER_C_WITH_CEDILLA */
-+  GDK_KEY_Multi_key,	GDK_KEY_c,  GDK_KEY_apostrophe,	0,      0,      0x00E7, /* LATIN_SMALL_LETTER_C_WITH_CEDILLA */
-+#endif
- };
- 
- static void
--- 
-1.7.3.2
-
-From a00ebefde44cf5daaa642fc880c51357cb83f15b Mon Sep 17 00:00:00 2001
-From: fujiwarat <takao.fujiwara1 at gmail.com>
-Date: Tue, 8 Feb 2011 18:17:11 +0900
-Subject: [PATCH] Fixed typo.
-
----
- client/gtk2/ibusimcontext.c |   10 +++++-----
- 1 files changed, 5 insertions(+), 5 deletions(-)
-
-diff --git a/client/gtk2/ibusimcontext.c b/client/gtk2/ibusimcontext.c
-index 608f294..bb5ae5c 100644
---- a/client/gtk2/ibusimcontext.c
-+++ b/client/gtk2/ibusimcontext.c
-@@ -401,11 +401,11 @@ _get_boolean_env(const gchar *name,
-     if (value == NULL)
-       return defval;
- 
--    if (g_strcmp0 (name, "") == 0 ||
--        g_strcmp0 (name, "0") == 0 ||
--        g_strcmp0 (name, "false") == 0 ||
--        g_strcmp0 (name, "False") == 0 ||
--        g_strcmp0 (name, "FALSE") == 0)
-+    if (g_strcmp0 (value, "") == 0 ||
-+        g_strcmp0 (value, "0") == 0 ||
-+        g_strcmp0 (value, "false") == 0 ||
-+        g_strcmp0 (value, "False") == 0 ||
-+        g_strcmp0 (value, "FALSE") == 0)
-       return FALSE;
- 
-     return TRUE;
--- 
-1.7.3.2
-
-From 0501756a1e51469849eca064aeb1e340afbf8be2 Mon Sep 17 00:00:00 2001
-From: fujiwarat <takao.fujiwara1 at gmail.com>
-Date: Wed, 9 Feb 2011 00:51:39 +0900
-Subject: [PATCH] Add pkgdatadir in ibus-1.0.pc.in
-
----
- ibus-1.0.pc.in |    2 ++
- 1 files changed, 2 insertions(+), 0 deletions(-)
-
-diff --git a/ibus-1.0.pc.in b/ibus-1.0.pc.in
-index 88357af..9f593ab 100644
---- a/ibus-1.0.pc.in
-+++ b/ibus-1.0.pc.in
-@@ -2,6 +2,8 @@ prefix=@prefix@
- exec_prefix=@exec_prefix@
- libdir=@libdir@
- includedir=@includedir@
-+datadir=@datadir@
-+pkgdatadir=@datadir@/ibus
- 
- Name: IBus
- Description: IBus Library
--- 
-1.7.3.2
-
-From 8ebad5f07b1ba821e278d4d04ab74e2d31a40139 Mon Sep 17 00:00:00 2001
-From: fujiwarat <takao.fujiwara1 at gmail.com>
-Date: Sat, 19 Feb 2011 04:52:40 +0900
-Subject: [PATCH] Call gtk_key_snooper_remove when GTK IM client is switched.
-
----
- client/gtk2/ibusimcontext.c |    6 ++++++
- 1 files changed, 6 insertions(+), 0 deletions(-)
-
-diff --git a/client/gtk2/ibusimcontext.c b/client/gtk2/ibusimcontext.c
-index bb5ae5c..c4ade53 100644
---- a/client/gtk2/ibusimcontext.c
-+++ b/client/gtk2/ibusimcontext.c
-@@ -620,6 +620,12 @@ ibus_im_context_finalize (GObject *obj)
-         pango_attr_list_unref (ibusimcontext->preedit_attrs);
-     }
- 
-+    if (_key_snooper_id != 0) {
-+        IDEBUG ("snooper is terminated.");
-+        gtk_key_snooper_remove (_key_snooper_id);
-+        _key_snooper_id = 0;
-+    }
-+
-     G_OBJECT_CLASS(parent_class)->finalize (obj);
- }
- 
--- 
-1.7.4
 
diff --git a/ibus.spec b/ibus.spec
index ed70439..34d39c4 100644
--- a/ibus.spec
+++ b/ibus.spec
@@ -3,6 +3,7 @@
 %{!?gtk3_binary_version: %define gtk3_binary_version %(pkg-config  --variable=gtk_binary_version gtk+-3.0)}
 
 %define have_libxkbfile 1
+%define have_gjsfile 1
 %define ibus_api_version 1.0
 
 %define glib_ver %([ -a %{_libdir}/pkgconfig/glib-2.0.pc ] && pkg-config --modversion glib-2.0 | cut -d. -f 1,2 || echo -n "999")
@@ -11,22 +12,22 @@
 %define gnome_icon_theme_legacy_version 2.91.6
 
 Name:       ibus
-Version:    1.3.99.20110206
-Release:    4%{?dist}
+Version:    1.3.99.20110228
+Release:    1%{?dist}
 Summary:    Intelligent Input Bus for Linux OS
 License:    LGPLv2+
 Group:      System Environment/Libraries
 URL:        http://code.google.com/p/ibus/
 Source0:    http://ibus.googlecode.com/files/%{name}-%{version}.tar.gz
 Source1:    xinput-ibus
-Source2:    http://fujiwara.fedorapeople.org/ibus/gnome-shell/ibus-ui-gjs-plugins-20110214.tar.bz2
-Source3:    ibus.js
-Patch0:     ibus-HEAD.patch
+%if %have_gjsfile
+Source2:    http://fujiwara.fedorapeople.org/ibus/gnome-shell/gnome-shell-ibus-plugins-20110304.tar.bz2
+%endif
+# Patch0:     ibus-HEAD.patch
 Patch1:     ibus-435880-surrounding-text.patch
 Patch2:     ibus-541492-xkb.patch
 Patch3:     ibus-530711-preload-sys.patch
 Patch4:     ibus-657165-panel-libs.patch
-Patch5:     ibus-657165-gjs-plugins.patch
 # This will be removed after the new gnome-shell is integrated.
 Patch99:    ibus-675503-gnome-shell-workaround.patch
 
@@ -139,8 +140,10 @@ The ibus-devel-docs package contains developer documentation for ibus
 
 %prep
 %setup -q
+%if %have_gjsfile
 bzcat %SOURCE2 | tar xf -
-%patch0 -p1
+%endif
+# %patch0 -p1
 %patch99 -p1 -b .g-s-typo
 # start surrounding patch
 %patch1 -p1 -b .surrounding
@@ -151,7 +154,6 @@ cp client/gtk2/ibusimcontext.c client/gtk3/ibusimcontext.c
 %endif
 %patch3 -p1 -b .preload-sys
 %patch4 -p1 -b .panel-libs
-%patch5 -p1 -b .gjs
 
 %build
 %if %have_libxkbfile
@@ -183,9 +185,6 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/gtk-3.0/%{gtk3_binary_version}/immodules/im-ibus
 # install xinput config file
 install -pm 644 -D %{SOURCE1} $RPM_BUILD_ROOT%{_xinputconf}
 
-# install ibus.js for a reference
-install -pm 644 -D %{SOURCE3} $RPM_BUILD_ROOT%{_datadir}/ibus/ui/gjs/ibus.js
-
 # install .desktop files
 # correct location in upstream.
 if test ! -f $RPM_BUILD_ROOT%{_sysconfdir}/xdg/autostart/ibus.desktop -a \
@@ -205,6 +204,22 @@ desktop-file-install --delete-original          \
   --dir $RPM_BUILD_ROOT%{_datadir}/applications \
   $RPM_BUILD_ROOT%{_datadir}/applications/*
 
+%if %have_gjsfile
+cp -R js/ui/status/ibus $RPM_BUILD_ROOT%{_datadir}/ibus/ui/gjs-g-s
+cat >> $RPM_BUILD_ROOT%{_datadir}/ibus/ui/gjs-g-s/README <<_EOF
+IBus Panel for GNOME-Shell
+--------------------------
+
+This is an alpha version of IBus Panel for GNOME-Shell.
+These files under this directory are prepared for the test purpose.
+It is planned to integrate the files into gnome-shell finally.
+Please refer the installation:
+https://fedoraproject.org/wiki/I18N/InputMethods#GNOME-Shell
+Bug Report:
+https://bugzilla.redhat.com/show_bug.cgi?id=657165
+_EOF
+%endif
+
 # FIXME: no version number
 %find_lang %{name}10
 
@@ -312,18 +327,16 @@ fi
 %{_datadir}/gtk-doc/html/*
 
 %changelog
-* Mon Feb 21 2011 Takao Fujiwara <tfujiwar at redhat.com> - 1.3.99.20110206-4
-- Fixed Bug 677856 - left ibus snooper when im client is switched.
-- Fixed Bug 678825 - SEGV in g_return_if_fail_warning.
-
-* Mon Feb 14 2011 Takao Fujiwara <tfujiwar at redhat.com> - 1.3.99.20110206-1
+* Thu Mar 10 2011 Takao Fujiwara <tfujiwar at redhat.com> - 1.3.99.20110228-1
+- Updated to 1.3.99.20110228
 - Integrated the part of gjs in Bug 657165 ibus for gnome-shell.
-  Added ibus-ui-gjs-plugins-20110214.tar.bz2
   Added ibus-657165-panel-libs.patch
-  Added ibus-657165-gjs-plugins.patch
+  Added gnome-shell-ibus-plugins-20110304.tar.bz2
 - Fixed Bug 675503 - a regression in sync mode
   Added ibus-675503-gnome-shell-workaround.patch until gnome-shell is updated.
-- Updated ibus-HEAD.patch from upstream.
+- Fixed Bug 677856 - left ibus snooper when im client is switched.
+- Fixed Bug 673047 - abrt ibus_xkb_get_current_layout for non-XKB system
+  Updated ibus-541492-xkb.patch
 
 * Wed Feb 09 2011 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 1.3.99.20110127-3
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
diff --git a/sources b/sources
index d2bbf09..9151a4a 100644
--- a/sources
+++ b/sources
@@ -1,2 +1,2 @@
-e35785efcf8d938170def1cf76f4f25b  ibus-1.3.99.20110206.tar.gz
-c279d4aa00021a45b81954211c5c88e7  ibus-ui-gjs-plugins-20110214.tar.bz2
+223ce787c5357f833ba34cdaf502ef76  ibus-1.3.99.20110228.tar.gz
+3d97318591cfb2aa82f97db3f3a5a7f2  gnome-shell-ibus-plugins-20110304.tar.bz2
diff --git a/xinput-ibus b/xinput-ibus
index 760f86f..6a5ac4e 100644
--- a/xinput-ibus
+++ b/xinput-ibus
@@ -1,7 +1,7 @@
 XIM=ibus
 XIM_PROGRAM="/usr/bin/ibus-daemon"
 ICON="ibus"
-XIM_ARGS="--xim"
+XIM_ARGS="-r --xim"
 PREFERENCE_PROGRAM=/usr/bin/ibus-setup
 SHORT_DESC="IBus"
 GTK_IM_MODULE=ibus


More information about the scm-commits mailing list